query
stringlengths
7
33.1k
document
stringlengths
7
335k
metadata
dict
negatives
sequencelengths
3
101
negative_scores
sequencelengths
3
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
TODO Autogenerated method stub
@Override public void onClick(View v) { Intent i = new Intent(MainActivity.this, ActivityB.class); i.putExtra("name", textBox.getText().toString()); i.putExtra("job", textBox1.getText().toString()); i.putExtra("boolean", textBox2.getText().toString()); i.putExtra("amount", textBox3.getText().toString()); startActivity(i); }
{ "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
Handle action bar item clicks here. The action bar will automatically handle clicks on the Home/Up button, so long as you specify a parent activity in AndroidManifest.xml.
@Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { //Toast.makeText(getApplicationContext(), "Thank You @Cc_Hub", Toast.LENGTH_LONG).show(); return true; } return super.onOptionsItemSelected(item); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public boolean onOptionsItemSelected(MenuItem item) { Handle action bar item clicks here. The action bar will\n // automatically handle clicks on the Home/Up button, so long\n // as you specify a parent activity in AndroidManifest.xml.\n\n //\n // HANDLE BACK BUTTON\n //\n int id = item.getItemId();\n if (id == android.R.id.home) {\n // Back button clicked\n this.finish();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n // app icon in action bar clicked; goto parent activity.\n onBackPressed();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n // Respond to the action bar's Up/Home button\n case android.R.id.home:\n onBackPressed();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n switch (id) {\r\n case android.R.id.home:\r\n // app icon in action bar clicked; go home\r\n this.finish();\r\n return true;\r\n default:\r\n return super.onOptionsItemSelected(item);\r\n }\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n // app icon in action bar clicked; go home\n finish();\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == android.R.id.home) {\n Log.e(\"clik\", \"action bar clicked\");\n finish();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n\t public boolean onOptionsItemSelected(MenuItem item) {\n\t int id = item.getItemId();\n\t \n\t\t\tif (id == android.R.id.home) {\n\t\t\t\t// Respond to the action bar's Up/Home button\n\t\t\t\t// NavUtils.navigateUpFromSameTask(this);\n\t\t\t\tonBackPressed();\n\t\t\t\treturn true;\n\t\t\t}\n\t \n\t \n\t return super.onOptionsItemSelected(item);\n\t }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\r\n switch (item.getItemId()) {\r\n // Respond to the action bar's Up/Home button\r\n case android.R.id.home:\r\n finish();\r\n return true;\r\n }\r\n return super.onOptionsItemSelected(item);\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n // Respond to the action bar's Up/Home button\n case android.R.id.home:\n finish();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n\n switch (item.getItemId()) {\n case android.R.id.home:\n\n // app icon in action bar clicked; goto parent activity.\n this.finish();\n return true;\n default:\n\n return super.onOptionsItemSelected(item);\n\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n\n switch (item.getItemId()) {\n case android.R.id.home:\n\n // app icon in action bar clicked; goto parent activity.\n this.finish();\n return true;\n default:\n\n return super.onOptionsItemSelected(item);\n\n }\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tswitch (item.getItemId()) {\n\t\tcase android.R.id.home:\n\t\t\tonBackPressed();\n\t\t\treturn true;\n\t\tdefault:\n\t\t\treturn super.onOptionsItemSelected(item);\n\t\t}\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n // Handle presses on the action bar items\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n case R.id.action_clear:\n return true;\n case R.id.action_done:\n\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n switch (id) {\n case android.R.id.home:\n onActionHomePressed();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n switch (id) {\n case android.R.id.home:\n onBackPressed();\n break;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n switch (id) {\n case android.R.id.home:\n onBackPressed();\n break;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n\n switch (item.getItemId())\n {\n case android.R.id.home :\n super.onBackPressed();\n break;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId ()) {\n case android.R.id.home:\n onBackPressed ();\n return true;\n\n default:\n break;\n }\n return super.onOptionsItemSelected ( item );\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t switch (item.getItemId()) {\n\t\tcase android.R.id.home:\n\t\t\t// app icon in action bar clicked; go home \n\t\t\tIntent intent = new Intent(this, Kelutral.class); \n\t\t\tintent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); \n\t\t\tstartActivity(intent); \n\t\t\treturn true;\t\t\n\t case R.id.Search:\n\t \treturn onSearchRequested();\n\t\tcase R.id.AppInfo:\n\t\t\t// Place holder menu item\n\t\t\tIntent newIntent = new Intent(Intent.ACTION_VIEW,\n\t\t\t\t\tUri.parse(\"http://forum.learnnavi.org/mobile-apps/\"));\n\t\t\tstartActivity(newIntent);\n\t\t\treturn true;\n\t\tcase R.id.Preferences:\n\t\t\tnewIntent = new Intent(getBaseContext(), Preferences.class);\n\t\t\tstartActivity(newIntent);\n\t\t\treturn true;\t\n\t }\n\t return false;\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n\n case android.R.id.home:\n onBackPressed();\n return true;\n\n }\n return super.onOptionsItemSelected(item);\n\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n\n default:\n return super.onOptionsItemSelected(item);\n }\n\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n // Intent homeIntent = new Intent(this, MainActivity.class);\n // homeIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n // startActivity(homeIntent);\n finish();\n return true;\n default:\n return (super.onOptionsItemSelected(item));\n }\n\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n // setResult and close the activity when Action Bar Up Button clicked.\n if (item.getItemId() == android.R.id.home) {\n setResult(RESULT_CANCELED);\n finish();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n // This ID represents the Home or Up button. In the case of this\n // activity, the Up button is shown. Use NavUtils to allow users\n // to navigate up one level in the application structure. For\n // more details, see the Navigation pattern on Android Design:\n //\n // http://developer.android.com/design/patterns/navigation.html#up-vs-back\n //\n \tgetActionBar().setDisplayHomeAsUpEnabled(false);\n \tgetFragmentManager().popBackStack();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n\n switch (item.getItemId()) {\n case android.R.id.home:\n super.onBackPressed();\n return true;\n\n default:\n // If we got here, the user's action was not recognized.\n // Invoke the superclass to handle it.\n return super.onOptionsItemSelected(item);\n\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if(id == android.R.id.home){\n onBackPressed();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == android.R.id.home) {\n onBackPressed();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n\n }\n\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@RequiresApi(api = Build.VERSION_CODES.M)\n @Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n break;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\r\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tif(item.getItemId()==android.R.id.home)\r\n\t\t{\r\n\t\t\tgetActivity().onBackPressed();\r\n\t\t}\r\n\t\treturn super.onOptionsItemSelected(item);\r\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if(item.getItemId()==android.R.id.home){\n super.onBackPressed();\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n switch (id) {\n case android.R.id.home:\n onBackPressed();\n return false;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n //Back arrow\n case android.R.id.home:\n onBackPressed();\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n // android.R.id.home是Android内置home按钮的id\n finish();\n break;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n super.onBackPressed();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n this.onBackPressed();\n return false;\n }\n return false;\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n // Handle action bar item clicks here. The action bar will\n // automatically handle clicks on the Home/Up button, so long\n // as you specify a parent activity in AndroidManifest.xml.\n int id = item.getItemId();\n\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n default:\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\r\n switch (item.getItemId()) {\r\n\r\n case android.R.id.home:\r\n /*Intent i= new Intent(getApplication(), MainActivity.class);\r\n i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);\r\n startActivity(i);*/\r\n onBackPressed();\r\n finish();\r\n return true;\r\n default:\r\n return super.onOptionsItemSelected(item);\r\n }\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n switch (id){\n case android.R.id.home:\n this.finish();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n // Pass the event to ActionBarDrawerToggle, if it returns\n // true, then it has handled the app icon touch event\n if (mDrawerToggle.onOptionsItemSelected(item)) {\n return true;\n }\n\n // Handle your other action bar items...\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n // Respond to the action bar's Up/Home button\n case android.R.id.home:\n NavUtils.navigateUpFromSameTask(getActivity());\n return true;\n case R.id.action_settings:\n Intent i = new Intent(getActivity(), SettingsActivity.class);\n startActivity(i);\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n //Fixes the Up Button\n if(id == android.R.id.home) {\n BuildRoute.this.finish();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()){\n case android.R.id.home:\n onBackPressed();\n break;\n }\n return true;\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n\n if (id == android.R.id.home) {\n NavUtils.navigateUpFromSameTask(this);\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\r\n case android.R.id.home:\r\n onBackPressed();\r\n break;\r\n }\r\n return true;\r\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tif (item.getItemId() == android.R.id.home) {\n\t\t\tfinish();\n\t\t}\n\t\treturn super.onOptionsItemSelected(item);\n\t}", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n if ( id == android.R.id.home ) {\r\n finish();\r\n return true;\r\n }\r\n return super.onOptionsItemSelected(item);\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n\n onBackPressed();\n\n return super.onOptionsItemSelected(item);\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n\r\n //noinspection SimplifiableIfStatement\r\n if (id == R.id.home) {\r\n NavUtils.navigateUpFromSameTask(this);\r\n return true;\r\n }\r\n\r\n //noinspection SimplifiableIfStatement\r\n if (id == R.id.action_about) {\r\n AboutDialog();\r\n return true;\r\n }\r\n\r\n //noinspection SimplifiableIfStatement\r\n if (id == R.id.action_exit) {\r\n finish();\r\n return true;\r\n }\r\n\r\n\r\n return super.onOptionsItemSelected(item);\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == android.R.id.home) {\n\n this.finish();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == android.R.id.home) {\n\n this.finish();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item)\n {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if( id == android.R.id.home ) // Back button of the actionbar\n {\n finish();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n//noinspection SimplifiableIfStatement\n if (id == android.R.id.home) {\n// finish the activity\n onBackPressed();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\r\n\t\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\t\tswitch (item.getItemId()) {\r\n\t\t\tcase android.R.id.home:\r\n\t\t\t\tfinish();\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\treturn super.onOptionsItemSelected(item);\r\n\t\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n\n this.finish();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n if (item.getItemId() == android.R.id.home) {\n onBackPressed();\n return true;\n }\n return false;\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n\n if(id == android.R.id.home){\n finish();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == android.R.id.home) {\n onBackPressed();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == android.R.id.home) {\n onBackPressed();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == android.R.id.home) {\n onBackPressed();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == android.R.id.home) {\n onBackPressed();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n\n if (item.getItemId() == android.R.id.home) {\n finish();\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\r\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tswitch (item.getItemId()) {\r\n\t\tcase android.R.id.home:\r\n\t\t\tsetResult(RESULT_OK, getIntent());\r\n\t\t\tfinish();\r\n\t\t\tbreak;\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n finish();\n return true;\n default:\n // If we got here, the user's action was not recognized.\n // Invoke the superclass to handle it.\n return super.onOptionsItemSelected(item);\n\n }\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tswitch (item.getItemId()) {\n\t\tcase android.R.id.home:\n\t\t\tfinish();\n\t\t\tbreak;\n\n\t\t}\n\t\treturn super.onOptionsItemSelected(item);\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n switch (id) {\n\n case android.R.id.home:\n this.finish();\n return true;\n }\n return true;\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tswitch (item.getItemId()) {\n\t\tcase android.R.id.home:\n\t\t\tfinish();\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t\treturn super.onOptionsItemSelected(item);\n\t}", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tint id = item.getItemId();\n\t\tif (id == android.R.id.home) {\n\t\t\tfinish();\n\t\t\treturn true;\n\t\t}\n\t\treturn super.onOptionsItemSelected(item);\n\t}", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n if (id == android.R.id.home) {\r\n finish();\r\n return true;\r\n }\r\n return super.onOptionsItemSelected(item);\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n //NavUtils.navigateUpFromSameTask(this);\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n // todo: goto back activity from here\n finish();\n return true;\n\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\r\n // Handle item selection\r\n switch (item.getItemId()) {\r\n case android.R.id.home:\r\n onBackPressed();\r\n return true;\r\n\r\n case me.cchiang.lookforthings.R.id.action_sample:\r\n// Snackbar.make(parent_view, item.getTitle() + \" Clicked \", Snackbar.LENGTH_SHORT).show();\r\n return true;\r\n default:\r\n return super.onOptionsItemSelected(item);\r\n }\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n finish();\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n finish();\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case android.R.id.home:\n finish();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n\n\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tswitch (item.getItemId()) {\n\t\tcase android.R.id.home:\n\t\t\tonBackPressed();\n\t\t\treturn true;\n\t\tcase R.id.scan_menu:\n\t\t\tonScan();\n\t\t\tbreak;\n\t\tcase R.id.opt_about:\n\t\t\t//onAbout();\n\t\t\tbreak;\n\t\tcase R.id.opt_exit:\n\t\t\tfinish();\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn super.onOptionsItemSelected(item);\n\t\t}\n\t\treturn true;\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == android.R.id.home) {\n super.onBackPressed();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n switch (id) {\n case android.R.id.home:\n this.finish();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(@NonNull MenuItem item) {\n if (item.getItemId() == android.R.id.home) {\n onBackPressed();\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n switch (id) {\n case android.R.id.home:\n finish();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n\n case android.R.id.home:\n finish();\n return true;\n\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\r\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\r\n\t switch (item.getItemId()) {\r\n\t \t// back to previous page\r\n\t case android.R.id.home:\r\n\t finish();\r\n\t return true;\r\n\t }\r\n\t return super.onOptionsItemSelected(item);\r\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if(id==android.R.id.home){\n finish();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n if (id == android.R.id.home) {\n finish();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n\r\n //noinspection SimplifiableIfStatement\r\n if (id == android.R.id.home) {\r\n // finish the activity\r\n onBackPressed();\r\n return true;\r\n }\r\n\r\n return super.onOptionsItemSelected(item);\r\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n\r\n //noinspection SimplifiableIfStatement\r\n if (id == android.R.id.home) {\r\n // finish the activity\r\n onBackPressed();\r\n return true;\r\n }\r\n\r\n return super.onOptionsItemSelected(item);\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId())\n {\n case android.R.id.home:\n this.finish();\n return (true);\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n finish();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == android.R.id.home) {\n finish();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n switch (id){\n case R.id.home:{\n NavUtils.navigateUpFromSameTask(this);\n return true;\n }\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n switch(item.getItemId())\n {\n case android.R.id.home:\n super.onBackPressed();\n break;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tswitch (item.getItemId()) {\n\t\tcase android.R.id.home:\n\t\t\tfinish();\n\t\t\treturn true;\n\n\t\tdefault:\n\t\t\treturn super.onOptionsItemSelected(item);\n\t\t}\n\t}", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n\r\n int id = item.getItemId();\r\n if(id==android.R.id.home){\r\n finish();\r\n return true;\r\n }\r\n return super.onOptionsItemSelected(item);\r\n }" ]
[ "0.79044175", "0.7806529", "0.77667165", "0.772694", "0.76315796", "0.76219255", "0.75851756", "0.75312436", "0.7488551", "0.7458599", "0.7458599", "0.74389243", "0.74213", "0.7403157", "0.7392013", "0.73872125", "0.73794484", "0.73704696", "0.73621285", "0.7356082", "0.7345742", "0.7341443", "0.733088", "0.7328954", "0.7325907", "0.7318753", "0.73168504", "0.7313684", "0.73043704", "0.73043704", "0.7301908", "0.72984296", "0.72936225", "0.72864836", "0.7283677", "0.7281339", "0.72789717", "0.7260108", "0.72600895", "0.72600895", "0.72600895", "0.72596836", "0.72502226", "0.72242427", "0.7219611", "0.7216851", "0.72045827", "0.7200463", "0.72004086", "0.7193572", "0.7185226", "0.71783286", "0.7168776", "0.71676975", "0.7153915", "0.7153821", "0.7136652", "0.71351427", "0.71351427", "0.7129448", "0.7129297", "0.71242833", "0.71234435", "0.7123295", "0.712224", "0.71176934", "0.71176934", "0.71176934", "0.71176934", "0.7117563", "0.7117515", "0.7116721", "0.7115215", "0.71125", "0.7110011", "0.71090037", "0.71059626", "0.71001154", "0.70987624", "0.709587", "0.70940375", "0.70940375", "0.70865333", "0.7082614", "0.70814234", "0.70805097", "0.7073973", "0.7068661", "0.7062176", "0.70607156", "0.70603514", "0.7051818", "0.7038252", "0.7038252", "0.7036113", "0.703577", "0.703577", "0.7033174", "0.7031257", "0.70298326", "0.7018852" ]
0.0
-1
Este metodo serve para retornar o alvo que esta decrito no JSON
private Alvo retornaAlvo(JSONObject jsonAlvo){ Alvo alvoTemp = null; String divisao = ((JSONObject) jsonAlvo).get("divisao").toString(); String tipo = ((JSONObject) jsonAlvo).get("tipo").toString(); alvoTemp= new Alvo(tipo, divisao); return alvoTemp; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Path(\"/productos\")\n @GET\n @Produces(MediaType.APPLICATION_JSON) //Por que una track si la aceptaba (ejemplo) pero un producto no?\n public String productos(){\n return test.getProductos().get(\"Leche\").toString();\n\n }", "@GET\n @Produces(MediaType.APPLICATION_JSON)\n public String obtener() {\n logger.debug(\"Obteniendo todos los equipos\");\n Set<Sala> salas= salaService.buscarTodasLasSalasSimples();\n logger.debug(\"Obtenidas.\");\n Genson genson = new Genson();\n String retorno = genson.serialize(salas);\n logger.debug(retorno);\n return retorno;\n }", "@GET\n @Path(\"/getAll\")\n @Produces(MediaType.APPLICATION_JSON)\n public Response getJson() {\n \n \ttry \n \t{\n \t\treturn Response.status(200).header(\"Access-Control-Allow-Origin\", \"*\").entity(servDoctores.getDoctores().toString()).build();\n \t} catch (Exception e) {\n\n \t\te.printStackTrace();\n \t\treturn Response.status(Response.Status.NO_CONTENT).build();\n \t}\n }", "@Override\r\n\tprotected GuardarVtaCeroMotivoResponse responseText(String json) {\n\t\tGuardarVtaCeroMotivoResponse guardarVtaCeroMotivoResponse = JSONHelper.desSerializar(json, GuardarVtaCeroMotivoResponse.class);\r\n\t\treturn guardarVtaCeroMotivoResponse;\r\n\t}", "@Override\r\n\tprotected GuardarSustentoResponse responseText(String json) {\n\t\tGuardarSustentoResponse guardarSustentoResponse = JSONHelper.desSerializar(json, GuardarSustentoResponse.class);\r\n\t\treturn guardarSustentoResponse;\r\n\t}", "@GET\n @Produces(\"application/json\")\n public String getJson() {\n\n JSONObject rezultat = new JSONObject();\n\n List<Korisnici> korisnici = korisniciFacade.findAll();\n\n \n\n try {\n for (Korisnici k : korisnici) {\n if (k.getIdkorisnik() == Long.parseLong(id)) {\n\n SoapListaAdresa soapOdgovor = listaDodanihAdresaBesplatno(k.getKorisnickoime(), k.getLozinka());\n\n List<Adresa> adrese = soapOdgovor.getAdrese();\n \n JSONArray jsonPolje = new JSONArray();\n int brojac = 0;\n for (Adresa a : adrese) {\n JSONObject jsonAdresa = new JSONObject();\n jsonAdresa.put(\"idadresa\", a.getIdadresa());\n jsonAdresa.put(\"adresa\", a.getAdresa());\n jsonAdresa.put(\"lat\", a.getGeoloc().getLatitude());\n jsonAdresa.put(\"long\", a.getGeoloc().getLongitude());\n jsonPolje.put(brojac,jsonAdresa);\n brojac++;\n }\n rezultat.put(\"adrese\", jsonPolje);\n } \n }\n return rezultat.toString();\n } catch (JSONException ex) {\n Logger.getLogger(MeteoRESTResource.class.getName()).log(Level.SEVERE, null, ex);\n }\n return null;\n }", "String getJson();", "String getJson();", "String getJson();", "@Override\r\n\tprotected ActualizarCompromisoResponse responseText(String json) {\n\t\tActualizarCompromisoResponse response = JSONHelper.desSerializar(json, ActualizarCompromisoResponse.class);\r\n\t\treturn response;\r\n\t}", "@Path(\"/\")\n @GET\n @Produces(MediaType.APPLICATION_JSON) // indique que la réponse est en json\n public Response test(@Context final UriInfo ui) {\n\n return Response.ok(true).build();\n }", "public String getJson();", "String getJSON();", "@GET\n @Produces(MediaType.APPLICATION_JSON)\n public String consultarSolicitudes()\n {\n Object objeto = sdao.consultaGeneral();\n return gson.toJson(objeto);\n }", "@GET\n @Produces(MediaType.APPLICATION_JSON)\n public String getJson() {\n GsonBuilder gBuilder = new GsonBuilder();\n Gson jObject = gBuilder.create();\n\n try {\n return jObject.toJson(dao.getAll());\n } catch (Exception e) {\n Resposta lResposta = new Resposta();\n\n lResposta.setMensagem(e.getMessage());\n lResposta.setSucesso(false);\n\n return jObject.toJson(lResposta);\n }\n }", "@Override\r\n\tprotected ActualizarClienteResponse responseText(String json) {\n\t\tActualizarClienteResponse actualizarClienteResponse = JSONHelper.desSerializar(json, ActualizarClienteResponse.class);\r\n\t\treturn actualizarClienteResponse;\r\n\t}", "@GetMapping(produces=MediaType.APPLICATION_JSON_VALUE)\n\tpublic Saludo consulta() {\n\t\treturn new Saludo(\"Hola\", \"!!!!\");\n\t}", "@GET\r\n @Produces(\"application/json\")\r\n public String listCarro() throws Exception {\r\n List<CarroModel> lista;\r\n //CarroDao dao = new CarroDao();\r\n CarroDao dao = CarroDao.getInstance();\r\n List<model.CarroModel> carros = dao.getAll();\r\n //Converter para Gson\r\n Gson g = new Gson();\r\n return g.toJson(carros);\r\n }", "@Override\r\n protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n WebFunction.JsonHeaderInit(resp);\r\n ArticleService svc=new ArticleService();\r\n JSONObject ResultJson = svc.GetType(\"1\");\r\n WebFunction.ResponseJson(resp, ResultJson);\r\n }", "@Override\n protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n PrintWriter out = resp.getWriter();\n resp.setStatus(200);\n resp.setCharacterEncoding(\"UTF-8\");\n resp.setContentType(\"application/json\");\n resp.addHeader(\"Access-Control-Allow-Origin\", \"*\");\n resp.addHeader(\"Access-Control-Allow-Methods\", \"POST, GET, OPTIONS, PUT, DELETE, HEAD\");\n\n if (req.getParameter(\"id\") != null) {\n Contato contato = new Contato(Integer.parseInt(req.getParameter(\"id\")));\n\n JSONObject obj = new JSONObject();\n obj.put(\"id\", contato.getId());\n obj.put(\"nome\", contato.getNome());\n obj.put(\"telefone\", contato.getTelefone());\n obj.put(\"celular\", contato.getCelular());\n obj.put(\"email\", contato.getEmail());\n\n out.println(obj);\n out.flush();\n\n } else {\n try {\n ArrayList<JSONObject> listaJson = new ArrayList<>();\n Contato contatos = new Contato();\n List<Contato> listaContatos = contatos.busca();\n for (int i = 0; i < listaContatos.size(); i++) {\n Contato c = listaContatos.get(i);\n JSONObject obj = new JSONObject();\n obj.put(\"id\", c.getId());\n obj.put(\"nome\", c.getNome());\n obj.put(\"telefone\", c.getTelefone());\n obj.put(\"celular\", c.getCelular());\n obj.put(\"email\", c.getEmail());\n listaJson.add(obj);\n }\n out.println(listaJson);\n out.flush();\n } catch (SQLException e) {\n e.printStackTrace();\n resp.setStatus(500);\n }\n }\n }", "@Override\r\n\tprotected ProfitHistoryDetalleResponse responseText(String json) {\n\t\tProfitHistoryDetalleResponse response = JSONHelper.desSerializar(json,ProfitHistoryDetalleResponse.class);\r\n\t\treturn response;\r\n\t}", "@GET\n @Produces(MediaType.APPLICATION_JSON)\n public Response getProductos() {\n //TODO return proper representation object\n return controller.mostrarProductos();\n }", "@Override\n\tpublic Response novo(String dadosEmJson) {\n\t\tProduto dadosNovoProduto = converterParaJava(dadosEmJson);\n\t\tif (dadosNovoProduto != null) {\n\t\t\t// convertido com sucesso.\n\t\t\t// pegar os dados para criar um novo Produto:\n\n\t\t\t// criar a Receita com os dados enviado para o novo Produto.\n\t\t\tReceita receita = new Receita(dadosNovoProduto.getReceita().getRendimento(),\n\t\t\t\t\tdadosNovoProduto.getReceita().getTempoPreparo());\n\t\t\t// pegar a lista de componentes que ira compor a receita do produto.\n\t\t\t// adiciona na lista da receita o componente e a qtd utilizada.\n\t\t\tfor (ItemReceita item : dadosNovoProduto.getReceita().getComponentes()) {\n\t\t\t\treceita.addComponente(item.getComponente(), item.getQtdUtilizada());\n\t\t\t}\n\t\t\t// criar um novo Produto com os dados enviado e com a receita pronta.\n\t\t\tProduto produto = new Produto(dadosNovoProduto.getDescricao(), dadosNovoProduto.getCategoria(),\n\t\t\t\t\tdadosNovoProduto.getSimbolo(), dadosNovoProduto.getPreco(), receita);\n\t\t\t// persistir no BD o novo Produto.\n\t\t\tif (getDao().salvar(produto)) {\n\t\t\t\t// novo produto foi criado e persistido no BD com sucesso.\n\t\t\t\tsetResposta(mensagemCriadoRecurso());\n\t\t\t} else {\n\t\t\t\t// os dados informado possui campos inválidos.\n\t\t\t\tsetResposta(mensagemDadosInvalidos());\n\t\t\t}\n\t\t} else {\n\t\t\t// aconteceu um erro com o servidor;\n\t\t\tsetResposta(mensagemErro());\n\t\t}\n\t\treturn getResposta();\n\t}", "@Override\r\n\tprotected ConsultarIndiceEjecucionAnioResponse responseText(String json) {\n\t\tConsultarIndiceEjecucionAnioResponse response = JSONHelper.desSerializar(json, ConsultarIndiceEjecucionAnioResponse.class);\r\n\t\treturn response;\r\n\t}", "public void listarJsonbyMovimientos(HttpServletRequest request, HttpServletResponse response) throws Exception{\n String valorcriterio = request.getParameter(\"valorcriterio\");\n \n GestionBendiv gbenef = new GestionBendiv();\n BeneficiarioDiv benef_div = gbenef.obtenerGenerico(valorcriterio);\n //ArrayList beneficiario_div = new ArrayList();\n Integer id_bendiv = benef_div.getId_bendiv();\n //beneficiario_div.add(benef_div);\n \n GestionMov_diversos modelo=new GestionMov_diversos();\n ArrayList movimientos_div=modelo.obtenerMovimientosporID(id_bendiv);\n \n \n GsonBuilder builder=new GsonBuilder().setDateFormat(\"dd/MM/yyy\");\n Gson gson=builder.create();\n \n //response.addHeader(\"Access-Control-Allow-Origin\", \"http://localhost:4200\");\n response.setHeader(\"Access-Control-Allow-Origin\", \"*\");\n response.setHeader(\"Access-Control-Allow-Methods\", \"POST, GET\");\n response.setHeader(\"Access-Control-Max-Age\", \"3600\");\n response.setHeader(\"Access-Control-Allow-Headers\", \"Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With\");\n //response.getWriter().write(\"{\\\"mov_diversos\\\":\"+gson.toJson(movimientos_div)+\",\\\"beneficiario_div\\\":\"+gson.toJson(beneficiario_div)+\"}\");\n response.getWriter().write(\"{\\\"mov_diversos\\\":\"+gson.toJson(movimientos_div)+\"}\");\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 }", "@GET\n\t@Produces({ MediaType.APPLICATION_JSON })\n\tpublic Response getServiciosDeAlojamiento() {\n\n\t\ttry {\n\t\t\tAlohAndesTransactionManager tm = new AlohAndesTransactionManager(getPath());\n\n\t\t\tList<ServicioDeAlojamiento> serviciosDeAlojamiento;\n\t\t\tserviciosDeAlojamiento = tm.getAllServiciosDeAlojamiento();\n\t\t\treturn Response.status(200).entity(serviciosDeAlojamiento).build();\n\t\t} \n\t\tcatch (Exception e) {\n\t\t\treturn Response.status(500).entity(doErrorMessage(e)).build();\n\t\t}\n\t}", "@GET\n\t@Produces({ MediaType.APPLICATION_JSON })\n\tpublic Response getRestaurantes() {\n\t\tRotondAndesTM tm = new RotondAndesTM(getPath());\n\t\tList<Restaurante> restaurantes;\n\t\ttry\n\t\t{\n\t\t\trestaurantes = tm.darRestaurantes();\n\t\t\treturn Response.status( 200 ).entity( restaurantes ).build( );\t\t\t\n\t\t}catch( Exception e )\n\t\t{\n\t\t\treturn Response.status( 500 ).entity( doErrorMessage( e ) ).build( );\n\t\t}\n\t}", "@Override\r\n\tprotected String requestText() {\n\t\tGuardarVtaCeroMotivoRequest guardarVtaCeroMotivoRequest = new GuardarVtaCeroMotivoRequest();\r\n\t\tguardarVtaCeroMotivoRequest.setAnio(Anio);\r\n\t\tguardarVtaCeroMotivoRequest.setCodCliente(codCliente);\r\n\t\tguardarVtaCeroMotivoRequest.setCodDeposito(codDeposito);\r\n\t\tguardarVtaCeroMotivoRequest.setMes(Mes);\r\n\t\tguardarVtaCeroMotivoRequest.setMotivo(Motivo);\r\n\t\tguardarVtaCeroMotivoRequest.setObservacion(observacion);\r\n\t\tguardarVtaCeroMotivoRequest.setSemana(Semana);\r\n\t\tguardarVtaCeroMotivoRequest.setUsuario(Usuario);\r\n\t\tString request = JSONHelper.serializar(guardarVtaCeroMotivoRequest);\r\n\t\treturn request;\r\n\t}", "@GET\n //@Path(\"/{usuario}-{clave}\")\n @Produces(MediaType.APPLICATION_JSON)\n @Consumes(MediaType.APPLICATION_JSON)\n public Response ConsultaItemsWS(@QueryParam(\"tipo\") String tipo, \n @QueryParam(\"cod_int\") String codigoIterno,\n @QueryParam(\"cod_alt\") String codigoAlterno,\n @QueryParam(\"descripcion\") String Descripcion,\n @QueryParam(\"linea\") String Linea\n ){\n String datos =\"[]\";\n JSONObject json = new JSONObject();\n JSONArray itemSelectedJson = new JSONArray();\n datos=item.ConsultaItems(tipo, codigoIterno, codigoAlterno, Descripcion, Linea);\n \n JsonParser parser = new JsonParser();\n\n // Obtain Array\n JsonArray gsonArr = parser.parse(datos).getAsJsonArray();\n json = new JSONObject();\n \n /*json.put(\"data\", gsonArr);\n json.put(\"mensaje\", \"ok\");\n json.put(\"codigo_error\", 1);\n itemSelectedJson.add(json);*/\n String datosJSON=\"{ \\\"data\\\":\"+gsonArr+\",\\\"mensaje\\\":\\\"ok\\\",\\\"codigo_error\\\":1}\";\n \n System.out.println(\"datosJSON: \"+datosJSON);\n //return Response.ok(itemSelectedJson.toString()).build();\n return Response.ok(datosJSON).build();\n }", "@Override\r\n protected void doGet(HttpServletRequest request, HttpServletResponse response)\r\n throws ServletException, IOException {\r\n processRequest(request, response);\r\n //String nombre = request.getParameter(\"nombre\");\r\n String nombre_articulo = request.getParameter(\"nombre_articulo\");\r\n System.out.println(nombre_articulo);\r\n //List<String> tallasPorArt = InventariosController.getTallasPorArticulo(nombre_articulo);\r\n// Gson gson = new Gson();\r\n// String json = gson.toJson(tallasPorArt);\r\n// PrintWriter out = response.getWriter();\r\n// out.println(json);\r\n // System.out.println(tallasPorArt.size());\r\n \r\n }", "@GET\n\t@Path(\"consultar/{titulo}\") //ruta -> metodo que al que llama\n\t@Produces(\"application/json\") \n\tpublic String buscarTitulo(@PathParam(\"titulo\") String titulo) {\n\t\tList<Libro> lista = negocio.consultarTitulo(titulo);\n\t\tJSONArray array = new JSONArray(lista);\n\t\treturn array.toString();\n\t}", "public interface PrecosService {\n\n @GET(\"/combustivelbarato/precos/master/precos.json\")\n List<Preco> getPrecos();\n}", "@GET\n @Produces(MediaType.APPLICATION_JSON)\n public String getJson() {\n return null;\n }", "private JSON() {\n\t}", "@GET\r\n @Produces(MediaType.APPLICATION_JSON)\r\n public String getIt() {\r\n // return \"Got it!\";\r\n \treturn appObj.readAppointment();\r\n }", "@GET\n @Produces(\"application/json\")\n public String getJson() {\n //TODO return proper representation object\n throw new UnsupportedOperationException();\n }", "@GET\n @Path(\"/{id}\")\n @Produces(MediaType.APPLICATION_JSON)\n public String getJson(@PathParam(\"id\") int id) {\n GsonBuilder gBuilder = new GsonBuilder();\n Gson jObject = gBuilder.create();\n try {\n return jObject.toJson(dao.getObjectById(id));\n } catch (Exception e) {\n Resposta lResposta = new Resposta();\n lResposta.setMensagem(e.getMessage());\n lResposta.setSucesso(false);\n\n return jObject.toJson(lResposta);\n }\n }", "@GET\n @Path(\"/mostrarOrdenadasFT\")\n @Produces({\"application/json\"})\n public List<Fotografia> fotoUsuarioOrdenadaFT(){\n int idUser = 1;\n return fotografiaEJB.FotoUsuarioOrdenadasFT(idUser);\n }", "@CrossOrigin\r\n @RequestMapping(value = \"/especialidad\", method = RequestMethod.GET, headers = {\"Accept=application/json\"})\r\n @ResponseBody\r\n String buscarTodos() throws Exception {\r\n String mensajito = \"nada\";\r\n ObjectMapper maper = new ObjectMapper();\r\n\r\n ArrayList<Especialidades> especialidad = new ArrayList<Especialidades>();\r\n especialidad = (ArrayList<Especialidades>) daoesp.findAll();\r\n //usamos del paquete fasterxml de json la clase objetMapper\r\n\r\n return maper.writeValueAsString(especialidad);\r\n\r\n }", "Object visitorResponse();", "@GET\n @Produces(\"application/json\")\n public JSONObject getResultado() {\n \n Connection con = null;\n PreparedStatement pst = null;\n ResultSet rs = null;\n\n String url = \"jdbc:mysql://localhost:3306/testdb\";\n String user = \"testuser\";\n String password = \"test623\";\n\n try {\n \n con = DriverManager.getConnection(url, user, password);\n pst = con.prepareStatement(\"SELECT * FROM Authors\");\n rs = pst.executeQuery();\n \n \n while (rs.next()) {\n System.out.print(rs.getInt(1));\n System.out.print(\": \");\n System.out.println(rs.getString(2));\n }\n \n \n con.close();\n\n } catch (SQLException ex) {\n System.err.println(\"Got an exception! \"); \n System.err.println(ex.getMessage()); \n\n }\n \n int resultado=0;\n \n JSONObject obj = new JSONObject();\n\n obj.put(\"res\", resultado);\n \n return obj;\n \n }", "@GET\n @Path(\"location/Arovince\")\n @Produces(\"application/json\")\n public String getJson() throws IOException {\n FileWriter file = new FileWriter(\"/home/component/NetBeansProjects/ArovinceAndSchool/web/api/Arovince.json\");\n JSONObject jsonArray = null;\n\n try {\n URL url = new URL(\"https://opend.data.go.th/get-ckan/datastore_search?resource_id=df922923-e009-4dee-92fc-d963a86ce4b8\"); \n HttpURLConnection httpURLConnection = (HttpURLConnection)url.openConnection();\n httpURLConnection.setRequestMethod(\"GET\");\n httpURLConnection.setRequestProperty(\"api-key\", \"XOe9aVTolOhCbyTU103IqAKTNNNPX8b5\");\n String line = \"\";\n InputStreamReader inputStreamReader = new InputStreamReader(httpURLConnection.getInputStream());\n BufferedReader bufferedReader = new BufferedReader(inputStreamReader);\n StringBuilder response = new StringBuilder();\n\n try {\n while((line = bufferedReader.readLine()) != null) {\n file.write(line);\n response.append(line);\n }\n } catch (IOException var10) {\n }\n\n file.close();\n bufferedReader.close();\n jsonArray = new JSONObject(response.toString());\n return jsonArray.toString(4);\n } catch (Exception var11) {\n return \"\" + var11;\n }\n }", "@GET\n @Produces(MediaType.APPLICATION_JSON)\n public String getJSON() {\n throw new UnsupportedOperationException();\n }", "@GET\n @Produces(MediaType.APPLICATION_JSON)\n public String getJson() {\n //TODO return proper representation object\n throw new UnsupportedOperationException();\n }", "@GET\n @Produces(MediaType.APPLICATION_JSON)\n public String getJson() {\n //TODO return proper representation object\n throw new UnsupportedOperationException();\n }", "@GET\n @Produces(MediaType.APPLICATION_JSON)\n public String getJson() {\n //TODO return proper representation object\n throw new UnsupportedOperationException();\n }", "public void jsonPresentation () {\n System.out.println ( \"****** Json Data Module ******\" );\n ArrayList<Book> bookArrayList = new ArrayList<Book>();\n String jsonData = \"\";\n ObjectMapper mapper = new ObjectMapper();\n bookArrayList = new Request().postRequestBook();\n try {\n jsonData = mapper.writeValueAsString(bookArrayList);\n } catch (JsonProcessingException e) {\n System.out.println(\"Error: \"+ e);\n }\n System.out.println(jsonData);\n ClientEntry.showMenu ( );\n }", "public String pasarAjson(ArrayList<Cliente> miLista){\n String textoenjson;\n Gson gson = new Gson();\n textoenjson = gson.toJson(miLista);\n\n\n return textoenjson;\n }", "public String leerArchivoJSON() {\n String contenido = \"\";\n FileReader entradaBytes;\n try {\n entradaBytes = new FileReader(new File(ruta));\n BufferedReader lector = new BufferedReader(entradaBytes);\n String linea;\n try {\n while ((linea = lector.readLine()) != null) {\n contenido += linea;\n }\n } catch (IOException e) {\n e.printStackTrace();\n } finally {\n try {\n if (entradaBytes != null) {\n entradaBytes.close();\n }\n if (lector != null) {\n lector.close();\n }\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n }\n } catch (FileNotFoundException ex) {\n Logger.getLogger(GenerarIsla.class.getName()).log(Level.SEVERE, null, ex);\n }\n return contenido;\n }", "@GET\r\n @Produces(\"application/json\")\r\n @Path(\"Carro/get/{placa}\")\r\n public String getCarro(@PathParam(\"placa\") String placa) throws Exception {\r\n CarroModel c = new CarroModel();\r\n c.setPlaca(placa);\r\n\r\n //CarroDao dao = new CarroDao();\r\n CarroDao dao = CarroDao.getInstance();\r\n c = dao.buscar(c);\r\n\r\n //Converter para Gson\r\n Gson g = new Gson();\r\n return g.toJson(c);\r\n }", "List<VoziloDto> sveVozila();", "private static JsonAluno toBasicJson(Aluno aluno) {\r\n\t\tJsonAluno jsonAluno = new JsonAluno();\r\n\t\tapplyBasicJsonValues(jsonAluno, aluno);\r\n\t\treturn jsonAluno;\r\n\t}", "@GET\n @Path(\"/getdetallealquilerfactura_id/{token}/{id}\")\n @Produces(MediaType.APPLICATION_JSON)\n public String getdetallealquilerfactura_id(\n @PathParam(\"token\") String token,\n @PathParam(\"id\")int id) throws Exception{\n \n Respuesta respon = new Respuesta();\n \n CheckToken check = new CheckToken();\n \n \n //instancie el objeto de DB\n DB dbase = new DB(\"itla2\",\"itlajava\",\"12345678@itla\");\n \n if (check.checktocken2(token)==0) \n { \n respon.setId(2);\n respon.setMensaje(\"Lo Sentimos token Desactivado, Comuniquese Con el Administrador, Gracias\");\n return respon.ToJson(respon);\n \n } \n \n //realizo el sql de busqueda\n String sql =\"SELECT f_id,f_id_t_alquiler_factura,f_tipo_factura_t_alquiler_factura,f_id_t_productos,\";\n sql+=\"f_fecha_salida,f_fecha_entrada,f_fecha_real_entrada,f_cantidad,f_precio,f_costo,f_itbis \";\n sql+=\" FROM public.t_detalle_alquiler_factura where f_id = \"+id;\n \n try\n {\n ResultSet rs = dbase.execSelect(sql); \n if(!rs.next())\n {\n \n Respuesta respo = new Respuesta();\n \n respo.setId(0);\n respo.setMensaje(\"No hay registros actualmente en la base de datos\");\n return respo.ToJson(respo);\n \n }\n while (rs.next())\n { \n \n \n detalleAlquilerFactura daf = new detalleAlquilerFactura();\n \n daf.setF_id(rs.getInt(1));\n daf.setF_id_t_alquiler_factura(rs.getInt(2));\n daf.setF_tipo_Factura_t_alquiler_factura(rs.getString(3));\n daf.setF_id_t_Producto(rs.getInt(4));\n daf.setF_fecha_salida(rs.getString(5));\n daf.setF_fecha_entrada(rs.getString(6));\n daf.setF_fecha_entrada_real(rs.getString(6));\n daf.setF_cantidad(rs.getInt(7));\n daf.setF_precio(rs.getInt(7));\n daf.setF_costo(rs.getInt(7));\n daf.setF_itbis(rs.getInt(8));\n \n //asigno elrs a la lista\n \n respon.setId(1);\n respon.setMensaje(respon.ToJson(daf));\n \n \n }\n } \n catch (SQLException e) \n {\n //si falla un error de base de datos\n respon.setId(-1);\n respon.setMensaje(\"Error de la base de datos \"+e.getMessage());\n return respon.ToJson(respon);\n \n }\n dbase.CerrarConexion();\n return respon.ToJson(respon); //retornando el Gson \n\n }", "@Override\r\n\tprotected String requestText() {\n\t\tProfitHistoryDetalleRequest profitHistoryDetalleRequest = new ProfitHistoryDetalleRequest();\r\n\t\tprofitHistoryDetalleRequest.setCodigoCliente(this.codigo);\r\n\t\tString request = JSONHelper.serializar(profitHistoryDetalleRequest);\r\n\t\treturn request;\r\n\t}", "@GET(\"montaje/proyectos/ver/\")\n Call<List<clsProyecto>> getProyectos();", "@GET\n\t@Path(\"/\")\n\t@Produces(MediaType.APPLICATION_JSON)\n\tpublic TempResponse controller1(){\n\t\tSystem.out.println(\"yay\");\n\t\t\n\t\tTempResponse tr = SelfImpl.getTempResponse();\n\t\treturn tr;\n\t}", "public static void ObtenerDatosGustoVerdura(Context context) {\n\n queue = Volley.newRequestQueue(context);\n\n String url = \"http://161.35.14.188/Persuhabit/GustoVerdura\";//establece ruta al servidor para obtener los datos\n JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {\n @Override\n public void onResponse(JSONObject response) {\n\n try {\n JSONArray jsonArray = response.getJSONArray(\"data\");//\n\n for (int i = 0; i < jsonArray.length(); i++) {\n JSONObject jsonObject = jsonArray.getJSONObject(i);\n\n }\n\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }\n }, new Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n\n }\n });\n queue.add(jsonObjectRequest);\n }", "public static RutaDTO consultarRutaById(int identificador){\n RutaDTO ruta = null;\n HttpClient httpClient = new DefaultHttpClient();\n HttpGet del = new HttpGet(HOST_BACKEND+\"mycityviewBE/rest/ruta/\"+identificador);\n del.setHeader(\"content-type\", CONTENT_TYPE);\n del.setHeader(\"Authorization\", getAuthorization().trim());\n try {\n HttpResponse resp = httpClient.execute(del);\n if(resp.getStatusLine().getStatusCode() == HttpStatus.SC_OK){\n String respStr = EntityUtils.toString(resp.getEntity());\n Gson gson = new GsonBuilder().create();\n ruta = gson.fromJson(respStr, RutaDTO.class);\n }\n } catch (Exception ex) {\n Log.e(\"ServicioRest\", \"Error!\", ex);\n }\n return ruta;\n }", "@Override\r\n\tprotected JSON_Paginador getJson_paginador() {\n\t\treturn null;\r\n\t}", "@Override\r\n\tprotected String requestText() {\n\t\tActualizarClienteRequest actualizarClienteRequest = new ActualizarClienteRequest();\r\n\t\tactualizarClienteRequest.setCliente(codigo);\r\n\t\tactualizarClienteRequest.setFechaAniversario(fechAniv);\r\n\t\tactualizarClienteRequest.setObservaciones(observaciones);\r\n\t\tactualizarClienteRequest.setRazonComercial(razonComercial);\r\n\t\tactualizarClienteRequest.setReferencia(referencia);\r\n\t\tactualizarClienteRequest.setUsuario(usuario);\r\n\t\t\r\n\t\tString request = JSONHelper.serializar(actualizarClienteRequest);\r\n\t\treturn request;\r\n\t}", "@Override\n public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {\n response.setContentType(\"application/json\");\n\n List<Table> tables = getTables();\n Gson gson = new Gson();\n String json = gson.toJson(tables);\n\n response.getOutputStream().println(json);\n }", "@Path(\"/inputdata/\")\n @GET\n @Produces(MediaType.APPLICATION_JSON)\n public Response getMannschaftenAndSpieltypen() {\n \n return Response.ok(QuoteModel.getAllMannschaftenAndSpieltyp()).build();\n }", "@GET\n @Path(\"/mostrarOrdenadasFS\")\n @Produces({\"application/json\"})\n public List<Fotografia> fotoUsuarioOrdenadaFS(){\n int idUser = 1;\n return fotografiaEJB.FotoUsuarioOrdenadasFS(idUser);\n }", "public abstract Object toJson();", "@RequestMapping(method = RequestMethod.GET, value = \"/pruebaConsulta.do\")\n public @ResponseBody\n void pruebaConsulta(Model model)\n {\n String idEstado = \"15\";\n// //Fabricacion de objeto\n MunicipiosJSON municipiosJSON = new MunicipiosJSON();\n try\n {\n //Track tiempo\n Calendar ahora1 = Calendar.getInstance();\n long tiempo1 = ahora1.getTimeInMillis();\n municipiosJSON = daoCodigosPostales.municipiosEstado(\"15\");\n\n //Operacion realizada con exito\n municipiosJSON.setStatusJSON(true);\n Calendar ahora2 = Calendar.getInstance();\n long tiempo2 = ahora2.getTimeInMillis();\n long total = tiempo2 - tiempo1;\n System.out.println(\"Operacion con exito en \" + total + \"ms\");\n\n } catch(Exception e)\n {\n e.printStackTrace();\n //Error en consulta\n municipiosJSON.setStatusJSON(false);\n\n }\n\n }", "@Override\r\n\tprotected String requestText() {\n\t\tGuardarSustentoRequest guardarSustentoRequest = new GuardarSustentoRequest();\r\n\t\tguardarSustentoRequest.setCodigoActvidad(codigoActvidad);\r\n\t\tguardarSustentoRequest.setCodigoCliente(codigoCliente);\r\n\t\tguardarSustentoRequest.setCodigoPLan(codigoPLan);\r\n\t\tguardarSustentoRequest.setDescripcionActividad(descripcionActividad);\r\n\t\tguardarSustentoRequest.setFechaVisita(fechaVisita);\r\n\t\tguardarSustentoRequest.setTipoActividad(tipoActividad);\r\n\t\tguardarSustentoRequest.setUsuario(usuario);\r\n\t\tString request = JSONHelper.serializar(guardarSustentoRequest);\r\n\t\treturn request;\r\n\t}", "@RequestMapping(method=RequestMethod.GET, produces=MediaType.APPLICATION_JSON_VALUE)\r\n\tpublic ResponseEntity<List<Producto>> buscarTodo(){\r\n\t\tList<Producto> productos = dao.buscarTodo();\r\n\t\treturn new ResponseEntity<List<Producto>>(productos,HttpStatus.OK);\r\n\t}", "@GetMapping(\"/balanceador-test\")\n\tpublic ResponseEntity<?> balanceadorTest(){\n\t\tMap<String, Object> response = new HashMap<>();\n\t\tresponse.put(\"balanceador\", balanceadorTest);\n\t\tresponse.put(\"cursos\", service.findAll());\n\t\t\n\t\t// Va a generar un json con dos atributos. por ej, dentro del atributo cursos anida el json de los cursos\n\t\treturn ResponseEntity.ok(response);\n\t}", "public abstract String toJson();", "@GET\n\t// The Java method will produce content identified by the MIME Media\n\t// type \"text/plain\"\n\t@Produces(MediaType.APPLICATION_JSON)\n\t@Path(\"{pagina}/{resultadoPorPagina}\")\n\tpublic String darSeguimientoCandidatos(\n\t\t\t@DefaultValue(\"0\") @PathParam(\"pagina\") final String paginaStr,\n\t\t\t@DefaultValue(\"10\") @PathParam(\"resultadoPorPagina\") final String resultadoPorPaginaStr,\n\t\t\t@Context HttpServletRequest request,\n\t\t\t@Context HttpServletResponse response) {\n\t\tBusquedaCandidatoRestDTO darSeguimiento = new BusquedaCandidatoRestDTO();\n\t\tString cookie = request.getHeader(CookieSession.NAME);\n\t\tdarSeguimiento.setResult(\"OK\");\n\t\tif (cookie == null) {\n\t\t\tdarSeguimiento.setResult(\"No se encuentra el Token\");\n\t\t\treturn gson.toJson(darSeguimiento);\n\t\t}\n\n\t\tList<OfertaCandidatoOcupacionDTO> ofertasCandidato = new ArrayList<OfertaCandidatoOcupacionDTO>();\n\t\tLong idEmpresa = 0L;\n\t\ttry {\n\t\t\t// validar el cookie para obtener el idEmpresa\n\t\t\tMovilSessionVO movilSession = CookieSession.decodeValue(cookie);\n\t\t\tidEmpresa = movilSession.getIdEmpresa();\n\n\t\t\tEmpresaEspacioDelegate service = EmpresaEspacioDelegateImpl\n\t\t\t\t\t.getInstance();\n\t\t\tList<ESTATUS> estatusBusqueda = new ArrayList<ESTATUS>();\n\t\t\testatusBusqueda.add(ESTATUS.EN_PROCESO);\n\t\t\tList<ESTATUS> estatusOferta = new ArrayList<ESTATUS>();\n\t\t\testatusOferta.add(ESTATUS.ACTIVO);\n\n\t\t\tofertasCandidato = service.obtenerOfertaCandidatoEmpresa(idEmpresa,\n\t\t\t\t\testatusBusqueda,estatusOferta);\n\t\t\t/*****/\n\t\t\tif (ofertasCandidato == null || ofertasCandidato.isEmpty()) {\n//\t\t\t\tdarSeguimiento.setError(\"No se encontraron ofertas activas para dar seguimiento\");\n\t\t\t\treturn gson.toJson(darSeguimiento);\n\t\t\t}\n\n\t\t\t/* se calcula compatibilidad */\n\t\t\tfor (int i = 0; i < ofertasCandidato.size(); i++) {\n\t\t\t\tlong compatibility = calculaCompatibilidad(Long.valueOf(ofertasCandidato.get(i).getIdOfertaEmpleo()),\n\t\t\t\t\t\tLong.valueOf(ofertasCandidato.get(i).getIdCandidato()));\n\t\t\t\tofertasCandidato.get(i).setCompatibilidad(String.valueOf(compatibility));\n\n\t\t\t}\n\n\t\t\t/* se ordena la lista deacuerdo a la compatibilidad */\n\t\t\tCollections.sort(ofertasCandidato, new OfertaCandidatoComparador());\n\n\t\t\tdarSeguimiento.setTamano(ofertasCandidato.size());\n\t\t\tofertasCandidato = limitarBusquedaCandidato(paginaStr,\n\t\t\t\t\tresultadoPorPaginaStr, ofertasCandidato);\n\n\t\t} catch (Exception se) {\n\t\t\tse.printStackTrace();\n\t\t\tlogger.error(se);\n\t\t\tdarSeguimiento.setResult(se.getMessage());\n\t\t\treturn gson.toJson(darSeguimiento);\n\t\t}\n\n\t\tdarSeguimiento.setOfertaCandidato(ofertasCandidato);\n\n\t\treturn gson.toJson(darSeguimiento);\n\n\t}", "@Override\n\tprotected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {\n\t Map<String, Object> map = doService(req,resp);\n\t Gson gson = new Gson();\n\t\tString json = gson.toJson(map);\n\t\tSystem.out.println(\"返回的json数据--------------------->\"+json);\n\t\tresp.getWriter().write(json);\n\t}", "public static void ObtenerDatosHistorial_Autoeficacia(Context context) {\n\n queue = Volley.newRequestQueue(context);\n\n String url = \"http://161.35.14.188/Persuhabit/HistorialAuto\";//establece ruta al servidor para obtener los datos\n JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {\n @Override\n public void onResponse(JSONObject response) {\n\n try {\n JSONArray jsonArray = response.getJSONArray(\"data\");//\n\n for (int i = 0; i < jsonArray.length(); i++) {\n JSONObject jsonObject = jsonArray.getJSONObject(i);\n\n }\n\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }\n }, new Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n\n }\n });\n queue.add(jsonObjectRequest);\n }", "@GetMapping(path=\"/json\")\n public String getTodos() {\n String theUrl = \"http://localhost:8080/hello\";\n ResponseEntity<String> response = restTemplate.exchange(theUrl, HttpMethod.GET, null, String.class);\n\n return response.getBody();\n }", "public static void ObtenerTutor(Context context) {\n\n queue = Volley.newRequestQueue(context);\n\n String url = \"http://161.35.14.188/Persuhabit/tutor\";//establece ruta al servidor para obtener los datos\n JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {\n @Override\n public void onResponse(JSONObject response) {\n\n try {\n JSONArray jsonArray = response.getJSONArray(\"data\");//\n\n for (int i = 0; i < jsonArray.length(); i++) {\n JSONObject jsonObject = jsonArray.getJSONObject(i);\n\n }\n\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }\n }, new Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n\n }\n });\n queue.add(jsonObjectRequest);\n }", "@Override\n public void onResponse(JSONObject response) {\n Log.e(\"puto\",\"PRECEOSA \");\n procesarRespuesta(response);\n\n Log.e(\"puto\",\"respuetsa -\"+response);\n }", "String toJSON();", "public ListaResponse<G> listar();", "@Get(\"json\")\n public Representation toJSON() {\n \tString status = getRequestFlag(\"status\", \"valid\");\n \tString access = getRequestFlag(\"location\", \"all\");\n\n \tList<Map<String, String>> metadata = null;\n\n \tString msg = \"no metadata matching query found\";\n\n \ttry {\n \t\tmetadata = getMetadata(status, access,\n \t\t\t\tgetRequestQueryValues());\n \t} catch(ResourceException r){\n \t\tmetadata = new ArrayList<Map<String, String>>();\n \tif(r.getCause() != null){\n \t\tmsg = \"ERROR: \" + r.getCause().getMessage();\n \t}\n \t}\n\n\t\tString iTotalDisplayRecords = \"0\";\n\t\tString iTotalRecords = \"0\";\n\t\tif (metadata.size() > 0) {\n\t\t\tMap<String, String> recordCounts = (Map<String, String>) metadata\n\t\t\t\t\t.remove(0);\n\t\t\tiTotalDisplayRecords = recordCounts.get(\"iTotalDisplayRecords\");\n\t\t\tiTotalRecords = recordCounts.get(\"iTotalRecords\");\n\t\t}\n\n\t\tMap<String, Object> json = buildJsonHeader(iTotalRecords,\n\t\t\t\tiTotalDisplayRecords, msg);\n\t\tList<ArrayList<String>> jsonResults = buildJsonResults(metadata);\n\n\t\tjson.put(\"aaData\", jsonResults);\n\n\t\t// Returns the XML representation of this document.\n\t\treturn new StringRepresentation(JSONValue.toJSONString(json),\n\t\t\t\tMediaType.APPLICATION_JSON);\n }", "@GET\n\t@Path(\"listado/{codigo}\") //ruta -> metodo que al que llama\n\t@Produces(\"application/json\") \n\tpublic String buscar(@PathParam(\"codigo\") String isbn) {\n\t\tLibro libro = negocio.consultarISBN(isbn);\n\t\tJSONObject json = new JSONObject(libro);\n\t\treturn json.toString();\n\t}", "@Override\r\n\tprotected String requestText() {\n\t\tActualizarCompromisoRequest actualizarCompromisoRequest = new ActualizarCompromisoRequest();\r\n\t\tactualizarCompromisoRequest.listaInventarioCompromiso = this.listaInventarioCompromiso;\r\n\t\tactualizarCompromisoRequest.listaPosicionCompromiso = this.listaPosicionCompromiso;\r\n\t\tactualizarCompromisoRequest.listaPresentacionCompromiso = this.listaPresentacionCompromiso;\r\n\t\tactualizarCompromisoRequest.updateInformacionAdicionalTO = this.updateInformacionAdicionalTO;\r\n\t\tactualizarCompromisoRequest.codigoCabecera = this.codigoCabecera;\r\n\t\tString request = JSONHelper.serializar(actualizarCompromisoRequest);\r\n\t\treturn request;\r\n\t}", "@GetMapping(\"/alunos\")\n\tpublic ResponseEntity<List<Aluno>> mostrarTodos() {\n\t\treturn ResponseEntity.ok(servico.recuperarTodos());\n\t}", "@GET\n\t@Produces(MediaType.APPLICATION_JSON)\n\tpublic ArrayList <Persistence.Tache> getdoneeeee(){\n\t\tdone=sug.gettoutelestaches().stream().filter(e->e.getEtatdeTache().name().equals(EtatdeTache.done.name())).collect(Collectors.toList());\n\n\t\treturn (ArrayList<Persistence.Tache>) done;\n\t}", "@RequestLine(\"GET /api/v1/localidades/estados\")\n\tList<EstadoJson> get();", "@GET\n\t@Produces({ MediaType.APPLICATION_JSON })\n\tpublic Response getTipos() {\n\t\tRotondAndesTM tm = new RotondAndesTM(getPath());\n\t\tList<Tipo> Tipos;\n\t\ttry {\n\t\t\tTipos = tm.darTipos();\n\t\t} catch (Exception e) {\n\t\n\t\t\treturn Response.status(500).entity(doErrorMessage(e)).build();\n\t\t}\n\t\treturn Response.status(200).entity(Tipos).build();\n\t}", "public static void ObtenerCuestionario_Nutricion(Context context) {\n\n queue = Volley.newRequestQueue(context);\n\n String url = \"http://161.35.14.188/Persuhabit/CuestionarioNutri\";//establece ruta al servidor para obtener los datos\n JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {\n @Override\n public void onResponse(JSONObject response) {\n\n try {\n JSONArray jsonArray = response.getJSONArray(\"data\");//\n\n for (int i = 0; i < jsonArray.length(); i++) {\n JSONObject jsonObject = jsonArray.getJSONObject(i);\n\n }\n\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }\n }, new Response.ErrorListener() {\n @Override\n public void onErrorResponse(VolleyError error) {\n\n }\n });\n queue.add(jsonObjectRequest);\n }", "protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n List<String> json = new LinkedList<>();\n Gson gson = new Gson();\n AppointmentService appservice = new AppointmentService();\n json = appservice.getDatabyId(Integer.parseInt(request.getParameter(\"id\")));\n try (PrintWriter out = response.getWriter()) {\n if (json != null) {\n out.println(json);\n } else {\n out.println(\"Ha ocurrido un error al buscar la cita\");\n }\n }\n }", "@GET\n\t@Path(\"/\")\n\t@Produces(MediaType.APPLICATION_JSON)\n\tpublic List<Tela> getTelas(){\n\t\treturn new TelaDAO().readAllTelas();\n\t}", "JsonObject raw();", "@Override\n\tprotected void handleResult(JSONObject obj) {\n\t\t\n\t}", "@Override\n protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {\n req.setCharacterEncoding(\"UTF-8\");\n resp.setContentType(\"application/json; charset=UTF-8\");\n JSONObject userJSon = Utils.getJsonFromRequest(req);\n JSONObject jsonObjectResponse = new JSONObject();\n\n\n System.out.println(userJSon);\n if (Authentication.isAdminInDbByCookies(req)) {\n if (userJSon.getString(\"command\").equals(\"setTurnNumberForMember\")) {\n\n if(Authentication.getRepository().isTurnNumberFree(userJSon.getInt(\"turnNumber\"))){\n\n\n Member member = Authentication.getRepository().getMemberById(userJSon.getInt(\"idMember\"));\n\n Authentication.getRepository().updateTurnNumberForMember(member, userJSon.getInt(\"turnNumber\"));\n\n\n jsonObjectResponse.append(\"status\", \"200\");\n jsonObjectResponse.append(\"message\", \"Номер жеребъевки установлен\");\n }else{\n jsonObjectResponse.append(\"status\", \"400\");\n jsonObjectResponse.append(\"message\", \"Номер уже занят\");\n\n\n\n }\n\n\n\n }\n\n }\n resp.getWriter().write(String.valueOf(jsonObjectResponse));\n resp.flushBuffer();\n }", "@Override \r\n public String getProfilo(String profilo) {\n Iterator<Map<String, String>> iterator;\r\n iterator = getUltimaEntry().iterator();\r\n\t\twhile (iterator.hasNext()) {\r\n\t\t\tMap<String, String> m = iterator.next();\r\n if(m.get(\"Iface\").equals(profilo))\r\n \r\n \r\n try {\r\n String json = new ObjectMapper().writeValueAsString(m);\r\n \r\n if (json!=null) return json ;\r\n } catch (JsonProcessingException ex) {\r\n Logger.getLogger(NetstatSingleton.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n }\r\n \r\n \r\n return \"NOT WORKING\";\r\n \r\n }", "@GET\r\n public List<DocumentoDTO> obtenerDocumento(){\r\n List<DocumentoEntity> documento= logic.obtenerDocumento(); \r\n return DocumentoDTO.toZooList(documento);\r\n }", "@GET\n @Produces(MediaType.APPLICATION_JSON)\n public Response handleGet() {\n Gson gson = GSONFactory.getInstance();\n List allEmployees = getAllEmployees();\n\n if (allEmployees == null) {\n allEmployees = new ArrayList();\n }\n\n Response response = Response.ok().entity(gson.toJson(allEmployees)).build();\n return response;\n }", "private void datosVehiculo(boolean esta_en_revista) {\n\t\ttry{\n\t\t\t String Sjson= Utils.doHttpConnection(\"http://datos.labplc.mx/movilidad/vehiculos/\"+placa+\".json\");\n\t\t\t JSONObject json= (JSONObject) new JSONTokener(Sjson).nextValue();\n\t\t\t JSONObject json2 = json.getJSONObject(\"consulta\");\n\t\t\t JSONObject jsonResponse = new JSONObject(json2.toString());\n\t\t\t JSONObject sys = jsonResponse.getJSONObject(\"tenencias\");\n\t\t\t \n\t\t\t if(sys.getString(\"tieneadeudos\").toString().equals(\"0\")){\n\t\t\t \tautoBean.setDescripcion_tenencia(getResources().getString(R.string.sin_adeudo_tenencia));\n\t\t\t \tautoBean.setImagen_teencia(imagen_verde);\n\t\t\t }else{\n\t\t\t \tautoBean.setDescripcion_tenencia(getResources().getString(R.string.con_adeudo_tenencia));\n\t\t\t \tautoBean.setImagen_teencia(imagen_rojo);\n\t\t\t \tPUNTOS_APP-=PUNTOS_TENENCIA;\n\t\t\t }\n\t\t\t \n\t\t\t JSONArray cast = jsonResponse.getJSONArray(\"infracciones\");\n\t\t\t String situacion;\n\t\t\t boolean hasInfraccion=false;\n\t\t\t for (int i=0; i<cast.length(); i++) {\n\t\t\t \tJSONObject oneObject = cast.getJSONObject(i);\n\t\t\t\t\t\t try {\n\t\t\t\t\t\t\t situacion = (String) oneObject.getString(\"situacion\");\n\t\t\t\t\t\t\t if(!situacion.equals(\"Pagada\")){\n\t\t\t\t\t\t\t\t hasInfraccion=true;\n\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t } catch (JSONException e) { \n\t\t\t\t\t\t\t DatosLogBean.setDescripcion(Utils.getStackTrace(e));\n\t\t\t\t\t\t }\n\t\t\t }\n\t\t\t if(hasInfraccion){\n\t\t\t \t autoBean.setDescripcion_infracciones(getResources().getString(R.string.tiene_infraccion));\n\t\t\t\t \tautoBean.setImagen_infraccones(imagen_rojo);\n\t\t\t\t \tPUNTOS_APP-=PUNTOS_INFRACCIONES;\n\t\t\t }else{\n\t\t\t \t autoBean.setDescripcion_infracciones(getResources().getString(R.string.no_tiene_infraccion));\n\t\t\t\t autoBean.setImagen_infraccones(imagen_verde);\n\t\t\t }\n\t\t\t JSONArray cast2 = jsonResponse.getJSONArray(\"verificaciones\");\n\t\t\t if(cast2.length()==0){\n\t\t\t \t autoBean.setDescripcion_verificacion(getResources().getString(R.string.no_tiene_verificaciones));\n\t\t\t\t\t autoBean.setImagen_verificacion(imagen_rojo);\n\t\t\t\t\t PUNTOS_APP-=PUNTOS_VERIFICACION;\n\t\t\t }\n\t\t\t\t\t Date lm = new Date();\n\t\t\t\t\t String lasmod = new SimpleDateFormat(\"yyyy-MM-dd\").format(lm);\n\t\t\t\t\t SimpleDateFormat formatter = new SimpleDateFormat(\"yyyy-MM-dd\");\n\t\t\t\t\tBoolean yaValide=true;\n\t\t\t\t for (int i=0; i<cast2.length(); i++) {\n\t\t\t\t \tJSONObject oneObject = cast2.getJSONObject(i);\n\t\t\t\t\t\t\t try {\n\t\t\t\t\t\t\t\t\tif(!esta_en_revista&&yaValide){\n\t\t\t\t\t\t\t\t\t\t autoBean.setMarca((String) oneObject.getString(\"marca\"));\n\t\t\t\t\t\t\t\t\t\t autoBean.setSubmarca((String) oneObject.getString(\"submarca\"));\n\t\t\t\t\t\t\t\t\t\t autoBean.setAnio((String) oneObject.getString(\"modelo\"));\n\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t autoBean.setDescripcion_revista(getResources().getString(R.string.sin_revista));\n\t\t\t\t\t\t\t\t\t\t autoBean.setImagen_revista(imagen_rojo);\n\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t Calendar calendar = Calendar.getInstance();\n\t\t\t\t\t\t\t\t\t\t int thisYear = calendar.get(Calendar.YEAR);\n\t\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\t\t if(thisYear-Integer.parseInt(autoBean.getAnio())<=10){\n\t\t\t\t\t\t\t\t\t\t\t autoBean.setDescripcion_vehiculo(getResources().getString(R.string.carro_nuevo)+\" \"+getResources().getString(R.string.Anio)+\" \"+autoBean.getAnio());\n\t\t\t\t\t\t\t\t\t\t\t autoBean.setImagen_vehiculo(imagen_verde);\n\t\t\t\t\t\t\t\t\t\t }else{\n\t\t\t\t\t\t\t\t\t\t\t autoBean.setDescripcion_vehiculo(getResources().getString(R.string.carro_viejo)+\" \"+getResources().getString(R.string.Anio)+\" \"+autoBean.getAnio());\n\t\t\t\t\t\t\t\t\t\t\t autoBean.setImagen_vehiculo(imagen_rojo);\n\t\t\t\t\t\t\t\t\t\t\t PUNTOS_APP-=PUNTOS_ANIO_VEHICULO;\n\t\t\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t\t\t\t yaValide=false;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t Date date1 = formatter.parse(lasmod);\n\t\t\t\t\t\t\t\t Date date2 = formatter.parse(oneObject.getString(\"vigencia\").toString());\n\t\t\t\t\t\t\t\t int comparison = date2.compareTo(date1);\n\t\t\t\t\t\t\t\t if((comparison==1||comparison==0)&&!oneObject.getString(\"resultado\").toString().equals(\"RECHAZO\")){\n\t\t\t\t\t\t\t\t\t autoBean.setDescripcion_verificacion(getResources().getString(R.string.tiene_verificaciones)+\" \"+oneObject.getString(\"resultado\").toString());\n\t\t\t\t\t\t\t\t\t autoBean.setImagen_verificacion(imagen_verde); \n\t\t\t\t\t\t\t\t\t hasVerificacion=true;\n\t\t\t\t\t\t\t\t\t break;\n\t\t\t\t\t\t\t\t }else{\n\t\t\t\t\t\t\t\t\t autoBean.setDescripcion_verificacion(getResources().getString(R.string.no_tiene_verificaciones));\n\t\t\t\t\t\t\t\t\t autoBean.setImagen_verificacion(imagen_rojo);\n\t\t\t\t\t\t\t\t\t hasVerificacion=false;\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\n\t\t\t\t\t\t\t } catch (JSONException e) { \n\t\t\t\t\t\t\t\t DatosLogBean.setDescripcion(Utils.getStackTrace(e));\n\t\t\t\t\t\t\t } catch (ParseException e) {\n\t\t\t\t\t\t\t\t DatosLogBean.setDescripcion(Utils.getStackTrace(e));\n\t\t\t\t\t\t\t}\n\t\t\t\t }\n\t\t\t\t if(!hasVerificacion){\n\t\t\t\t \t PUNTOS_APP-=PUNTOS_VERIFICACION;\n\t\t\t\t }\n\t\t\t \n\t\t\t}catch(JSONException e){\n\t\t\t\tDatosLogBean.setDescripcion(Utils.getStackTrace(e));\n\t\t\t}\n\t\t\n\t}", "@GET\n @Produces(MediaType.TEXT_PLAIN)\n public String getIt() {\n return \"Got it!\";\n }", "@RequestMapping(value = \"/oeuvres/{id}\",\n method = RequestMethod.GET,\n produces = MediaType.APPLICATION_JSON_VALUE)\n @Timed\n public ResponseEntity<Oeuvre> getOeuvre(@PathVariable Long id) {\n log.debug(\"REST request to get Oeuvre : {}\", id);\n Oeuvre oeuvre = oeuvreRepository.findOne(id);\n return Optional.ofNullable(oeuvre)\n .map(result -> new ResponseEntity<>(\n result,\n HttpStatus.OK))\n .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));\n }", "Reserva Obtener();", "protected void processRequest(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n response.setContentType(\"application/json;charset=UTF-8\");\n try (PrintWriter out = response.getWriter()) {\n //defino una propiedad accion para que responda a una url determinada\n String accion = request.getServletPath().substring(request.getServletPath().lastIndexOf(\"/\")+1);\n //llamo al controlador\n AnimalController anic = new AnimalController();\n RespuestaServlet respuesta =new RespuestaServlet();\n switch (accion){\n case \"animal\":\n //armo lista\n List<AnimalVO> listadoAnimal = anic.consultar();\n //envio respuesta\n respuesta.setCodigo(1);\n respuesta.setMensage(\"Consulta Animal\");\n respuesta.setDatos(listadoAnimal);\n //armo un json para enviarlo a la vista\n Gson gsonConAnimal=new Gson();\n String jsonAnimal =gsonConAnimal.toJson(respuesta);\n out.println(jsonAnimal);\n\n \n break;\n case \"jaula\":\n break;\n case \"empelado\":\n break;\n case \"cliente\":\n break;\n case \"taquilla\":\n break;\n default:\n throw new AssertionError();\n }\n \n }catch(ZologicoException error){\n error.printStackTrace();\n RespuestaServlet respuesta =new RespuestaServlet();\n respuesta.setCodigo(500);\n respuesta.setMensage(\"error en actividad del servlet comuniquece con el administrador\");\n respuesta.setDatos(null);\n //armo un json para enviarlo a la vista\n Gson gson=new Gson();\n String json =gson.toJson(respuesta);\n PrintWriter out;\n out = response.getWriter();\n out.println(json);\n }\n }", "@Override\n\tprotected String toJSON()\n\t{\n\t\treturn getJSON(null);\n\t}" ]
[ "0.692742", "0.681112", "0.6636768", "0.6567738", "0.6537581", "0.6408511", "0.63295925", "0.63295925", "0.63295925", "0.6313578", "0.6312587", "0.62614155", "0.6240915", "0.62336177", "0.6227993", "0.6149919", "0.61307544", "0.61292624", "0.61229306", "0.60866046", "0.6084523", "0.605326", "0.60249156", "0.60063475", "0.59791803", "0.59737027", "0.59701735", "0.59444046", "0.5927802", "0.59272337", "0.59141004", "0.5903324", "0.5901778", "0.59003735", "0.58947355", "0.5893862", "0.58819205", "0.5872683", "0.58635974", "0.58469", "0.5816783", "0.5792928", "0.5784215", "0.5772703", "0.57700145", "0.57700145", "0.57700145", "0.57541287", "0.57092905", "0.5700848", "0.568542", "0.56837136", "0.5683471", "0.5656993", "0.5655151", "0.56420106", "0.5630677", "0.562999", "0.56248415", "0.5624578", "0.56190133", "0.5616215", "0.561249", "0.5611389", "0.5605176", "0.5600024", "0.5599496", "0.5593582", "0.55935305", "0.55900306", "0.55744344", "0.5573181", "0.55718863", "0.55687845", "0.5564766", "0.5563692", "0.55594206", "0.5553862", "0.555348", "0.5552469", "0.5549978", "0.55451775", "0.5540451", "0.55392355", "0.5536438", "0.55299675", "0.5523265", "0.55179405", "0.55139816", "0.5512171", "0.55110157", "0.5508638", "0.550824", "0.5508017", "0.5507481", "0.5501578", "0.5495065", "0.54900974", "0.54881114", "0.5488094" ]
0.61510026
15
Este metodo vai verificar se a divisao tem mais que um Inimigo
public Inimigo retornaInimigo(String divisaoaux, JSONArray jsonInimigos){ for (Object inimigos:jsonInimigos) { String nome = ((JSONObject) inimigos).get("nome").toString(); Integer poder = Integer.parseInt(((JSONObject)inimigos).get("poder").toString()); String divisao = ((JSONObject) inimigos).get("divisao").toString(); if(divisaoaux.equals(divisao)){ // verificar se existe algum inimigo repetido for (Object inimigosVerificacao:jsonInimigos) { String nomeVerificacao = ((JSONObject) inimigosVerificacao).get("nome").toString(); Integer poderVerificacao = Integer.parseInt(((JSONObject)inimigosVerificacao).get("poder").toString()); String divisaoVerificacao = ((JSONObject) inimigosVerificacao).get("divisao").toString(); if(divisao.equals(divisaoVerificacao) && !nome.equals(nomeVerificacao)){ poder = poder+poderVerificacao; } } Inimigo temp = new Inimigo(nome,(double)poder,divisao); return temp; } } return null; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void handleIndivisible() {\n\t\n}", "public boolean verificarMinerosComodin() {\r\n int oro = 0;\r\n int plata = 0;\r\n int bronce = 0;\r\n int comodin = 0;\r\n\r\n for (int i = 0; i < listadeMineros.size(); i++) {\r\n if (\"ORO\".equals(listadeMineros.get(i).getEspecialidadDelMinero())) {\r\n oro++;\r\n }\r\n if (\"PLATA\".equals(listadeMineros.get(i).getEspecialidadDelMinero())) {\r\n plata++;\r\n }\r\n if (\"BRONCE\".equals(listadeMineros.get(i).getEspecialidadDelMinero())) {\r\n bronce++;\r\n }\r\n if (\"COMODIN\".equals(listadeMineros.get(i).getEspecialidadDelMinero())) {\r\n comodin++;\r\n }\r\n }\r\n if (!listadeMineros.isEmpty()) {\r\n if ((((comodin + 1) / (oro + plata + bronce)) * 100) <= 10) {\r\n return true;\r\n }\r\n if ((((comodin + 1) / (oro + plata + bronce)) * 100) > 10) {\r\n return false;\r\n }\r\n }\r\n\r\n return false;\r\n }", "public void enfoncerDiv() {\n\t\ttry {\n\t\t\tthis.op = new Div();\n\t\t\tif (!raz) {\n\t\t\t\tthis.pile.push(valC);\n\t\t\t}\n\t\t\tint a = this.pile.pop(); int b = this.pile.pop();\n\t\t\tthis.valC = this.op.eval(b,a);\n\t\t\tthis.pile.push(this.valC);\n\t\t\tthis.raz = true;\n\t\t}\n\t\tcatch (ArithmeticException e) {\n\t\t\tSystem.out.println(\"Erreur : Division par zero !\");\n\t\t}\n\t\tcatch (EmptyStackException e) {\n\t\t\tSystem.out.println(\"Erreur de syntaxe : Saisir deux operandes avant de saisir un operateur\");\n\t\t}\n\t}", "public void ex() {\n int inches = 86; \n int pie = 12; //1 pie = 12 inches \n //Operaciones para obtener la cantidad de pies e inches\n int cant = inches / pie; \n int res = inches % pie;\n //Muestra de resultados\n System.out.println(inches + \" pulgadas es equivalente a\\n \" + \n cant + \" pies \\n \" + res + \" pulgadas \");\n }", "private int pasarMilisegundoASegundo( long milisegundos )\n {\n return (int)(milisegundos/MILISEGUNDOS_EN_SEGUNDO);\n }", "public void dividirDineroGobierno() {\n\n double dineroDividible = super.getMundo().getGobierno().getCapitalEconomico() / 2;\n double dineroPorPersona = super.getMundo().contarPersonas();\n\n if (dineroDividible > 0) {\n\n super.getMundo().gobiernoDarDinero(dineroDividible);\n\n for (Persona p : super.getMundo().getListaDoctores())\n p.ganarDinero(dineroPorPersona);\n for (Persona p : super.getMundo().getListaCocineros())\n p.ganarDinero(dineroPorPersona);\n for (Persona p : super.getMundo().getListaAlbaniles())\n p.ganarDinero(dineroPorPersona);\n for (Persona p : super.getMundo().getListaHerreros())\n p.ganarDinero(dineroPorPersona);\n for (Persona p : super.getMundo().getListaCocineros())\n p.ganarDinero(dineroPorPersona);\n for (Persona p : super.getMundo().getListaDoctores())\n p.ganarDinero(dineroPorPersona);\n for (Persona p : super.getMundo().getListaCocineros())\n p.ganarDinero(dineroPorPersona);\n for (Persona p : super.getMundo().getListaAlbaniles())\n p.ganarDinero(dineroPorPersona);\n for (Persona p : super.getMundo().getListaHerreros())\n p.ganarDinero(dineroPorPersona);\n for (Persona p : super.getMundo().getListaCocineros())\n p.ganarDinero(dineroPorPersona);\n }\n }", "@Test\n\tvoid calcularSalarioConMasCuarentaHorasPagoPositivoTest() {\n\t\tEmpleadoPorComision empleadoPorComision = new EmpleadoPorComision(\"Eiichiro oda\", \"p33\", 400000, 500000);\n\t\tdouble salarioEsperado = 425000;\n\t\tdouble salarioEmpleadoPorComision = empleadoPorComision.calcularSalario();\n\t\tassertEquals(salarioEsperado, salarioEmpleadoPorComision);\n\n\t}", "private String[] guardaDivisoes() throws EmptyExcpetion{\n\n String[] salasSemInimigo = new String[this.divisoes.size()];\n int contador=0;\n\n\n for(int i=0;i<this.getDivisoes().size();i++){\n\n String divisao = this.getDivisoes().iteratorBFS(i).next();\n\n if(verificaSeEInimigo(divisao)==false){\n salasSemInimigo[contador]=divisao;\n contador++;\n }\n }\n\n return salasSemInimigo;\n }", "public void testIsIndivisibleElement() throws Exception {\n assertTrue(cfg.isIndivisibleElement(\"test\"));\n assertTrue(cfg.isIndivisibleElement(\"d1\"));\n assertTrue(cfg.isIndivisibleElement(\"ind1\"));\n assertTrue(cfg.isIndivisibleElement(\"ind2\"));\n\n cfg.associateStylisticAndAntiElements(\"anti-test\", \"test\",\n permittedChildren);\n cfg.addDivisibleElementsThatPermitStyles(new String[] {\"d1\"});\n cfg.addIndivisibleElementsThatPermitStyles(new String[] {\"ind1\", \"ind2\"});\n\n assertTrue(cfg.isIndivisibleElement(\"ind1\"));\n assertTrue(cfg.isIndivisibleElement(\"ind2\"));\n assertTrue(cfg.isIndivisibleElement(\"not-in-any-set\"));\n assertTrue(cfg.isIndivisibleElement(\"child\"));\n assertTrue(cfg.isIndivisibleElement(\"TEST\"));\n assertTrue(cfg.isIndivisibleElement(\"D1\"));\n\n assertFalse(cfg.isIndivisibleElement(\"test\"));\n assertFalse(cfg.isIndivisibleElement(\"d1\"));\n assertFalse(cfg.isIndivisibleElement(\"anti-test\"));\n }", "public int calcularIMC(){\r\n\t\t//Calculamos el peso de la persona\r\n\t\tdouble pesoActual=peso/(Math.pow(altura, 2));\r\n\t\t//Segun el peso, devuelve un codigo\r\n\t\tif (pesoActual>=18.75 && pesoActual<=24.9){\r\n\t\t\treturn NORMAL;\r\n\t\t}else if(pesoActual<18.75){\r\n \t\t\treturn DELGADO;\r\n \t\t}else{\r\n \t\t\treturn SOBREPESO;\r\n \t\t}\r\n \t}", "public static int contarDivisores(int n){\n int contDivisores=0;\n for(int i=1;i<=n;i++){\n if(n%i==0){contDivisores++;}\n }\n return contDivisores;\n }", "@Override\r\n\tpublic int div() {\n\t\treturn 0;\r\n\t}", "int getFluidAmount(ICastingContainer inv);", "private boolean procesoComer(int a, int b)\n {\n ArrayList<Integer> muertes;\n muertes = animales.get(a).get(b).come();\n if (muertes.get(0) > krill) {\n krill = 0;\n return false;\n } else {\n krill -= muertes.get(0);\n }\n for (int i = 1; i < muertes.size(); i++) {\n for (int j = 0; j < muertes.get(i); j++) {\n if (animales.get(i).size() > 0) {\n animales.get(i).get(0).destruir(); //Reduce en 1 la cantidad\n animales.get(i).remove(0);\n } else {\n return false;\n }\n }\n }\n return true;\n }", "public abstract void isDIVRejection(long ms);", "public int dividir(int a, int b) throws ExececaoCalculo{\n \n if(b==0){\n //ExececaoCalculo é uma class que esta nesse pacote atual\n throw new ExececaoCalculo(a, b);\n }\n return a/b;\n }", "public int notaMedia() {\n\t\tint media = 0;\n\t\t//sumatoria\n\t\tfor (Integer integer : notas) {\n\t\t\tmedia += integer.intValue();\n\t\t}\n\t\t//division\n //control divison por 0\n if(notas.size() != 0){\n\t\tmedia /= notas.size();\n }\n\t\treturn media;\n\t}", "public int cantHijosIzquierdos() {\n if (NodoBinario.esNodoVacio(this.raiz)) {\n return 0;\n }\n int cantHijosIzq = 0;\n Queue<NodoBinario<T>> colaDeNodos = new LinkedList<>();\n colaDeNodos.offer(this.raiz);\n while (!colaDeNodos.isEmpty()) {\n NodoBinario<T> nodoActual = colaDeNodos.poll();\n if (!nodoActual.esHijoIzquiedoVacio()) {\n colaDeNodos.offer(nodoActual.getHijoIzquierdo());\n cantHijosIzq++;\n }\n if (!nodoActual.esHijoDerechoVacio()) {\n colaDeNodos.offer(nodoActual.getHijoDerecho());\n }\n }\n return cantHijosIzq;\n }", "public void CobrarImpuestosReducidos(){\n\t\tif(sueldoBruto>=BASE_MINIMA_IMPUESTOS && sueldoBruto<IMPUESTO_SUP){\n\t\t\tsueldoNeto=sueldoBruto-(sueldoBruto*PAGA_IMPUESTOS_MIN);\n\t\t\ttipoImpuesto=\"Ha pagado el 20% de impuestos\";\n\t\t}\n\t}", "@Before\n\tpublic void iniciaDisciplinaConvencional() {\n\t\tList<String> pos = new ArrayList<String>();\n\t\tList<String> pos1 = new ArrayList<String>();\n\t\tpos1.add(\"Disciplina 3\");\n\t\tpos1.add(\"Disciplina 4\");\n\t\tpos1.add(\"Disciplina 5\");\n\n\t\tminitElimBai_1 = new MinitestesEliminandoBaixa(\"Disciplina 1\", 5, pos,\n\t\t\t\t1);\n\t\tminitElimBai_2 = new MinitestesEliminandoBaixa(\"Disciplina 2\", 10,\n\t\t\t\tpos1, 2);\n\t}", "@Test(expected = ArithmeticException.class)\r\n\tpublic void testDivPorCero() {\r\n\t\tSystem.out.println(\" Ejecutando Test: testDivPorCero()\");\r\n\t\tint result = calc.div(5, 0);\r\n\t}", "private boolean propriedadesIguais( Integer pro1, Integer pro2 ){\r\n\t if ( pro2 != null ){\r\n\t\t if ( !pro2.equals( pro1 ) ){\r\n\t\t\t return false;\r\n\t\t }\r\n\t } else if ( pro1 != null ){\r\n\t\t return false;\r\n\t }\r\n\t \r\n\t // Se chegou ate aqui quer dizer que as propriedades sao iguais\r\n\t return true;\r\n\t}", "private void moverJogadorAPosicao(int jogador, int valorDados, boolean iguais) {\n int tentativasDeSairDaPrisao = this.listaJogadores.get(jogadorAtual()).getTentativasSairDaPrisao();\n //Analisando se o cara esta preso, se a prisao ta ativada e se o cara tentou um numero de vezes menos que tres\n //ou se a funcao prisao esta falsa\n //ou se o jogador nao esta preso\n if ((JogadorEstaPreso(this.listaJogadores.get(jogadorAtual()).getNome()) && iguais && this.prisao == true && tentativasDeSairDaPrisao <= 2) || this.prisao == false || (!JogadorEstaPreso(this.listaJogadores.get(jogadorAtual()).getNome()) && this.prisao == true)) {\n if (JogadorEstaPreso(this.listaJogadores.get(jogadorAtual()).getNome()) && iguais && this.prisao == true && tentativasDeSairDaPrisao < 2);\n {\n this.sairdaPrisao(this.listaJogadores.get(jogadorAtual()));\n this.listaJogadores.get(jogadorAtual()).setTentativasSairDaPrisao(0);\n }\n this.posicoes[jogador] = (this.posicoes[jogador] + valorDados);\n if (posicoes[jogador] > 40) {\n posicoes[jogador] = posicoes[jogador] - 40;\n }\n }\n\n //analisando se o jogador esta preso e lanca numeros diferentes nos dados\n if (JogadorEstaPreso(this.listaJogadores.get(jogadorAtual()).getNome()) && !iguais && this.prisao == true) {\n //analisa se estourou as tentativas\n //se estourou\n if (this.listaJogadores.get(jogadorAtual()).getTentativasSairDaPrisao() == 2) {\n this.sairdaPrisao(this.listaJogadores.get(jogadorAtual()));\n this.listaJogadores.get(jogadorAtual()).retirarDinheiro(50);\n this.listaJogadores.get(jogadorAtual()).setTentativasSairDaPrisao(0);\n this.posicoes[jogador] = (this.posicoes[jogador] + valorDados);\n if (posicoes[jogador] > 40) {\n posicoes[jogador] = posicoes[jogador] - 40;\n }\n\n } //se nao estourou\n else if (this.listaJogadores.get(jogadorAtual()).getTentativasSairDaPrisao() < 2) {\n this.listaJogadores.get(jogadorAtual()).addTentativasSairDaPrisao();\n }\n\n\n }\n\n\n }", "@Test\n\tpublic void testaAdicionaNota() throws Exception {\n\t\tminitElimBai_1.adicionaNota(0.0);\n\t\ttry {\n\t\t\tminitElimBai_1.adicionaNota(-1.0);\n\t\t\tAssert.fail(\"Deveria ter retornado excessao.\");\n\t\t} catch (Exception e) {\n\t\t\tAssert.assertEquals(\"Erro no adicionaNota()\", \"Nota invalida.\",\n\t\t\t\t\te.getMessage());\n\t\t}\n\t\ttry {\n\t\t\tminitElimBai_1.adicionaNota(11.0);\n\t\t\tAssert.fail(\"Deveria ter retornado excessao.\");\n\t\t} catch (Exception e) {\n\t\t\tAssert.assertEquals(\"Erro no adicionaNota()\", \"Nota invalida.\",\n\t\t\t\t\te.getMessage());\n\t\t}\n\n\t\tminitElimBai_2.adicionaNota(1.0);\n\t\tminitElimBai_2.adicionaNota(2.0);\n\t\tminitElimBai_2.adicionaNota(3.0);\n\t\tminitElimBai_2.adicionaNota(4.0);\n\t\tminitElimBai_2.adicionaNota(5.0);\n\t\tminitElimBai_2.adicionaNota(6.0);\n\t\tminitElimBai_2.adicionaNota(7.0);\n\t\tminitElimBai_2.adicionaNota(8.0);\n\t\tminitElimBai_2.adicionaNota(9.0);\n\t\tminitElimBai_2.adicionaNota(10.0);\n\t\ttry {\n\t\t\tminitElimBai_2.adicionaNota(10.0);\n\t\t\tAssert.fail(\"Deveria ter retornado excessao.\");\n\t\t} catch (Exception e) {\n\t\t\tAssert.assertEquals(\"Erro em adicionaNota()\",\n\t\t\t\t\t\"Quantidade de provas atingida.\", e.getMessage());\n\t\t}\n\n\t}", "public void aumentarMinas(){\n\r\n if(espM==false){\r\n minascerca++;\r\n }\r\n }", "@ZenCodeType.Operator(ZenCodeType.OperatorType.DIV)\n default IData div(IData other) {\n \n return notSupportedOperator(OperatorType.DIV);\n }", "public static void NumeroAmigo(){\n\t\tint a;\n\t\tint b;\n\t\tString tomar;\n\t\tint resultado;\n\t\tScanner reader= new Scanner(System.in);\n\t\tSystem.out.println(\"Ingrese dos numeros\");\n\t\ta=reader.nextInt();\n\t\tb=reader.nextInt();\n\t\tif(a>=0 && b>=0){\n\t\t\tresultado=RepetidorFor(a);\n\t\t\t\tif(resultado==b){\n\t\t\t\tresultado=RepetidorFor(b);\n\t\t\t\tif(resultado==a){\n\t\t\t\t\tSystem.out.println(\"Son numeros amigos\");\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tSystem.out.println(\"No son numeros amigos\");\n\t\t\t}\n\t\t}else{\n\t\t\tSystem.out.println(\"Ingrese numeros positivos\");\n\t\t}\n\t\tSystem.out.println(\"Desea regresar al menu anterior?\");\n\t\treader.nextLine();\n\t\ttomar=reader.nextLine();\n\t\tif(tomar.equals(\"si\")){\n\t\t\trepetidor=true;\n\t\t}else{\n\t\t\trepetidor=false;\n\t\t}\n\t}", "public void testIsDivisibleStyleElement() throws Exception {\n assertFalse(cfg.isDivisibleStyleElement(\"child\"));\n cfg.addDivisibleElementsThatPermitStyles(new String[] {\"child\", null});\n assertFalse(cfg.isDivisibleStyleElement(\"test\"));\n assertFalse(cfg.isDivisibleStyleElement(\"stylistic\"));\n assertTrue(cfg.isDivisibleStyleElement(\"child\"));\n assertTrue(cfg.isDivisibleStyleElement(null));\n }", "public void hallarPerimetroIsosceles() {\r\n this.perimetro = 2*(this.ladoA+this.ladoB);\r\n }", "private boolean isPosicaoFerrovia(int posicao) {\n return (posicao == 5 || posicao == 15 || posicao == 25 || posicao == 35);\n }", "public static int cantNodosHojas(Nodo raiz)\r\n {\r\n if(raiz == null)\r\n {\r\n return 0;\r\n }\r\n else if(raiz.ramaDerecha == null && raiz.ramaIzquierda == null)\r\n {\r\n return 1;\r\n }\r\n else\r\n {\r\n return (cantNodosHojas(raiz.subArbolIzquierdo())) + (cantNodosHojas(raiz.subArbolDerecho()));\r\n }\r\n }", "private boolean isPosicaoEstatal(int posicao) {\n\n boolean estatal = false;\n if (posicao == 12 || posicao == 28) {\n return true;\n } else {\n return false;\n }\n }", "boolean ePrimo(int n) {\n \n if (n < 2) {\n return false;\n }\n \n \n // Guarda o numero de divisores de n. Inicialmente eh 1. Todos os numeros\n // sao divisiveis por 1\n \n int numeroDeDivisores = 1;\n \n // O primeiro candidato a divisor nao trivial eh 2.\n \n int candidatoADivisor = 2;\n \n // Testa a divisao por todos os numeros menores ou iguais a n/2 ou ate \n // encontrar o primeiro divisor.\n \n while((candidatoADivisor <= Math.sqrt(n)) && (numeroDeDivisores == 1)) {\n if (n % candidatoADivisor == 0) {\n // o resto da divisao eh zero. Logo, candidatoADivisor eh um divisor de n. \n // Por isso, que o numero de divisores eh incrementado em 1.\n numeroDeDivisores = numeroDeDivisores + 1;\n }\n candidatoADivisor = candidatoADivisor + 1;\n }\n \n if (numeroDeDivisores == 1) {\n return true;\n }\n else {\n return false;\n }\n }", "public int AmbosHijos() { //Hecho por mi\n if (this.esArbolVacio()) {\n return 0; //Arbol vacio\n }\n int ambos = 0;\n Queue<NodoBinario<T>> colaDeNodos = new LinkedList<>();\n colaDeNodos.offer(raiz);\n while (!colaDeNodos.isEmpty()) {\n NodoBinario<T> nodoActual = colaDeNodos.poll();\n if (!NodoBinario.esNodoVacio(nodoActual.getHijoIzquierdo())\n && !NodoBinario.esNodoVacio(nodoActual.getHijoDerecho())) {\n ambos++;\n }\n if (!nodoActual.esHijoIzquiedoVacio()) {\n colaDeNodos.offer(nodoActual.getHijoIzquierdo());\n }\n if (!nodoActual.esHijoDerechoVacio()) {\n colaDeNodos.offer(nodoActual.getHijoDerecho());\n }\n }\n return ambos;\n }", "private static int multAndDivFixer(int size){\n return size;\n }", "private static boolean isDivisibeby3or5(int a){\n\t\treturn a%3 == 0 || a%5 == 0;\n\t}", "private boolean esPrimo(int pNumero)\r\n\t{\r\n\t\tboolean esPrimo = true;\r\n\t\tfor(int i=2; i<=pNumero/2 && esPrimo;i++)\r\n\t\t{\r\n\t\t\tif(pNumero%i == 0)\r\n\t\t\t{\r\n\t\t\t\tesPrimo = false;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn esPrimo;\r\n\t}", "public static String div(String bytes,int size, int value) throws MultDivException {\n if(value<=1||size<1||size>bytes.length()||(!Cript2010x8b.USEDIVMULT)) return bytes; \n value=Math.abs(value);\n\n size=Operations.multAndDivFixer(size);\n \n String out=\"\"; \n int max=bytes.length()/size; \n if(bytes.length()%size!=0) \n max++; \n for(int i=0;i<max;i++){ \n String subStr=\"\"; \n for(int l=0;l<size;l++) \n try{ \n subStr+=bytes.charAt(i*size+(size-l-1)); \n }catch(Exception e){ \n String bug=bytes.substring(i*size); \n bug=addLong(bug,1,value); \n return out+bug; \n } \n BigInteger current=strToBInt(subStr); \n int n=0;int MAX=151;\n while(n<MAX&&current.mod(BigInteger.valueOf(value)).compareTo(BigInteger.ZERO)!=0){ \n current=current.add(BigInteger.valueOf(2).pow(8*size)); n++;\n } \n if(n>=MAX){\n throw new MultDivException(\"Erro while(true) Via:Div\");\n }\n current=current.divide(BigInteger.valueOf(value)); \n while(current.compareTo(BigInteger.valueOf(2).pow(8*size))>0)current=current.add(BigInteger.valueOf(2).pow(8*size).negate()); \n while(current.compareTo(BigInteger.ZERO)<0)current=current.add(BigInteger.valueOf(2).pow(8*size)); \n \n out+=BintToStr(current,size); \n } \n return out; \n }", "static void diviser() throws IOException {\n\t Scanner clavier = new Scanner(System.in);\n\tdouble nb1, nb2, resultat;\n\tnb1 = lireNombreEntier();\n\tnb2 = lireNombreEntier();\n\tif (nb2 != 0) {\n\tresultat = nb1 / nb2;\n\tSystem.out.println(\"\\n\\t\" + nb1 + \" / \" + nb2 + \" = \" +\n\tresultat);\n\t} else\n\tSystem.out.println(\"\\n\\t le nombre 2 est nul, devision par 0 est impossible \");\n\t}", "@Test\n public void testGetLimite() {\n \n assertEquals(50.0, soin1.getLimite(),0.01);\n assertEquals(80.0, soin2.getLimite(),0.01);\n }", "public boolean isConfermabile() {\n boolean confermabile = false;\n Date d1, d2;\n\n try { // prova ad eseguire il codice\n confermabile = super.isConfermabile();\n\n /* controllo che le date siano in sequenza */\n if (confermabile) {\n d1 = this.getDataInizio();\n d2 = this.getDataFine();\n confermabile = Lib.Data.isSequenza(d1, d2);\n }// fine del blocco if\n\n /* controllo che almeno una riga sia selezionata */\n if (confermabile) {\n confermabile = getPanServizi().getRigheSelezionate().size() > 0;\n }// fine del blocco if\n\n } catch (Exception unErrore) { // intercetta l'errore\n Errore.crea(unErrore);\n }// fine del blocco try-catch\n\n /* valore di ritorno */\n return confermabile;\n\n }", "@Override\r\n\tpublic int queryByCont(QueryUser query) {\n\t\tint cont=dao.queryCont(query);\r\n\t\tif(cont%contests.PAGECONT==0) {\r\n\t\t\treturn cont/contests.PAGECONT;\r\n\t\t}else {\r\n\t\t\treturn cont/contests.PAGECONT+1;\r\n\t\t}\r\n\t\t\r\n\t}", "public int numeroHojas(){\n\t int N=0, ni=0, nd=0;\n\t Arbol <T> aux=null;\n\t if (!vacio()) {\n\t if ((aux=getHijoIzq())!=null) ni = aux.numeroHojas();\n\t if ((aux=getHijoDer())!=null) nd = aux.numeroHojas();\n\t if ((aux=getHijoDer())==null && (aux=getHijoIzq())==null)N = 1;\n\t else N = ni + nd;\n\t }\n\t\treturn N;\n\t}", "public static void classificarImc(double peso, double altura) {\n\t\tdouble imc = peso / (altura * altura); \n\t\t\n\t\tif (imc < 20.0) {\n\t\t\tSystem.out.println(\"abaixo do peso\");\n\t\t}\n\t\telse if (imc < 25.0) {\n\t\t\tSystem.out.println(\"peso normal\");\n\t\t}\n\t\telse if (imc < 30.0) {\n\t\t\tSystem.out.println(\"sobrepeso\");\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(\"obeso\");\n\t\t}\n\t}", "private void compruebaMinas(boolean add, int i, int j) {\n\tif (add) {\n\t contadorInterrogaciones++;\n\t if (arrayBotones[i][j].getMina() == 1) {\n\t\tcontadorMinas++;\n\t }\n\t} else {\n\t contadorInterrogaciones--;\n\t if (arrayBotones[i][j].getMina() == 1) {\n\t\tcontadorMinas--;\n\t }\n\t}\n\tif ((contadorMinas == numMinas) && (contadorInterrogaciones == numMinas)) {\n\t this.setVisible(false);\n\t ventanaReset.setVisible(true);\n\t labelGanador.setVisible(true);\n\t}\n }", "@Test\n\tpublic void testPileVide() throws LimiteException{\n\t\tassertEquals(m.getPile().empty(),true);\n\t}", "@Override\n public long minutosOcupados(Integer idEstacion, Date inicio, Date fin) {\n long minutos = 0;\n String sql = \"SELECT eje FROM Recurso rec, Ejecucion eje WHERE rec.idestacion = :idEstacion AND eje.idrecurso = rec.idrecurso AND eje.fechafin >= :inicio AND eje.fechainicio < :fin\";\n List<Ejecucion> ejecuciones = getCurrentSession().createQuery(sql).setParameter(\"idEstacion\", idEstacion).setParameter(\"inicio\", inicio).setParameter(\"fin\", fin).list();\n for (Ejecucion next : ejecuciones) {\n Date inicioEjecucion = next.getFechainicio();\n Date finEjecucion = next.getFechafin();\n if (inicioEjecucion.before(inicio) && finEjecucion.before(fin)) {\n //Comienza en inicio y finaliza en el fin de la ejecucion\n minutos = minutos + Math.abs(finEjecucion.getTime() - inicio.getTime())/60000;\n \n } else if (inicioEjecucion.after(inicio) && finEjecucion.before(fin)) {\n //Comienza en inicio de la ejecucion y finaliza en el fin de la ejecucion\n minutos = minutos + Math.abs(fin.getTime() - inicioEjecucion.getTime())/60000;\n \n }else if (inicioEjecucion.after(inicio) && finEjecucion.after(fin)){\n //Comienza en inicio de la ejecucion y finaliza en el fin\n minutos = minutos + Math.abs(fin.getTime() - inicioEjecucion.getTime())/60000;\n \n } else if (inicioEjecucion.before(inicio) && finEjecucion.after(fin)) {\n //Comienza en inicio y finaliza en el fin\n minutos = minutos + Math.abs(fin.getTime() - inicio.getTime())/60000;\n }\n }\n return minutos;\n }", "public void aumentaInSitu(){\n if(quantidade_in_situ<quantidade_disponivel)\n quantidade_in_situ++;\n else\n return;\n }", "private void detectExcessSize() {\n final String overflow = getElement().getStyle().getProperty(\n \"overflow\");\n getElement().getStyle().setProperty(\"overflow\", \"hidden\");\n if (BrowserInfo.get().isIE()\n && getElement().getPropertyInt(\"clientWidth\") == 0) {\n // can't detect possibly themed border/padding width in some\n // situations (with some layout configurations), use empty div\n // to measure width properly\n DivElement div = Document.get().createDivElement();\n div.setInnerHTML(\"&nbsp;\");\n div.getStyle().setProperty(\"overflow\", \"hidden\");\n div.getStyle().setProperty(\"height\", \"1px\");\n getElement().appendChild(div);\n excessWidth = getElement().getOffsetWidth()\n - div.getOffsetWidth();\n getElement().removeChild(div);\n } else {\n excessWidth = getElement().getOffsetWidth()\n - getElement().getPropertyInt(\"clientWidth\");\n }\n excessHeight = getElement().getOffsetHeight()\n - getElement().getPropertyInt(\"clientHeight\");\n \n getElement().getStyle().setProperty(\"overflow\", overflow);\n }", "public static void DeterminarArregloDeMisiles() {\n\t\tVectorDeMisilesCrucerosPorNivel[3] = true;\n\t\tVectorDeMisilesCrucerosPorNivel[4] = true;\n\t\tVectorDeMisilesCrucerosPorNivel[7] = true;\n\t\tVectorDeMisilesCrucerosPorNivel[8] = true;\n\t\tVectorDeMisilesCrucerosPorNivel[11] = true;\n\t\tVectorDeMisilesCrucerosPorNivel[12] = true;\n\t\tVectorDeMisilesCrucerosPorNivel[15] = true;\n\t\tVectorDeMisilesCrucerosPorNivel[16] = true;\n\t}", "public static void verificarPagamento(Cliente cliente){\n if(cliente.getModoDePagamento() == \"dinheiro\" || \n cliente.getModoDePagamento() == \"Dinheiro\" || \n cliente.getModoDePagamento() == \"cheque\" || \n cliente.getModoDePagamento() == \"Cheque\" || \n cliente.getModoDePagamento() == \"cartão\" || \n cliente.getModoDePagamento() == \"Cartão\") System.out.println(\"Pagamento aceito! O pedido está pago.\");\n else System.out.println(\"O pagamento não foi aceito!\");\n }", "public static boolean isDivisibleBy(int j, int i) {\n\t\tif (j%i==0) { //use mod to achieve no remainder--meaning completely divisible\r\n\t\treturn true;\t//return true\r\n\t\t} else {\r\n\t\treturn false;\t//return false\r\n\t\t}\r\n\t}", "@Override\n public void subida(){\n // si es mayor a la eperiencia maxima sube de lo contrario no\n if (experiencia>(100*nivel)){\n System.out.println(\"Acabas de subir de nivel\");\n nivel++;\n System.out.println(\"Nievel: \"+nivel);\n }else {\n\n }\n }", "private void calculadorNotaFinal() {\n\t\t//calculo notaFinal, media de las notas medias\n\t\tif(this.getAsignaturas() != null) {\n\t\t\t\tfor (Iterator<Asignatura> iterator = this.asignaturas.iterator(); iterator.hasNext();) {\n\t\t\t\t\tAsignatura asignatura = (Asignatura) iterator.next();\n\t\t\t\t\tif(asignatura.getNotas() != null) {\n\t\t\t\t\tnotaFinal += asignatura.notaMedia();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t//curarse en salud con division entre 0\n\t\t\t\tif(this.getAsignaturas().size() != 0) {\n\t\t\t\tnotaFinal /= this.getAsignaturas().size();\n\t\t\t\t}\n\t\t}\n\t}", "@Test\n public void testDivisao() {\n System.out.println(\"divisao\");\n float num1 = 0;\n float num2 = 0;\n float expResult = 0;\n float result = Calculadora_teste.divisao(num1, num2);\n assertEquals(expResult, result, 0);\n }", "public static void main(String[] args) {\n\t\tScanner src=new Scanner(System.in);\n\t\tint n1, n2, suma=0, i;\n\t\t\n\t\tSystem.out.println(\"Introduce el primer numero:\");\n\t\tn1=src.nextInt();\n\t\tSystem.out.println(\"Introduce el segundo numero\");\n\t\tn2=src.nextInt();\n\t\t\n\t\tfor(i=1;i<n1;i++) {\n\t\t\tif(n1%i==0) { // Si el resto es igual a 0 entre en el if\n\t\t\t\tsuma=suma+i; // a suma le aņade el divisor\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tif(suma==n2) { //Comprueba si la suma de divisores es igual al segundo numero introducido\n\t\t\tsuma=0; //Iguala suma a 0\n\t\t\tfor(i=1;i<n2;i++) { \n\t\t\t\tif(n2%i==0) { //si el resto de el segundo numero es 0 entra en el if\n\t\t\t\t\tsuma=suma+i; // Le aņade divisor a suma\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tif(suma==n1) {\n\t\t\t\tSystem.out.println(\"Son amigos\"); //Compara si suma es iguala 1\n\t\t\t}else {\n\t\t\t\tSystem.out.println(\"No son amigos\");\n\t\t\t}\n\t\t\t\n\t\t}\n\t\telse {\n\t\t\tSystem.out.println(\"No son amigos\");\n\t\t}\n\t\t\n\t\tsrc.close();\n\t\t\t\n\t\t\n\n\t}", "public List<Integer> codificarDigitoASieteSegmentos(int numero) {\n\n\t\tList<Integer> segList = new ArrayList<>();\n\n\t\tswitch (numero) {\n\t\tcase 1:\n\t\t\tsegList.add(3);\n\t\t\tsegList.add(4);\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tsegList.add(5);\n\t\t\tsegList.add(3);\n\t\t\tsegList.add(6);\n\t\t\tsegList.add(2);\n\t\t\tsegList.add(7);\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\tsegList.add(5);\n\t\t\tsegList.add(3);\n\t\t\tsegList.add(6);\n\t\t\tsegList.add(4);\n\t\t\tsegList.add(7);\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tsegList.add(1);\n\t\t\tsegList.add(6);\n\t\t\tsegList.add(3);\n\t\t\tsegList.add(4);\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tsegList.add(5);\n\t\t\tsegList.add(1);\n\t\t\tsegList.add(6);\n\t\t\tsegList.add(4);\n\t\t\tsegList.add(7);\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tsegList.add(5);\n\t\t\tsegList.add(1);\n\t\t\tsegList.add(6);\n\t\t\tsegList.add(2);\n\t\t\tsegList.add(7);\n\t\t\tsegList.add(4);\n\t\t\tbreak;\n\t\tcase 7:\n\t\t\tsegList.add(5);\n\t\t\tsegList.add(3);\n\t\t\tsegList.add(4);\n\t\t\tbreak;\n\t\tcase 8:\n\t\t\tsegList.add(1);\n\t\t\tsegList.add(2);\n\t\t\tsegList.add(3);\n\t\t\tsegList.add(4);\n\t\t\tsegList.add(5);\n\t\t\tsegList.add(6);\n\t\t\tsegList.add(7);\n\t\t\tbreak;\n\t\tcase 9:\n\t\t\tsegList.add(1);\n\t\t\tsegList.add(3);\n\t\t\tsegList.add(4);\n\t\t\tsegList.add(5);\n\t\t\tsegList.add(6);\n\t\t\tsegList.add(7);\n\t\t\tbreak;\n\t\tcase 0:\n\t\t\tsegList.add(1);\n\t\t\tsegList.add(2);\n\t\t\tsegList.add(3);\n\t\t\tsegList.add(4);\n\t\t\tsegList.add(5);\n\t\t\tsegList.add(7);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\n\t\treturn segList;\n\t}", "public static void Promedio(){\n int ISumaNotas=0;\n int IFila=0,ICol=0;\n int INota;\n float FltPromedio;\n for(IFila=0;IFila<10;IFila++)\n {\n ISumaNotas+=Integer.parseInt(StrNotas[IFila][1]);\n }\n FltPromedio=ISumaNotas/10;\n System.out.println(\"El promedio de la clase es:\"+FltPromedio);\n }", "public interface Inteiros extends Numeros\n{\n}", "@Test\n\tvoid calcularSalarioSinVentasPagoPositivoTest() {\n\t\tEmpleadoPorComision empleadoPorComision = new EmpleadoPorComision(\"Hiromu Arakawa\", \"p24\", 400000, 0);\n\t\tdouble salarioEsperado = 400000;\n\t\tdouble salarioEmpleadoPorComision = empleadoPorComision.calcularSalario();\n\t\tassertEquals(salarioEsperado, salarioEmpleadoPorComision);\n\n\t}", "public void testAddIndivisibleElementsThatPermitStyles() throws Exception {\n String[] elements = { \"a\", \"b\", \"c\" };\n cfg.addIndivisibleElementsThatPermitStyles(elements);\n\n String[] moreElements = { \"c\", \"d\" };\n cfg.addIndivisibleElementsThatPermitStyles(moreElements);\n\n Set set = (Set)PrivateAccessor.getField(\n cfg, \"indivisibleElementsThatPermitStyles\");\n assertEquals(\"Should have added and merged all elements:\",\n 6, set.size());\n\n for (int i = 0; i < elements.length; i++) {\n assertTrue(\"Should be in list: \", set.contains(elements[i]));\n }\n for (int i = 0; i < moreElements.length; i++) {\n assertTrue(\"Should be in list: \", set.contains(moreElements[i]));\n }\n }", "@Override\npublic void div(int a, int b) {\n\t\n}", "public static Interval division(Interval in1, Interval in2){\r\n if(in2.getSecondExtreme()==0.0||in2.getFirstExtreme()==0.0){\r\n System.out.println(\"División por cero!\");\r\n System.exit(1);\r\n return new Interval();\r\n }else{\r\n return new Interval(in1.getFirstExtreme()/in2.getSecondExtreme(),in1.getSecondExtreme()/in2.getFirstExtreme(),in1.getFEincluded()=='['&&in2.getSEincluded()==']'?in1.getFEincluded():'(',in1.getSEincluded()==']'&&in2.getFEincluded()=='['?in1.getSEincluded():')');\r\n }\r\n }", "public static int FValidaDimensao(int minimo, int maximo) {\n\t\tint n;\n\t\tdo {\n\t\t\tSystem.out.print( \"\\nDigite a Dimensao entre \"+ minimo+ \" e \"+maximo+ \": \");\n\t\t\tn = teclado1.nextInt();\n\t\t} while(n<minimo || n>maximo);\n\t\treturn n;\n\t}", "public int cantHijosIzquierdosR() {\n return this.cantHijosIzquierdosR(this.raiz);\n }", "IVec3 div(IVec3 v);", "public int esquinas(){\n int v=0;\n if (fila==0 && columna==0){\n if(automata.getElemento(fila,columna+1)!=null && automata.getElemento(fila,columna+1).isVivo()){v++;}\n if(automata.getElemento(fila+1,columna+1)!=null && automata.getElemento(fila+1,columna+1).isVivo()){v++;}\n if(automata.getElemento(fila+1,columna)!=null && automata.getElemento(fila+1,columna).isVivo()){v++;}\n }\n else if(fila==0 && columna==15){\n if(automata.getElemento(fila,columna-1)!=null && automata.getElemento(fila,columna-1).isVivo()){v++;}\n if(automata.getElemento(fila+1,columna-1)!=null && automata.getElemento(fila+1,columna-1).isVivo()){v++;}\n if(automata.getElemento(fila+1,columna)!=null && automata.getElemento(fila+1,columna).isVivo()){v++;}\n }\n else if(fila==15 && columna==0){\n if(automata.getElemento(fila-1,columna)!=null && automata.getElemento(fila-1,columna).isVivo()){v++;}\n if(automata.getElemento(fila-1,columna+1)!=null && automata.getElemento(fila-1,columna+1).isVivo()){v++;}\n if(automata.getElemento(fila,columna+1)!=null && automata.getElemento(fila,columna+1).isVivo()){v++;}\n }\n else if(fila==15 && columna==15){\n if(automata.getElemento(fila-1,columna)!=null && automata.getElemento(fila-1,columna).isVivo()){v++;}\n if(automata.getElemento(fila-1,columna-1)!=null && automata.getElemento(fila-1,columna-1).isVivo()){v++;}\n if(automata.getElemento(fila,columna-1)!=null && automata.getElemento(fila,columna-1).isVivo()){v++;}\n }\n return v;\n }", "public int puntoUno() {\n int contador = 0;\n for (int i = 0; i < jugadores.length; i++) {\n if (jugadores[i] != null && jugadores[i].getCantPartidosJugados() > 10) {\n contador++;\n }\n }\n return contador;\n }", "private static void estadisticaClase() {\n int numeroAlumnos;\n int aprobados = 0, suspensos = 0; // definición e instanciación de varias a la vez\n int suficentes = 0, bienes = 0, notables = 0, sobresalientes = 0;\n float totalNotas = 0;\n float media;\n Scanner in = new Scanner(System.in);\n\n // Salismos del bucle sólo si nos introduce un número positivo\n do {\n System.out.println(\"Introduzca el número de alumnos/as: \");\n numeroAlumnos = in.nextInt();\n } while (numeroAlumnos <= 0);\n\n // Como sabemos el número de alumnos es un bucle definido\n for (int i = 1; i <= numeroAlumnos; i++) {\n float nota = 0;\n\n // nota solo existe dentro de este for, por eso la definimos aquí.\n do {\n System.out.println(\"Nota del alumno \" + i + \" [0-10]: \");\n nota = in.nextFloat();\n } while (nota < 0 || nota > 10);\n\n // Sumamos el total de notas\n totalNotas += nota;\n\n if (nota < 5) {\n suspensos++;\n } else if (nota >= 5 && nota < 6) {\n aprobados++;\n suficentes++;\n } else if (nota >= 6 && nota < 7) {\n aprobados++;\n bienes++;\n } else if (nota >= 7 && nota < 9) {\n aprobados++;\n notables++;\n } else if (nota >= 9) {\n aprobados++;\n sobresalientes++;\n }\n }\n // De esta manera redondeo a dos decimales. Tengo que hacer un casting porque de Double quiero float\n // Si no debería trabajar con double siempre.\n media = (float) (Math.round((totalNotas / numeroAlumnos) * 100.0) / 100.0);\n\n // Sacamos las estadísticas\n System.out.println(\"Número de alumnos/as: \" + numeroAlumnos);\n System.out.println(\"Número de aprobados/as: \" + aprobados);\n System.out.println(\"Número de suspensos: \" + suspensos);\n System.out.println(\"Nota media: \" + media);\n System.out.println(\"Nº Suficientes: \" + suficentes);\n System.out.println(\"Nº Bienes: \" + bienes);\n System.out.println(\"Nº Notables: \" + notables);\n System.out.println(\"Nº Sobresalientes: \" + sobresalientes);\n\n\n }", "public boolean verificaNumero() {\n if (contemSomenteNumeros(jTextFieldDeposita.getText()) || contemSomenteNumeros(jTextFieldSaca.getText())\n || contemSomenteNumeros(jTextFieldTransfere.getText())) {\n return true;\n } else {\n JOptionPane.showMessageDialog(this, \"Digite somente números, por favor. \", \"Atenção !!\", JOptionPane.ERROR_MESSAGE);\n return false;\n }\n }", "@Override\n public long minutosLibres(Integer idEstacion, Date inicio, Date fin) {\n long minutos = Math.abs(fin.getTime() - inicio.getTime())/60000;\n List<Ejecucion> ejecuciones = null;\n String sql = \"SELECT eje FROM Recurso rec, Ejecucion eje WHERE rec.estacion.idestaciones = :idEstacion AND eje.recurso.idrecurso = rec.idrecurso AND eje.fechafin >= :inicio AND eje.fechainicio < :fin\";\n ejecuciones = getCurrentSession().createQuery(sql).setParameter(\"idEstacion\", idEstacion).setParameter(\"inicio\", inicio).setParameter(\"fin\", fin).list();\n \n if (ejecuciones != null) {\n for (Ejecucion next : ejecuciones) {\n Date inicioEjecucion = next.getFechainicio();\n Date finEjecucion = next.getFechafin();\n if (inicioEjecucion.before(inicio) && finEjecucion.before(fin)) {\n //Comienza en inicio y finaliza en el fin de la ejecucion\n minutos = minutos - Math.abs(finEjecucion.getTime() - inicio.getTime())/60000;\n\n } else if (inicioEjecucion.after(inicio) && finEjecucion.before(fin)) {\n //Comienza en inicio de la ejecucion y finaliza en el fin de la ejecucion\n minutos = minutos - Math.abs(fin.getTime() - inicioEjecucion.getTime())/60000;\n\n }else if (inicioEjecucion.after(inicio) && finEjecucion.after(fin)){\n //Comienza en inicio de la ejecucion y finaliza en el fin\n minutos = minutos - Math.abs(fin.getTime() - inicioEjecucion.getTime())/60000;\n\n } else if (inicioEjecucion.before(inicio) && finEjecucion.after(fin)) {\n //Comienza en inicio y finaliza en el fin\n minutos = minutos - Math.abs(fin.getTime() - inicio.getTime())/60000;\n }\n /*if (inicioEjecucion.before(inicio) && finEjecucion.before(fin)) {\n //Comienza en inicio y finaliza en el fin de la ejecucion\n minutos = minutos + (fin.getTime() - inicio.getTime())/60000;\n\n } else if (inicioEjecucion.after(inicio) && finEjecucion.before(fin)) {\n //Comienza en inicio de la ejecucion y finaliza en el fin de la ejecucion\n minutos = minutos + ((fin.getTime() - inicio.getTime()) + (inicioEjecucion.getTime() - inicio.getTime()))/60000;\n\n }else if (inicioEjecucion.after(inicio) && finEjecucion.after(fin)){\n //Comienza en inicio de la ejecucion y finaliza en el fin\n minutos = minutos + Math.abs(inicioEjecucion.getTime() - inicio.getTime())/60000;\n\n }*/\n }\n }\n return minutos;\n }", "private int contabilizaHorasNoLectivas(ArrayList<FichajeRecuentoBean> listaFichajesRecuento, ProfesorBean profesor, boolean guardar, int mes) {\r\n int segundos=0;\r\n for (FichajeRecuentoBean fichajeRecuento : listaFichajesRecuento) {\r\n// System.out.println(fichajeRecuento.getFecha()+\" \"+fichajeRecuento.getHoraEntrada()+\"->\"+fichajeRecuento.getHoraSalida()+\" => \"+UtilsContabilizar.dimeDuracion(fichajeRecuento.getHoraEntrada(),fichajeRecuento.getHoraSalida()));\r\n segundos+=UtilsContabilizar.dimeDuracion(fichajeRecuento.getHoraEntrada(),fichajeRecuento.getHoraSalida());\r\n \r\n DetalleInformeBean detalleInforme=new DetalleInformeBean();\r\n detalleInforme.setIdProfesor(profesor.getIdProfesor());\r\n detalleInforme.setTotalHoras(UtilsContabilizar.dimeDuracion(fichajeRecuento.getHoraEntrada(),fichajeRecuento.getHoraSalida()));\r\n detalleInforme.setFecha(fichajeRecuento.getFecha());\r\n detalleInforme.setHoraIni(fichajeRecuento.getHoraEntrada());\r\n detalleInforme.setHoraFin(fichajeRecuento.getHoraSalida());\r\n detalleInforme.setTipoHora(\"NL\");\r\n if(guardar && detalleInforme.getTotalHoras()>0)GestionDetallesInformesBD.guardaDetalleInforme(detalleInforme, \"contabilizaHorasNoLectivas\", mes);\r\n \r\n }\r\n return segundos;\r\n }", "@Override\n public int contarHojas(){\n return (super.contarHojas());\n }", "private void jogarIa() {\n\t\tia = new IA(this.mapa,false);\r\n\t\tia.inicio();\r\n\t\tthis.usouIa = true;\r\n\t\tatualizarBandeirasIa();//ATUALIZA AS BANDEIRAS PARA DEPOIS QUE ELA JOGOU\r\n\t\tatualizarNumeroBombas();//ATUALIZA O NUMERO DE BOMBAS PARA DPS QUE ELA JOGOU\r\n\t\tatualizarTela();\r\n\t\tif(ia.isTaTudoBem() == false)\r\n\t\t\tJOptionPane.showMessageDialog(this, \"IMPOSSIVEL PROSSEGUIR\", \"IMPOSSIVEL ENCONTRAR CASAS CONCLUSIVAS\", JOptionPane.INFORMATION_MESSAGE);\r\n\t}", "@Override\n\tpublic double calculaImc() {\n\t\t imc = peso / (altura * altura);\n\t\treturn imc;\n\t}", "public void CobrarImpuestosAmpliado(){\n\t\tif(sueldoBruto>=IMPUESTO_SUP){\n\t\t\tsueldoNeto=sueldoBruto-(sueldoBruto*PAGA_IMPUESTOS_MAX);\n\t\t\ttipoImpuesto=\"Ha pagado el 30% de impuestos\";\n\t\t}\n\t}", "public float liquidarAlquiler(int posicion){\n float valor = -1;\n int i = 0;\n boolean posicionEncontrada = false;\n while(!posicionEncontrada && i<alquileres.size()) {\n if(alquileres.get(i)!=null) {\n if(alquileres.get(i).getPosicion()==posicion) {\n valor = alquileres.get(i).getCosteAlquiler();\n alquileres.remove(i);\n posicionEncontrada = true;\n }\n }\n i++;\n }\n return valor;\n }", "private static int calcularMedia(int[] notas) {\n\t\tint media = 0;\n\n\t\tfor (int i = 0; i < notas.length; i++) {\n\n\t\t\tmedia = media + notas[i];\n\n\t\t}\n\t\treturn media/notas.length;\n\t}", "@Test\n public void testSize_Overflow() {\n SegmentedOasisList<Integer> instance = new SegmentedOasisList<>();\n int expResult = 6;\n\n instance.add(1);\n instance.add(2);\n instance.add(3);\n instance.add(4);\n instance.add(5);\n instance.add(6);\n\n long result = instance.size();\n assertEquals(expResult, result);\n\n }", "public boolean isDivided() {\n\t\treturn divided;\n\t}", "public void NopagaImpuestos(){\n\t\tif(sueldoBruto<BASE_MINIMA_IMPUESTOS){\n\t\tsueldoNeto=sueldoBruto;\n\t\ttipoImpuesto=\"En esta ocasión no paga impuestos\";\n\t\t}\n\t}", "private boolean temMunicao() {\n\t\t\n\t\tif (round<1) {\n\t\t\tsetSemMunicao(true);\n\t\t\treturn false;\n\t\t\t\n\t\t}else \n\t\t\tsetSemMunicao(false);\n\t\t\n\t\t\n\t\treturn true;\n\t}", "public void MOD( ){\n String tipo1 = pilhaVerificacaoTipos.pop().toString();\n String tipo2 = pilhaVerificacaoTipos.pop().toString();\n String val1 = dads.pop().toString();\n float fresult = -1;\n String val2 = dads.pop().toString();\n if(val1 != null && val2 != null){\n if (tipo1 != null && tipo2 != null){\n if(tipo1 == \"inteiro\" && tipo2 == \"real\"){\n if(Float.parseFloat(val2) != 0){\n fresult = Integer.parseInt(val1) % Float.parseFloat(val2);\n dads.push(fresult);\n pilhaVerificacaoTipos.push(\"real\");\n }\n else{\n mensagensErrosVM += \"\\nRUNTIME ERROR(5): impossível realizar a operação. O valor do dividendo deve ser maior que zero\";\n numErrVM += 1;\n }\n }else if(tipo1 == \"real\" && tipo2 ==\"inteiro\"){\n if(Float.parseFloat(val1) != 0){\n fresult = Integer.parseInt(val2) % Float.parseFloat(val1);\n dads.push(fresult);\n pilhaVerificacaoTipos.push(\"real\");\n }\n else{\n mensagensErrosVM += \"\\nRUNTIME ERROR(5): impossível realizar a operação. O valor do dividendo deve ser maior que zero\";\n numErrVM += 1;\n }\n }else if(tipo1 == \"real\" && tipo2 ==\"real\"){\n if(Float.parseFloat(val1) != 0){\n fresult = Float.parseFloat(val2) % Float.parseFloat(val1);\n dads.push(fresult);\n pilhaVerificacaoTipos.push(\"real\");\n }\n else{\n mensagensErrosVM += \"\\nRUNTIME ERROR(5): impossível realizar a operação. O valor do dividendo deve ser maior que zero\";\n numErrVM += 1;\n }\n }else if(tipo1 == \"inteiro\" && tipo2 ==\"inteiro\"){\n if(Integer.parseInt(val1) != 0){\n fresult = Integer.parseInt(val2) % Integer.parseInt(val1);\n dads.push(fresult);\n pilhaVerificacaoTipos.push(\"real\");\n }\n else{\n mensagensErrosVM += \"\\nRUNTIME ERROR(5): impossível realizar a operação. O valor do dividendo deve ser maior que zero\";\n numErrVM += 1;\n return;\n }\n }\n else{\n mensagensErrosVM += \"\\nRUNTIME ERROR(1): essa instrução é válida apenas para valores inteiros ou reais.\";\n numErrVM += 1;\n return;\n }\n }else{\n mensagensErrosVM += \"\\nRUNTIME ERROR(2): não foi possível executar a instrução, tipo null encontrado.\";\n numErrVM += 1;\n return;\n }\n }else {\n mensagensErrosVM += \"\\nRUNTIME ERROR(3): não foi possível executar a instrução, valor null encontrado.\";\n numErrVM += 1;\n return;\n }\n\n\n topo += -1;\n ponteiro += 1;\n }", "@Override\n\tpublic double dividir(double numerador, double denominador) throws ArithmeticException {\n\t\treturn 0;\n\t}", "public static void divisores(int n){\n for(int i=1;i<=n;i++){\n if(n%i==0){System.out.println(i+\" es divisor\");}\n }\n }", "private void calcularOtrosIngresos(Ingreso ingreso)throws Exception{\n\t\tfor(IngresoDetalle ingresoDetalle : ingreso.getListaIngresoDetalle()){\r\n\t\t\tif(ingresoDetalle.getIntPersPersonaGirado().equals(ingreso.getBancoFondo().getIntPersonabancoPk())\r\n\t\t\t&& ingresoDetalle.getBdAjusteDeposito()==null){\r\n\t\t\t\tbdOtrosIngresos = ingresoDetalle.getBdMontoAbono();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private boolean idSaoIguais(Service servico, Service servicoAComparar) {\n return servico.getId() == servicoAComparar.getId();\n }", "public void mutacioni(Individe individi, double probabiliteti) {\n int gjasaPerNdryshim = (int) ((1 / probabiliteti) * Math.random());\r\n if (gjasaPerNdryshim == 1) {\r\n int selectVetura1 = (int) (Math.random() * individi.pikatEVeturave.length);//selekton veturen e pare\r\n int selectPikenKamioni1 = (int) (Math.random() * individi.pikatEVeturave[selectVetura1].size());//selekton piken e vetures tpare\r\n if (pikatEVeturave[selectVetura1].size() == 0) {\r\n return;\r\n }\r\n Point pika1 = individi.pikatEVeturave[selectVetura1].get(selectPikenKamioni1);//pika 1\r\n\r\n int selectVetura2 = (int) (Math.random() * individi.pikatEVeturave.length);//selekton veturen e dyte\r\n int selectPikenKamioni2 = (int) (Math.random() * individi.pikatEVeturave[selectVetura2].size());//selekton piken e vetures tdyte\r\n if (pikatEVeturave[selectVetura2].size() == 0) {\r\n return;\r\n }\r\n Point pika2 = individi.pikatEVeturave[selectVetura2].get(selectPikenKamioni2);//pika 2\r\n\r\n individi.pikatEVeturave[selectVetura2].set(selectPikenKamioni2, pika1);//i ndrron vendet ketyre dy pikave\r\n individi.pikatEVeturave[selectVetura1].set(selectPikenKamioni1, pika2);\r\n }\r\n\r\n }", "public void division(){\n ObjEmp obj1 = this.depile();\n ObjEmp obj2 = this.depile();\n try{\n obj2.division(obj1);\n this.empile(obj2);\n }\n catch(NullPointerException nullPE){\n try{\n writer.write(\"Impossible to divide : either obj1=\"+obj1+\" or obj2=\"+obj2+ \" is null\\n\");\n writer.flush();\n }\n catch(IOException e){\n printStream.println(\"I/O exception!!!\");\n }\n if(obj2 != null)\n this.empile(obj2);\n if(obj1 != null)\n this.empile(obj1);\n }\n catch(ArithmeticException zeroE){\n try{\n writer.write(\"Impossible to divide : obj1=\"+obj1+ \" is 0\\n\");\n writer.flush();\n }\n catch(IOException e){\n printStream.println(\"I/O exception!!!\");\n }\n this.empile(obj2);\n this.empile(obj1);\n }\n }", "boolean EsHemisferioNorte() { return hemisferio_N; }", "private Integer getMines(Integer xOpen, Integer yOpen){\n int counter=0;\r\n // System.out.println(\"getMines() [\"+xOpen+\"][\"+yOpen+\"]\");\r\n for(int i=xOpen-1; i<=(xOpen+1) ; i++){\r\n for(int j=yOpen-1; j<=(yOpen+1) ; j++){\r\n if(isValidCell(i,j) && grid[i][j].isMine()){ //split y && le quite uno\r\n counter++; //solo un operador and \r\n }\r\n }\r\n }\r\n// System.out.println(\" getMines().result = \"+counter);\r\n return counter; //contador de minas, el mismo no puede ser una mina \r\n }", "private boolean checkDivisibility(int year, int num) {\n\t\treturn (year%num==0);\n\t}", "public boolean existeIncendio(float humedad, float temperatura, float nivelHumo, String fuego){\n if(nivelHumo<500 && temperatura > 45 && humedad >30 && fuego.equals(\"Si\")){\n return true;\n }else{\n return false;\n }\n\n }", "public String toString(){ return \"DIV\";}", "private void imprimirProgresso(AtualizacaoUI.Comunicado comunicado){\n\n if(comunicado.obterLimite() != Sintaxe.SEM_REGISTO){\n if(activityUploadBinding.progressBarProgresso.getMax() != comunicado.obterLimite()){\n activityUploadBinding.progressBarProgresso.setMax(comunicado.obterLimite());\n }\n }\n\n activityUploadBinding.txtProgresso.setText(comunicado.obterPosicao() + \"/\" + comunicado.obterLimite());\n activityUploadBinding.txtTituloProgresso.setText(comunicado.obterMensagem());\n activityUploadBinding.progressBarProgresso.setProgress(comunicado.obterPosicao());\n }", "private void cuentaminas() {\n\t//TODO: falta por hacer que calcule lasminas en el borde exterior\n\t//Probar a hacerlo con un try catch\n\tint minas = 0;\n\n\tfor (int i = 0; i < filas; i++) {\n\t for (int j = 0; j < columnas; j++) {\n\t\t//\t1 2 3\n\t\t//\t4 X 5\n\t\t//\t6 7 8\n\t\ttry {\n\t\t minas += arrayBotones[i - 1][j - 1].getMina();//1\n\n\t\t} catch (Exception e) {\n\t\t}\n\t\ttry {\n\t\t minas += arrayBotones[i - 1][j].getMina();//2\n\n\t\t} catch (Exception e) {\n\t\t}\n\t\ttry {\n\t\t minas += arrayBotones[i - 1][j + 1].getMina();//3\n\t\t} catch (Exception e) {\n\t\t}\n\t\ttry {\n\t\t minas += arrayBotones[i][j - 1].getMina();//4\n\n\t\t} catch (Exception e) {\n\t\t}\n\t\ttry {\n\t\t minas += arrayBotones[i][j + 1].getMina();//5\n\t\t} catch (Exception e) {\n\t\t}\n\t\ttry {\n\t\t minas += arrayBotones[i + 1][j - 1].getMina();//6 \t\t \n\t\t} catch (Exception e) {\n\t\t}\n\t\ttry {\n\t\t minas += arrayBotones[i + 1][j].getMina();//7\n\t\t} catch (Exception e) {\n\t\t}\n\t\ttry {\n\t\t minas += arrayBotones[i + 1][j + 1].getMina();//8\n\t\t} catch (Exception e) {\n\t\t}\n\t\tarrayBotones[i][j].setNumeroMinasAlrededor(minas);\n\t\t//TODO: comentar la siguiente parte para que no aparezcan los numeros al iniciar\n//\t\tif (arrayBotones[i][j].getMina() == 0 && minas != 0) {\n//\t\t arrayBotones[i][j].setText(String.valueOf(minas));\n//\t\t}\n\t\tminas = 0;\n\t }\n\t}\n }", "public static void main(String[] args) {\n int digito = 3;\n int numeroDigitos = 0;\n if (digito <= 0) {\n System.out.println(\"Ingrese como parámetro, un numero de digitos correcto (mayor que 0): \");\n }\n for (int i = 1; i <= 99999; i++) {\n int aux = i;\n\n int contador = 0;\n\n numeroDigitos = devolverContador(aux, contador);\n\n if (numeroDigitos == digito) {\n if (i < 4) {\n primo = true;\n } else {\n if (i % 2 == 0) {\n primo = false;\n } else {\n int contador1 = 0;\n int i1 = 1;\n int k = (i - 1) / 2;\n if (k % 2 == 0) {\n k--;\n }\n\n contador1 = primoDivisible(i1, k, i, contador1);\n\n if (contador1 == 1) {\n primo = true;\n }\n }\n }\n\n if (primo == true) {\n System.out.println(i);\n }\n }\n }\n }", "public void ganarDineroPorAutomoviles() {\n for (Persona p : super.getMundo().getListaDoctores()) {\n for (Vehiculo v : p.getVehiculos()) {\n v.puedeGanarInteres();\n v.setPuedeGanarInteres(false);\n }\n }\n for (Persona p : super.getMundo().getListaCocineros()) {\n for (Vehiculo v : p.getVehiculos()) {\n v.puedeGanarInteres();\n v.setPuedeGanarInteres(false);\n }\n }\n for (Persona p : super.getMundo().getListaAlbaniles()) {\n for (Vehiculo v : p.getVehiculos()) {\n v.puedeGanarInteres();\n v.setPuedeGanarInteres(false);\n }\n }\n for (Persona p : super.getMundo().getListaHerreros()) {\n for (Vehiculo v : p.getVehiculos()) {\n v.puedeGanarInteres();\n v.setPuedeGanarInteres(false);\n }\n }\n for (Persona p : super.getMundo().getListaCocineros()) {\n for (Vehiculo v : p.getVehiculos()) {\n v.puedeGanarInteres();\n v.setPuedeGanarInteres(false);\n }\n }\n }", "public boolean erreurStandard1() {\r\n\t\t\t\r\n\t\t\t//Initialisation du booléen, identification des champs à vérifer \r\n\t\t\tboolean verif = false;\r\n\t\t\tWebElement messageErreur = wait.until(ExpectedConditions.presenceOfElementLocated(By.xpath(\"//div[.='Out of range (>= 0).']\")));\r\n\t\t\t\r\n\t\t\t//Vérification\r\n\t\t\tif (messageErreur.isDisplayed()) {\r\n\t\t\t\tverif = true;\r\n\t\t\t}\r\n\t\t\treturn verif;\r\n\t\t}", "Proof notDivides(int n, int m) {\n return introduceNotExists(var(\"z\"), notDivides(n, m, var(\"z\")));\n }" ]
[ "0.58611524", "0.5857423", "0.58037037", "0.5586829", "0.5565371", "0.55213916", "0.548475", "0.5445661", "0.5420599", "0.5376619", "0.5369965", "0.5357316", "0.5328118", "0.53127295", "0.53102493", "0.53019077", "0.52986795", "0.5282357", "0.5280704", "0.52608114", "0.5224116", "0.5209407", "0.51915485", "0.5188061", "0.51861733", "0.5119444", "0.5107361", "0.51036245", "0.5102655", "0.5101052", "0.5099123", "0.5098836", "0.50960785", "0.50746727", "0.5042983", "0.5023312", "0.50189257", "0.5016634", "0.49922302", "0.49921286", "0.49870807", "0.49808216", "0.49725848", "0.49651656", "0.4961433", "0.49606597", "0.4957741", "0.49437585", "0.49358723", "0.49302575", "0.49290562", "0.49162993", "0.4908719", "0.49076042", "0.49024194", "0.49003366", "0.48998868", "0.48942295", "0.48753384", "0.48746005", "0.4874485", "0.4872009", "0.48688027", "0.48684278", "0.48615158", "0.48487318", "0.48418075", "0.4831287", "0.4829952", "0.482426", "0.48218197", "0.48124972", "0.4812006", "0.48096728", "0.48050198", "0.48044398", "0.47928274", "0.47917157", "0.47861794", "0.47795212", "0.47764745", "0.4768953", "0.47679645", "0.47637197", "0.47594687", "0.47537252", "0.4753134", "0.4752716", "0.47486618", "0.47447264", "0.4742951", "0.47347242", "0.47331908", "0.47331056", "0.47330433", "0.47271794", "0.47226632", "0.4715566", "0.4713912", "0.47115692" ]
0.6131221
0
Este metodo vai percorrer todos os vertices do grafo com a travessia em largura comparando quais nao contem inimigo
private String[] guardaDivisoes() throws EmptyExcpetion{ String[] salasSemInimigo = new String[this.divisoes.size()]; int contador=0; for(int i=0;i<this.getDivisoes().size();i++){ String divisao = this.getDivisoes().iteratorBFS(i).next(); if(verificaSeEInimigo(divisao)==false){ salasSemInimigo[contador]=divisao; contador++; } } return salasSemInimigo; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private List<Vertice> pegaVerticesFolha() {\n List<Vertice> verticesFolha = new ArrayList<Vertice>();\n\n for (Vertice vertice : this.pegaTodosOsVerticesDoGrafo()) {\n if (this.getGrauDeSaida(vertice) == 0) {\n verticesFolha.add(vertice);\n }\n }\n\n return verticesFolha;\n }", "public static boolean Util(Graph<V, DefaultEdge> g, ArrayList<V> set, int colors, HashMap<String, Integer> coloring, int i, ArrayList<arc> arcs, Queue<arc> agenda)\n {\n /*if (i == set.size())\n {\n System.out.println(\"reached max size\");\n return true;\n }*/\n if (set.isEmpty())\n {\n System.out.println(\"Set empty\");\n return true;\n }\n //V currentVertex = set.get(i);\n\n /*System.out.println(\"vertices and mrv:\");\n V start = g.vertexSet().stream().filter(V -> V.getID().equals(\"0\")).findAny().orElse(null);\n Iterator<V> iterator = new DepthFirstIterator<>(g, start);\n while (iterator.hasNext()) {\n V v = iterator.next();\n System.out.println(\"vertex \" + v.getID() + \" has mrv of \" + v.mrv);\n }*/\n\n // Find vertex with mrv\n V currentVertex;\n int index = -1;\n int mrv = colors + 10;\n for (int it = 0; it < set.size(); it++)\n {\n if (set.get(it).mrv < mrv)\n {\n mrv = set.get(it).mrv;\n index = it;\n }\n }\n currentVertex = set.remove(index);\n\n //System.out.println(\"Got vertex: \" + currentVertex.getID());\n\n\n // Try to assign that vertex a color\n for (int c = 0; c < colors; c++)\n {\n currentVertex.color = c;\n if (verifyColor(g, currentVertex))\n {\n\n // We can assign color c to vertex v\n // See if AC3 is satisfied\n /*currentVertex.domain.clear();\n currentVertex.domain.add(c);*/\n if (!agenda.isEmpty()) numAgenda++;\n while(!agenda.isEmpty())\n {\n arc temp = agenda.remove();\n\n // Make sure there exists v1, v2, in V1, V2, such that v1 != v2\n V v1 = g.vertexSet().stream().filter(V -> V.getID().equals(temp.x)).findAny().orElse(null);\n V v2 = g.vertexSet().stream().filter(V -> V.getID().equals(temp.y)).findAny().orElse(null);\n\n\n\n // No solution exists in this branch if a domain is empty\n //if ((v1.domain.isEmpty()) || (v2.domain.isEmpty())) return false;\n\n if (v2.color == -1) continue;\n else\n {\n Boolean[] toRemove = new Boolean[colors];\n Boolean domainChanged = false;\n for (Integer it : v1.domain)\n {\n if (it == v2.color)\n {\n toRemove[it] = true;\n }\n }\n for (int j = 0; j < toRemove.length; j++)\n {\n if ((toRemove[j] != null))\n {\n v1.domain.remove(j);\n domainChanged = true;\n }\n }\n // Need to check constraints with v1 on the right hand side\n if (domainChanged)\n {\n for (arc it : arcs)\n {\n // Add arc back to agenda to check constraints again\n if (it.y.equals(v1.getID()))\n {\n agenda.add(it);\n }\n }\n }\n }\n if ((v1.domain.isEmpty()) || (v2.domain.isEmpty()))\n {\n System.out.println(\"returning gfalse here\");\n return false;\n }\n }\n\n // Reset agenda to check arc consistency on next iteration\n for (int j = 0; j < arcs.size(); j++)\n {\n agenda.add(arcs.get(i));\n }\n\n\n //System.out.println(\"Checking if vertex \" + currentVertex.getID() + \" can be assigned color \" + c);\n coloring.put(currentVertex.getID(), c);\n updateMRV(g, currentVertex);\n if (Util(g, set, colors, coloring, i + 1, arcs, agenda))\n {\n\n return true;\n }\n\n //System.out.println(\"Assigning vertex \" + currentVertex.getID() + \" to color \" + currentVertex.color + \" did not work\");\n coloring.remove(currentVertex.getID());\n currentVertex.color = -1;\n }\n }\n return false;\n }", "private static <V> boolean profPrimeroCiclos(Graph<V> pGraph, V pInicio, V vertAnterior, Set<V> pConjunto) {\n pConjunto.put(pInicio);\n List<V> adyacencias = pGraph.getAdjacentNodes(pInicio);\n for (int x = 1; x <= adyacencias.size(); x++) {\n V adyacencia = adyacencias.get(x);\n if (!adyacencia.equals(vertAnterior)) {\n if (!pConjunto.isMember(adyacencia)) {\n return profPrimeroCiclos(pGraph, adyacencia, pInicio, pConjunto);\n } else {\n return false;\n }\n }\n }\n return true;\n }", "public Dijkstra(Grafo<K, Integer> grafo, Vertice<K, Integer> vertOrigem) {\n\t\t\n\t\tthis.vertices = grafo.getVertices();\n\t\tthis.vertOrigem = vertOrigem;\n\t\t\n\t\tint total = vertices.size();\n\t\tboolean visitado[] = new boolean[total];\n\t\tthis.solucao = new Object[total][2]; // [0] = distancia [1] = vertice adjacente\n\t\t\n\t\tfor (int i = 0; i < total; i++) {\n\t\t\tsolucao[i][0] = Integer.MAX_VALUE;\n\t\t}\n\t\t\n\t\tint vIndex = vertices.indexOf(vertOrigem);\n\t\tsolucao[vIndex][0] = 0;\n\t\tsolucao[vIndex][1] = vertOrigem;\n\t\t\n\t\twhile (true) {\n\t\t\t\n\t\t\tint min = Integer.MAX_VALUE;\n\t\t\tVertice<K, Integer> y = null;\n\t\t\t\n\t\t\tfor (int z = 0; z < total; z++) {\n\t\t\t\tif (visitado[z]) continue;\n\t\t\t\tif ((Integer)solucao[z][0] < min) {\n\t\t\t\t\tmin = (Integer)solucao[z][0];\n\t\t\t\t\ty = vertices.get(z);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif (min == Integer.MAX_VALUE) break;\n\t\t\t\n\t\t\tint yIndex = vertices.indexOf(y);\n\t\t\t\n\t\t\tList<Aresta<K, Integer>> arestas = y.getArestas();\n\t\t\tfor (Aresta<K, Integer> a:arestas) {\n\t\t\t\t\n\t\t\t\tVertice<K, Integer> w = a.getVertices()[0];\n\t\t\t\tint wIndex = vertices.indexOf(w);\n\t\t\t\tif (visitado[wIndex]) continue;\n\t\t\t\t\n\t\t\t\tif ((Integer)solucao[yIndex][0] + a.getValor() < (Integer)solucao[wIndex][0]) {\n\t\t\t\t\tsolucao[wIndex][0] = (Integer)solucao[yIndex][0] + a.getValor();\n\t\t\t\t\tsolucao[wIndex][1] = y;\n\t\t }\n\t\t\t}\n\t\t\t\n\t\t\tvisitado[yIndex] = true;\n\t\t\t\n\t\t}\n\t\t\n\t}", "public List<Vertex> newPath() {\r\n\t\tList<Vertex> Pathchange = new ArrayList<Vertex>();\r\n\t\tList<Vertex> tempPath = new ArrayList<Vertex>();\r\n\t\tint BestEval = Integer.MAX_VALUE;\r\n\t\tVertex changeVertexV1 = new Vertex();\r\n\t\tVertex changeVertexV2 = new Vertex();\r\n\r\n\t\tfor (int position = 0; position < this.LastPath.size() - 1; position++) {\r\n\t\t\tfor (int changement = position+1; changement < this.LastPath.size(); changement++) {\r\n\r\n\t\t\t\ttempPath.clear();\r\n\t\t\t\ttempPath = new ArrayList<Vertex>(this.LastPath);\r\n\t\t\t\tif (!(this.TabuListV1.contains(tempPath.get(position)) || this.TabuListV1.contains(tempPath.get(changement)) || this.TabuListV2.contains(tempPath.get(position)) || this.TabuListV2.contains(tempPath.get(changement)))) {\r\n\t\t\t\t\t\r\n\t\t\t\t\tCollections.swap(tempPath, position, changement);\r\n\t\t\t\t\tif (this.fit(tempPath) < BestEval) {\r\n\t\t\t\t\t\tPathchange.clear();\r\n\t\t\t\t\t\tPathchange = new ArrayList<Vertex>(tempPath);\r\n\t\t\t\t\t\tchangeVertexV1 = tempPath.get(position);\r\n\t\t\t\t\t\tchangeVertexV2 = tempPath.get(changement);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif(this.tabuElementType == 0) {\r\n\t\t\tthis.TabuListV1.add(0, changeVertexV1);\r\n\t\t}else if(this.tabuElementType == 1) {\r\n\t\t\tthis.TabuListV2.add(0, changeVertexV2);\r\n\t\t}else {\r\n\t\t\tthis.TabuListV1.add(0, changeVertexV1);\r\n\t\t\tthis.TabuListV2.add(0, changeVertexV2);\r\n\t\t}\r\n\t\t\r\n\t\tif (this.TabuListV1.size() > this.TabuListSize) {\r\n\t\t\tthis.TabuListV1.remove(this.TabuListV1.size() - 1);\r\n\t\t}\r\n\t\tif (this.TabuListV2.size() > this.TabuListSize) {\r\n\t\t\tthis.TabuListV2.remove(this.TabuListV2.size() - 1);\r\n\t\t}\r\n\r\n\t\treturn Pathchange;\r\n\t}", "public static String BFS(Graph grafo, Vertice vertice) {\r\n\t\tArrayList<Integer> busca = new ArrayList<Integer>(); // vertice nivel pai em ordem de descoberta\r\n\t\tArrayList<Vertice> aux1 = new ArrayList<Vertice>(); // fila de nos pais a serem visitados\r\n\t\tArrayList<Vertice> aux2 = new ArrayList<Vertice>(); // fila de nos filhos a serem visitdados\r\n\r\n\t\tint nivel = 0;\r\n\r\n\t\taux1.add(vertice);// adiciona a raiz a aux1 para inicio da iteracao\r\n\t\tvertice.setPai(0);// seta o pai da raiz para zero\r\n\r\n\t\twhile (aux1.size() > 0) {\r\n\t\t\tfor (int i = 0; i < aux1.size(); i++) {\r\n\t\t\t\tif (aux1.get(i).statusVertice() == false) {// verifrifica se o no ja nao foi atingido por outra ramificacao.\r\n\t\t\t\t\tbusca.add(aux1.get(i).getValor());\r\n\t\t\t\t\tbusca.add(nivel);\r\n\t\t\t\t\tbusca.add(aux1.get(i).getPai());\r\n\t\t\t\t\tvertice.alteraStatusVertice(true);\r\n\r\n\t\t\t\t\tfor (int j = 0; i < vertice.getArestas().size(); j++) {\r\n\t\t\t\t\t\tproxVertice(vertice, vertice.getArestas().get(j)).setPai(aux1.get(i).getValor());// associa o no pai\r\n\t\t\t\t\t\taux2.add(proxVertice(vertice, vertice.getArestas().get(j)));// adiciona lista dos proximos nos filhos serem percorridos\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\taux1 = aux2; // todos os nos pai ja foram percoridos, filhos se tornam a lista de nos pai\r\n\t\t\t\t\taux2.clear(); // lista de nos filhos e esvaziada para o proximo ciclo de iteracoes\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tnivel++;\r\n\t\t}\r\n\r\n\t\tresetStatusVertex(grafo);\r\n\r\n\t\treturn criaStringDeSaida(grafo, busca);// formata o resutltado da busca para a string esperada\r\n\t}", "boolean hasIsVertexOf();", "@Test\r\n void add_20_remove_20_add_20() {\r\n //Add 20\r\n for(int i = 0; i < 20; i++) {\r\n graph.addVertex(\"\" +i);\r\n }\r\n vertices = graph.getAllVertices();\r\n //Check all 20 are in graph\r\n for(int i = 0; i < 20; i++) {\r\n if(!vertices.contains(\"\" + i)) {\r\n fail();\r\n }\r\n }\r\n //Remove 20 \r\n for(int i = 0; i < 20; i++) {\r\n graph.removeVertex(\"\" +i);\r\n }\r\n //Check all 20 are not in graph anymore \r\n \r\n for(int i = 0; i < 20; i++) {\r\n if(vertices.contains(\"\" + i)) {\r\n fail();\r\n }\r\n }\r\n //Add 20 again\r\n for(int i = 0; i < 20; i++) {\r\n graph.addVertex(\"\" +i);\r\n }\r\n //Check all 20 are in graph\r\n for(int i = 0; i < 20; i++) {\r\n if(!vertices.contains(\"\" + i)) {\r\n fail();\r\n }\r\n }\r\n }", "void evoluer()\n {\n int taille = grille.length;\n int nbVivantes = 0;\n for(int i=-1; i<2; i++)\n {\n int xx = ((x+i)+taille)%taille; // si x+i=-1, xx=taille-1. si x+i=taille, xx=0\n for(int j=-1; j<2; j++)\n {\n if (i==0 && j==0) continue;\n int yy = ((y+j)+taille)%taille;\n if (grille[xx][yy].vivante) nbVivantes++;\n }\n }\n if (nbVivantes<=1 || nbVivantes>=4) {vientDeChanger = (vivante==true); vivante = false;}\n if (nbVivantes==3) {vientDeChanger = (vivante==false); vivante = true;}\n }", "public static void obtenerInfoColisionEnemigo(Enemigo enemigo, Objeto col,String[] direccion, ArrayList<Objeto> obj_colision) {\n Rectangle[] lados_ente = enemigo.objeto_ente.getRectangle();\n Rectangle[] lados_col = col.getRectangle();\n\n if (col.getTag().compareToIgnoreCase(Objeto.Tag.JUGADOR) == 0) {\n if (lados_ente[0].intersects(lados_col[2])) {\n //\"arriba\";\n obj_colision.add(col);\n direccion[0] = \"jugador_arriba\";\n }\n if (lados_ente[1].intersects(lados_col[3])) {\n //\"derecha\";\n obj_colision.add(col);\n direccion[1] = \"jugador_derecha\";\n\n }\n if (lados_ente[2].intersects(lados_col[0])) {\n //\"abajo\";\n obj_colision.add(col);\n direccion[2] = \"jugador_abajo\";\n }\n if (lados_ente[3].intersects(lados_col[1])) {\n //\"izquierda\";\n obj_colision.add(col);\n direccion[3] = \"jugador_izquierda\";\n }\n }\n\n if (lados_ente[0].intersects(lados_col[0])) {\n //\"arriba\";\n obj_colision.add(col);\n direccion[0] = \"entorno_arriba\";\n }\n if (lados_ente[1].intersects(lados_col[0])) {\n //\"derecha\";\n obj_colision.add(col);\n direccion[1] = \"entorno_derecha\";\n }\n if (lados_ente[2].intersects(lados_col[0])) {\n //\"abajo\";\n obj_colision.add(col);\n direccion[2] = \"entorno_abajo\";\n }\n if (lados_ente[3].intersects(lados_col[0])) {\n //\"izquierda\";\n obj_colision.add(col);\n direccion[3] = \"entorno_izquierda\";\n }\n }", "private Map<Vertice<T>, Integer> caminosMinimoDikstra(Vertice<T> origen) {\n \tMap<Vertice<T>, Integer> distancias = new HashMap<Vertice<T>, Integer>();\n \tfor(Vertice<T> unVertice : this.vertices) {\n \t\tdistancias.put(unVertice, Integer.MAX_VALUE);\n \t}\n \tdistancias.put(origen, 0);\n \t\n \t// guardo visitados y pendientes de visitar\n \tSet<Vertice<T>> visitados = new HashSet<Vertice<T>>();\n \tTreeMap<Integer,Vertice<T>> aVisitar= new TreeMap<Integer,Vertice<T>>();\n\n \taVisitar.put(0,origen);\n \t \n \twhile (!aVisitar.isEmpty()) {\n \t\tEntry<Integer, Vertice<T>> nodo = aVisitar.pollFirstEntry();\n \t\tvisitados.add(nodo.getValue());\n \t\t\n \tint nuevaDistancia = Integer.MIN_VALUE;\n \tList<Vertice<T>> adyacentes = this.getAdyacentes(nodo.getValue());\n \t\n \tfor(Vertice<T> unAdy : adyacentes) {\n if(!visitados.contains(unAdy)) {\n Arista<T> enlace = this.buscarArista(nodo.getValue(), unAdy);\n if(enlace !=null) {\n nuevaDistancia = enlace.getValor().intValue();\n }\n int distanciaHastaAdy = distancias.get(nodo.getValue()).intValue();\n int distanciaAnterior = distancias.get(unAdy).intValue();\n if(distanciaHastaAdy + nuevaDistancia < distanciaAnterior ) {\n distancias.put(unAdy, distanciaHastaAdy + nuevaDistancia);\n aVisitar.put(distanciaHastaAdy + nuevaDistancia,unAdy);\n }\n }\n } \t\t\n \t}\n \tSystem.out.println(\"DISTANCIAS DESDE \"+origen);\n \tSystem.out.println(\"Resultado: \"+distancias);\n \treturn distancias;\n }", "public static <V> Graph<V> getMinimumSpanningTreePrim(Graph<V> graph) {\n V[] array = graph.getValuesAsArray();\n double[][] matriz = graph.getGraphStructureAsMatrix();\n\n double[][] matrizCopia = new double[array.length][array.length]; //Se hace una copia del array. Sino, se modificaria en el grafo original.\n for (int x = 0; x < array.length; x++) {\n for (int y = 0; y < array.length; y++) {\n matrizCopia[x][y] = matriz[x][y];\n }\n }\n\n boolean[] revisados = new boolean[array.length]; // Arreglo de booleanos que marca los valores por donde ya se paso.\n Set<V> conjuntoRevisados = new LinkedListSet<>(); //Conjunto donde se guardan los vertices por donde ya se paso\n Graph<V> nuevo = new AdjacencyMatrix<>(graph.isDirected(), true);\n\n if (array.length > 0) { // Grafo no vacio\n\n revisados[0] = true;\n conjuntoRevisados.put(array[0]);\n nuevo.addNode(array[0]);\n\n double menorArista = 50000;\n V verticeOrigen = null;\n V verticeDestino = null;\n\n while (conjuntoRevisados.size() != array.length) { // mientras hayan vertices sin revisar\n\n Iterator<V> it1 = conjuntoRevisados.iterator(); //Se recorren todos los vertices guardados\n while (it1.hasNext()) {\n\n V aux = it1.next();\n int posArray = buscarPosicion(aux, array);\n for (int x = 0; x < array.length; x++) {\n\n if (matrizCopia[posArray][x] != -1) { //Si existe arista\n //Si los 2 vertices no estan en el arbol, para evitar un ciclo\n if (!(conjuntoRevisados.isMember(aux) && conjuntoRevisados.isMember(array[x]))) {\n if (matrizCopia[posArray][x] < menorArista) {\n menorArista = matrizCopia[posArray][x];\n if (!graph.isDirected()) {\n matrizCopia[x][posArray] = -1;\n }\n verticeOrigen = aux;\n verticeDestino = array[x];\n }\n }\n }\n }\n }\n\n if (verticeOrigen != null) {\n if (!nuevo.contains(verticeDestino)) {\n nuevo.addNode(verticeDestino);\n if (!conjuntoRevisados.isMember(verticeDestino)) {\n conjuntoRevisados.put(verticeDestino);\n }\n revisados[buscarPosicion(verticeDestino, array)] = true;\n }\n nuevo.addEdge(verticeOrigen, verticeDestino, menorArista);\n\n verticeOrigen = null;\n menorArista = 50000;\n } else {\n for (int x = 0; x < array.length; x++) {\n if (revisados[x] == false) {\n conjuntoRevisados.put(array[x]);\n nuevo.addNode(array[x]);\n }\n }\n }\n }\n }\n return nuevo;\n }", "private static void criaListaDeVertices(Graph graph) {\r\n\t\tfor (int i = 0; i < graph.getArestas().size(); i++) {\r\n\t\t\tif (!graph.getArestas().get(i).getV1().statusVertice()) {\r\n\t\t\t\tgraph.getVerticesGraph().add( graph.getArestas().get(i).getV1() );\r\n\t\t\t\tgraph.getArestas().get(i).getV1().alteraStatusVertice(true);\r\n\t\t\t}\r\n\r\n\t\t\tif (!graph.getArestas().get(i).getV2().statusVertice()) {\r\n\t\t\t\tgraph.getVerticesGraph().add( graph.getArestas().get(i).getV2() );\r\n\t\t\t\tgraph.getArestas().get(i).getV2().alteraStatusVertice(true);\r\n\r\n\t\t\t}\r\n\t\t}\r\n\t}", "@Test\n public void getVertexes() {\n\n for (int i = 0; i < 6; i++) {\n\n Vertex temp = new Vertex(i + \"\", \"Location number \" + i);\n assertTrue(temp.equals(testGraph.getVertices ().get(i)));\n\n }\n }", "private void verficarChoques() {\n\t\t\n\t\tfor(int i=0; i<JuegoListener.elementos.size();i++){\n\t\t\t\n\t\t\tElemento e1 = JuegoListener.elementos.get(i);\n\t\t\t\n\t\t\t//guaramos las coordenadas para verificar si choco contra el tablero\n\t\t\tint coord1 = e1.getPosicion().getX();\n\t\t\tint coord2 = e1.getPosicion().getY();\n\t\t\t//Creamos el rectangulo\n\t\t\tRectangle r1 = new Rectangle(e1.getPosicion().getX(),\n\t\t\t\t\t\t\t\t\t\te1.getPosicion().getY(),\n\t\t\t\t\t\t\t\t\t\te1.getTamanio().getAncho(),\n\t\t\t\t\t\t\t\t\t\te1.getTamanio().getAlto());\n\t\t\t\n\t\t\tfor(int j=i+1; j<JuegoListener.elementos.size(); j++){\n\t\t\t\t\n\t\t\t\t//Creamos el rectangulo\n\t\t\t\tElemento e2 = JuegoListener.elementos.get(j);\n\t\t\t\tRectangle r2 = new Rectangle(e2.getPosicion().getX(),\n\t\t\t\t\t\te2.getPosicion().getY(),\n\t\t\t\t\t\te2.getTamanio().getAncho(),\n\t\t\t\t\t\te2.getTamanio().getAlto());\n\t\t\t\tif(r1.intersects(r2)){\n\t\t\t\t\te1.chocarContra(e2);\n\t\t\t\t\te1.chocarContra(e1);\n\t\t\t\t}\n\t\t\t}\n\t\t\t// estaContenidoDentro, hace referencia si no se paso del tope del tablero\n\t\t\t// esta contenidoposito, se fija si las posiciones son positivas \n\t\t\tboolean estaContenidoDentro = ( (coord1 >= this.config.getAnchoTablero()) || (coord2 >= this.config.getAltoTablero()) ); \n\t\t\tboolean estaContenidoPositivo= (coord1<= 0) || (coord2 <= 0 ); \n\t\t\tif(estaContenidoPositivo || estaContenidoDentro){\n\t\t\t\te1.chocarContraPared();\n\t\t\t}\t\t\t\n\t\t}\n\n\n\t}", "public static void obtenerInfoColisionJugador(Jugador jugador, Objeto col,String[] direccion, ArrayList<Objeto> obj_colision) {\n Rectangle[] lados_ente = jugador.objeto_ente.getRectangle();\n Rectangle[] lados_col = col.getRectangle();\n\n \n if (col.getTag().compareToIgnoreCase(Objeto.Tag.COMIDA) == 0 || col.getTag().compareToIgnoreCase(Objeto.Tag.MONEDA) == 0) {\n //System.out.println(\"COMIDA\");\n for(int i=0;i<4;i++)\n if (lados_ente[i].intersects(lados_col[0])) {\n obj_colision.add(col);\n return;\n }\n }\n\n \n \n if (col.getTag().compareToIgnoreCase(Objeto.Tag.ENEMIGO) == 0) {\n\n //System.out.println(lados_ente[0].x + \" con \" + lados_col[0].x + \" tag: \" + col.getId());\n if (lados_ente[0].intersects(lados_col[2])) {\n //\"arriba\";\n obj_colision.add(col);\n direccion[0] = \"enemigo_arriba\";\n }\n //else\n // System.out.println(lados_ente[0].y + \" con \" + lados_col[2].y + \" tag: \" + col.getId());\n if (lados_ente[1].intersects(lados_col[3])) {\n //\"derecha\";\n obj_colision.add(col);\n direccion[1] = \"enemigo_derecha\";\n\n }\n if (lados_ente[2].intersects(lados_col[0])) {\n //\"abajo\";\n obj_colision.add(col);\n direccion[2] = \"enemigo_abajo\";\n }\n if (lados_ente[3].intersects(lados_col[1])) {\n //\"izquierda\";\n obj_colision.add(col);\n direccion[3] = \"enemigo_izquierda\";\n }\n\n }\n \n if (col.getTag().compareToIgnoreCase(Objeto.Tag.NPC) == 0) {\n\n //System.out.println(lados_ente[0].x + \" con \" + lados_col[0].x + \" tag: \" + col.getId());\n if (lados_ente[0].intersects(lados_col[0])) {\n //\"arriba\";\n obj_colision.add(col);\n direccion[0] = \"npc_arriba\";\n }\n //else\n // System.out.println(lados_ente[0].y + \" con \" + lados_col[2].y + \" tag: \" + col.getId());\n if (lados_ente[1].intersects(lados_col[0])) {\n //\"derecha\";\n obj_colision.add(col);\n direccion[1] = \"npc_derecha\";\n\n }\n if (lados_ente[2].intersects(lados_col[0])) {\n //\"abajo\";\n obj_colision.add(col);\n direccion[2] = \"npc_abajo\";\n }\n if (lados_ente[3].intersects(lados_col[0])) {\n //\"izquierda\";\n obj_colision.add(col);\n direccion[3] = \"npc_izquierda\";\n }\n\n }\n\n if (lados_ente[0].intersects(lados_col[0])) {\n //\"arriba\";\n obj_colision.add(col);\n direccion[0] = \"entorno_arriba\";\n }\n if (lados_ente[1].intersects(lados_col[0])) {\n //\"derecha\";\n obj_colision.add(col);\n direccion[1] = \"entorno_derecha\";\n }\n if (lados_ente[2].intersects(lados_col[0])) {\n //\"abajo\";\n obj_colision.add(col);\n direccion[2] = \"entorno_abajo\";\n }\n if (lados_ente[3].intersects(lados_col[0])) {\n //\"izquierda\";\n obj_colision.add(col);\n direccion[3] = \"entorno_izquierda\";\n }\n }", "public static <V> void printAllShortestPaths(Graph<V> graph) {\n double[][] matrizPesos = graph.getGraphStructureAsMatrix();\n double[][] pesos = new double[matrizPesos.length][matrizPesos.length];\n V[] vertices = graph.getValuesAsArray();\n V[][] caminos = (V[][]) new Object[matrizPesos.length][matrizPesos.length];\n for (int x = 0; x < matrizPesos.length; x++) {\n for (int y = 0; y < matrizPesos.length; y++) {\n if (x == y) {\n pesos[x][y] = -1;\n } else {\n if (matrizPesos[x][y] == -1) {\n pesos[x][y] = Integer.MAX_VALUE; //Si no existe arista se pone infinito\n } else {\n pesos[x][y] = matrizPesos[x][y];\n }\n }\n caminos[x][y] = vertices[y];\n }\n }\n for (int x = 0; x < vertices.length; x++) { // Para cada uno de los vertices del grafo\n for (int y = 0; y < vertices.length; y++) { // Recorre la fila correspondiente al vertice\n for (int z = 0; z < vertices.length; z++) { //Recorre la columna correspondiente al vertice\n if (y != x && z != x) {\n double tam2 = pesos[y][x];\n double tam1 = pesos[x][z];\n if (pesos[x][z] != -1 && pesos[y][x] != -1) {\n double suma = pesos[x][z] + pesos[y][x];\n if (suma < pesos[y][z]) {\n pesos[y][z] = suma;\n caminos[y][z] = vertices[x];\n }\n }\n }\n }\n }\n }\n\n //Cuando se termina el algoritmo, se imprimen los caminos\n for (int x = 0; x < vertices.length; x++) {\n for (int y = 0; y < vertices.length; y++) {\n boolean seguir = true;\n int it1 = y;\n String hilera = \"\";\n while (seguir) {\n if (it1 != y) {\n hilera = vertices[it1] + \"-\" + hilera;\n } else {\n hilera += vertices[it1];\n }\n if (caminos[x][it1] != vertices[it1]) {\n int m = 0;\n boolean continuar = true;\n while (continuar) {\n if (vertices[m].equals(caminos[x][it1])) {\n it1 = m;\n continuar = false;\n } else {\n m++;\n }\n }\n } else {\n if (x == y) {\n System.out.println(\"El camino entre \" + vertices[x] + \" y \" + vertices[y] + \" es: \" + hilera);\n } else {\n hilera = vertices[x] + \"-\" + hilera;\n if (pesos[x][y] == Integer.MAX_VALUE) {\n System.out.println(\"El camino mas corto entre \" + vertices[x] + \" y \" + vertices[y] + \" es: infinito (no hay camino)\");\n } else {\n System.out.println(\"El camino mas corto entre \" + vertices[x] + \" y \" + vertices[y] + \" es: \" + hilera + \" con distancia de: \" + (pesos[x][y]));\n }\n }\n seguir = false;\n }\n }\n }\n System.out.println();\n }\n }", "@Test\n void test04_checkOrder() {\n graph.addVertex(\"a\");\n graph.addVertex(\"b\");\n graph.addVertex(\"c\");\n graph.addVertex(\"d\");\n graph.addVertex(\"e\");\n graph.addVertex(\"f\"); // added 6 items\n if (graph.order() != 6) {\n fail(\"graph has counted incorrect number of vertices\");\n }\n }", "@Test\r\n void test_insert_50_vertex_check() {\r\n String str;\r\n for(int i = 0; i < 50; i++) {\r\n str = \"\" + i;\r\n graph.addVertex(str);\r\n }\r\n vertices = graph.getAllVertices();\r\n for(int j = 0; j < 50; j++) {\r\n str = \"\" + j;\r\n if (!vertices.contains(str))\r\n fail(\"Insert not working!!\");\r\n }\r\n }", "public List<Long> getPath(Long start, Long finish){\n \n \n List<Long> res = new ArrayList<>();\n // auxiliary list\n List<DeixtraObj> serving = new ArrayList<>();\n// nearest vertexes map \n Map<Long,DeixtraObj> optimMap = new HashMap<>();\n// thread save reading \n synchronized (vertexes){ \n // preparation\n for (Map.Entry<Long, Vertex> entry : vertexes.entrySet()) {\n Vertex userVertex = entry.getValue();\n // If it`s start vertex weight = 0 and the nereast vertex is itself \n if(userVertex.getID().equals(start)){\n serving.add(new DeixtraObj(start, 0.0, start));\n }else{\n // For other vertex weight = infinity and the nereast vertex is unknown \n serving.add(new DeixtraObj(userVertex.getID(), Double.MAX_VALUE, null));\n }\n\n } \n // why auxiliary is not empty \n while(serving.size()>0 ){\n // sort auxiliary by weight \n Collections.sort(serving);\n\n \n // remove shortes fom auxiliary and put in to answer \n DeixtraObj minObj = serving.remove(0);\n optimMap.put(minObj.getID(), minObj);\n\n Vertex minVertex = vertexes.get(minObj.getID());\n\n // get all edges from nearest \n for (Map.Entry<Long, Edge> entry : minVertex.allEdges().entrySet()) {\n Long dest = entry.getKey();\n Double wieght = entry.getValue().getWeight();\n // by all remain vertexes \n for(DeixtraObj dx : serving){\n if(dx.getID().equals(dest)){\n // if in checking vertex weight more then nearest vertex weight plus path to cheking \n // then change in checking weight and nearest\n if( (minObj.getWeight()+wieght) < dx.getWeight()){\n dx.setNearest(minVertex.getID());\n dx.setWeight((minObj.getWeight()+wieght));\n }\n }\n }\n }\n\n }\n }\n \n // create output list\n res.add(finish);\n Long point = finish;\n while(!point.equals(start)){\n \n point = ((DeixtraObj)optimMap.get(point)).getNearest();\n res.add(point);\n }\n \n Collections.reverse(res);\n \n \n return res;\n \n }", "public static boolean connected(Graph grafo) {\r\n\t\tint numVertices = grafo.getVertexNumber();\r\n\t\tSet<Vertice> verticesVisitados = new HashSet<Vertice>(); // sem repeticoes\r\n\t\tfor (Aresta aresta : grafo.getArestas()) {\r\n\t\t\tverticesVisitados.add(aresta.getV1());\r\n\t\t\tverticesVisitados.add(aresta.getV2());\r\n\t\t}\r\n\r\n\t\treturn numVertices == verticesVisitados.size();\r\n\t}", "public static void main(String[] args) {\n // write your code here\n initialize();\n\n\n Sort(profile.getProfile());\n Integer[][][] mas = new Integer[11][11][1];\n\n R.add(Q.pollFirst());\n\n for (Integer[] e : Q) {\n if (DiskCover(e, R, Rant)) {\n R.add(e);\n // Rtmp.add(Q.pollFirst());\n }\n }\n\n FindMaxAngle(R, 0);\n\n Rg = R;\n //Rtmp-R add Q\n list_r.add(R);\n int j = 0;\n boolean flag = false;\n while (!Q.isEmpty()) {\n\n\n list_r.add(FindMaxPolygonCover(Rg));\n\n }\n\n MakePolygon(list_r);\n\n boolean work = true;\n\n do {\n R.clear();\n Gr.getEdge().clear();\n // algorithmConnectivity.setMarketVertexFirst();\n for (int i = 0; i < Gr.getVertex().size(); i++) {\n\n AlgorithmConnectivity algorithmConnectivity = new AlgorithmConnectivity();\n algorithmConnectivity.initializated(Gr.getVertex().size());\n algorithmConnectivity.setMarketVertexFirst();\n algorithmConnectivity.setMarketVertexSecond(i);\n while (algorithmConnectivity.findSecond() != 100) {\n //int a= iterator.next();\n int index = algorithmConnectivity.findSecond();\n algorithmConnectivity.setMarketVertexThird(index);\n algorithmConnectivity = MakeConnection(index, algorithmConnectivity);\n }\n R.add(algorithmConnectivity.getMarket());\n }\n if (!checkConnectionGraf(R)) {\n //MakeConnection(Gr);\n ArrayList<Integer[]> result = new ArrayList<Integer[]>();\n ArrayList<Integer> ver = new ArrayList<Integer>();\n ArrayList<ArrayList<Integer>> v = new ArrayList<ArrayList<Integer>>();\n for (Integer[] p : R) {\n ArrayList<Integer> res = new ArrayList<Integer>();\n ver.clear();\n for (int i = 0; i < p.length; i++) {\n if (p[i] != 1) {\n ver.add(Gr.getVertex().get(i));\n }\n }\n if (ver.size() != 1) {\n // result.add(AddNewRoute(ver));\n // v.add(ver);\n result.addAll(AddNewRoute(ver));\n }\n }\n int minumum = 1000;\n Integer[] place = new Integer[3];\n for (int i = 0; i < result.size(); i++) {\n Integer[] ma = result.get(i);\n if (ma[2] == null) {\n System.out.print(\"\");\n }\n if ((minumum > ma[2]) && (ma[2]) != 0) {\n minumum = ma[2];\n place = ma;\n }\n }\n if (minumum == 1000) {\n for (Integer[] p : R) {\n ver.clear();\n for (int i = 0; i < p.length - 1; i++) {\n if (p[i] == 1) {\n ver.add(Gr.getVertex().get(i));\n }\n }\n result.addAll(AddNewRoute(ver));\n // result.add(AddNewRoute(ver));\n for (int i = 0; i < result.size(); i++) {\n Integer[] ma = result.get(i);\n if (ma[2] == null) {\n System.out.print(\"\");\n }\n if ((minumum > ma[2]) && (ma[2]) != 0) {\n minumum = ma[2];\n place = ma;\n }\n }\n AddNewVertex(place);\n }\n } else {\n AddNewVertex(place);\n }\n } else {\n work = false;\n }\n\n } while (work);\n\n MobileProfile prof = new MobileProfile();\n prof.initialization(Gr.getVertex().size());\n int sum = 0;\n int[][][] massive = profile.getProfile();\n for (int i = 0; i < Gr.getVertex().size(); i++) {\n // sum=sum+massive;\n }\n\n\n zcd = new ZCD();\n\n zcd.setGraphR(Gr);\n\n Iterator<Edges> it = Gr.getEdgeses().iterator();\n boolean fla = false;\n while (it.hasNext()) {\n Edges d = it.next();\n LinkedList<Integer[]> graph_edges = g.getSort_index();\n\n for (int i = 0; i < graph_edges.size(); i++) {\n Integer[] mass = graph_edges.get(i);\n if (checkLine(g.getCoordinate().get(mass[0]), g.getCoordinate().get(mass[1]), Gr.getCoordinate().get(d.getX()), Gr.getCoordinate().get(d.getY()))) {\n if (!fla) {\n Integer[] wr = new Integer[3];\n wr[0] = d.getX();\n wr[1] = d.getY();\n wr[2] = mass[2];\n fla = true;\n zcd.addWrEdges(wr);\n }\n }\n }\n if (!fla) {\n\n Integer[] wr = new Integer[3];\n wr[0] = d.getX();\n wr[1] = d.getY();\n wr[2] = 2;\n\n zcd.addWrEdges(wr);\n\n }\n fla = false;\n }\n\n Edges e = null;\n for (int i = 0; i < Gr.getVertex().size(); i++) {\n int sumwr = 0;\n HashSet<Edges> item = Gr.getEdgeses();\n Iterator<Edges> iterator = item.iterator();\n for (int k = 0; k < zcd.getWrEdges().size(); k++) {\n\n e = iterator.next();\n if (e.checkEdge(i)) {\n Integer[] m = zcd.getWrEdges().get(k);\n sumwr = sumwr + m[2];\n\n }\n\n }\n wr.add(sumwr);\n\n }\n\n int max = 0;\n int count = 0;\n for (int i = 0; i < wr.size(); i++) {\n if (max < wr.get(i)) {\n max = wr.get(i);\n count = i;\n }\n }\n Integer[] a = new Integer[2];\n a[0] = count;\n a[1] = max;\n zcd.setRoot_vertex(a);\n\n\n int number_vertex = 5;\n //ZTC ztc = new ZTC();\n neig = new int[Gr.getVertex().size()][Gr.getVertex().size()];\n for (int i = 0; i < Gr.getVertex().size(); i++) {\n HashSet<Edges> item = Gr.getEdgeses();\n Iterator<Edges> iterator = item.iterator();\n while (iterator.hasNext()) {\n e = iterator.next();\n if (e.checkEdge(i)) {\n\n neig[i][e.getY()] = 1;\n }\n }\n }\n ztc.setNeigboor(neig);\n ztc.addTVertex(a[0]);\n Integer[] zero = new Integer[3];\n zero[0] = a[0];\n zero[1] = 0;\n zero[2] = 0;\n verLmtest.add(zero);\n vertex_be = new boolean[Gr.getVertex().size()];\n int root_number = 5;\n while (ztc.getTvertex().size() != Gr.getVertex().size()) {\n\n LinkedList<Edges> q = new LinkedList<Edges>();\n\n\n count_tree++;\n\n\n LinkedList<Integer> vertext_t = new LinkedList<Integer>(ztc.getTvertex());\n while (vertext_t.size() != 0) {\n // for(int i=0; i<count_tree;i++){\n\n number_vertex = vertext_t.pollFirst();\n weight_edges.clear();\n if (!vertex_be[number_vertex]) {\n vertex_be[number_vertex] = true;\n } else {\n continue;\n }\n\n // if(i<vertext_t.size())\n\n\n HashSet<Edges> item = Gr.getEdgeses();\n Iterator<Edges> iterator = item.iterator();\n // while (iterator.hasNext()) {\n for (int k = 0; k < item.size(); k++) {\n e = iterator.next();\n\n if (e.checkEdge(number_vertex)) {\n\n weight_edges.add(zcd.getWrEdges().get(k));\n q.add(e);\n }\n\n if (q.size() > 1)\n q = sort(weight_edges, q);\n\n\n while (!q.isEmpty()) {\n e = q.pollFirst();\n Integer[] lm = new Integer[3];\n\n\n lm[0] = e.getY();\n lm[1] = 1;\n lm[2] = 0;\n boolean add_flag = true;\n for (int i = 0; i < verLmtest.size(); i++) {\n Integer[] mess = verLmtest.get(i);\n if (e.getY() == mess[0]) {\n add_flag = false;\n }\n }\n if (add_flag) {\n for (int i = 0; i < verLmtest.size(); i++) {\n Integer[] mess = verLmtest.get(i);\n if (e.getX() == mess[0]) {\n mess[2] = mess[2] + 1;\n /* if (e.getX() == root_number) {\n mess[1] = 1;\n } else {\n mess[1] = mess[1] + 1;\n lm[1]=mess[1];\n\n }*/\n verLmtest.set(i, mess);\n break;\n }\n\n }\n for (int i = 0; i < verLmtest.size(); i++) {\n Integer[] mess = verLmtest.get(i);\n if (e.getX() == mess[0]) {\n lm[1] = mess[1] + 1;\n }\n\n }\n\n verLmtest.add(lm);\n } else {\n continue;\n }\n // }\n if (ztc.getTvertex().size() == 1) {\n edgesesTestHash.add(e);\n int x = e.getX();\n int y = e.getY();\n Edges e1 = new Edges(y, x);\n edgesesTestHash.add(e1);\n\n ztc.addEdges(e);\n ztc.addEdges(e1);\n\n ztc.addTVertex(lm[0]);\n // q.removeFirst();\n\n\n } else {\n // edgesTest.add(e);\n int x = e.getX();\n int y = e.getY();\n Edges e1 = new Edges(y, x);\n // disable.add(e);\n // disable.add(e1);\n\n edgesesTestHash.add(e1);\n edgesesTestHash.add(e);\n\n int[][] ad = getNeighboor();\n\n\n if (checkLegal(e, ad)) {\n ztc.addEdges(e);\n ztc.addEdges(e1);\n\n ztc.addTVertex(lm[0]);\n\n // if(q.size()!=0)\n // q.removeFirst();\n } else {\n // q.removeFirst();\n\n Iterator<Edges> edgesIterator = edgesesTestHash.iterator();\n while (edgesIterator.hasNext()) {\n Edges eo = edgesIterator.next();\n if ((eo.getY() == e.getY()) && (eo.getX() == e.getX())) {\n edgesIterator.remove();\n }\n if ((eo.getY() == e1.getY()) && (eo.getX() == e1.getX())) {\n edgesIterator.remove();\n }\n }\n\n verLmtest.removeLast();\n }\n\n\n }\n\n\n }\n\n\n }\n }\n }\n\n ztc.setEdgesesTree(edgesesTestHash);\n ztc.setGr(Gr);\n ConvertDataToJs convertDataToJs=new ConvertDataToJs();\n try {\n convertDataToJs.save(ztc);\n } catch (FileNotFoundException e1) {\n e1.printStackTrace();\n }\n\n System.out.print(\"\");\n\n }", "private static void cargarLista(String linea, TraductorDesdeLista grafo)\r\n\t\t\tthrows IllegalArgumentException\r\n\t{\r\n\t\tint vertice = Integer.parseInt(linea.substring(0,1));\t\t// Guarda el vertice\r\n\t\tlinea = linea.substring(3);\t\t\t\t\t\t\t\t\t// Guarda los vertices sucesores \r\n\t\tString[] lista = linea.split(\" \");\t\t\t\t\t\t\t// Almacena los vertices sucesores en un arreglo\r\n\r\n\t\t// Agrega vertice en la matriz de adyacencia\r\n\t\tgrafo.agregarVertice(vertice);\r\n\r\n\t\t// Itera sobre los vertices sucesores al vertice agregado agregando los arcos en la matriz de adyacencia\r\n\t\tfor(int i=0;i<lista.length;i++){\r\n\t\t\tgrafo.agregarArco(vertice, Integer.parseInt(lista[i]));\r\n\t\t}\r\n\r\n\t}", "private static void extendPath(Grafo g, List<Integer> caminho) {\n Integer next = null;\n for (Integer v : caminho) {\n if (g.estaConectado(v, caminho.get(caminho.size() - 1))) { //Vi\n int index = caminho.indexOf(v); //Vi+1\n int unvisited, maxEta = 0;\n for (Integer w : g.vizinhos(caminho.get(index + 1))) { //Checando se Vi+1 tem vizinhos não visitados\n if (caminho.contains(w)) {\n continue;\n }\n unvisited = 0;\n for (Integer m : g.vizinhos(w)) { //eta de w\n if (!caminho.contains(m)) {\n unvisited++;\n }\n }\n if (unvisited > maxEta) {\n next = w;\n maxEta = unvisited;\n }\n }\n if (next != null) {\n //Reorganizar o caminho\n Collections.reverse(caminho.subList(index + 1, caminho.size()));\n caminho.add(next);\n findAPath(g, caminho, null);\n extendPath(g, caminho);\n break;\n }\n }\n }\n }", "private List<Node> findBranchsMesh()\r\n\t{\t\r\n\t\t// Nos que fecham o laco\r\n\t\tList<Node> nodes = new ArrayList<>();\r\n\t\t\r\n\t\tfor (Entry<String, Integer> value : cacheDestinationNodes.entrySet())\r\n\t\t{\r\n\t\t\t// No possui mais de um arco chegando (ANEL!)\r\n\t\t\tif (value.getValue() > 1)\r\n\t\t\t{\r\n\t\t\t\tString label = value.getKey();\r\n\t\t\t\tNode node = cacheNodes.get(label);\r\n\t\t\t\tnodes.add(node);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t// nodes > 1 indica que esta rede possui anel\r\n\t\treturn nodes; \r\n\t}", "int getVertices();", "public static void main(String[] args) {\n Grafo g = new Grafo(6); \r\n g.addAresta(5, 2); \r\n g.addAresta(5, 0); \r\n g.addAresta(4, 0); \r\n g.addAresta(4, 1); \r\n g.addAresta(2, 3); \r\n g.addAresta(3, 1); \r\n System.out.println(\"Grafo ordenado topologicamente pelo algoritmo de Kahn:\"); \r\n g.topologicalSort(); \r\n \r\n System.out.println(\"\\n\\n\\n\");\r\n \r\n // Cria um grafo e adiciona as arestas com seus pesos\r\n GrafoComplexo gc = new GrafoComplexo(6); \r\n gc.addAresta(0, 1, 5); \r\n gc.addAresta(0, 2, 3); \r\n gc.addAresta(1, 3, 6); \r\n gc.addAresta(1, 2, 2); \r\n gc.addAresta(2, 4, 4); \r\n gc.addAresta(2, 5, 2); \r\n gc.addAresta(2, 3, 7); \r\n gc.addAresta(3, 4, -1); \r\n gc.addAresta(4, 5, -2); \r\n \r\n int s = 1; \r\n System.out.println(\"Caminho mais curto desde a origem \" + s ); \r\n gc.shortestPath(s); \r\n }", "public void provocarEvolucion(Tribu tribuJugador, Tribu tribuDerrotada){\r\n System.out.println(\"\\n\");\r\n System.out.println(\"-------------------Fase de evolución ----------------------\");\r\n int indiceAtributo;\r\n int indiceAtributo2;\r\n double golpeViejo = determinarGolpe(tribuJugador);\r\n for(int i = 1; i <= 10 ; i++){\r\n System.out.println(\"Iteración número: \" + i);\r\n indiceAtributo = (int)(Math.random() * 8);\r\n indiceAtributo2 = (int)(Math.random() * 8);\r\n String nombreAtributo1 = determinarNombrePosicion(indiceAtributo);\r\n String nombreAtributo2 = determinarNombrePosicion(indiceAtributo2);\r\n if((tribuJugador.getArray()[indiceAtributo] < tribuDerrotada.getArray()[indiceAtributo] \r\n && (tribuJugador.getArray()[indiceAtributo2] < tribuDerrotada.getArray()[indiceAtributo2]))){\r\n System.out.println(\"Se cambió el atributo \" + nombreAtributo1 + \" de la tribu del jugador porque\"\r\n + \" el valor era \" + tribuJugador.getArray()[indiceAtributo] + \" y el de la tribu enemeiga era de \"\r\n + tribuDerrotada.getArray()[indiceAtributo] + \" esto permite hacer más fuerte la tribu del jugador.\");\r\n \r\n tribuJugador.getArray()[indiceAtributo] = tribuDerrotada.getArray()[indiceAtributo];\r\n \r\n System.out.println(\"Se cambió el atributo \" + nombreAtributo2 + \" de la tribu del jugador porque\"\r\n + \" el valor era \" + tribuJugador.getArray()[indiceAtributo2] + \" y el de la tribu enemeiga era de \"\r\n + tribuDerrotada.getArray()[indiceAtributo2] + \" esto permite hacer más fuerte la tribu del jugador.\");\r\n \r\n tribuJugador.getArray()[indiceAtributo2] = tribuDerrotada.getArray()[indiceAtributo2];\r\n }\r\n }\r\n double golpeNuevo = determinarGolpe(tribuJugador);\r\n if(golpeNuevo > golpeViejo){\r\n tribus.replace(tribuJugador.getNombre(), determinarGolpe(tribuJugador));\r\n System.out.println(\"\\nTribu evolucionada\");\r\n imprimirAtributos(tribuJugador);\r\n System.out.println(\"\\n\");\r\n System.out.println(tribus);\r\n }\r\n else{\r\n System.out.println(\"\\nTribu sin evolucionar\");\r\n System.out.println(\"La tribu no evolucionó porque no se encontraron atributos\"\r\n + \" que permitiesen crecer su golpe\");\r\n imprimirAtributos(tribuJugador);\r\n System.out.println(\"\\n\");\r\n System.out.println(tribus);\r\n }\r\n }", "public void findTrack() {\n for (Node n : start_node.getLinks()) {\n precedenti.put(n, start_node);\n valori.put(n, calculator.calcDistance(n, start_node));\n }\n while (!da_collegare.isEmpty()) {\n Node piu_vicino = null;\n double min = Double.MAX_VALUE;\n for (Node n : da_collegare) {\n double dist = valori.get(n);\n if (dist - min < THRESHOLD) {\n min = dist;\n piu_vicino = n;\n }\n }\n double dist = valori.get(piu_vicino);\n for (Node n : piu_vicino.getLinks()) {\n double ricalc = dist + calculator.calcDistance(n, piu_vicino);\n if (ricalc - valori.get(n) < THRESHOLD) {\n precedenti.put(n, piu_vicino);\n valori.put(n, ricalc);\n }\n }\n da_collegare.remove(piu_vicino);\n }\n }", "public void vaciar(){\r\n\t\t//Monto un iterador de vertices del grafo\r\n\t\tIterator iteradorVertices = vertices.iterator();\r\n\t\tArista aristaAux;\r\n\t\tVertice verticeAux;\r\n\t\t//obtengo todos los vertices del grafo\r\n\t\twhile (iteradorVertices.hasNext()){\r\n\t\t\tverticeAux = (Vertice) iteradorVertices.next();\r\n\t\t\t//por cada vertice obtengo sus aristas salientes\r\n\t\t\tIterator iteradorAristas = verticeAux.getAristasSalientes().iterator();\r\n\t\t\t//mientras tenga aristas salientes\r\n\t\t\twhile(iteradorAristas.hasNext()){\r\n\t\t\t\t//Elimino cada arista\r\n\t\t\t\taristaAux = (Arista)iteradorAristas.next(); \r\n\t\t\t\tverticeAux.elimiarAristaSaliente(aristaAux);\r\n\t\t\t}\r\n\t\t\t//Elimino el vertice\r\n\t\t\tthis.eliminarVertice(verticeAux);\r\n\t\t}\r\n\t}", "private void paintCourbeLie() {\n\t\tfloat x, y, yPrec = parent.getY(0);\n\t\tint j=0, jPrec = (int) axis.getY();\n\t\t\n\t\tfor(int i=(int) axis.getX()-1; i>0; i--) { //Dessine la courbe precedant l'origine\n\t\t\tx = (float) ((i-axis.getX())/(pointsParX));\n\t\t\ty = parent.getY(x);\n\n\t\t\tif(y>yMin && y<yMax) {\n\t\t\t\tj = convertY(y);\n\t\t\t\n\t\t\t\tpaintPointInColor(i, j);\n\t\t\t\t\n\t\t\t\tif(j != jPrec-1 && j != jPrec+1) //Si il y a un espacement entre ce point et le dernier point dessine\n\t\t\t\t\ttraceLink(i, j, i-1, jPrec); //on trace une ligne entre ces deux points\n\t\t\t\t\n\t\t\t\tjPrec = j;\n\t\t\t}\n\t\t\t\n\t\t\telse if(y > yMax && yPrec < yMax) //Trace la courbe jusqu'en haut si le point sort de l'affichage\n\t\t\t\ttraceLink(i, 1, i-1, jPrec);\n\t\t\t\t\n\t\t\telse if(y < yMin && yPrec > yMin) //Trace la courbe jusqu'en bas si le point sort de l'affichage\n\t\t\t\ttraceLink(i, height-1, i-1, jPrec);\n\n\t\t\tyPrec = y;\n\t\t}\n\t\t\n\t\tyPrec = parent.getY(0);\n\t\tjPrec = (int) axis.getY();\n\t\t\n\t\tfor(int i=(int) axis.getX(); i<width; i++) { //Dessine la courbe suivant l'origine\n\t\t\tx = (float) ((i-axis.getX())/(pointsParX));\n\t\t\ty = parent.getY(x);\n\n\t\t\tif(y>yMin && y<yMax) {\n\t\t\t\tj = convertY(y);\n\t\t\t\n\t\t\t\tpaintPointInColor(i, j);\n\t\t\t\t\n\t\t\t\tif(j != jPrec-1 && j != jPrec+1)\n\t\t\t\t\ttraceLink(i, j, i-1, jPrec);\n\t\t\t\t\n\t\t\t\tjPrec = j;\n\t\t\t}\n\t\t\t\n\t\t\telse if(y > yMax && yPrec < yMax)\n\t\t\t\ttraceLink(i, 1, i-1, jPrec);\n\n\t\t\telse if(y < yMin && yPrec > yMin)\n\t\t\t\ttraceLink(i, height-1, i-1, jPrec);\n\t\t\t\t\n\t\t\tyPrec = y;\n\t\t}\n\t}", "private boolean revisar(GrafoAristaPonderada G) {\n\n // check peso\n double pesoTotal = 0.0;\n for (Arista a : aristas()) {\n pesoTotal += a.peso();\n }\n if (Math.abs(pesoTotal - peso()) > EPSILON_PUNTO_FLOTANTE) {\n System.err.printf(\n \"Peso de la aristas no es igual a peso(): %f vs. %f\\n\",\n pesoTotal, peso());\n return false;\n }\n\n // check that it is acyclic\n UF uf = new UF(G.V());\n for (Arista e : aristas()) {\n int v = e.unVertice(), w = e.otroVertice(v);\n if (uf.estanConectados(v, w)) {\n System.err.println(\"No es un bosque\");\n return false;\n }\n uf.union(v, w);\n }\n\n // check that it is a spanning forest\n for (Arista a : G.aristas()) {\n int v = a.unVertice(), w = a.otroVertice(v);\n if (!uf.estanConectados(v, w)) {\n System.err.println(\"No es un bosque de expansion\");\n return false;\n }\n }\n\n // check that it is a minimal spanning forest (cut optimality conditions)\n for (Arista a : aristas()) {\n\n // all aristas in MST except a\n uf = new UF(G.V());\n for (Arista o : aristas()) {\n int x = o.unVertice(), y = o.otroVertice(x);\n if (o != a) uf.union(x, y);\n }\n\n // check that e is min peso edge in crossing cut\n for (Arista o : G.aristas()) {\n int x = o.unVertice(), y = o.otroVertice(x);\n if (!uf.estanConectados(x, y)) {\n if (o.peso() < a.peso()) {\n System.err.println(\"Arista \" + o + \n \" viola las condiciones de optimalidad\"\n + \"del corte\");\n return false;\n }\n }\n }\n\n }\n\n return true;\n }", "private void calculate() {\n\t\tList<Edge> path = new ArrayList<>();\n\t\tPriorityQueue<Vert> qv = new PriorityQueue<>();\n\t\tverts[s].dist = 0;\n\t\tqv.add(verts[s]);\n\t\twhile (!qv.isEmpty()) {\n\t\t\tVert v = qv.poll();\n\t\t\tint vidx = v.idx;\n\t\t\tfor (Edge e : v.edges) {\n\t\t\t\tif (e.w==0) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tVert vo = verts[e.other(vidx)];\n\t\t\t\tif (vo.dist > v.dist + e.w) {\n\t\t\t\t\tvo.dist = v.dist + e.w;\n\t\t\t\t\tqv.add(vo);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (verts[t].dist < L) {\n\t\t\tok = false;\n\t\t\treturn;\n\t\t} else if (verts[t].dist == L) {\n\t\t\tok = true;\n\t\t\tfor (int i=0; i<m; i++) {\n\t\t\t\tif (edges[i].w == 0) {\n\t\t\t\t\tedges[i].w = MAX_DIST;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\t// replace 0 with 1, adding to za list\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tif (edges[i].w == 0) {\n\t\t\t\tza[i] = true;\n\t\t\t\tedges[i].w = 1;\n\t\t\t} else {\n\t\t\t\tza[i] = false;\n\t\t\t}\n\t\t}\n\t\t\n\t\t// looking for shortest path from s to t with 0\n\t\tfor (int i=0; i<n; i++) {\n\t\t\tif (i != s) {\n\t\t\t\tverts[i].dist = MAX_DIST;\n\t\t\t}\n\t\t}\n\t\tqv.clear();\n\t\tqv.add(verts[s]);\n\t\twhile (!qv.isEmpty()) {\n\t\t\tVert v = qv.poll();\n\t\t\tint vidx = v.idx;\n\t\t\tfor (Edge e : v.edges) {\n\t\t\t\tVert vo = verts[e.other(vidx)];\n\t\t\t\tif (vo.dist > v.dist + e.w) {\n\t\t\t\t\tvo.dist = v.dist + e.w;\n\t\t\t\t\tqv.add(vo);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (verts[t].dist > L) {\n\t\t\tok = false;\n\t\t\treturn;\n\t\t}\n\t\tVert v = verts[t];\n\t\twhile (v.dist > 0) {\n\t\t\tlong minDist = MAX_DIST;\n\t\t\tVert vMin = null;\n\t\t\tEdge eMin = null;\n\t\t\tfor (Edge e : v.edges) {\n\t\t\t\tVert vo = verts[e.other(v.idx)];\n\t\t\t\tif (vo.dist+e.w < minDist) {\n\t\t\t\t\tvMin = vo;\n\t\t\t\t\teMin = e;\n\t\t\t\t\tminDist = vMin.dist+e.w;\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\tv = vMin;\t\n\t\t\tpath.add(eMin);\n\t\t}\n\t\tCollections.reverse(path);\n\t\tfor (int i=0; i<m; i++) {\n\t\t\tif (za[i]) {\n\t\t\t\tedges[i].w = MAX_DIST;\n\t\t\t}\n\t\t}\n\t\tlong totLen=0;\n\t\tboolean wFixed = false;\n\t\tfor (Edge e : path) {\n\t\t\ttotLen += (za[e.idx] ? 1 : e.w);\n\t\t}\n\t\tfor (Edge e : path) {\n\t\t\tif (za[e.idx]) {\n\t\t\t\tif (!wFixed) {\n\t\t\t\t\te.w = L - totLen + 1;\n\t\t\t\t\twFixed = true;\n\t\t\t\t} else {\n\t\t\t\t\te.w = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tok = true;\n\t}", "public void testaGraph() {\n\t\tEstacaoDAO a = new EstacaoDAO();\n\t\ta.carregarEstacoes();\n\t\tLinha b = new Linha(\"a\");\n\t\tb.loadAllStations(a);\n\t\tb.shortestPath(a,\"Curado\",\"Recife\");\n\t}", "@DisplayName(\"Coloca las piezas negras en la parte superior del tablero\")\r\n\t\t@ParameterizedTest\r\n\t\t@CsvSource({ \"0,0,1\", \"0,2,2\", \"0,4,3\", \"0,6,4\", \"1,1,5\", \"1,3,6\", \"1,5,7\", \"1,7,8\", \"2,0,9\", \"2,2,10\",\r\n\t\t\t\t\"2,4,11\", \"2,6,12\" })\r\n\t\tvoid comprobarColocacionInicialDePiezasNegras(int fila, int columna, int id) {\r\n\t\t\tCelda celda = tablero.obtenerCelda(fila, columna);\r\n\t\t\tassertThat(\"Celda vacia\", celda.estaVacia(), is(false));\r\n\t\t\tassertThat(\"Color de pieza colocada incorrecta\", celda.obtenerColorDePieza(), is(NEGRO));\r\n\t\t\tassertThat(\"Tipo de pieza incorrecto\", celda.obtenerPieza().obtenerTipoPieza(), is(PEON));\r\n\t\t\tassertThat(\"Identificador incorrecto\", celda.obtenerPieza().obtenerId(), is(id));\r\n\t\t\tassertThat(\"Numero de peones negros incorrecto\", tablero.obtenerNumeroPiezas(NEGRO), is(12));\r\n\t\t}", "boolean containsJewel(Graph<V, E> g)\n {\n for (V v2 : g.vertexSet()) {\n for (V v3 : g.vertexSet()) {\n if (v2 == v3 || !g.containsEdge(v2, v3))\n continue;\n for (V v5 : g.vertexSet()) {\n if (v2 == v5 || v3 == v5)\n continue;\n\n Set<V> F = new HashSet<>();\n for (V f : g.vertexSet()) {\n if (f == v2 || f == v3 || f == v5 || g.containsEdge(f, v2)\n || g.containsEdge(f, v3) || g.containsEdge(f, v5))\n continue;\n F.add(f);\n }\n\n List<Set<V>> componentsOfF = findAllComponents(g, F);\n\n Set<V> X1 = new HashSet<>();\n for (V x1 : g.vertexSet()) {\n if (x1 == v2 || x1 == v3 || x1 == v5 || !g.containsEdge(x1, v2)\n || !g.containsEdge(x1, v5) || g.containsEdge(x1, v3))\n continue;\n X1.add(x1);\n }\n Set<V> X2 = new HashSet<>();\n for (V x2 : g.vertexSet()) {\n if (x2 == v2 || x2 == v3 || x2 == v5 || g.containsEdge(x2, v2)\n || !g.containsEdge(x2, v5) || !g.containsEdge(x2, v3))\n continue;\n X2.add(x2);\n }\n\n for (V v1 : X1) {\n if (g.containsEdge(v1, v3))\n continue;\n for (V v4 : X2) {\n if (v1 == v4 || g.containsEdge(v1, v4) || g.containsEdge(v2, v4))\n continue;\n for (Set<V> FPrime : componentsOfF) {\n if (hasANeighbour(g, FPrime, v1) && hasANeighbour(g, FPrime, v4)) {\n if (certify) {\n Set<V> validSet = new HashSet<>();\n validSet.addAll(FPrime);\n validSet.add(v1);\n validSet.add(v4);\n GraphPath<V, E> p = new DijkstraShortestPath<>(\n new AsSubgraph<>(g, validSet)).getPath(v1, v4);\n List<E> edgeList = new LinkedList<>();\n edgeList.addAll(p.getEdgeList());\n if (p.getLength() % 2 == 1) {\n edgeList.add(g.getEdge(v4, v5));\n edgeList.add(g.getEdge(v5, v1));\n\n } else {\n edgeList.add(g.getEdge(v4, v3));\n edgeList.add(g.getEdge(v3, v2));\n edgeList.add(g.getEdge(v2, v1));\n\n }\n\n double weight =\n edgeList.stream().mapToDouble(g::getEdgeWeight).sum();\n certificate = new GraphWalk<>(g, v1, v1, edgeList, weight);\n }\n return true;\n }\n }\n }\n }\n }\n }\n }\n\n return false;\n }", "public static LinkedList<LinkedList<Integer>> asignarVehiculos(Graph grafo, float p) throws Exception {\n LinkedList<LinkedList<Integer>> caminos = new LinkedList<>();\n LinkedList<Integer> grafoOrganizado = organizarDistancias(grafo), visitados = new LinkedList<>();\n while (!grafoOrganizado.isEmpty()) {\n int nodo = grafoOrganizado.poll();\n if (visitados.contains(nodo))\n continue;\n LinkedList<LinkedList<Integer>> permutaciones = new LinkedList<>();\n LinkedList<Integer> permutacion = new LinkedList<>();\n permutaciones(grafo, nodo, permutacion, permutaciones, nodo, 0, grafo.getWeight(nodo, 0) * p);\n LinkedList<Integer> laPermutacionMasLarga = laPermutacionMasLarga(permutaciones, visitados);\n caminos.add(laPermutacionMasLarga);\n for (int i : laPermutacionMasLarga)\n visitados.add(i);\n }\n return caminos;\n }", "private void InicializaGrafo() {\n\t\t\n\t\tnumeroVertices = ruas.length + 1;\n\t\tgrafo = new Grafo(numeroVertices);\n\t\t\n\t\tfor (int i = 0; i < numeroVertices - 1; i++) {\n\t\t\t\n\t\t\tint u = ruas[i];\n\t\t\tint v = (i + 1);\n\t\t\t\n\t\t\tgrafo.AdicionaAresta(u, v);\n\t\t\t\n\t\t} // Fim for int i = 0\n\t\t\n\t}", "public boolean foiChecado(Vertice v){\n int i = v.label;\n return vertices[i];\n }", "@Test\n public void testLerArquivoTexto(){\n grafo = new Grafo(\"Mapa\");\n try {\n new LeituraArquivo(\"teste.txt\", grafo).lerArquivoTexto();\n System.out.println(grafo.getVertices().size());\n } catch(IOException e){\n System.out.println(\"Não foi possivel ler o arquivo :x\");\n }\n }", "public static HashMap<Integer,Nodo> Dijkstra(Grafo g,int origen){\n\t\t// Inicialmente S contendrá el vértice origen\n\t\tArrayList<Integer> s = new ArrayList<Integer>();\n \tHashMap<Integer,Integer> costo = new HashMap<Integer,Integer>();\n \tHashMap<Integer,Nodo> padre = new HashMap<Integer,Nodo>();\n\t\ts.add(origen);\n\t\tcosto.put(origen,-100000000);\t\n\t\t// Para cada v en el grafo: \n\t\tfor( Map.Entry<Integer, Nodo> v : g.nodos.entrySet() ){\n\t\t\t// si v no es el origen:\n\t\t\tif( v.getKey() != origen ){\n\t\t\t\tcosto.put(v.getKey(),g.valorArista(v.getKey(),origen));\n\t\t\t\t// Inicialmente, el predecesor de v en el camino mínimo construido hasta el momento es origen\n\t\t\t\tpadre.put(v.getKey(),g.nodos.get(origen));\n\t\t\t} // fin if\n\t\t} // fin for\n\n\t\t// Mientras existan vértices para los cuales no se ha determinado el camino mínimo\n\t\twhile( g.nodos.size() - s.size() > 0 ){\n\t\t\t//\tElegir un vértice w en (V-S) tal que su costo sea el mayor.\n\t\t\tfor(Map.Entry<Integer, Nodo> w : g.nodos.entrySet()){\n\t\t\t\tint mayor = -10000000;\n\t\t\t\tif(!s.contains(w.getKey())){\n\t\t\t\t\tif( mayor < costo.get(w.getKey()) ){\n\t\t\t\t\t\t// Se agrega w al conjunto S\n\t\t\t\t\t\ts.add(w.getKey());\n\t\t\t\t\t\tmayor = costo.get(w.getKey());\n\t\t\t\t\t} // fin if mayor\n\t\t\t\t} // fin if contains\n\t\t\t\t\t\n\t\t\t\t\t//\tPara cada v en (V-S):\n\t\t\t\t\tfor(Map.Entry<Integer, Nodo> v : g.nodos.entrySet()){\n\t\t\t\t\t\tif(!s.contains(v.getKey())){\n\t\t\t\t\t\t\t// Se escoge, entre \n\t\t\t\t\t\t\t// el camino mayor hacia v que se tiene hasta el momento, \n\t\t\t\t\t\t\tint dv = costo.get(v.getKey());\n\t\t\t\t\t\t\tint dw = costo.get(w.getKey());\n\t\t\t\t\t\t\t//y el camino hacia v pasando por w mediante su camino mayor, \n\t\t\t\t\t\t\tint cwv = g.valorArista(w.getKey(),v.getKey());\n\t\t\t\t\t\t\t//el de mayor costo.\n\t\t\t\t\t\t\tint max = Math.max( dv , dw + cwv );\n\t\t\t\t\t\t\tcosto.put(v.getKey(),max);\t\n\n\t\t\t\t\t\t\t// Si max(D[v],D[w]+C[w,v]) = D[w]+C[w,v] entonces P[v] ← w \n\t\t\t\t\t\t\tif( max == dw + cwv ){\n\t\t\t\t\t\t\t\tpadre.put(v.getKey(),w.getValue());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} // fin if contains\n\t\t\t\t\t} // fin for map\n\t\t\t} //fin for map\n\t\t} // fin while\n\t\treturn padre;\n\t}", "private Punto getPuntoPriorizado(Punto puntoini, List<Punto> puntos ){\n\t\t\n\t\tPunto puntopriorizado = null;\n\t\t// calculamos la heuristica de distancias a los demas puntos\n\t\tfor (Punto punto : puntos) {\n\t\t\tif( (puntoini!=null && punto!=null) && !puntoini.equals(punto) ){\n\t\t\t\tdouble d = Geometria.distanciaDeCoordenadas(puntoini, punto);\n\t\t\t\tpunto.getDatos().put(\"distanci\", d);\n\t\t\t}\n\t\t}\n\t\t\n\t\t// ordenamos por las heuristicas definidad en la clase comparator\n\t\t// hora atencion, prioridad, urgencia, distancia\n\t\tCollections.sort(puntos, new PuntoHeuristicaComparator1());\n\t\tSystem.out.println(\"### mostrando las heuristicas #####\");\n\t\tmostratPuntosHeuristica(puntos);\n\t\n\t\tif( puntos!=null && puntos.size()>0){\n\t\t\tpuntopriorizado = puntos.get(0);\n\t\t}\n\t\t\n\t\t/*Punto pa = null ;\n\t\tfor (Punto p : puntos) {\n\t\t\tif(pa!=null){\n\t\t\t\tString key = p.getDatos().toString();\n\t\t\t\tString keya = pa.getDatos().toString();\n\t\t\t\tif(!key.equals(keya)){\n\t\t\t\t\tpuntopriorizado = p;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t}\n\t\t\tpa = p ;\n\t\t}*/\n\n\t\treturn puntopriorizado;\n\t}", "Collection<? extends Subdomain_group> getIsVertexOf();", "public Collection<V> getOtherVertices(Collection<V> vs);", "@Test\n\tpublic void verticesTest() {\n\t\tgraph.addVertex(A);\n\t\tgraph.addVertex(B);\n\t\tgraph.addVertex(C);\n\t\tgraph.addVertex(D);\n\t\tassertEquals(4, graph.vertices().size());\n\t\tassertTrue(graph.vertices().contains(A));\n\t\tassertTrue(graph.vertices().contains(D));\n\t}", "public void testContainsVertex() {\n System.out.println(\"containsVertex\");\n\n Graph<Integer, Edge<Integer>> graph = generateGraph();\n\n for (int i = 0; i < 25; i++) {\n Assert.assertTrue(graph.containsVertex(new Integer(i)));\n }\n }", "public void addedge(String fro, String to, int wt) {\r\n Edge e = new Edge(fro, to, wt);\r\n\r\n\r\n Set<String> keys = graph.keySet();\r\n// Object[] arr = keys.toArray();\r\n int f = 0;\r\n if(graph.containsKey(fro)&&graph.containsKey(to))\r\n {\r\n\r\n int[] bb2 = new int[2000];\r\n for(int zz=0;zz<5000;zz++){\r\n\r\n\r\n ArrayList<Integer> abcd = new ArrayList<>();\r\n abcd.add(zz);\r\n\r\n if(zz<2500)\r\n zz++;\r\n else\r\n zz++;\r\n\r\n bb2[zz%500]=zz;\r\n\r\n\r\n int qq= 5000;\r\n\r\n qq--;\r\n\r\n String nnn = \"aaa aa\";\r\n nnn+=\"df\";\r\n\r\n\r\n }\r\n\r\n }\r\n else\r\n {\r\n\r\n\r\n System.out.println(\"some vertices are not present\");\r\n return;\r\n }\r\n for ( String y : keys) {\r\n if (fro.compareTo(y) == 0) {\r\n f = 1;\r\n ArrayList<Edge> ee =graph.get(y);\r\n\r\n\r\n ee.add(e);\r\n }\r\n\r\n\r\n }\r\n if (f == 0) {}\r\n }", "public Nodo espaciosJustos(Nodo nodo){\n System.out.println(\"----------------inicio heuristica espaciosJustos--------------\");\n Operadores operadores = new Operadores();\n //variables de matriz\n int numFilas,numColumnas,numColores;\n \n numColumnas = nodo.getnColumnas();\n numFilas = nodo.getnFilas();\n numColores = nodo.getnColores();\n \n String [][] matriz = new String [numFilas][numColumnas];\n matriz = operadores.clonarMatriz(nodo.getMatriz());\n //-------------------\n \n //variables de filas y columnas\n ArrayList<ArrayListColumna> columnas = new ArrayList<ArrayListColumna>();\n columnas = (ArrayList<ArrayListColumna>)nodo.getColumnas();\n \n ArrayList<ArrayListFila> filas = new ArrayList<ArrayListFila>();\n filas = (ArrayList<ArrayListFila>)nodo.getFilas();\n //---------------------------\n \n ArrayListFila auxListFila = new ArrayListFila();\n ArrayListColumna auxListColumna = new ArrayListColumna();\n \n int cambio=1;\n int changue=0;\n while(cambio!=0){\n cambio=0;\n \n nodo.setCambio(0);\n for(int i=0;i<numFilas;i++){\n auxListFila = (ArrayListFila)filas.get(i);\n for(int j=0;j<numColores;j++){\n Color auxColor = new Color();\n auxColor = auxListFila.getColor(j);\n\n if(auxColor.getNumero() > 0){\n int contador=0;\n for(int c=0;c<numColumnas;c++){\n auxListColumna=(ArrayListColumna)columnas.get(c);\n\n for(int j1=0;j1<numColores;j1++){\n Color auxColor1 = new Color();\n auxColor1 = auxListColumna.getColor(j1);\n if(auxColor1.getNumero() > 0){\n if(auxColor.getColor().equals(auxColor1.getColor()) && operadores.isPosicionVaciaFila(nodo.getMatriz(), i, c)){\n contador++;\n }\n }\n }\n }\n \n if(auxColor.getNumero() == contador){\n changue=1;\n cambio=1;\n auxColor.setNumero(0);\n for(int c=0;c<numColumnas;c++){\n auxListColumna=(ArrayListColumna)columnas.get(c);\n\n for(int j1=0;j1<numColores;j1++){\n Color auxColor1 = new Color();\n auxColor1 = auxListColumna.getColor(j1);\n if(auxColor1.getNumero() > 0){\n if(auxColor.getColor().equals(auxColor1.getColor()) && operadores.isPosicionVaciaFila(nodo.getMatriz(), i, c)){\n \n auxColor1.setNumero(auxColor1.getNumero()-1);\n\n matriz = operadores.pintarPosicion(matriz, i, c, auxColor.getColor());\n\n nodo.setMatriz(matriz);\n }\n }\n }\n }\n System.out.println(\"-----\");\n operadores.imprimirMatriz(nodo.getMatriz());\n System.out.println(\"-----\");\n \n \n }\n }\n }\n }\n \n }\n if(changue==1) nodo.setCambio(1);\n System.out.println(\"----------------fin heuristica espaciosJustos-------------- \");\n return (Nodo)nodo;\n }", "public Collection<V> getOtherVertices(V v);", "private void drawScanlines(Graphics g, ArrayList<Vector2f> vertices) {\r\n if (vertices.isEmpty()) return;\r\n g.setColor(Color.GREEN);\r\n // 1. Sort vertices by y-axis-value\r\n vertices.sort((v0, v1) -> Float.compare(v0.y, v1.y));\r\n // 2. Iterate through sorted vertices\r\n int i = 0;\r\n while (i < vertices.size()) {\r\n // Get the vertices with the lowest y-value\r\n int currentY = (int)vertices.get(i).y;\r\n List<Vector2f> vList = vertices\r\n .stream().filter(v -> v.y == currentY)\r\n .collect(Collectors.toList());\r\n // Check if there is at least a pair of vertices on the same 'level'\r\n // to be drawn in between\r\n if (vList.size() >= 2) {\r\n // Get the lowest x-value\r\n float minX = vList.stream().min((v1, v2) -> Float.compare(v1.x, v2.x)).get().x;\r\n // Get the highest x-value\r\n float maxX = vList.stream().max((v1, v2) -> Float.compare(v1.x, v2.x)).get().x;\r\n // Loop through x-values until maximum x is reached\r\n while(minX < maxX) {\r\n // Check if there is still space between lowest and highest x-value\r\n if (!vertices.contains(new Vector2f(minX, currentY))) {\r\n // Fill the space with an arc\r\n g.drawArc((int)minX, currentY, 1, 1, 0, 360);\r\n }\r\n // Continue with next x-value\r\n minX++;\r\n }\r\n }\r\n // Current y-value has been processed, skip those\r\n i += vList.size();\r\n }\r\n }", "Set<Vertex> getVertices();", "private static void associaGraphAresta(Graph grafo) {\r\n\t\tfor (int i = 0; i < grafo.getArestas().size(); i++) {\r\n\t\t\tgrafo.getArestas().get(i).getV1().getArestas().add(grafo.getArestas().get(i));\r\n\t\t\tgrafo.getArestas().get(i).getV2().getArestas().add(grafo.getArestas().get(i));\r\n\t\t}\r\n\t}", "public Enumeration vertices();", "@Test \r\n void add_mutiple_edges_check_size(){\r\n for(int i = 0; i < 20; i++) {\r\n graph.addEdge(\"\" + i, \"\" + (i + 1));\r\n } \r\n List<String> adjacent;\r\n for(int i = 0; i < 20; i++) {\r\n adjacent = graph.getAdjacentVerticesOf(\"\"+i);\r\n if(!adjacent.contains(\"\" + (i+1))) {\r\n fail();\r\n }\r\n }\r\n if(graph.size() != 20 | graph.order() != 21) {\r\n fail();\r\n }\r\n \r\n }", "public Rettangolo(Punto[] vertici)\n\t{\n\t\tsuper(vertici);\n\n\t\tif(this.direzioneLati[0] != -1.0 / this.direzioneLati[1] && (this.direzioneLati[0] != Double.POSITIVE_INFINITY || this.direzioneLati[1] != 0.0))\n\t\t{\n\t\t\tthis.vertici = null;\n\t\t\tthis.direzioneLati = this.lunghezzaLati = null; // TODO: eccezioni\n\t\t\tSystem.out.println(\"Errore: i quattro punti non individuano un rettangolo.\");\n\t\t}\n\t}", "private static int detectarVertices(String linea)\r\n\t\t\tthrows IllegalArgumentException\r\n\t{\r\n linea = linea.substring(3); // Elimina los espacios innecesarios\r\n String[] lista = linea.split(\" \");\r\n \r\n return lista.length;\r\n\t}", "public static void main(String[] args) throws IOException {\n File file = new File(args[0]);\r\n //FileOutputStream f = new FileOutputStream(\"prat_dfs_data2.txt\");\r\n //System.setOut(new PrintStream(f));\r\n BufferedReader reader = new BufferedReader(new FileReader(file));\r\n String line;\r\n line = reader.readLine();\r\n int nodecount = 0;\r\n HashMap <String , Integer> nodeMap = new HashMap <String , Integer>(); \r\n while ((line = reader.readLine()) != null ) {\r\n String data[] = line.split(\",(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)\");\r\n if (!nodeMap.containsKey(data[0].replaceAll(\"^\\\"|\\\"$\", \"\"))){\r\n nodeMap.put(data[0].replaceAll(\"^\\\"|\\\"$\", \"\"), nodecount);\r\n nodecount++;\r\n }\r\n }\r\n reader.close();\r\n Vertex adjList[] = new Vertex[nodecount];\r\n Vertex sortVer[] = new Vertex[nodecount];\r\n for(int it = 0; it < nodecount; it++){\r\n adjList[it] = new Vertex(it);\r\n }\r\n nodeMap.forEach((k, v) -> adjList[v].val = k);\r\n File file2 = new File(args[1]);\r\n BufferedReader reader2 = new BufferedReader(new FileReader(file2));\r\n line = reader2.readLine();\r\n while ((line = reader2.readLine()) !=null) {\r\n String data[] = line.split(\",(?=(?:[^\\\"]*\\\"[^\\\"]*\\\")*[^\\\"]*$)\");\r\n String source = data[0].replaceAll(\"^\\\"|\\\"$\", \"\");\r\n String target = data[1].replaceAll(\"^\\\"|\\\"$\", \"\");\r\n\r\n int weight = Integer.parseInt(data[2]);\r\n Vertex current = adjList[nodeMap.get(source)];\r\n Vertex newbie = new Vertex(nodeMap.get(target));\r\n current.countN++;\r\n current.co_occur += weight;\r\n if (adjList[nodeMap.get(source)].next == null){\r\n current.next = newbie;\r\n newbie.prev = current;\r\n }\r\n else{\r\n current.next.prev = newbie;\r\n newbie.next = current.next;\r\n current.next = newbie;\r\n newbie.prev = current;\r\n }\r\n Vertex current1 = adjList[nodeMap.get(target)];\r\n Vertex newbie1 = new Vertex(nodeMap.get(source));\r\n current1.co_occur += weight;\r\n current1.countN++;\r\n if (current1.next == null){\r\n current1.next = newbie1;\r\n newbie1.prev = current1;\r\n }\r\n else{\r\n current1.next.prev = newbie1;\r\n newbie1.next = current1.next;\r\n current1.next = newbie1;\r\n newbie1.prev = current1;\r\n }\r\n }\r\n reader2.close();\r\n \r\n for(int it = 0; it < nodecount; it++){\r\n sortVer[it] = new Vertex(adjList[it].id);\r\n sortVer[it].val = adjList[it].val;\r\n sortVer[it].co_occur = adjList[it].co_occur;\r\n }\r\n if (args[2].equals(\"average\")){\r\n double countdeg = 0;\r\n for(int it = 0; it<nodecount; it++){\r\n countdeg+= (double) adjList[it].countN;\r\n }\r\n countdeg = countdeg / (double) (nodecount);\r\n System.out.printf(\"%.2f\", countdeg);\r\n System.out.println();\r\n //long toc= System.nanoTime();\r\n //System.out.println((toc- startTime)/1000000000.0);\r\n }\r\n \r\n if(args[2].equals(\"rank\")){\r\n Graph.mergesort(sortVer, 0, nodecount-1);\r\n // long toc= System.nanoTime();\r\n // System.out.println((toc- startTime)/1000000000.0);\r\n System.out.print(sortVer[0].val);\r\n for(int kk=1; kk<nodecount; kk++){\r\n System.out.print(\",\" + sortVer[kk].val.toString());\r\n }\r\n System.out.println();\r\n }\r\n if(args[2].equals(\"independent_storylines_dfs\")){\r\n boolean visited[] = new boolean[nodecount];\r\n int ind = 0;\r\n ArrayList<ArrayList<Vertex>> comps = new ArrayList<ArrayList<Vertex>>();\r\n for(int it1 = 0; it1<nodecount; it1++){\r\n visited[it1] = false;\r\n }\r\n for(int it1 = 0; it1<nodecount; it1++){\r\n if (visited[it1] == false){\r\n ArrayList<Vertex> temp = new ArrayList<Vertex>();\r\n Graph.dfs(it1, visited, ind, adjList, temp);\r\n ind++;\r\n Graph.mergesort2(temp, 0, temp.size()-1);\r\n comps.add(temp);\r\n }\r\n }\r\n Graph.mergesort3(comps, 0, comps.size()-1);\r\n // long toc= System.nanoTime();\r\n // System.out.println((toc- startTime)/1000000000.0);\r\n for(int a1 = 0; a1 < ind; a1++){\r\n System.out.print(comps.get(a1).get(0).val);\r\n for(int j1 = 1; j1<comps.get(a1).size(); j1++){\r\n System.out.print(\",\" + comps.get(a1).get(j1).val);\r\n }\r\n System.out.println();\r\n }\r\n }\r\n }", "private List<Integer> vertices(int num) {\n List<Integer> list = new LinkedList<>();\n for (int i = 0; i < num; i++) {\n list.add(i);\n }\n return list;\n }", "public PosicionVertice[] getVertices(PosicionVertice rpv[]) {\n \n // inicializacion\n rpv = (rpv == null) ? new PosicionVertice[2] : rpv;\n for (int i=0; i<rpv.length; i++) {\n rpv[i] = (rpv[i] == null) ? new PosicionVertice() : rpv[i];\n }\n normaliza();\n \n switch(getOrientacion()) {\n case Este:\n rpv[0].setPos(getX(), getY()-1);\n rpv[0].setOrientacion(OrientacionVertice.Sur);\n rpv[1].setPos(getX()+1, getY());\n rpv[1].setOrientacion(OrientacionVertice.Norte);\n break;\n case NorEste:\n rpv[0].setPos(getX(), getY());\n rpv[0].setOrientacion(OrientacionVertice.Norte);\n rpv[1].setPos(getX(), getY()-1);\n rpv[1].setOrientacion(OrientacionVertice.Sur);\n break; \n case NorOeste:\n rpv[0].setPos(getX(), getY());\n rpv[0].setOrientacion(OrientacionVertice.Norte);\n rpv[1].setPos(getX()-1, getY());\n rpv[1].setOrientacion(OrientacionVertice.Sur);\n break; \n }\n return rpv;\n }", "boolean ignoreExistingVertices();", "public Vertex[] Vertices (TrianglePair pair)\n\t{\n\t\tFace tri1 = trimesh.faces[pair.face1];\n\t\tFace tri2 = trimesh.faces[pair.face2];\n\t\tVertex[] verts1 = new Vertex[3];\n\t\tVertex[] verts2 = new Vertex[3];\n\t\tverts1[0] = trimesh.vertices[tri1.fvlist[0]];\n\t\tverts1[1] = trimesh.vertices[tri1.fvlist[1]];\n\t\tverts1[2] = trimesh.vertices[tri1.fvlist[2]];\n\t\tverts2[0] = trimesh.vertices[tri2.fvlist[0]];\n\t\tverts2[1] = trimesh.vertices[tri2.fvlist[1]];\n\t\tverts2[2] = trimesh.vertices[tri2.fvlist[2]];\n\t\tboolean[] equalVerts = new boolean[9];\n\t\tVertex[] retverts = new Vertex[4];\n\t\tequalVerts[0] = (verts1[0] == verts2[0]);\n\t\tequalVerts[1] = (verts1[0] == verts2[1]);\n\t\tequalVerts[2] = (verts1[0] == verts2[2]);\n\t\tequalVerts[3] = (verts1[1] == verts2[0]);\n\t\tequalVerts[4] = (verts1[1] == verts2[1]);\n\t\tequalVerts[5] = (verts1[1] == verts2[2]);\n\t\tequalVerts[6] = (verts1[2] == verts2[0]);\n\t\tequalVerts[7] = (verts1[2] == verts2[1]);\n\t\tequalVerts[8] = (verts1[2] == verts2[2]);\n\t\tint eqto1in1 = 0, eqto1in2 = 0, eqto2in1 = 0, eqto2in2 = 0;\n\t\tint i;\n\t\tfor (i = 0; i < 9; i++)\n\t\t{\n\t\t\tif (equalVerts[i])\n\t\t\t{\n\t\t\t\teqto1in1 = i / 3;\n\t\t\t\teqto1in2 = i % 3;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tfor (i = 8; i >= 0; i--)\n\t\t{\n\t\t\tif (equalVerts[i])\n\t\t\t{\n\t\t\t\teqto2in1 = i / 3;\n\t\t\t\teqto2in2 = i % 3;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tretverts[0] = verts1[eqto1in1];\n\t\tretverts[1] = verts1[eqto2in1];\n\t\tint lone1, lone2;\n\t\tif (eqto1in1 == 0)\n\t\t{\n\t\t\tif (eqto2in1 == 1)\n\t\t\t\tlone1 = 2;\n\t\t\telse // eqto2in1 == 2\n\t\t\t\tlone1 = 1;\n\t\t}\n\t\telse if (eqto1in1 == 1)\n\t\t{\n\t\t\tif (eqto2in1 == 0)\n\t\t\t\tlone1 = 2;\n\t\t\telse // eqto2in1 == 2\n\t\t\t\tlone1 = 0;\n\t\t}\n\t\telse // eqto1in1 == 2\n\t\t{\n\t\t\tif (eqto2in1 == 0)\n\t\t\t\tlone1 = 1;\n\t\t\telse // eqto2in1 == 1\n\t\t\t\tlone1 = 0;\n\t\t}\n\t\tif (eqto1in2 == 0)\n\t\t{\n\t\t\tif (eqto2in2 == 1)\n\t\t\t\tlone2 = 2;\n\t\t\telse // eqto2in2 == 2\n\t\t\t\tlone2 = 1;\n\t\t}\n\t\telse if (eqto1in2 == 1)\n\t\t{\n\t\t\tif (eqto2in2 == 0)\n\t\t\t\tlone2 = 2;\n\t\t\telse // eqto2in2 == 2\n\t\t\t\tlone2 = 0;\n\t\t}\n\t\telse // eqto1in2 == 2\n\t\t{\n\t\t\tif (eqto2in2 == 0)\n\t\t\t\tlone2 = 1;\n\t\t\telse // eqto2in2 == 1\n\t\t\t\tlone2 = 0;\n\t\t}\n\t\tretverts[2] = verts1[lone1];\n\t\tretverts[3] = verts2[lone2];\n\t\treturn retverts;\n\t}", "public ArrayList<Triangle> getOccluderVertexData();", "public static void main(String[] args) throws Exception {\n BufferedReader r = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter w = new PrintWriter(System.out);\n\n String[] inputs = r.readLine().split(\" \");\n \n int start = Integer.parseInt(inputs[0]);\n int end = Integer.parseInt(inputs[1]); \n //today you learned that the distance between the eyes from years 10 to 15 expands from about 62 to 64mm.\n \n inputs = r.readLine().split(\" \");\n \n int n = Integer.parseInt(inputs[0]); //number of junktions\n int m = Integer.parseInt(inputs[1]); //number of rodes\n \n Vertex[] vertices = new Vertex[n + 1];\n for (int i = 0; i < n; i++) {\n inputs = r.readLine().split(\" \");\n boolean blue = inputs[0].equals(\"B\");\n vertices[i + 1] = new Vertex(i + 1, blue, Integer.parseInt(inputs[0]), Integer.parseInt(inputs[1]), Integer.parseInt(inputs[2]));\n }\n \n for (int i = 0; i < m; i++) {\n inputs = r.readLine().split(\" \");\n int a = Integer.parseInt(inputs[0]);\n int b = Integer.parseInt(inputs[1]);\n int c = Integer.parseInt(inputs[2]);\n vertices[a].addPath(b, c);\n vertices[b].addPath(a, c);\n }\n \n \n \n \n }", "public static void main(String[] args) {\n\t\tVertex v1, v2, v3, v4, v5, v6, v7;\n\t\tv1 = new Vertex(\"v1\");\n\t\tv2 = new Vertex(\"v2\");\n\t\tv3 = new Vertex(\"v3\");\n\t\tv4 = new Vertex(\"v4\");\n\t\tv5 = new Vertex(\"v5\");\n\t\tv6 = new Vertex(\"v6\");\n\t\tv7 = new Vertex(\"v7\");\n\n\t\tv1.addAdjacency(v2, 2);\n\t\tv1.addAdjacency(v3, 4);\n\t\tv1.addAdjacency(v4, 1);\n\n\t\tv2.addAdjacency(v1, 2);\n\t\tv2.addAdjacency(v4, 3);\n\t\tv2.addAdjacency(v5, 10);\n\n\t\tv3.addAdjacency(v1, 4);\n\t\tv3.addAdjacency(v4, 2);\n\t\tv3.addAdjacency(v6, 5);\n\n\t\tv4.addAdjacency(v1, 1);\n\t\tv4.addAdjacency(v2, 3);\n\t\tv4.addAdjacency(v3, 2);\n\t\tv4.addAdjacency(v5, 2);\n\t\tv4.addAdjacency(v6, 8);\n\t\tv4.addAdjacency(v7, 4);\n\n\t\tv5.addAdjacency(v2, 10);\n\t\tv5.addAdjacency(v4, 2);\n\t\tv5.addAdjacency(v7, 6);\n\n\t\tv6.addAdjacency(v3, 5);\n\t\tv6.addAdjacency(v4, 8);\n\t\tv6.addAdjacency(v7, 1);\n\n\t\tv7.addAdjacency(v4, 4);\n\t\tv7.addAdjacency(v5, 6);\n\t\tv7.addAdjacency(v6, 1);\n\n\t\tArrayList<Vertex> weightedGraph = new ArrayList<Vertex>();\n\t\tweightedGraph.add(v1);\n\t\tweightedGraph.add(v2);\n\t\tweightedGraph.add(v3);\n\t\tweightedGraph.add(v4);\n\t\tweightedGraph.add(v5);\n\t\tweightedGraph.add(v6);\n\t\tweightedGraph.add(v7);\n\t\t\n\t\tdijkstra( weightedGraph, v7 );\n\t\tprintPath( v1 );\n\t\tSystem.out.println(\"\");\n\t\tprintPath( v2 );\n\t\tSystem.out.println(\"\");\n\t\tprintPath( v3 );\n\t\tSystem.out.println(\"\");\n\t\tprintPath( v4 );\n\t\tSystem.out.println(\"\");\n\t\tprintPath( v5 );\n\t\tSystem.out.println(\"\");\n\t\tprintPath( v6 );\n\t\tSystem.out.println(\"\");\n\t\tprintPath( v7 );\n\t\tSystem.out.println(\"\");\n\t}", "private Map<String, List<PreDocumentoEntrata>> raggruppaPrimoLivelloConStatoCompleto(List<PreDocumentoEntrata> preDocumentiEntrata) {\n\t\tString methodName = \"raggruppaPrimoLivelloConStatoCompleto\";\n\t\t\n\t\tMap<String, List<PreDocumentoEntrata>> result = new HashMap<String, List<PreDocumentoEntrata>>();\n\t\t\n\t\tfor(PreDocumentoEntrata preDoc : preDocumentiEntrata) {\n\t\t\t\n\t\t\tpreDoc = getDettaglioPreDocumentoEntrata(preDoc);\n\t\t\t\n\t\t\tString key = getDocumentoKey(preDoc);\n\t\t\t\t\t\t\n\t\t\tif(!isCompleto(preDoc)) {\t\n\t\t\t\tlog.info(methodName, \"Saltato perche' non completo: \"+key);\n\t\t\t\tinserisciDettaglioOperazioneAsinc(\"SALTATO\", \" predocumento: \" + preDoc.getNumero() + \" [\"+preDoc.getUid()+\"] - \" + preDoc.getDescrizione(), Esito.FALLIMENTO, \"Non completo\");\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t\n\t\t\tinserisciDettaglioOperazioneAsinc(\"AGGIORNATO\", \" predocumento: \" + preDoc.getNumero() + \" [\"+preDoc.getUid()+\"] - \" + preDoc.getDescrizione(), Esito.SUCCESSO);\n\t\t\t\n\t\t\t\n\t\t\tif(!result.containsKey(key)) {\n\t\t\t\tresult.put(key, new ArrayList<PreDocumentoEntrata>());\t\t\t\t\n\t\t\t\tlog.debug(methodName, \"Nuovo gruppo di primo livello: \"+key);\n\t\t\t}\n\t\t\t\n\t\t\tList<PreDocumentoEntrata> list = result.get(key);\t\t\t\n\t\t\tlist.add(preDoc);\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\t\n\t\treturn result;\n\t}", "public boolean pathExists(int startVertex, int stopVertex) {\n// your code here\n ArrayList<Integer> fetch_result = visitAll(startVertex);\n if(fetch_result.contains(stopVertex)){\n return true;\n }\n return false;\n }", "private static String representacaoAL(Graph grafo) {\r\n\t\tString retorno = \"\";\r\n\r\n\t\tfor (int i = 0; i < grafo.getVerticesGraph().size(); i++) {\r\n\t\t\tretorno += grafo.getVerticesGraph().get(i).getValor() + \" \";\r\n\r\n\t\t\tfor (int j = 0; j < grafo.getVerticesGraph().get(i).getArestas().size(); j++) {\r\n\t\t\t\tretorno += proxVertice(grafo.getVerticesGraph().get(i), grafo.getVerticesGraph().get(i).getArestas().get(j)) + \" \";\r\n\t\t\t}\r\n\r\n\t\t\tretorno += \"/n\";\r\n\t\t}\r\n\r\n\t\treturn retorno;\r\n\t}", "public List<Vertex> runTabuSearch() {\r\n\t\tBestPath = convertPath(ClothestPath.findCycle(this.vertexGraph, this.edgeGraph, this.isOriented));\r\n\t\tLastPath = new ArrayList<Vertex>(BestPath);\r\n\t\tint BestEval = fit(BestPath);\r\n\t\thistoBestPath.add(new ArrayList<Vertex>(BestPath));\r\n\r\n\t\tint iteration_actuel = 0;\r\n\t\twhile (iteration_actuel < this.numberIteration) {\r\n\t\t\tLastPath = newPath();\r\n\t\t\t\r\n\t\t\tif(LastPath.isEmpty()) {\r\n\t\t\t\titerationReal = iteration_actuel;\r\n\t\t\t\treturn BestPath;\r\n\t\t\t}\r\n\r\n\t\t\tif (fit(LastPath) < BestEval) {\r\n\t\t\t\tBestPath = new ArrayList<Vertex>(LastPath);\r\n\t\t\t\tBestEval = fit(LastPath);\r\n\t\t\t\thistoBestPath.add(new ArrayList<Vertex>(BestPath));\r\n\t\t\t}\r\n\r\n\t\t\titeration_actuel++;\r\n\t\t}\r\n\r\n\t\titerationReal = iteration_actuel;\r\n\t\treturn BestPath;\r\n\t}", "private static <V> void recorridoProf(Graph<V> graph, V pInicio, Set<V> pRevisado, Graph<V> grafoNuevo) {\n grafoNuevo.addNode(pInicio);\n pRevisado.put(pInicio);\n List<V> adyacencias = graph.getAdjacentNodes(pInicio);\n for (int x = 1; x <= adyacencias.size(); x++) {\n V adyacencia = adyacencias.get(x);\n if (!pRevisado.isMember(adyacencia)) {\n recorridoProf(graph, adyacencia, pRevisado, grafoNuevo);\n }\n grafoNuevo.addEdge(pInicio, adyacencia, graph.getWeight(pInicio, adyacencia));\n }\n }", "public static void main(String[] args) { \n /* Grafo grafo = new Grafo();\n \n No no;\n no = new No(\"1\");//0\n grafo.addNo(no);\n no = new No(\"2\");//1\n grafo.addNo(no);\n no = new No(\"3\");//2\n grafo.addNo(no);\n no = new No(\"4\");//3\n grafo.addNo(no);\n no = new No(\"5\");//4\n grafo.addNo(no);\n no = new No(\"6\");//5\n grafo.addNo(no);\n no = new No(\"7\");//6\n grafo.addNo(no);\n \n //Cria as arestas do nó\n \n Aresta.inserirAresta(grafo.getNo(0), grafo.getNo(1), 2);\n Aresta.inserirAresta(grafo.getNo(0), grafo.getNo(2), 5);\n Aresta.inserirAresta(grafo.getNo(0), grafo.getNo(3), 4);\n Aresta.inserirAresta(grafo.getNo(1), grafo.getNo(2), 2);\n Aresta.inserirAresta(grafo.getNo(1), grafo.getNo(4), 7);\n Aresta.inserirAresta(grafo.getNo(2), grafo.getNo(3), 1);\n Aresta.inserirAresta(grafo.getNo(2), grafo.getNo(4), 4);\n Aresta.inserirAresta(grafo.getNo(2), grafo.getNo(5), 3);\n Aresta.inserirAresta(grafo.getNo(3), grafo.getNo(5), 4);\n Aresta.inserirAresta(grafo.getNo(4), grafo.getNo(5), 1);\n Aresta.inserirAresta(grafo.getNo(4), grafo.getNo(6), 5);\n Aresta.inserirAresta(grafo.getNo(5), grafo.getNo(6), 7);\n \n No no;\n no = new No(\"SF\");//0\n grafo.addNo(no);\n no = new No(\"LA\");//1\n grafo.addNo(no);\n no = new No(\"D\");//2\n grafo.addNo(no);\n no = new No(\"C\");//3\n grafo.addNo(no);\n no = new No(\"A\");//4\n grafo.addNo(no);\n no = new No(\"B\");//5\n grafo.addNo(no);\n no = new No(\"NY\");//6\n grafo.addNo(no);\n no = new No(\"M\");//7\n grafo.addNo(no);\n \n \n //Cria as arestas do nó\n Aresta.inserirAresta(grafo.getNo(0), grafo.getNo(1), 39);\n Aresta.inserirAresta(grafo.getNo(0), grafo.getNo(2), 89);\n Aresta.inserirAresta(grafo.getNo(0), grafo.getNo(3), 120);\n Aresta.inserirAresta(grafo.getNo(0), grafo.getNo(6), 210);\n Aresta.inserirAresta(grafo.getNo(1), grafo.getNo(2), 50);\n Aresta.inserirAresta(grafo.getNo(1), grafo.getNo(6), 170);\n Aresta.inserirAresta(grafo.getNo(2), grafo.getNo(3), 65);\n Aresta.inserirAresta(grafo.getNo(3), grafo.getNo(5), 79);\n Aresta.inserirAresta(grafo.getNo(3), grafo.getNo(6), 59);\n Aresta.inserirAresta(grafo.getNo(3), grafo.getNo(4), 99);\n Aresta.inserirAresta(grafo.getNo(4), grafo.getNo(6), 80);\n Aresta.inserirAresta(grafo.getNo(4), grafo.getNo(7), 70);\n Aresta.inserirAresta(grafo.getNo(5), grafo.getNo(6), 20);\n Aresta.inserirAresta(grafo.getNo(6), grafo.getNo(7), 66);*/\n \n Grafo grafo = GrafoAleatorioKruskal.gerar(1000, 10, 10, 100);\n //Gera a arvore geradora com custo minimo\n grafo.kruskal();\n \n //TESTE\n int teste = grafo.getNo(0).getConjunto();\n boolean answer = true;\n for(No n : grafo.getNos()){\n if (teste!= n.getConjunto()){\n answer = false;\n }\n }\n if(answer){\n System.out.println(\"Todos os nós pertecem ao mesmo conjunto\");\n }\n else{\n System.out.println(\"Deu erro\");\n }\n }", "public static void ordIntercambio(int [] Grado1, int NNEstudent){\nint i,j;\nfor(i=0; i<NNEstudent-1; i++){\nfor(j=i+1; j<NNEstudent; j++){\nif(Grado1[i]> Grado1[j]){\nintercambiar(Grado1,i,j);\n}}}}", "private void dibujarRuta(Aeropuerto origen, Aeropuerto destino, List<Aeropuerto> mundoA,List<Ruta> mundoR) {\n\t\tList<Ruta> rutaAerolineas = new ArrayList<Ruta>();\n\t\t\n\t\tfor (int i=0;i<mundoR.size();i++){\n\t\t\tif (mundoR.get(i).getIdOrigen().equals(origen.getId()) && mundoR.get(i).getIdDestino().equals(destino.getId())){ \n\t\t\t\t//System.out.println(mundoR.get(i).getAerolinea());\n\t\t\t\trutaAerolineas.add(mundoR.get(i));\n\t\t\t\tNode nodoOrigen = Display.graph.getNode(origen.getId());\n\t\t\t\tNode nodoDestino = Display.graph.getNode(destino.getId());\n\t\t\t\t \n\t\t\t\t//Eliminar todos los nodos y agregar exclusivamente el seleccionado. \n\t\t\t\tfor (int j = 0; j <mundoR.size(); j++){\n\t\t\t\t\ttry{\n\t\t\t\t\t\tDisplay.graph.removeEdge(mundoR.get(j).getId());\n\t\t\t\t\t} catch(Exception e) {};\n\t\t\t\t}\n\t\t\t\t \n\t\t\t\tDisplay.graph.addEdge(mundoR.get(i).getId(), nodoOrigen, nodoDestino);\n\t\t\t\tDisplay.graph.addAttribute(\"ui.stylesheet\", \n\t\t\t\t\t\t\t\t\"\t\t node {shape: circle;\" + \n\t\t\t\t\t\t \t\t\" size: 2px;\" + \n\t\t\t\t\n\t\t\t\t\t\t \t\t\" fill-color: rgba(3, 166, 120,200);}\" + \n\t\t\t\t\t\t \t\t\n\t\t\t\t\t\t \t\t\" edge { shape: cubic-curve;\" +\n\t\t\t\t\t\t \t\t\" fill-mode: gradient-horizontal;\" + \n\t\t\t\t\t\t \t\t\"\t\t fill-color: rgba(250,190,88,250);\"+\t\n\t\t\t\t\t\t \t\t\" z-index: 100;\" + \n\t\t\t\t\t\t \t\t\"\t\t arrow-size: 10px;}\" +\n\t\t\t\t\t\t \t\t\n\t\t\t\t\t\t \t\t\" graph {fill-color: #2C3E50;}\"\n\t\t\t\t);\n\t\t\t\t\n\t\t\t}\n\t\t }\n\t\t\n\t\t\n\t\tif (rutaAerolineas.size() == 0){\n\t\t\tSystem.out.println(\"No hay ruta directa\");\n\t\t\tDijkstraAlgorithm dijkstra = new DijkstraAlgorithm();\n\t\t\tdijkstra.shortestPath(origen, destino, mundoR);\n\t\t\t\n\t\t\t\n\t\t}\n\t\telse {\n\t\t\tViewer viewer = Display.graph.display();\n\t\t\tView view = viewer.getDefaultView();\n\t\t\t //view.getCamera().setViewPercent(1.7);\n\t\t\tviewer.disableAutoLayout(); \n\t\t}\n\t}", "public void checaColision() {\n //Si el proyectil colisiona con la barra entonces..\n if (objBarra.colisiona(objProyectil)) {\n //Guardo el centro x del proyectil para no facilitar su comparacion\n int iCentroProyectil = objProyectil.getX()\n + objProyectil.getAncho() / 2;\n //Si el nivel de Y del lado inferior del proyectil es el mismo que\n //el nivel de Y del lado superior de la barra...\n if (objProyectil.getY() + objProyectil.getAlto()\n >= objBarra.getY()) {\n //Dividimos el ancho de la barra en 2 secciones que otorgan \n //diferente velocidad dependiendo que seccion toque el proyectil\n //Si el centro del proyectil toca la primera parte de la \n //barra o el lado izquierdo del proyectil esta mas a la \n //izquierda que el lado izquierdo de la barra...\n if ((iCentroProyectil > objBarra.getX() && iCentroProyectil\n < objBarra.getX() + objBarra.getAncho() / 2)\n || (objProyectil.getX() < objBarra.getX())) {\n bDireccionX = false; // arriba\n bDireccionY = false; // izquierda\n } //Si el centro del proyectil toca la ultima parte de la barra o\n //el lado derecho del proyectil esta mas a la derecha que el \n //lado derecho de la barra\n else if ((iCentroProyectil > objBarra.getX()\n + (objBarra.getAncho() / 2) && iCentroProyectil\n < objBarra.getX() + (objBarra.getAncho()\n - objBarra.getAncho() / 18)) || (objProyectil.getX()\n + objProyectil.getAncho() > objBarra.getX()\n + objBarra.getAncho())) {\n bDireccionX = true; // arriba\n bDireccionY = false; // derecha\n }\n }\n\n }\n for (Object objeBloque : lnkBloques) {\n Objeto objBloque = (Objeto) objeBloque;\n //Checa si la barra choca con los bloques (Choca con el poder)\n if(objBarra.colisiona(objBloque)) {\n bPoderes[objBloque.getPoder()] = true;\n }\n // Checa si el proyectil choca contra los bloques\n if (objBloque.colisiona(objProyectil)) {\n iScore++; // Se aumenta en 1 el score\n iNumBloques--; //Se resta el numero de bloques\n //Se activa el bloque con el poder para que se mueva para abajo\n if (objBloque.getPoder() != 0) {\n URL urlImagenPoder\n = this.getClass().getResource(\"metanfeta.png\");\n objBloque.setImagen(Toolkit.getDefaultToolkit()\n .getImage(urlImagenPoder));\n objBloque.setVelocidad(2);\n bAvanzaBloque = true;\n }\n if(objProyectil.colisiona(objBloque.getX(), \n objBloque.getY()) ||\n objProyectil.colisiona(objBloque.getX(), \n objBloque.getY()+objBloque.getAlto())) {\n objBloque.setX(getWidth() + 50);\n bDireccionX = false; //va hacia arriba\n }\n if(objProyectil.colisiona(objBloque.getX()+objBloque.getAncho(), \n objBloque.getY()) ||\n objProyectil.colisiona(objBloque.getX()+objBloque.getAncho(), \n objBloque.getY()+objBloque.getAlto())) {\n objBloque.setX(getWidth() + 50);\n bDireccionX = true; //va hacia arriba\n }\n //Si la parte superior de proyectil es mayor o igual a la parte\n //inferior del bloque(esta golpeando por abajo del bloque...\n if((objProyectil.getY() <= objBloque.getY() \n + objBloque.getAlto()) && (objProyectil.getY() \n + objProyectil.getAlto() > objBloque.getY() \n + objBloque.getAlto())) {\n objBloque.setX(getWidth() + 50);\n bDireccionY = true; //va hacia abajo\n \n \n }\n //parte inferior del proyectil es menor o igual a la de la parte\n //superior del bloque(esta golpeando por arriba)...\n else if(( objProyectil.getY() + objProyectil.getAlto()\n >= objBloque.getY())&&( objProyectil.getY() \n < objBloque.getY())) {\n objBloque.setX(getWidth() + 50);\n bDireccionY = false; //va hacia arriba\n }\n //Si esta golpeando por algun otro lugar (los lados)...\n else {\n objBloque.setX(getWidth()+50);\n bDireccionX = !bDireccionX;\n }\n }\n }\n //Si la barra choca con el lado izquierdo...\n if (objBarra.getX() < 0) {\n objBarra.setX(0); //Se posiciona al principio antes de salir\n } //Si toca el lado derecho del Jframe...\n else if (objBarra.getX() + objBarra.getAncho() - objBarra.getAncho() / 18\n > getWidth()) {\n objBarra.setX(getWidth() - objBarra.getAncho() + objBarra.getAncho()\n / 18);// Se posiciciona al final antes de salir\n }\n //Si el Proyectil choca con cualquier limite de los lados...\n if (objProyectil.getX() < 0 || objProyectil.getX()\n + objProyectil.getAncho() > getWidth()) {\n //Cambias su direccion al contrario\n bDireccionX = !bDireccionX;\n } //Si el Proyectil choca con la parte superior del Jframe...\n else if (objProyectil.getY() < 0) {\n //Cambias su direccion al contrario\n bDireccionY = !bDireccionY;\n } //Si el proyectil toca el fondo del Jframe...\n else if (objProyectil.getY() + objProyectil.getAlto() > getHeight()) {\n iVidas--; //Se resta una vida.\n // se posiciona el proyectil en el centro arriba de barra\n objProyectil.reposiciona((objBarra.getX() + objBarra.getAncho() / 2\n - (objProyectil.getAncho() / 2)), (objBarra.getY()\n - objProyectil.getAlto()));\n }\n }", "@Test\r\n\tpublic void testFineTurno() {\r\n\t\tfor (int i = 0; i < 2; i++) {\r\n\t\t\tthis.giocatori.add(new Giocatore());\r\n\t\t\tfor (int j = 0; j < 4; j++) {\r\n\t\t\t\tthis.giocatori.get(i).getFamigliare(j).setPosizionato(true);\r\n\t\t\t}\r\n\t\t}\r\n\t\tthis.giocatoreDiTurno = this.giocatori.get(1);\r\n\t\tassertTrue(this.giocatoreDelTurnoSuccessivo(giocatoreDiTurno) == null);\r\n\t}", "public static Resultado PCF(GrafoMatriz G, Demanda demanda,ListaEnlazada [] ksp,int capacidad){\n \n //*Definicion de variables las variables\n int inicio=0, fin=0,cont; // posicion inicial y final dentro del espectro asi como el contador de FSs contiguos disponibles\n \n int demandaColocada=0; // bandera para controlar si ya se encontro espectro disponible para la demanda.\n int [] OE= new int[capacidad]; //Ocupacion de Espectro.\n ArrayList<ListaEnlazada> kspUbicados = new ArrayList<ListaEnlazada>();\n ArrayList<Integer> inicios = new ArrayList<Integer>();\n ArrayList<Integer> fines = new ArrayList<Integer>();\n ArrayList<Integer> indiceKsp = new ArrayList<Integer>();\n\n //Probamos para cada camino, si existe espectro para ubicar la damanda\n int k=0;\n\n while(k<ksp.length && ksp[k]!=null){\n //Inicializadomos el espectro, inicialmente todos los FSs estan libres\n for(int i=0;i<capacidad;i++){\n OE[i]=1;\n }\n //Calcular la ocupacion del espectro para cada camino k\n for(int i=0;i<capacidad;i++){\n for(Nodo n=ksp[k].getInicio();n.getSiguiente().getSiguiente()!=null;n=n.getSiguiente()){\n //System.out.println(\"v1 \"+n.getDato()+\" v2 \"+n.getSiguiente().getDato()+\" cant vertices \"+G.getCantidadDeVertices()+\" i \"+i+\" FSs \"+G.acceder(n.getDato(),n.getSiguiente().getDato()).getFS().length);\n if(G.acceder(n.getDato(),n.getSiguiente().getDato()).getFS()[i].getEstado()==0){\n OE[i]=0;\n break;\n }\n }\n }\n \n inicio=fin=cont=0;\n for(int i=0;i<capacidad;i++){\n if(OE[i]==1){\n inicio=i;\n for(int j=inicio;j<capacidad;j++){\n if(OE[j]==1){\n cont++;\n }\n else{\n cont=0;\n break;\n }\n //si se encontro un bloque valido, salimos de todos los bloques\n if(cont==demanda.getNroFS()){\n fin=j;\n fines.add(fin);\n inicios.add(inicio);\n demandaColocada=1;\n kspUbicados.add(ksp[k]);\n indiceKsp.add(k);\n //inicio=fin=cont=0;\n break;\n }\n }\n }\n if(demandaColocada==1){\n demandaColocada = 0;\n break;\n }\n }\n k++;\n }\n \n /*if(demandaColocada==0){\n return null; // Si no se encontro, en ningun camino un bloque contiguo de FSs, retorna null.\n }*/\n \n if (kspUbicados.isEmpty()){\n //System.out.println(\"Desubicado\");\n return null;\n }\n \n int [] cortesSlots = new int [2];\n double corte = -1;\n double Fcmt = 9999999;\n double FcmtAux = -1;\n \n int caminoElegido = -1;\n\n //controla que exista un resultado\n boolean nulo = true;\n\n ArrayList<Integer> indiceL = new ArrayList<Integer>();\n \n //contar los cortes de cada candidato\n for (int i=0; i<kspUbicados.size(); i++){\n cortesSlots = Utilitarios.nroCuts(kspUbicados.get(i), G, capacidad);\n if (cortesSlots != null){\n \n corte = (double)cortesSlots[0];\n \n indiceL = Utilitarios.buscarIndices(kspUbicados.get(i), G, capacidad);\n \n double saltos = (double)Utilitarios.calcularSaltos(kspUbicados.get(i));\n \n double slotsDemanda = demanda.getNroFS();\n \n //contar los desalineamientos\n double desalineamiento = (double)Utilitarios.contarDesalineamiento(kspUbicados.get(i), G, capacidad, cortesSlots[1]);\n \n double capacidadLibre = (double)Utilitarios.contarCapacidadLibre(kspUbicados.get(i),G,capacidad);\n \n \n \n \n // double vecinos = (double)Utilitarios.contarVecinos(kspUbicados.get(i),G,capacidad);\n \n\n \n //FcmtAux = corte + (desalineamiento/(demanda.getNroFS()*vecinos)) + (saltos *(demanda.getNroFS()/capacidadLibre)); \n \n FcmtAux = ((saltos*slotsDemanda) + corte + desalineamiento)/capacidadLibre;\n \n if (FcmtAux<Fcmt){\n Fcmt = FcmtAux;\n caminoElegido = i;\n }\n \n nulo = false;\n if (caminoElegido==-1){\n System.out.println(\"Camino Elegido = -1 ..................\");\n }\n \n }\n }\n \n if (caminoElegido==-1){\n System.out.println(\"Camino Elegido = -1 ..................\");\n }\n //caminoElegido = Utilitarios.contarCuts(kspUbicados, G, capacidad);\n \n if (nulo || caminoElegido==-1){\n return null;\n }\n \n Resultado r= new Resultado();\n /*r.setCamino(k-1);\n r.setFin(fin);\n r.setInicio(inicio);*/\n \n r.setCamino(indiceKsp.get(caminoElegido));\n r.setFin(fines.get(caminoElegido));\n r.setInicio(inicios.get(caminoElegido));\n return r;\n }", "public void naplnVrcholy() {\r\n System.out.println(\"Zadajte pocet vrcholov: \");\r\n pocetVrcholov = skener.nextInt();\r\n for (int i=0; i < pocetVrcholov; i++) {\r\n nekonecno = (int)(Double.POSITIVE_INFINITY);\r\n if(i==0) { //pre prvy vrchol potrebujeme nastavit vzdialenost 0 \r\n String menoVrcholu = Character.toString((char)(i+65)); //pretipovanie int na String, z i=0 dostanem A\r\n Vrchol vrchol = new Vrchol(menoVrcholu, 0, \"\"); //vrcholu nastavim vzdialenost a vrcholPrichodu \r\n vrcholy.add(vrchol);\r\n } else { //ostatne budu mat nekonecno alebo v tomto pripade 9999 (lebo tuto hodnotu v mensich grafoch nepresiahnem)\r\n String menoVrcholu = Character.toString((char)(i+65)); //pretipovanie int na String, z i=0 dostanem A\r\n Vrchol vrchol = new Vrchol(menoVrcholu,nekonecno, \"\"); //vrcholu nastavim vzdialenost a vrcholPrichodu \r\n vrcholy.add(vrchol);\r\n }\r\n }\r\n }", "public void CFC() {\n\t\tthis.DFS(null);\n\t\tGrafo d2 = this.reverse();\n\n\t\tList<Vertice> decreasing_f2 = new ArrayList<Vertice>();\n\t\tfor (Vertice v1 : this.vertices.values()) {\n\t\t\tVertice v2 = d2.vertices.get(v1.id);\n\t\t\tv2.size = v1.f;\n\t\t\tdecreasing_f2.add(v2);\n\t\t}\n\t\tCollections.sort(decreasing_f2);\n\n\t\td2.DFS(decreasing_f2);\n\n\t\tthis.reset();\n\t\tfor (Vertice v21 : d2.vertices.values()) {\n\t\t\tVertice v11 = this.vertices.get(v21.id);\n\t\t\tif (v21.parent != null) {\n\t\t\t\tVertice v12 = this.vertices.get(v21.parent.id);\n\t\t\t\tv11.parent = v12;\n\t\t\t}\n\t\t}\n\t}", "public void testEdgesSet_ofVertices() {\n System.out.println(\"edgesSet\");\n\n Graph<Integer, Edge<Integer>> graph = generateGraph();\n\n for (int i = 0; i < 25; i++) {\n for (int j = 0; j < 25; j++) {\n Set<Edge<Integer>> set = graph.edgesSet(new Integer(i), new Integer(j));\n\n if ((i + j) % 2 == 0) {\n Assert.assertEquals(set.size(), 1);\n } else {\n Assert.assertEquals(set.size(), 0);\n }\n }\n }\n }", "public static strictfp void main(String... args) {\n\t\tArrayList<Vertex> graph = new ArrayList<>();\r\n\t\tHashMap<Character, Vertex> map = new HashMap<>();\r\n\t\t// add vertices\r\n\t\tfor (char c = 'a'; c <= 'i'; c++) {\r\n\t\t\tVertex v = new Vertex(c);\r\n\t\t\tgraph.add(v);\r\n\t\t\tmap.put(c, v);\r\n\t\t}\r\n\t\t// add edges\r\n\t\tfor (Vertex v: graph) {\r\n\t\t\tif (v.getNodeId() == 'a') {\r\n\t\t\t\tv.getAdjacents().add(map.get('b'));\r\n\t\t\t\tv.getAdjacents().add(map.get('h'));\r\n\t\t\t} else if (v.getNodeId() == 'b') {\r\n\t\t\t\tv.getAdjacents().add(map.get('a'));\r\n\t\t\t\tv.getAdjacents().add(map.get('c'));\r\n\t\t\t\tv.getAdjacents().add(map.get('h'));\r\n\t\t\t} else if (v.getNodeId() == 'c') {\r\n\t\t\t\tv.getAdjacents().add(map.get('b'));\r\n\t\t\t\tv.getAdjacents().add(map.get('d'));\r\n\t\t\t\tv.getAdjacents().add(map.get('f'));\r\n\t\t\t\tv.getAdjacents().add(map.get('i'));\r\n\t\t\t} else if (v.getNodeId() == 'd') {\r\n\t\t\t\tv.getAdjacents().add(map.get('c'));\r\n\t\t\t\tv.getAdjacents().add(map.get('e'));\r\n\t\t\t\tv.getAdjacents().add(map.get('f'));\r\n\t\t\t} else if (v.getNodeId() == 'e') {\r\n\t\t\t\tv.getAdjacents().add(map.get('d'));\r\n\t\t\t\tv.getAdjacents().add(map.get('f'));\r\n\t\t\t} else if (v.getNodeId() == 'f') {\r\n\t\t\t\tv.getAdjacents().add(map.get('c'));\r\n\t\t\t\tv.getAdjacents().add(map.get('d'));\r\n\t\t\t\tv.getAdjacents().add(map.get('e'));\r\n\t\t\t\tv.getAdjacents().add(map.get('g'));\r\n\t\t\t} else if (v.getNodeId() == 'g') {\r\n\t\t\t\tv.getAdjacents().add(map.get('f'));\r\n\t\t\t\tv.getAdjacents().add(map.get('h'));\r\n\t\t\t\tv.getAdjacents().add(map.get('i'));\r\n\t\t\t} else if (v.getNodeId() == 'h') {\r\n\t\t\t\tv.getAdjacents().add(map.get('a'));\r\n\t\t\t\tv.getAdjacents().add(map.get('b'));\r\n\t\t\t\tv.getAdjacents().add(map.get('g'));\r\n\t\t\t\tv.getAdjacents().add(map.get('i'));\r\n\t\t\t} else if (v.getNodeId() == 'i') {\r\n\t\t\t\tv.getAdjacents().add(map.get('c'));\r\n\t\t\t\tv.getAdjacents().add(map.get('g'));\r\n\t\t\t\tv.getAdjacents().add(map.get('h'));\r\n\t\t\t}\t\r\n\t\t}\r\n\t\t// graph created\r\n\t\t// create disjoint sets\r\n\t\tDisjointSet S = null, V_S = null;\r\n\t\tfor (Vertex v: graph) {\r\n\t\t\tchar c = v.getNodeId();\r\n\t\t\tif (c == 'a' || c == 'b' || c == 'd' || c == 'e') {\r\n\t\t\t\tif (S == null) {\r\n\t\t\t\t\tS = v.getDisjointSet();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tDisjointSet set = DisjointSet.union(S, v.getDisjointSet());\r\n\t\t\t\t\tv.setDisjointSet(set);\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\tif (V_S == null) {\r\n\t\t\t\t\tV_S = v.getDisjointSet();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tDisjointSet set = DisjointSet.union(V_S, v.getDisjointSet());\r\n\t\t\t\t\tv.setDisjointSet(set);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\t// Disjoint sets created\r\n\t\tfor (Vertex u: graph) {\r\n\t\t\tfor (Vertex v: u.getAdjacents()) {\r\n\t\t\t\tif (DisjointSet.findSet((DisjointSet) u.getDisjointSet()) == \r\n\t\t\t\t DisjointSet.findSet((DisjointSet) v.getDisjointSet())) {\r\n\t\t\t\t\tSystem.out.println(\"The cut respects (\" + u.getNodeId() + \", \" + v.getNodeId() + \").\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void testVerticesSet() {\n System.out.println(\"verticesSet\");\n\n Assert.assertTrue(generateGraph().verticesSet().size() == 25);\n }", "Iterable<Long> vertices() {\n //YOUR CODE HERE, this currently returns only an empty list.\n return world.keySet();\n }", "public String findMaxDegree(String parolaInserire) {\n\t\t//System.err.println(\"findMaxDegree -- TODO\");\n\t\t//return -1;\n\t/*Set<String>vertici=grafo.vertexSet();\n\tint maxDegree=0;\n\tString vertexMaxDegree=null;\n\tfor(String vertice: vertici) {\n\t\tint vertexDegree=grafo.degreeOf(vertice);\n\t\tif(vertexDegree>=maxDegree) {\n\t\t\tmaxDegree=vertexDegree;\n\t\t\tvertexMaxDegree=vertice;}\n\t}\n\treturn maxDegree;*/\n\t\tList<String>vicini=Graphs.neighborListOf(grafo, parolaInserire);\n\t\tSet<String>vertici=grafo.vertexSet();\n\t\tint maxDegree=0;\n\t\tString vMaxDegree=null;\n\t\tfor(String parola: vertici) {\n\t\t\tif(vicini.contains(parola)) {\n\t\t\t int pDegree=grafo.degreeOf(parola);\n\t\t\t if(pDegree>=maxDegree) {\n\t\t\t\t maxDegree=pDegree;\n\t\t\t\t vMaxDegree=parola;\n\t\t\t }\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn maxDegree+\" \"+vMaxDegree;\n\t\n\t\t\n\t\t\n\t}", "public static void main(String[] args) {\n\n // create random DAG with V vertices and E aristas; then add F random aristas\n int V = Integer.parseInt(args[0]);\n int A = Integer.parseInt(args[1]);\n int F = Integer.parseInt(args[2]);\n DigrafoAristaPonderada G = new DigrafoAristaPonderada(V);\n int[] vertices = new int[V];\n for (int i = 0; i < V; i++)\n vertices[i] = i;\n StdRandom.shuffle(vertices);\n for (int i = 0; i < A; i++) {\n int v, w;\n do {\n v = StdRandom.uniform(V);\n w = StdRandom.uniform(V);\n } while (v >= w);\n double peso = StdRandom.uniform();\n G.agregarArista(new AristaDirigida(v, w, peso));\n }\n\n // add F extra aristas\n for (int i = 0; i < F; i++) {\n int v = StdRandom.uniform(V);\n int w = StdRandom.uniform(V);\n double peso = StdRandom.uniform(0.0, 1.0);\n G.agregarArista(new AristaDirigida(v, w, peso));\n }\n\n StdOut.println(G);\n\n // find a directed ciclo\n AristaPonderadaDeCicloDirigido descubridor = \n new AristaPonderadaDeCicloDirigido(G);\n if (descubridor.tieneCiclo()) {\n StdOut.print(\"Ciclo: \");\n for (AristaDirigida a : descubridor.ciclo()) {\n StdOut.print(a + \" \");\n }\n StdOut.println();\n }\n\n // or give topologial sort\n else {\n StdOut.println(\"No existen ciclos dirigidos\");\n }\n }", "void findSearchOrder() {\n boolean filled = false;\n for(int node: queryGraphNodes.keySet()) {\n\n vertexClass vc = queryGraphNodes.get(node);\n searchOrderSeq.add(node);\n for(int edge: queryGraphNodes.get(node).edges.keySet()) {\n filled = calcOrdering(edge);\n if (filled)\n break;\n }\n if(searchOrderSeq.size() == queryGraphNodes.size())\n break;\n\n }\n\n }", "private List<Point> getPath(int index) {\n\t\t \n\t \n\t\t Node fromNode = oEdge.fromNode;\n\t\t Node toNode = oEdge.toNode;\n\t\t float x1 = fromNode.longitude;\n\t\t float x2 = toNode.longitude;\n\t\t float y1 = fromNode.latitude;\n\t\t float y2 = toNode.latitude;\n\t\t double slope, angle;\n\t\t if(x1!=x2) {\n\t\t\t slope = (y2-y1)/(x2-x1);\n\t\t\t \tangle = Math.atan(slope);\n\t\t\t \t} else {\n\t\t\t \t\tangle = Math.PI/2;\n\t\t\t \t}\n\t\t Double L = Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));\n\t\t float offsetPixels=0;\n\t\t if(Math.toDegrees(angle)>Math.toDegrees(90)) {\n\t\t\t if (index==0){\n\t\t\t\t offsetPixels=roadWidth*6/10;\n\t\t\t }\n\t\t\t else if(index==1){\n\t\t\t\t offsetPixels=roadWidth*11/10;\n\t\t\t }\n\t\t\t else if(index==-1){\n\t\t\t\t offsetPixels=roadWidth*1/10;\n\t\t\t }\n\t\t\t \n\t\t } else {\n\t\t\t \n\t\t\t if (index==0){\n\t\t\t\t offsetPixels=-roadWidth*6/10;\n\t\t\t }\n\t\t\t else if(index==1){\n\t\t\t\t offsetPixels=-roadWidth*11/10;\n\t\t\t }\n\t\t\t else if(index==-1){\n\t\t\t\t offsetPixels=-roadWidth*1/10;\n\t\t\t }\n\t\t }\n\t\t \n\t\t // This is the first parallel line\n\t\t float x1p1 = x1 + offsetPixels * (y2-y1) / L.floatValue();\n\t\t float x2p1 = x2 + offsetPixels * (y2-y1) / L.floatValue();\n\t\t float y1p1 = y1 + offsetPixels * (x1-x2) / L.floatValue();\n\t\t float y2p1 = y2 + offsetPixels * (x1-x2) / L.floatValue();\n//\t\t if(oEdge.edgeID==16) {\n//\t\t\t System.out.println(\"testing\");\n//\t\t }\n\t\t \n\t\t Point P1 = new Point(x1p1,y1p1);\n\t\t Point P2 = new Point(x2p1,y2p1);\n\t\t List<Point> gP = GetPoints(P1, P2);\n\t\t return gP;\n\t \n\t}", "public List<String> displayNeighbours(String parolaInserita) {\n\t\t/*List<String> risultato=new ArrayList<String>();\n\t\t\n\t\tbackVisit=new HashMap<>();\n\t\t\n\t\t//creo l'iteratore\n\t\tGraphIterator<String, DefaultEdge>iterator=new DepthFirstIterator<>(this.grafo, parolaInserita);\n\t\t\n\t\t//aggiungo all'iteratore il listener\n\t\titerator.addTraversalListener(new Model.EdgeListenerParoleSimili());\n\t\t\n\t\tbackVisit.put(parolaInserita, null);//tutti i nodi hanno un padre, tranne la radice che ne ha zero\n\t\t\n\t\twhile(iterator.hasNext()) {\n\t\t\trisultato.add(iterator.next());\n\t\t}\n\t\t\n\t\treturn risultato;\n\t\t\n\t\t//System.err.println(\"displayNeighbours -- TODO\");\n\t\t//return new ArrayList<String>();*/\n\t\t\n\t\tif(parolaInserita.length()!=listWordsFixedLength.get(0).length()) {\n\t\t\tthrow new RuntimeException(\"La parola inserita ha un numero di lettere diverso dal numero inserito\\n\");\n\t\t}\n\t\tList<String>paroleVicine=new ArrayList<String>();\n\t\tparoleVicine.addAll(Graphs.neighborListOf(grafo, parolaInserita));\n\t\t\n\t\treturn paroleVicine;\n\t}", "public void controlla_collisioni() {\n\n for (int i = punti; i > 0; i--) {\n\n if ((i > 4) && (x[0] == x[i]) && (y[0] == y[i])) {\n in_gioco = false;\n }\n }\n\n if (y[0] >= ALTEZZA+85) { //devo aggungere +85 perche' l'area di gioco comincia dal punto 100,100\n in_gioco = false;\n }\n\n if (y[0] <= 100) {\n in_gioco = false;\n }\n\n if (x[0] >= LARGHEZZA+85) {\n in_gioco = false;\n }\n\n if (x[0] <= 100) {\n in_gioco = false;\n }\n }", "public static ArrayList<Integer[]> compactForwardAlgorithmTriangles(ArrayList<Integer>[] graph) {\n Set<Pair<Integer, ArrayList<Integer>>> pairs = Utils.getSortedArrays(graph);\n Map<Integer, Integer> etas = Utils.getEtasMap(pairs);\n\n // sort adjacency arrays according to eta\n pairs.forEach(p -> p.getSecond().sort(Comparator.comparing(etas::get)));\n\n\n\n int triangleCount = 0;\n ArrayList<Integer[]> triangles = new ArrayList();\n\n\n // main part, in which we actually count triangles\n Iterator<Pair<Integer, ArrayList<Integer>>> iterator = pairs.iterator();\n while (iterator.hasNext()) {\n Pair<Integer, ArrayList<Integer>> pair = iterator.next();\n Integer v = pair.getFirst();\n ArrayList<Integer> v_neighbors = graph[v];\n\n for (int u : v_neighbors) {\n if (etas.get(u) > etas.get(v)) {\n ArrayList<Integer> u_neighbors = graph[u];\n\n Iterator<Integer> uIterator = u_neighbors.iterator(), vIterator = v_neighbors.iterator();\n\n if (uIterator.hasNext() && vIterator.hasNext()) {\n Integer u_ = uIterator.next(), v_ = vIterator.next();\n while (uIterator.hasNext() && vIterator.hasNext() && etas.get(u_) < etas.get(v)\n && etas.get(v_) < etas.get(v)) {\n if (etas.get(u_) < etas.get(v_))\n u_ = uIterator.next();\n else if (etas.get(u_) > etas.get(v_))\n v_ = vIterator.next();\n else {\n Integer[] triangle = new Integer[3];\n\n triangle[0] = u;\n triangle[1] = v;\n triangle[2] = u_;\n triangles.add(triangle);\n\n\n triangleCount++;\n\n u_ = uIterator.next();\n v_ = vIterator.next();\n\n }\n }\n\n }\n }\n }\n }\n return triangles;\n }", "@Test\n public void testShortestPathEstacoes() {\n completeMap = new Graph(false);\n incompleteMap = new Graph(false);\n\n completeMap.insertVertex(porto);\n Company.getParkRegistry().getParkMap().put(porto, portoL);\n completeMap.insertVertex(braga);\n Company.getParkRegistry().getParkMap().put(braga, bragaL);\n completeMap.insertVertex(vila);\n Company.getParkRegistry().getParkMap().put(vila, vilaL);\n completeMap.insertVertex(aveiro);\n Company.getParkRegistry().getParkMap().put(aveiro, aveiroL);\n completeMap.insertVertex(coimbra);\n Company.getParkRegistry().getParkMap().put(coimbra, coimbraL);\n completeMap.insertVertex(leiria);\n Company.getParkRegistry().getParkMap().put(leiria, leiriaL);\n\n completeMap.insertVertex(viseu);\n Company.getParkRegistry().getParkMap().put(viseu, viseuL);\n completeMap.insertVertex(guarda);\n Company.getParkRegistry().getParkMap().put(guarda, guardaL);\n completeMap.insertVertex(castelo);\n Company.getParkRegistry().getParkMap().put(castelo, casteloL);\n completeMap.insertVertex(lisboa);\n Company.getParkRegistry().getParkMap().put(lisboa, lisboaL);\n completeMap.insertVertex(faro);\n Company.getParkRegistry().getParkMap().put(faro, faroL);\n\n completeMap.insertEdge(porto, aveiro, c, 75);\n completeMap.insertEdge(porto, braga, c2, 60);\n completeMap.insertEdge(porto, vila, c3, 100);\n completeMap.insertEdge(viseu, guarda, c4, 75);\n completeMap.insertEdge(guarda, castelo, c5, 100);\n completeMap.insertEdge(aveiro, coimbra, c6, 60);\n completeMap.insertEdge(coimbra, lisboa, c7, 200);\n completeMap.insertEdge(coimbra, leiria, c8, 80);\n completeMap.insertEdge(aveiro, leiria, c9, 120);\n completeMap.insertEdge(leiria, lisboa, c10, 150);\n\n completeMap.insertEdge(aveiro, viseu, c11, 85);\n completeMap.insertEdge(leiria, castelo, c12, 170);\n completeMap.insertEdge(lisboa, faro, c13, 280);\n\n incompleteMap = completeMap.clone();\n\n incompleteMap.removeEdge(aveiro, viseu);\n incompleteMap.removeEdge(leiria, castelo);\n incompleteMap.removeEdge(lisboa, faro);\n\n System.out.println(\"Test of shortest path\");\n\n LinkedList<String> shortPath = new LinkedList<>();\n double lenpath = 0;\n\n Company.getParkRegistry().setGraph(completeMap);\n lenpath = GraphAlgorithms.shortestPathEnergySpent(completeMap, porto, l, shortPath);\n assertTrue(\"Length path should be 0 if vertex does not exist\", lenpath == 0);\n\n Company.getParkRegistry().setGraph(incompleteMap);\n lenpath = GraphAlgorithms.shortestPathEnergySpent(incompleteMap, porto, faro, shortPath);\n assertTrue(\"Length path should be 0 if there is no path\", lenpath == 0);\n\n Company.getParkRegistry().setGraph(completeMap);\n lenpath = GraphAlgorithms.shortestPath(completeMap, porto, porto, shortPath);\n assertTrue(\"Number of nodes should be 1 if source and vertex are the same\", lenpath == 0);\n\n Company.getParkRegistry().setGraph(incompleteMap);\n lenpath = GraphAlgorithms.shortestPath(incompleteMap, porto, lisboa, shortPath);\n assertTrue(\"Path between Porto and Lisboa should be 335 Km\", lenpath == 335);\n\n Iterator<String> it = shortPath.iterator();\n assertTrue(\"First in path should be Porto\", it.next().equals(porto));\n assertTrue(\"then Aveiro\", it.next().equals(aveiro));\n assertTrue(\"then Coimbra\", it.next().equals(coimbra));\n assertTrue(\"then Lisboa\", it.next().equals(lisboa));\n completeMap.insertEdge(porto, lisboa, c, 10);\n\n Company.getParkRegistry().setGraph(incompleteMap);\n lenpath = GraphAlgorithms.shortestPathEnergySpent(incompleteMap, braga, leiria, shortPath);\n assertEquals(\"Path between Braga and Leiria should be close to 152.89\", lenpath, 152, 1);\n\n it = shortPath.iterator();\n\n assertTrue(\"First in path should be Braga\", it.next().equals(braga));\n assertTrue(\"then Porto\", it.next().equals(porto));\n assertTrue(\"then Aveiro\", it.next().equals(aveiro));\n assertTrue(\"then Coimbra\", it.next().equals(coimbra));\n assertTrue(\"then Leiria\", it.next().equals(leiria));\n\n shortPath.clear();\n Company.getParkRegistry().setGraph(completeMap);\n lenpath = GraphAlgorithms.shortestPathEnergySpent(completeMap, porto, castelo, shortPath);\n assertEquals(\"Path between Porto and Castelo Branco should be close to 202.86\", lenpath, 202, 1);\n assertTrue(\"N. cities between Porto and Castelo Branco should be 5 \", shortPath.size() == 5);\n\n it = shortPath.iterator();\n\n assertTrue(\"First in path should be Porto\", it.next().equals(porto));\n assertTrue(\"then Aveiro\", it.next().equals(aveiro));\n assertTrue(\"then Viseu\", it.next().equals(viseu));\n assertTrue(\"then Viseu\", it.next().equals(guarda));\n assertTrue(\"then Castelo Branco\", it.next().equals(castelo));\n\n //Changing Edge: aveiro-viseu with Edge: leiria-C.Branco \n //should change shortest path between porto and castelo Branco\n completeMap.removeEdge(aveiro, viseu);\n completeMap.insertEdge(leiria, castelo, c12, 170);\n shortPath.clear();\n\n Company.getParkRegistry().setGraph(completeMap);\n lenpath = GraphAlgorithms.shortestPath(completeMap, porto, castelo, shortPath);\n assertTrue(\"Path between Porto and Castelo Branco should now be 330 Km\", lenpath == 330);\n assertTrue(\"Path between Porto and Castelo Branco should be 4 cities\", shortPath.size() == 4);\n\n }", "private boolean iguales(Pares f){\n\t\t\tboolean devolucion = false;\n\t\t\t\n\t\t\tif(f!=null){\n\t\t\t\tif(primero.iguales(f.getSegundo())){\n\t\t\t\t\tif(segundo.iguales(f.getPrimero())){\n\t\t\t\t\t\tif(distancia==f.getDistancia()){\n\t\t\t\t\t\t\tdevolucion=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\t\n\t\t\t\n\t\t\treturn devolucion;\n\t\t}", "private boolean existeNegro(Vertice<T> v){\n\tif(v == null)\n\t return true;\n\tif(v.color == Color.NEGRO)\n\t return true;\n\treturn false;\n }", "private static void noDirigido(TraductorGrafo grafo){\r\n\r\n\t\t// Inicializa variable booleana que almacena si el grafo es no dirigido\r\n\t\tboolean esNoDirigido = true;\r\n\r\n\t\t// Itera sobre la matriz de adyacencias del grafo verificando que paratodo i,j se cumple que\r\n\t\t// grafo[i][j] == grafo[j][i]\r\n\t\tfor(int i=0;i<grafo.grafo.length;i++){\r\n\t\t\tfor(int j=0;j<grafo.grafo.length;j++){\r\n\t\t\t\tif(grafo.grafo[i][j] != grafo.grafo[j][i]){\r\n\t\t\t\t\t// En caso de encontrar un caso para el cual no se cumple, se asigna a la variable booleana false\r\n\t\t\t\t\tesNoDirigido = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\t// Verifica el estado de la variable booleana, y dependiendo de este imprime el mensaje correspondiente\r\n\t\tif(esNoDirigido){\r\n\t\t\tSystem.out.println(\"El grafo es no dirigido\");\r\n\t\t} else {\r\n\t\t\tSystem.out.println(\"El grafo es dirigido\");\r\n\t\t}\r\n\r\n\t}", "public int vecinos(){\n int v=0;\n if(fila<15 && columna<15 && fila>0 && columna>0){\n if(automata.getElemento(fila,columna-1)!=null && automata.getElemento(fila,columna-1).isVivo()){v++;}\n if(automata.getElemento(fila+1,columna-1)!=null && automata.getElemento(fila+1,columna-1).isVivo()){v++;}\n if(automata.getElemento(fila+1,columna)!=null && automata.getElemento(fila+1,columna).isVivo()){v++;} \n if(automata.getElemento(fila+1,columna+1)!=null && automata.getElemento(fila+1,columna+1).isVivo()){v++;}\n if(automata.getElemento(fila,columna+1)!=null && automata.getElemento(fila,columna+1).isVivo()){v++;}\n if(automata.getElemento(fila-1,columna+1)!=null && automata.getElemento(fila-1,columna+1).isVivo()){v++;}\n if(automata.getElemento(fila-1,columna)!=null && automata.getElemento(fila-1,columna).isVivo()){v++;}\n if(automata.getElemento(fila-1,columna-1)!=null && automata.getElemento(fila-1,columna-1).isVivo()){v++;}\n }\n else{v=limitesX();}\n return v;\n }", "int getNumberOfVertexes();", "private void preenchePosicoes(List<Par<Integer,Integer>> posicoes, \n\t\t\tEstadoAmbiente estado) {\n\t\tfor (Par<Integer,Integer> p : posicoes) {\n\t\t\tthis.quadricula[p.primeiro()][p.segundo()] = estado;\n\t\t}\n\t}", "@Test\n void test01_addVertex() {\n graph.addVertex(\"a\");\n graph.addVertex(\"b\"); // adds two vertices\n\n Set<String> vertices = new LinkedHashSet<>();\n vertices.add(\"a\");\n vertices.add(\"b\"); // creates a check list to compare with\n\n if (!graph.getAllVertices().equals(vertices)) {\n fail(\"Graph didn't add the vertices correctly\");\n }\n }", "@Override\r\n public void paint(Graphics g) {\n super.paint(g);\r\n Color col = new Color(255, 255, 255);//color gris\r\n g.drawLine(0, 20, 245, 20);//pinta una linea en la parte superior de la ventana\r\n Dimension size = getSize();//encapsula el tamñao de un objeto\r\n int parteSuperiorTablero = (int) size.getHeight() - altoTablero * alturaPieza();\r\n\r\n for (int i = 0; i < altoTablero; ++i) {\r\n for (int j = 0; j < anchoTablero; ++j) {\r\n PiezasTetris pieza = dimensionar(j, altoTablero - i - 1);\r\n if (pieza != PiezasTetris.NoPieza) {\r\n pintarPiezas(g, 0 + j * anchoPieza(),\r\n parteSuperiorTablero + i * alturaPieza(), pieza);\r\n }\r\n }\r\n }\r\n\r\n if (piezaActual.getPieza() != PiezasTetris.NoPieza) {\r\n for (int i = 0; i < 4; ++i) {\r\n int x = posicionX + piezaActual.x(i);\r\n int y = posicionY - piezaActual.y(i);\r\n pintarPiezas(g, 0 + x * anchoPieza(),\r\n parteSuperiorTablero + (altoTablero - y - 1) * alturaPieza(),\r\n piezaActual.getPieza());\r\n }\r\n }\r\n }", "@Test\n void test08_getAllAdjacentVertices() {\n graph.addEdge(\"a\", \"b\");\n graph.addEdge(\"a\", \"c\"); // add two edges\n\n List<String> check = new ArrayList<>();\n check.add(\"b\");\n check.add(\"c\"); // create mock up adjacent list\n\n if (!check.equals(graph.getAdjacentVerticesOf(\"a\"))) { // checks if both are same\n fail(\"graph didn't record adjacent vertices correctly\");\n }\n }", "public void ganarDineroPorAutomoviles() {\n for (Persona p : super.getMundo().getListaDoctores()) {\n for (Vehiculo v : p.getVehiculos()) {\n v.puedeGanarInteres();\n v.setPuedeGanarInteres(false);\n }\n }\n for (Persona p : super.getMundo().getListaCocineros()) {\n for (Vehiculo v : p.getVehiculos()) {\n v.puedeGanarInteres();\n v.setPuedeGanarInteres(false);\n }\n }\n for (Persona p : super.getMundo().getListaAlbaniles()) {\n for (Vehiculo v : p.getVehiculos()) {\n v.puedeGanarInteres();\n v.setPuedeGanarInteres(false);\n }\n }\n for (Persona p : super.getMundo().getListaHerreros()) {\n for (Vehiculo v : p.getVehiculos()) {\n v.puedeGanarInteres();\n v.setPuedeGanarInteres(false);\n }\n }\n for (Persona p : super.getMundo().getListaCocineros()) {\n for (Vehiculo v : p.getVehiculos()) {\n v.puedeGanarInteres();\n v.setPuedeGanarInteres(false);\n }\n }\n }", "@Override\n public Combinacion comprobarColores(Combinacion filaIntroducida) {\n Combinacion respuesta;\n\n\n ArrayList<Ficha> combinacionRespuesta = new ArrayList<>();\n ArrayList<Integer> fichasNegrasUtilizadas = new ArrayList<>();\n ArrayList<Integer> fichasTotalesUtilizadas = new ArrayList<>();\n boolean comprobado = false;\n Colores color = Colores.SC;\n\n // COMPROBAMOS LAS NEGRAS\n for (int i = 0; i < filaIntroducida.getCodigo().length; i++) {\n if (filaIntroducida.getCodigo()[i].equals(tablero.getCombinacionOculta().getCodigo()[i])) {\n combinacionRespuesta.add(new Ficha(Colores.NEGRO));\n fichasNegrasUtilizadas.add(i);\n }\n }\n\n fichasTotalesUtilizadas.addAll(fichasNegrasUtilizadas);\n // SEPARAMOS NEGRAS DE BLANCAS\n\n for (int i = 0; i < filaIntroducida.getCodigo().length; i++) {\n if (!fichasNegrasUtilizadas.contains(i)) {\n for (int j = 0; j < filaIntroducida.getCodigo().length && !comprobado; j++) {\n if (!fichasTotalesUtilizadas.contains(j)) {\n if (filaIntroducida.getCodigo()[i].equals(tablero.getCombinacionOculta().getCodigo()[j])) {\n color = Colores.BLANCO;\n fichasTotalesUtilizadas.add(j);\n comprobado = true;\n } else {\n color = Colores.SC;\n }\n }\n }\n combinacionRespuesta.add(new Ficha(color));\n comprobado = false;\n }\n }\n\n combinacionRespuesta.sort(new Comparator<Ficha>() {\n @Override\n public int compare(Ficha o1, Ficha o2) {\n return o1.getColor().compareTo(o2.getColor());\n }\n });\n\n respuesta = new Combinacion(combinacionRespuesta.toArray(new Ficha[combinacionRespuesta.size()]));\n\n // MODO MEDIO Y FACIL\n\n return respuesta;\n }", "List<V> getAdjacentVertexList(V v);" ]
[ "0.6639431", "0.6427557", "0.61404115", "0.60104185", "0.59356564", "0.58986205", "0.58888453", "0.5883023", "0.5814847", "0.58061224", "0.5805326", "0.57672536", "0.576528", "0.57583255", "0.57495874", "0.5744372", "0.57158923", "0.5671707", "0.56504977", "0.56423765", "0.56420445", "0.5628666", "0.5616762", "0.56110233", "0.5607159", "0.5599789", "0.5590236", "0.55773073", "0.55766755", "0.55641055", "0.55574924", "0.55555874", "0.5541727", "0.55309504", "0.55296534", "0.55258787", "0.5498449", "0.549693", "0.54684347", "0.5464692", "0.54477674", "0.54469985", "0.54398966", "0.5427185", "0.5423914", "0.5412238", "0.54088485", "0.5407982", "0.540228", "0.53792924", "0.5377304", "0.5374089", "0.5372358", "0.5367097", "0.53624254", "0.53504425", "0.53477305", "0.5345729", "0.5339706", "0.5330595", "0.532593", "0.53257036", "0.5318827", "0.53111285", "0.53061634", "0.53046757", "0.53015524", "0.5292628", "0.5282846", "0.5278317", "0.52722704", "0.52713233", "0.52662325", "0.52519315", "0.5243669", "0.5240643", "0.52370876", "0.5230955", "0.52308106", "0.52268946", "0.5216836", "0.521506", "0.52098995", "0.5207086", "0.5199828", "0.5197348", "0.5189132", "0.51839924", "0.51836616", "0.518265", "0.518201", "0.5181732", "0.51789767", "0.51787597", "0.51771057", "0.51761156", "0.5172546", "0.516647", "0.51663214", "0.51643133", "0.5160392" ]
0.0
-1
Corre um array de divisoes e escolhe uma divisao aliatoriamente
public String randomRoom() throws EmptyExcpetion{ String[] divisoes = guardaDivisoes(); Random random = new Random(); int temp=0; do{ temp = random.nextInt(divisoes.length); }while(divisoes[temp]==null); return divisoes[temp]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private static void div(int[] numbers) {\n\t\tint sum=-1;\n\t\ttry {\n\t\t\tsum = numbers[0] / numbers[1];\n\t\t\tSystem.out.println(sum);\n\t\t} catch (ArithmeticException ex) {\n\t\t\tSystem.out.println(\"Sie dürfen um gottes Willen nicht durch NULL dividieren!\");\n\t\t\tex.printStackTrace();\n\t\t}\n\t\t\n\t}", "public static int[] Divide (int[] ar)\n\t{\n\t if(ar.length<= 1)//that means we're done dividing the array\n\t {\n\t\t return ar; \n\t }\n\t int middle = ar.length/2;//dividing the array \n\t int [] left = new int [middle]; //this will be the left side of new array\n\t int [] right; //this will be the right side of new array but we need to know if the array's length is even or odd number\n\t if(ar.length %2 ==0)//if the length is even\n\t {\n\t\t right = new int [middle]; //if the length is even\n\t }\n\t else\n\t {\n\t\t right = new int [middle+1];//if the length is odd\n\t }\n\t int [] result = new int [ar.length];//this will be the new array after dividing\n\t \n\t for(int i=0;i<middle;i++)//fill the left side from 0 to the middle point\n\t {\n\t\t left[i]=ar[i];\n\t }\n\t for(int j=middle; j <ar.length;j++)//fill the right side from middle point which will have 0 to the end of array\n\t {\n\t\t int k =0; \n\t\t if(k < right.length)\n\t\t {\n\t\t right[k]=ar[j];\n\t\t k++;\n\t }\n\t }\n\t left = Divide(left);\n\t right = Divide(right);\n\t result = Merge(left,right);\n\t return result;\n\t \n\t \n\t \n\t}", "private String[] guardaDivisoes() throws EmptyExcpetion{\n\n String[] salasSemInimigo = new String[this.divisoes.size()];\n int contador=0;\n\n\n for(int i=0;i<this.getDivisoes().size();i++){\n\n String divisao = this.getDivisoes().iteratorBFS(i).next();\n\n if(verificaSeEInimigo(divisao)==false){\n salasSemInimigo[contador]=divisao;\n contador++;\n }\n }\n\n return salasSemInimigo;\n }", "public double[][] division()\n\t{\n\t\trank = 0;\n\t\tint pivR = 0;\n\t\tfor(int h = 0; h < cols && pivR < rows; h++) //for each col of A\n\t\t{\n\t\t\tif(A[pivR][h] != 0) //there's a pivot in this col\n\t\t\t{\t\n\t\t\t\trank++;\n\t\t\t\tdouble denom = A[pivR][h]; //thing to divide by\n\t\t\t\tfor(int i = 0; i < cols+1; i++)\n\t\t\t\t{\n\t\t\t\t\tA[pivR][i] /= denom; \n\n\n\t\t\t\t}\n\t\t\t\tpivR++;\n\t\t\t}\n\t\t}\n\t\tif(rank == cols) {numSols = 1;}\n\t\telse if(rank < cols) {numSols = 2;}\n\t\treturn A;\n\t}", "public void enfoncerDiv() {\n\t\ttry {\n\t\t\tthis.op = new Div();\n\t\t\tif (!raz) {\n\t\t\t\tthis.pile.push(valC);\n\t\t\t}\n\t\t\tint a = this.pile.pop(); int b = this.pile.pop();\n\t\t\tthis.valC = this.op.eval(b,a);\n\t\t\tthis.pile.push(this.valC);\n\t\t\tthis.raz = true;\n\t\t}\n\t\tcatch (ArithmeticException e) {\n\t\t\tSystem.out.println(\"Erreur : Division par zero !\");\n\t\t}\n\t\tcatch (EmptyStackException e) {\n\t\t\tSystem.out.println(\"Erreur de syntaxe : Saisir deux operandes avant de saisir un operateur\");\n\t\t}\n\t}", "public static void main(String[] args) {\n int v1[] = new int[50];\r\n int v2[] = new int[50];\r\n int posicao_v2 = 0;\r\n int quantidade_divisores = 0;\r\n //preenche o vetor de 1 a 50 \r\n for (int i = 0; i < 50; i++) {\r\n v1[i] = i + 1;\r\n\r\n }\r\n \r\n \r\n //procura numero primos no vetor\r\n for (int i = 0; i < v1.length; i++) {\r\n //testar se v1[i] e um numero primo\r\n //Um número é divisível por outro quando o resto da divisão entre os dois é igual a zero\r\n quantidade_divisores = 0;\r\n //calcula a quatidade de divisores\r\n for (int j = 0; j < v1[i]; j++) {\r\n if (v1[i] % v1[j] == 0) {\r\n quantidade_divisores++;\r\n //sera divisivel\r\n }\r\n }\r\n if (quantidade_divisores == 2 ){\r\n //e primo \r\n v2[posicao_v2] = v1[i];\r\n posicao_v2++;\r\n }\r\n \r\n \r\n \r\n\r\n }\r\n for (int i = 0; i < 50; i++) {\r\n System.out.print(v1[i]+\" \");\r\n \r\n }\r\n System.out.println();\r\n for (int i = 0; i < 50; i++) {\r\n if (v2[i] > 0) {\r\n System.out.print(\"v1{\");\r\n System.out.print(v2[i]+\" , }\");\r\n }\r\n \r\n \r\n \r\n }\r\n \r\n System.out.println();\r\n }", "public final void div() {\n\t\tif (size > 1) {\n\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (topMostValue > 0) {\n\t\t\t\tpush(secondTopMostValue / topMostValue);\n\t\t\t}\n\t\t}\n\t}", "public static void main(String[] args) throws java.lang.Exception {\n\t\tScanner s = new Scanner(System.in);\n\t\tint a = s.nextInt();\n\t\t// output the sum of divisors of numbers in an array having exactly 4 divisors.\n\n\t\tfor (int i = 0; i < a; i++) {\n\t\t\tint len = s.nextInt();\n\t\t\tint[] subsequence = new int[len];\n\t\t\tint key = 0;\n\t\t\tint[] div = new int[len];\n\t\t\tint[] div1 = new int[len];\n\t\t\tint sum = 0;\n\t\t\tfor (int j = 0; j < len; j++) {\n\n\t\t\t\tsubsequence[j] = s.nextInt();\n\t\t\t\tint d = (int) Math.sqrt(subsequence[j]);\n\t\t\t\tif (d * d == subsequence[j])\n\t\t\t\t\tcontinue;\n\t\t\t\tboolean f = false;\n\t\t\t\tfor (int k = 2; k <= d; k++) {\n\t\t\t\t\tif (subsequence[j] % k == 0) {\n\t\t\t\t\t\tif (div1[key] == 0) {\n\t\t\t\t\t\t\tdiv1[key] = k;\n\t\t\t\t\t\t\tdiv[key] = subsequence[j];\n\t\t\t\t\t\t\tf = true;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tf = false;\n\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\tif (f) {\n\t\t\t\t\tkey++;\n\t\t\t\t}\n\n\t\t\t\t\n\n\t\t\t}\n\t\t\tint n = 0;\n\t\t\tfor (int k = 0; k < key; k++) {\n\t\t\t\tn = div[k] / div1[k];\n\t\t\t\tsum += 1 + div[k] + div1[k] + n;\n\t\t\t}\n\t\t\tSystem.out.println(sum);\n\n\t\t}\n\n\t\ts.close();\n\n\t}", "@Override\n public void crunch(float values[]){\n int biggest = 0;\n int smallest = 0;\n\n for(int j = 0; j <= values.length -1; j++){\n for(int i = 0; i <= values.length -1; i++){\n if(values[i+1] > values[i]){\n biggest = i+1;\n smallest = i;\n } else{\n biggest = i;\n smallest = i+1;\n }\n }\n if(smallest != 0){\n values[biggest] /= values[smallest];\n }\n }\n }", "static int[] modifiedArrayWithDivision(int[] original) {\n\t\tint[] newArr = new int[original.length];\n\t\tint totalProduct = 1;\n\t\t\n\t\t// Get the product of all numbers in array\n\t\tfor (int i = 0; i < original.length; i++) {\n\t\t\ttotalProduct *= original[i];\n\t\t}\n\t\t\n\t\t// Divide product by int at index to determine final array\n\t\tfor (int i = 0; i < newArr.length; i++) {\n\t\t\tnewArr[i] = totalProduct / original[i];\n\t\t}\n\t\t\n\t\treturn newArr;\n\t}", "private double selectDivisor( double v[], double param[] ) {\n\n\t\tdouble maxValue = 0;\n\t\tint maxIndex = 0;\n\t\tfor (int i = 0; i < v.length; i++) {\n\t\t\tif (Math.abs(v[i]) > maxValue) {\n\t\t\t\tmaxValue = Math.abs(v[i]);\n\t\t\t\tmaxIndex = i;\n\t\t\t}\n\t\t}\n\n\t\tdouble divisor = v[maxIndex];\n\n\t\tint index = 0;\n\t\tfor (int i = 0; i < v.length; i++) {\n\t\t\tv[i] /= divisor;\n\n\t\t\tif (i != maxIndex) {\n\t\t\t\t// save first 5 parameters\n\t\t\t\tparam[index] = v[i];\n\t\t\t\t// save indexes in the matrix\n\t\t\t\tint col = i < 3 ? col0 : col1;\n\t\t\t\tindexes[index++] = 3*(i%3) + col;\n\t\t\t}\n\t\t}\n\n\t\t// index of 1\n\t\tint col = maxIndex >= 3 ? col1 : col0;\n\t\tindexes[5] = 3*(maxIndex%3) + col;\n\n\t\treturn divisor;\n\t}", "public void divide(double skalar) {\r\n for (int i = 0; i < matrix.length; i++) {\r\n for (int j = 0; j < matrix[0].length; j++) {\r\n matrix[i][j] /= skalar;\r\n }\r\n }\r\n }", "public void calcularEntropia(){\n //Verificamos si será con la misma probabilida o con probabilidad\n //especifica\n if(contadorEstados == 0){\n //Significa que será con la misma probabilidad por lo que nosotros\n //calcularemos las probabilidades individuales\n for(int i = 0; i < numEstados; i++){\n probabilidadEstados[i] = 1.0 / numEstados;\n }\n }\n for(int i = 0; i < numEstados; i++){\n double logEstado = Math.log10(probabilidadEstados[i]);\n logEstado = logEstado * (-1);\n double logDos = Math.log10(2);\n double divisionLog = logEstado / logDos;\n double entropiaTmp = probabilidadEstados[i] * divisionLog;\n resultado += entropiaTmp;\n }\n }", "public static void promedio(int [] Grado1, int NNEstudent){\nint aux=0;\nfor(int i=0;i<NNEstudent;i++){\naux=Grado1[i]+aux;}\nint promedio;\npromedio=aux/NNEstudent;\nSystem.out.println(aux);\nSystem.out.println(\"el promedio de las edades es:\");\nSystem.out.println(promedio);\n}", "public void ex() {\n int inches = 86; \n int pie = 12; //1 pie = 12 inches \n //Operaciones para obtener la cantidad de pies e inches\n int cant = inches / pie; \n int res = inches % pie;\n //Muestra de resultados\n System.out.println(inches + \" pulgadas es equivalente a\\n \" + \n cant + \" pies \\n \" + res + \" pulgadas \");\n }", "public void notaFinal() {\n\n for (int i = 0; i <= (nombres.size() - 1); i++) {\n\n notaFinal.add((notas.get(0) + notas.get(1) + notas.get(2)) / 3);\n\n }\n\n }", "public Fraccion division() {\r\n Fraccion division = new Fraccion(operador1.getNumerador()*operador2.getDenominador() , operador1.getDenominador()*operador2.getNumerador());\r\n return simplify(division);\r\n }", "public static final int[] get_DIVIDE(){\n\t\t\n\t\treturn get_MINUS();\n\t}", "public static int[] divisors(int n) {\n\t\tList<Integer> lista= new ArrayList(); // lista en vez de array por desconocer su tamaño\n\t\tint divisor=n;\n\n\t\tif(n<=0)\n\t\t\treturn null;\n\t\t/* n es valido */\n\t\twhile(divisor>0){\n\t\t\tif(n%divisor==0){\n\t\t\t\tlista.add(divisor);\n\t\t\t\tdivisor--;\n\t\t\t}else{\n\t\t\t\tdivisor--;\n\t\t\t}\n\t\t}\n\t\t/* paso de lista a array */\n\t\tint divisores[]=new int[lista.size()];\n\t\tfor (int i=0;i<lista.size();i++)\n\t\t\tdivisores[i]=lista.get(i);\n\n\t\treturn divisores;\n\n\t}", "public static void main(String[] args) {\n\t\t\r\n\t\t\r\n\t\tArrayOfFraction arr1= new ArrayOfFraction();\r\n\t\tarr1.add(new Fraction(3,1));\r\n\t\tarr1.add(new Fraction(4,2));\r\n\t\tarr1.add(new Fraction(5,3));\r\n\t\tarr1.add(new Fraction(6,7));\r\n\t\t\r\n\t\tfor(int i=0;i<arr1.size();i++)\r\n\t\t{\r\n\t\t\tSystem.out.println(arr1.a[i].divide());\r\n\t\t}\r\n//\t\tFraction fr1 = new Fraction();\r\n//\t\tfr1.input();\r\n//\t\tarr1.add(fr1);\r\n//\t\t\r\n//\t\tFraction fr2 = new Fraction();\r\n//\t\tfr2.input();\r\n//\t\tarr1.add(fr2);\r\n//\t\t\r\n//\t\tFraction fr3 = new Fraction();\r\n//\t\tfr3.input();\r\n//\t\tarr1.add(fr3);\r\n//\t\t\r\n//\t\tarr1.output();\r\n\t\t\r\n//\t\tSystem.out.println(\"get ra gia tri index: \"+arr1.get(0));\r\n\r\n//\t\tFraction fr4 = new Fraction();\r\n//\t\tfr4.input();\r\n//\t\tarr1.set(2,fr4 );\r\n//\t\tarr1.output();\r\n//\t\t\r\n//\t\t\r\n//\t\tFraction fr5 = new Fraction();\r\n//\t\tfr5.input();\r\n//\t\tarr1.add(1, fr5);\r\n//\t\tarr1.output();\r\n\t\t\r\n//\t\tarr1.remove(2);\r\n//\t\tarr1.output();\r\n\t\t\r\n//\t\tFraction fr6 = new Fraction();\r\n//\t\tfr6.input();\r\n//\t\tSystem.out.println(arr1.indexOf(fr6));\r\n\t\t\r\n//\t\tFraction fr7 = new Fraction();\r\n//\t\tfr7.input();\r\n//\t\tSystem.out.println(arr1.indexOf(r7));\r\n\t\t\r\n\t\t\r\n//\t\tSystem.out.println(arr1.toString());\r\n\t\t\r\n\t}", "@org.junit.Test\n public void testDiviseurs() {\n //given\n long n = 9;\n Parfait instance = new Parfait();\n long[] expResult = {1, 9, 3};\n\n //when\n long[] result = instance.diviseurs(n);\n\n //then\n assertArrayEquals(expResult, result);\n }", "private static String[] calculateAllMultiplicationsAndDivisions(String[] formulaArray){\n Integer operatorPosition = getMultiplicationOrDivisionPosition(formulaArray);\n while(operatorPosition!=-1){\n try {\n formulaArray = calculateMultiplicationOrDivision(formulaArray, operatorPosition);\n }catch(Exception e){\n System.err.println(e);\n }\n operatorPosition= getMultiplicationOrDivisionPosition(formulaArray);\n }\n return formulaArray;\n\n }", "public double calculaMedia(int[] vals) {\n if (vals == null) {\n System.out.println(\"vals == null: Como indicar que aconteceu um\" +\n \" erro e interromper a execucao normal do metodo \" +\n \"calculaMedia?\");\n }\n\n int soma = 0;\n for(int val : vals) {\n soma += val;\n }\n\n return soma / vals.length;\n }", "public void reduce()\n\t{\n\t\tint divider = getGCD(myNumerator, myDenominator);\n\t\tmyNumerator /= divider;\n\t\tmyDenominator /= divider;\n\t}", "public double[] Normalizar(int[] v){\n double[] result=new double[v.length];\n double s=0;\n for (int i=0;i<v.length;i++){\n s+=v[i];\n }\n for (int i=0;i<v.length;i++){\n result[i]=(double)v[i]/(double)s;\n }\n\n return result;\n }", "public void MOD( ){\n String tipo1 = pilhaVerificacaoTipos.pop().toString();\n String tipo2 = pilhaVerificacaoTipos.pop().toString();\n String val1 = dads.pop().toString();\n float fresult = -1;\n String val2 = dads.pop().toString();\n if(val1 != null && val2 != null){\n if (tipo1 != null && tipo2 != null){\n if(tipo1 == \"inteiro\" && tipo2 == \"real\"){\n if(Float.parseFloat(val2) != 0){\n fresult = Integer.parseInt(val1) % Float.parseFloat(val2);\n dads.push(fresult);\n pilhaVerificacaoTipos.push(\"real\");\n }\n else{\n mensagensErrosVM += \"\\nRUNTIME ERROR(5): impossível realizar a operação. O valor do dividendo deve ser maior que zero\";\n numErrVM += 1;\n }\n }else if(tipo1 == \"real\" && tipo2 ==\"inteiro\"){\n if(Float.parseFloat(val1) != 0){\n fresult = Integer.parseInt(val2) % Float.parseFloat(val1);\n dads.push(fresult);\n pilhaVerificacaoTipos.push(\"real\");\n }\n else{\n mensagensErrosVM += \"\\nRUNTIME ERROR(5): impossível realizar a operação. O valor do dividendo deve ser maior que zero\";\n numErrVM += 1;\n }\n }else if(tipo1 == \"real\" && tipo2 ==\"real\"){\n if(Float.parseFloat(val1) != 0){\n fresult = Float.parseFloat(val2) % Float.parseFloat(val1);\n dads.push(fresult);\n pilhaVerificacaoTipos.push(\"real\");\n }\n else{\n mensagensErrosVM += \"\\nRUNTIME ERROR(5): impossível realizar a operação. O valor do dividendo deve ser maior que zero\";\n numErrVM += 1;\n }\n }else if(tipo1 == \"inteiro\" && tipo2 ==\"inteiro\"){\n if(Integer.parseInt(val1) != 0){\n fresult = Integer.parseInt(val2) % Integer.parseInt(val1);\n dads.push(fresult);\n pilhaVerificacaoTipos.push(\"real\");\n }\n else{\n mensagensErrosVM += \"\\nRUNTIME ERROR(5): impossível realizar a operação. O valor do dividendo deve ser maior que zero\";\n numErrVM += 1;\n return;\n }\n }\n else{\n mensagensErrosVM += \"\\nRUNTIME ERROR(1): essa instrução é válida apenas para valores inteiros ou reais.\";\n numErrVM += 1;\n return;\n }\n }else{\n mensagensErrosVM += \"\\nRUNTIME ERROR(2): não foi possível executar a instrução, tipo null encontrado.\";\n numErrVM += 1;\n return;\n }\n }else {\n mensagensErrosVM += \"\\nRUNTIME ERROR(3): não foi possível executar a instrução, valor null encontrado.\";\n numErrVM += 1;\n return;\n }\n\n\n topo += -1;\n ponteiro += 1;\n }", "public static void main (String args[]) {\n int[] numero = new int[10];\n int[] primo = new int[10];\n int[] noPrimo = new int[10];\n //Variables\n int contPrimo = 0;\n int contNoPrimo = 0;\n int contA = 0;\n \n //Bucle para pedir los números\n System.out.println(\"Introduce los valores del array\");\n for (int i = 0; i < numero.length; i++) {\n System.out.println(\"-\");\n numero[i] = Integer.parseInt(System.console().readLine());\n \n //Comprobar si no es primo\n if ( (numero[i] != 2) || (numero[i]/2 == 0) ){\n noPrimo[contNoPrimo] = numero[i];\n contNoPrimo ++;\n }else {\n primo[contPrimo] = numero[i];\n contPrimo ++;\n }\n }\n //Mostrar la tabla con los valores del array original\n System.out.print(\"Índice: \");\n for (int j = 0; j < numero.length;j++){\n contA = j;\n System.out.printf(\"%4d \", contA);\n \n }\n System.out.print(\"\\nValor: \");\n System.out.print(\" ┏━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━┳━━━━━┓\");\n \n \n \n \n\t}", "public void OrdenarIndividuos(int izq, int der) {\n Individuo pivote = (Individuo) individuos.get(izq); // tomamos primer elemento como pivote\r\n int i = izq; // i realiza la búsqueda de izquierda a derecha\r\n int j = der; // j realiza la búsqueda de derecha a izquierda\r\n Individuo ind;\r\n int aux;\r\n\r\n while (i < j) { // mientras no se crucen las búsquedas\r\n while (individuos.get(i).getEvaluacion() <= pivote.getEvaluacion() && i < j) {\r\n i++; // busca elemento mayor que pivote\r\n }\r\n while (individuos.get(j).getEvaluacion() > pivote.getEvaluacion()) {\r\n j--; // busca elemento menor que pivote\r\n }\r\n if (i < j) {\r\n ind = (Individuo) individuos.get(i); // si no se han cruzado \r\n //aux= A[i]; // los intercambia\r\n individuos.set(i, individuos.get(j));\r\n //A[i]=A[j];\r\n individuos.set(j, ind);\r\n //A[j]=aux;\r\n }\r\n }\r\n individuos.set(izq, individuos.get(j));\r\n //A[izq]=A[j]; // se coloca el pivote en su lugar de forma que tendremos\r\n individuos.set(j, pivote);\r\n //A[j]=pivote; // los menores a su izquierda y los mayores a su derecha\r\n if (izq < j - 1) {\r\n OrdenarIndividuos(izq, j - 1); // ordenamos subarray izquierdo\r\n }\r\n if (j + 1 < der) {\r\n OrdenarIndividuos(j + 1, der); // ordenamos subarray derecho\r\n } \r\n }", "public static void divide(Double[] vector, Double divider) {\r\n for(int i = 0; i < vector.length; i++){\r\n vector[i] = vector[i] / divider;\r\n }\r\n }", "public int[] ejecSimulador(){\n\t\t\n\t\tint ruedas[] = new int[2]; //Izda-Dcha\n\t\t\n\t\t/* Por defecto, giro a la izquierda */\n\t\tswitch(factor){\n\t\tcase 1: //Giro muy debil\n\t\t\truedas[0] = 0;\n\t\t\truedas[1] = 10;\n\t\t\tbreak;\n\t\tcase 2: //Giro debil\n\t\t\truedas[0] = 0;\n\t\t\truedas[1] = 20;\n\t\t\tbreak;\n\t\tcase 3: //Giro normal\n\t\t\truedas[0] = 0;\n\t\t\truedas[1] = 30;\n\t\t\tbreak;\n\t\tcase 4: //Giro fuerte\n\t\t\truedas[0] = 0;\n\t\t\truedas[1] = 40;\n\t\t\tbreak;\n\t\tcase 5: //Giro muy fuerte\n\t\t\truedas[0] = 0;\n\t\t\truedas[1] = 50;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\truedas[0] = 0;\n\t\t\truedas[1] = 0;\n\t\t}\n\t\t\n\t\tif(!izquierda){ //Si giro a la derecha, cambio de ruedas\n\t\t\tint aux = ruedas[0];\n\t\t\truedas[0] = ruedas[1];\n\t\t\truedas[1] = aux;\n\t\t}\n\t\t\n\t\treturn ruedas;\n\t}", "public static void main(String[] args){\n\t\tint [] array = {1, 4, 2, 6, 3};\n\t\tArrayDivision(array, 3);\n\t}", "public static String arrayToString(int[] a, String div){\n\t\tString output = \"\";\n\t\tfor(int i=0; i<a.length; i++){\n\t\t\toutput=output+\"\"+a[i];\n\t\t\tif (i<a.length-1)\n\t\t\t\toutput=output+div;\n\t\t}\n\t\treturn output;\n\t}", "public void matrizInversa(){\n for (int i = 0; i < 3; i++) {\n for (int j = 0; j < 3; j++) {\n //System.out.println(\"\");getDeter();\n getMatriz()[i][j] = getMatrizAdjunta()[i][j]/getDeter();\n }\n }\n mostrarMatriz(getMatriz(),\"Matriz inversa\");\n }", "void Divide(int[] a,int lef,int righ) // this function will\n // divide the array into halves and calls recursively\n {\n int left = lef;\n int right = righ;\n int[] b =a; // here modifying b or a will be the same as it is passed as reference\n if(left < right) {\n Divide(b, left, left + (right - left) / 2);\n Divide(b, 1 + left + (right - left) / 2, right);\n int middle = left + (right - left )/2;\n System.out.println(\"calling merge on left is \" + left +\" middle is\" +middle+ \" right is \"+ right);\n Merge(b, left,middle, right);\n }\n //System.out.println(\" left is \" + left + \" right is \"+ right);\n }", "public static void main(String[] args) {\n\t\t\r\n\t\tdouble [] [] notasAlunos = new double[2][4];\r\n\t\t\r\n\t\tnotasAlunos [0][0]= 10;\r\n\t\tnotasAlunos [0][1]= 4;\r\n\t\tnotasAlunos [0][2]= 6.9;\r\n\t\tnotasAlunos [0][3]= 8;\r\n\t\t\r\n\r\n\t\tnotasAlunos [1][0]= 9.7;\r\n\t\tnotasAlunos [1][1]= 4;\r\n\t\tnotasAlunos [1][2]= 5;\r\n\t\tnotasAlunos [1][3]= 10;\r\n\r\n\t\tdouble soma = 0;\r\n\t\t\r\n\t\t\r\n\t\tfor (int i = 0; i < notasAlunos.length; i++) {\r\n\t\t\t//System.out.print(notasAlunos[i]+\" \");\r\n\t\t\t\r\n\t\t\tfor (int j = 0; j < notasAlunos[i].length; j++) {\r\n\t\t\t\tSystem.out.print(notasAlunos[i][j]+ \" - \");\r\n\t\t\t}\r\n\t\t\tSystem.out.println();\r\n\t\t}\r\n\t\tSystem.out.println(\"Caluclando a media: \");\r\n\t\t\r\n\t\tfor (int i = 0; i < notasAlunos.length; i++) {\r\n\t\t\tsoma = 0;//inicializando a soma para a proxima iteração\r\n\t\t\tfor (int j = 0; j < notasAlunos[i].length; j++) {\r\n\t\t\t//\tSystem.out.print(notasAlunos[i][j]+ \" - \");\r\n\t\t\t\tsoma += notasAlunos[i][j];\r\n\t\t\t}\r\n\t\t\tSystem.out.println(\"A media do aluno \"+(i+1)+ \" é \"+ (soma/4));\r\n\t\t}\r\n\t\r\n\r\n\t}", "private static void divide(int[] n1, int[] n2, int[] quotient, int []remainder) {\n\t\tif (isZero(n2)) {\n\t\t\tthrow new ArithmeticException (\"Divide by Zero\");\n\t\t}\n\t\t\n\t\tclear (remainder);\n\t\tclear (quotient);\n\t\t\n\t\t// if clearly greater, then copy integer remainder\n\t\tif (compareTo(n2,n1) > 0) {\n\t\t\tint idx = remainder.length-1;\n\t\t\tfor (int i = 0; i < n1.length; i++ ) { \n\t\t\t\tremainder[idx--] = n1[i];\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\t\n\t\t// This returns a copy of n1/n2\n\t\tn1 = reduce(n1);\n\t\tn2 = reduce(n2);\n\n\t\t// we have to extend, and reduce length. Note that this WILL terminate because\n\t\t// we would have left earlier if n2 were greater than n1.\n\t\twhile (compareTo(n2,0,n2.length,n1,0) > 0) {\n\t\t\tn2 = expand(n2);\n\t\t}\n\t\t\n\t\t// return string \"quot+remainder\";\n\t\tString result = subProcess(n1, n2);\n\t\t\n\t\t// pack into quotient/remainder.\n\t\tint idx = result.indexOf(\"+\");\n\t\tif (idx == -1) {\n\t\t\tfor (int i = 0; i < quotient.length; i++) {\n\t\t\t\tquotient[i] = 0;\n\t\t\t}\n\t\t\tpack(remainder,result); // ever happen?\n\t\t} else {\n\t\t\tpack(quotient,result.substring(0,idx));\n\t\t\tpack(remainder,result.substring(idx+1));\n\t\t}\n\t}", "public double[] Normalizar01(int[] v){\n double[] result=new double[v.length];\n double s=v[0];\n double max=v[0];\n double min=v[0];\n for (int i=1;i<v.length;i++){\n s+=v[i];\n //minimo\n if (v[i]<min)\n min=v[i];\n if (v[i]>max)\n max=v[i];\n //maximo\n }\n for (int i=0;i<v.length;i++){\n result[i]=((double)v[i]-min)/(max-min);\n }\n\n return result;\n }", "public void printDivideAscendingNumbers(int[] array){\r\n\t\tSystem.out.println(\"\\nDivided into the previous element:\");\r\n\t\tfor (int i = 0; i < array.length - 1; i++) {\r\n\t\t\tif(i == 0){\r\n\t\t\t\tSystem.out.print(array[i] + \" \");\r\n\t\t\t}\r\n\t\t\tif(array[i+1] % array[i] == 0){\r\n\t\t\t\tSystem.out.print(array[i + 1] + \" \");\r\n\t\t\t} \r\n\t\t}\r\n\t}", "private int[] enquadramentoContagemDeCaracteres(int[] quadro) throws Exception {\n System.out.println(\"\\n\\t[Contagem de Caracteres]\");\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\n\\t[Contagem de Caracteres]\\n\");\n Thread.sleep(velocidade);\n\n int informacaoDeControle = ManipuladorDeBit.getPrimeiroByte(quadro[0]);//Quantidade de Bits do quadro\n //Quantidade de Bits de carga util do quadro\n int quantidadeDeBitsCargaUtil = informacaoDeControle;\n System.out.println(\"IC: \" + informacaoDeControle);\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\n\\tIC [\"+informacaoDeControle+\"] \");\n\n\n int novoTamanho = quantidadeDeBitsCargaUtil/8;\n\n int[] quadroDesenquadrado = new int[novoTamanho];//Novo vetor de Carga Util\n int posQuadro = 0;//Posicao do Vetor de Quadros\n\n int cargaUtil = 0;//Nova Carga Util\n\n quadro[0] = ManipuladorDeBit.deslocarBits(quadro[0]);//Deslocando os bits 0's a esquerda\n //Primeiro inteiro do Quadro - Contem a informacao de Controle IC nos primeiros 8 bits\n quadro[0] <<= 8;//Deslocando 8 bits para a esquerda, descartar a IC\n\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"Carga Util [ \");\n for (int i=1; (i<=3) && (i<=novoTamanho); i++) {\n cargaUtil = ManipuladorDeBit.getPrimeiroByte(quadro[0]);\n quadroDesenquadrado[posQuadro++] = cargaUtil;\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(cargaUtil + \" \");\n quadro[0] <<= 8;//Desloca 8 bits para a esquerda\n }\n\n Thread.sleep(velocidade);\n\n //Caso o quadro for composto por mais de um inteiro do vetor\n for (int i=1, quantidadeByte; posQuadro<novoTamanho; i++) {\n quantidadeByte = ManipuladorDeBit.quantidadeDeBytes(quadro[i]);\n quadro[i] = ManipuladorDeBit.deslocarBits(quadro[i]);\n\n for (int x=1; (x<=quantidadeByte) && (x<=4); x++) {\n cargaUtil = ManipuladorDeBit.getPrimeiroByte(quadro[i]);\n quadroDesenquadrado[posQuadro++] = cargaUtil;\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(cargaUtil + \" \");\n quadro[i] <<= 8;//Desloca 8 bits para a esquerda\n }\n Thread.sleep(velocidade);\n }\n \n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"]\\n\");\n Thread.sleep(velocidade);\n\n return quadroDesenquadrado;\n }", "private int[] process(int[] ip)\n\t{\n\t\tint[] result = new int[ip.length];\n\t\t//first multiply all numbers\n\t\tint x = ip[0];\n\t\tfor(int i=0; i<ip.length; i++)\n\t\t{\n\t\t\tx = x*ip[i];\n\t\t}\n\t\t\n\t\tfor(int i=0;i<ip.length; i++)\n\t\t{\n\t\t\tresult[i] = x / ip[i];\n\t\t}\n\t\treturn result;\n\t}", "static void diviser() throws IOException {\n\t Scanner clavier = new Scanner(System.in);\n\tdouble nb1, nb2, resultat;\n\tnb1 = lireNombreEntier();\n\tnb2 = lireNombreEntier();\n\tif (nb2 != 0) {\n\tresultat = nb1 / nb2;\n\tSystem.out.println(\"\\n\\t\" + nb1 + \" / \" + nb2 + \" = \" +\n\tresultat);\n\t} else\n\tSystem.out.println(\"\\n\\t le nombre 2 est nul, devision par 0 est impossible \");\n\t}", "public void divisorsInRange(int begin, int end)\n\t{\n\t\tint size = 0;\n\t\tfor(int i=begin;i<end;i++){\n\t\t\tif(isDivisibleBy(i,7)){\n\t\t\t\tsize++;\n\t\t\t}\n\t\t}\n\t\tdivisibleBySeven = new int[size]; \n\t\tint index = 0;\n\t\tfor(int i=begin;i<end;i++){\n\t\t\tif(isDivisibleBy(i,7)){\n\t\t\t\tdivisibleBySeven[index] = i;\n\t\t\t\tindex++;\n\t\t\t}\n\n\t\t}\n\t\t//System.out.println(\"testDivisors NOT IMPLEMENTED\");\n\t}", "public static int ruolette(ArrayList<Integer> fitvalores, ArrayList<int[]> poblacion, int semilla){ \n int totalfitnes = 0;\n int totalfitnesnuevo = 0;\n int indtablero = 0;\n int semi=semilla;\n int tpoblacion=poblacion.size();\n int []nuevofitness = new int [fitvalores.size()];\n double []nproporcion = new double [fitvalores.size()];\n ArrayList <Double> proporcion = new ArrayList<>();//proporcion j la ruleta\n ArrayList <Double> ruleta = new ArrayList<>();\n //obtener el max fitnes\n for(int i=0;i<fitvalores.size();i++){ //total de fitnes\n totalfitnes=totalfitnes+fitvalores.get(i);\n }\n \n for(int i=0;i<fitvalores.size();i++){ //poner datos en el nuevo fittnes inverso\n double pro=(tpoblacion*tpoblacion-tpoblacion)-fitvalores.get(i);\n nuevofitness[i]= (int) pro;\n // System.out.println(\"nuevo fitnes\"+nuevofitness[i]);\n } \n for(int i=0;i<fitvalores.size();i++){ //total de fitnes nuevo o inverso\n totalfitnesnuevo=(totalfitnesnuevo+nuevofitness[i]);//para que los mejores casos usen mas espacio\n }\n \n for(int i=0;i<fitvalores.size();i++){ //poner datos en el array proporcion\n double var1=nuevofitness[i];\n double var2=totalfitnesnuevo;\n double pro=var1/var2;\n nproporcion[i]=pro;\n //System.out.println(\"nueva proporcion \"+nproporcion[i]);\n } \n ruleta.add(nproporcion[0]);\n // System.out.println(\"primera propporniaso \"+nproporcion[0]);\n for(int i=1;i<fitvalores.size();i++){ //poner datos en la ruleta\n double var1=ruleta.get(i-1);\n double var2=nproporcion[i];\n ruleta.add(var1+var2);\n //System.out.println(\"ruleta \"+ruleta.get(i));\n }\n double num=randomadec(0,1,semi);\n // System.out.println(\"numero random dec \"+num); \n for(int i=0;i<fitvalores.size();i++){ //poner datos en el array proporcion\n // System.out.println(ruleta.get(i));\n if(num<ruleta.get(i)){\n indtablero=i;\n //System.out.println(\"se guardo el tablero \"+indtablero);\n break;\n }\n }\n return indtablero;//esto devuelve el indice del tablero ganador en la ruleta\n }", "public static void main(String[] args) {\n\t\tint[] testInput1 = {1,2,3,4,5}; // input from example 1 in problem\n\t\tint[] testInput2 = {3,2,1};\t\t// input from example 2 in problem\n\t\tint[] testOutput11;\t\t\t\t// result of Test 1.1\n\t\tint[] testOutput12;\t\t\t\t// result of Test 1.2\n\t\tint[] testOutput21;\t\t\t\t// result of Test 2.1\n\t\tint[] testOutput22;\t\t\t\t// result of Test 2.\n\t\t\n\t\t// Tests: modifiedArrayWithDivision \n\t\tSystem.out.println(\"Tests: modifiedArrayWithDivision\");\n\t\t\n\t\t// Test 1.1 (Case: example 1 in problem statement)\n\t\ttestOutput11 = modifiedArrayWithDivision(testInput1);\n\t\tSystem.out.println(\"-Test 1.1 Input: \" + Arrays.toString(testInput1));\n\t\tSystem.out.println(\"-Test 1.1 Output: \" + Arrays.toString(testOutput11));\n\t\tSystem.out.println();\n\t\t\n\t\t// Test 1.2 (Case: example 2 in problem statement)\n\t\ttestOutput12 = modifiedArrayWithDivision(testInput2);\n\t\tSystem.out.println(\"-Test 1.2 Input: \" + Arrays.toString(testInput2));\n\t\tSystem.out.println(\"-Test 1.2 Output: \" + Arrays.toString(testOutput12));\n\t\tSystem.out.println();\n\t\t\n\t\t// Tests: modifiedArrayWithoutDivision \n\t\tSystem.out.println(\"Tests: modifiedArrayWithoutDivision\");\n\t\t\n\t\t// Test 2.1 (Case: example 1 in problem statement)\n\t\ttestOutput21 = modifiedArrayWithoutDivision(testInput1);\n\t\tSystem.out.println(\"-Test 2.1 Input: \" + Arrays.toString(testInput1));\n\t\tSystem.out.println(\"-Test 2.1 Output: \" + Arrays.toString(testOutput21));\n\t\tSystem.out.println();\n\t\t\n\t\t// Test 2.2 (Case: example 2 in problem statement)\n\t\ttestOutput22 = modifiedArrayWithoutDivision(testInput2);\n\t\tSystem.out.println(\"-Test 2.2 Input: \" + Arrays.toString(testInput2));\n\t\tSystem.out.println(\"-Test 2.2 Output: \" + Arrays.toString(testOutput22));\n\t\t\n\t}", "private void reduce()\r\n {\r\n int lowest, highest, temp;\r\n if(Math.abs(numerator) >= Math.abs(denominator))\r\n { \r\n lowest = Math.abs(denominator);\r\n highest = Math.abs(numerator);\r\n }\r\n else\r\n {\r\n lowest = Math.abs(numerator);\r\n highest = Math.abs(denominator);\r\n }\r\n while(lowest != 0)\r\n {\r\n temp = lowest;\r\n lowest = highest % lowest;\r\n highest = temp;\r\n } \r\n numerator = numerator / highest;\r\n denominator = denominator / highest; \r\n \r\n if(denominator < 0)\r\n {\r\n numerator = numerator * (-1);\r\n denominator = denominator * (-1); \r\n } \r\n }", "private final static void dddivd(final double[] a, final double b, double[] c) {\n\tdouble t1 = a[0] / b;\n\tdouble cona = t1 * SPLIT;\n\tdouble conb = b * SPLIT;\n\tdouble a1 = cona - (cona - t1);\n\tdouble b1 = conb - (conb - b);\n\tdouble a2 = t1 - a1;\n\tdouble b2 = b - b1;\n\tdouble t12 = t1 * b;\n\tdouble t22 = (((a1 * b1 - t12) + a1 * b2) + a2 * b1) + a2 * b2;\n\tdouble t11 = a[0] - t12;\n\tdouble e = t11 - a[0];\n\tdouble t21 = ((-t12 - e) + (a[0] - (t11 - e))) + a[1] - t22;\n\tdouble t2 = (t11 + t21) / b;\n\tdouble s1 = t1 + t2;\n\tc[0] = s1;\n\tc[1] = t2 - (s1 - t1);\n\treturn;\n }", "private float[] calculateData(float[] data) {\n float total=0;\n for(int i=0;i<data.length;i++)\n {\n total+=data[i];\n }\n for(int i=0;i<data.length;i++)\n {\n data[i]=360*(data[i]/total); \n }\n return data;\n\n }", "public String[][] medianaDeTres(String[][] arr, int primeiro, int ultimo, int requiredData) {\r\n\t\tif (requiredData != 4) {\r\n\t\t\tif (primeiro < ultimo) {\r\n\r\n\t\t\t\tint meio = ((primeiro + ultimo) / 2);\r\n\t\t\t\tint a = Integer.parseInt(arr[primeiro][requiredData]);\r\n\t\t\t\tint b = Integer.parseInt(arr[meio][requiredData]);\r\n\t\t\t\tint c = Integer.parseInt(arr[ultimo][requiredData]);\r\n\t\t\t\tint medianaIndice;\r\n\r\n\t\t\t\tif (a < b) {\r\n\t\t\t\t\tif (b < c) {\r\n\t\t\t\t\t\t// a < b && b < c\r\n\t\t\t\t\t\tmedianaIndice = meio;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (a < c) {\r\n\t\t\t\t\t\t\t// a < c && c <= b\r\n\t\t\t\t\t\t\tmedianaIndice = ultimo;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// c <= a && a < b\r\n\t\t\t\t\t\t\tmedianaIndice = primeiro;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (c < b) {\r\n\t\t\t\t\t\t// c < b && b <= a\r\n\t\t\t\t\t\tmedianaIndice = meio;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (c < a) {\r\n\t\t\t\t\t\t\t// b <= c && c < a\r\n\t\t\t\t\t\t\tmedianaIndice = ultimo;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// b <= a && a <= c\r\n\t\t\t\t\t\t\tmedianaIndice = primeiro;\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\tswap(arr, medianaIndice, ultimo);\r\n\r\n\t\t\t\tint pivo = Integer.parseInt(arr[ultimo][requiredData]);\r\n\r\n\t\t\t\tint i = (primeiro - 1);\r\n\t\t\t\tfor (int j = primeiro; j <= ultimo - 1; j++) {\r\n\r\n\t\t\t\t\tif (Integer.parseInt(arr[j][requiredData]) < pivo) {\r\n\t\t\t\t\t\ti++;\r\n\t\t\t\t\t\tString[] aux = arr[i];\r\n\t\t\t\t\t\tarr[i] = arr[j];\r\n\t\t\t\t\t\tarr[j] = aux;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tString[] aux = arr[i + 1];\r\n\t\t\t\tarr[i + 1] = arr[ultimo];\r\n\t\t\t\tarr[ultimo] = aux;\r\n\t\t\t\tint piAux = i + 1;\r\n\r\n\t\t\t\tmedianaDeTres(arr, primeiro, piAux - 1, requiredData);\r\n\t\t\t\tmedianaDeTres(arr, piAux + 1, ultimo, requiredData);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tif (primeiro < ultimo) {\r\n\t\t\t\tCollator collator = Collator.getInstance();\r\n\t\t\t\tcollator.setStrength(Collator.NO_DECOMPOSITION);\r\n\t\t\t\tint meio = ((primeiro + ultimo) / 2);\r\n\t\t\t\tString a = (arr[primeiro][requiredData]);\r\n\t\t\t\tString b = (arr[meio][requiredData]);\r\n\t\t\t\tString c = (arr[ultimo][requiredData]);\r\n\t\t\t\tint medianaIndice;\r\n\r\n\t\t\t\tif (collator.compare(b, a) > 0) {\r\n\t\t\t\t\tif (collator.compare(c, b) > 0) {\r\n\t\t\t\t\t\t// a < b && b < c\r\n\t\t\t\t\t\tmedianaIndice = meio;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (collator.compare(c, a) > 0) {\r\n\t\t\t\t\t\t\t// a < c && c <= b\r\n\t\t\t\t\t\t\tmedianaIndice = ultimo;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// c <= a && a < b\r\n\t\t\t\t\t\t\tmedianaIndice = primeiro;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t} else {\r\n\t\t\t\t\tif (collator.compare(b, c) > 0) {\r\n\t\t\t\t\t\t// c < b && b <= a\r\n\t\t\t\t\t\tmedianaIndice = meio;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (collator.compare(a, c) > 0) {\r\n\t\t\t\t\t\t\t// b <= c && c < a\r\n\t\t\t\t\t\t\tmedianaIndice = ultimo;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t// b <= a && a <= c\r\n\t\t\t\t\t\t\tmedianaIndice = primeiro;\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\tswap(arr, medianaIndice, ultimo);\r\n\r\n\t\t\t\tString pivo = (arr[ultimo][requiredData]);\r\n\r\n\t\t\t\tint i = (primeiro - 1);\r\n\t\t\t\tfor (int j = primeiro; j <= ultimo - 1; j++) {\r\n\r\n\t\t\t\t\tif (collator.compare(pivo, arr[j][requiredData]) > 0) {\r\n\t\t\t\t\t\ti++;\r\n\t\t\t\t\t\tString[] aux = arr[i];\r\n\t\t\t\t\t\tarr[i] = arr[j];\r\n\t\t\t\t\t\tarr[j] = aux;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\r\n\t\t\t\tString[] aux = arr[i + 1];\r\n\t\t\t\tarr[i + 1] = arr[ultimo];\r\n\t\t\t\tarr[ultimo] = aux;\r\n\t\t\t\tint piAux = i + 1;\r\n\r\n\t\t\t\tmedianaDeTres(arr, primeiro, piAux - 1, requiredData);\r\n\t\t\t\tmedianaDeTres(arr, piAux + 1, ultimo, requiredData);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn arr;\r\n\t}", "public static int countMults(int[] nums, int divisibility){\n int total = 0;\n for(int num : nums){\n if(num % divisibility == 0){\n total ++;\n }\n }\n// System.out.println(\"Should return 3 \" + total);\n return total;\n }", "private static int calcularMedia(int[] notas) {\n\t\tint media = 0;\n\n\t\tfor (int i = 0; i < notas.length; i++) {\n\n\t\t\tmedia = media + notas[i];\n\n\t\t}\n\t\treturn media/notas.length;\n\t}", "public static void main(String[] args) {\n int numeros[] = {2, 3, 4, 2, 4, 5, 6, 2, 1, 2};\n //Creamos segundo arreglo con iguall tamaño que el arreglo nùmeros\n int cuadrados[] = new int[numeros.length];\n //Arreglo para almacenar el proceso de la operación\n String procesos[] = new String[numeros.length];\n //Creamos ciclo de repeticiòn para recorrer arreglo \n for (int indice = 0; indice < numeros.length; indice++) {\n int cuadrado = numeros[indice] * numeros[indice];\n //Almacenamos el proceso de la opreaciòn en el arreglo cuadrados\n cuadrados[indice] = cuadrado;\n \n //Almacenar resultado en el arreglo procesos\n procesos[indice] = numeros[indice] + \"x\" + numeros[indice];\n }\n //Ciclo de repetición para mostrar arreglos\n String print_numeros = \"numeros - \";\n String print_cuadrados = \"cuadrados - \";\n String print_procesos = \"procesoss - \";\n for (int indice = 0; indice < numeros.length; indice++) {\n print_numeros = print_numeros + numeros[indice] + \", \";\n print_cuadrados = print_cuadrados + cuadrados[indice] + \", \";\n print_procesos = print_procesos + procesos[indice] + \", \";\n\n }\n System.out.println(print_numeros);\n System.out.println(print_cuadrados);\n System.out.println(print_procesos);\n \n //suma solo numeros pares\n int acumulador_pares=0;\n for (int indice = 0; indice < 10; indice++) {\n boolean par= detectar_par(numeros[indice]);\n if (par == true) {\n acumulador_pares = acumulador_pares + numeros[indice];\n \n }\n }\n System.out.println(\"La suma de los nùmeros pares es: \"+acumulador_pares);\n \n }", "private void calculateEachDivision(int division) {\n DataController.setCurrentDivisionForWriting(division);\r\n percentageSlid = (division / (float) DIVISIONS_OF_VALUE_SLIDER);\r\n newCurrentValue = minValueNumeric + (percentageSlid * deltaValueNumeric);\r\n dataController.setValueAsFloat(currentSliderKey, newCurrentValue);\r\n CalculatedVariables.crunchCalculation();\r\n }", "public static String optimalDivision(int[] nums) {\n if(nums.length==1) return nums[0]+\"\";\n if(nums.length==2) return nums[0]+\"/\"+nums[1];\n StringBuilder res=new StringBuilder();\n res.append(nums[0]); res.append(\"/(\"); res.append(nums[1]);\n for(int i=2;i<nums.length;i++){\n res.append(\"/\"+nums[i]);\n }\n res.append(\")\");\n return res.toString();\n }", "public static String[][] acomodamiento(char direccion, String[][] cuadricula) {\n int numeroA;\n int espacios;\n for (int fila = 0; fila < 4; fila++) {\n\n for (int columna = 0; columna < 4; columna++) {\n\n switch (direccion) {\n case 'w':\n /*Creamos una condicion que empezara a mover los numeros si la posicion en esa parte\n de la matriz no esta vacia, cuando la encuentra mueve desde esa posicion hacia arriba\n del cuadro y si se encuentra alguna parte igual la suma , si esta vacia la remplaza y si no se queda igual\n */\n if (cuadricula[columna][fila].equals(\" \") == false) {\n for (int vecesMovimiento = columna; vecesMovimiento > 0; vecesMovimiento--) {\n //Verigica si hay un numero igual arriba suyo para sumarse\n if (cuadricula[vecesMovimiento][fila].equals(cuadricula[vecesMovimiento - 1][fila])) {\n /* Como los numeros son iguales se toma uno, se convierte el string de esa parte de la cuadricula a\n numeroA la duplica y se la agrega a la posicion de arriba\n */\n numeroA = Integer.parseInt(cuadricula[vecesMovimiento][fila].replaceAll(\" \", \"\"));\n numeroA += numeroA;\n cuadricula[vecesMovimiento - 1][fila] = Integer.toString(numeroA);\n /* desde la parte de espacios = 4 - cuadricula[vecesMovimiento-1]... hasta el for solo es el numero de espacios agregados al numero que dara\n para que se mantenga posicionado junto con la cuadricula\n */\n espacios = 4 - cuadricula[vecesMovimiento - 1][fila].length();\n for (int barras = espacios; barras > 0; barras--) {\n cuadricula[vecesMovimiento - 1][fila] += \" \";\n }\n cuadricula[vecesMovimiento][fila] = \" \";\n } //Condicion que indica si hay un espacio vacio en una posicion arriba la sustituye la de abajo\n else if (cuadricula[vecesMovimiento - 1][fila].equals(\" \")) {\n cuadricula[vecesMovimiento - 1][fila] = cuadricula[vecesMovimiento][fila];\n cuadricula[vecesMovimiento][fila] = \" \";\n }\n }\n }\n break;\n\n case 's':\n /*Creamos una condicion que empezara a mover los numeros si la posicion en esa parte\n de la matriz no esta vacia,tomando en cuenta que inicia a contar de abajo para arriba, cuando la encuentra mueve\n desde esa posicion hacia abajo del cuadro y si se encuentra alguna parte igual la suma , si esta vacia la remplaza y si no se queda igual\n */\n if (cuadricula[3 - columna][fila].equals(\" \") == false) {\n //Empezamos el ciclo en una posicion de abajo de la matriz\n // llegaremos hasta 2 ya que sigue comparando con una posicion abajo extra gracias al +1\n for (int vecesMovimiento = 3 - columna; vecesMovimiento < 3; vecesMovimiento++) {\n /* Como los numeros son iguales se toma uno, se convierte el string de esa parte de la cuadricula a\n numeroA la duplica y se la agrega a la posicion de abajo\n */\n if (cuadricula[vecesMovimiento][fila].equals(cuadricula[vecesMovimiento + 1][fila])) {\n numeroA = Integer.parseInt(cuadricula[vecesMovimiento][fila].replaceAll(\" \", \"\"));\n numeroA += numeroA;\n cuadricula[vecesMovimiento + 1][fila] = Integer.toString(numeroA);\n /* desde la parte de espacios = 4 - cuadricula[vecesMovimiento-1]... hasta el for solo es el numero de espacios agregados al numero que dara\n para que se mantenga posicionado junto con la cuadricula\n */\n espacios = 4 - cuadricula[vecesMovimiento + 1][fila].length();\n for (int barras = espacios; barras > 0; barras--) {\n cuadricula[vecesMovimiento + 1][fila] += \" \";\n }\n cuadricula[vecesMovimiento][fila] = \" \";\n } //Condicion que indica si hay un espacio vacio en una posicion abajo la sustituye la de arriba\n else if (cuadricula[vecesMovimiento + 1][fila].equals(\" \")) {\n cuadricula[vecesMovimiento + 1][fila] = cuadricula[vecesMovimiento][fila];\n cuadricula[vecesMovimiento][fila] = \" \";\n }\n }\n }\n break;\n\n case 'a':\n /*Creamos una condicion que empezara a mover los numeros si la posicion en esa parte\n de la matriz no esta vacia,tomando en cuenta que inicia a contar de izquierda a derecha, cuando la encuentra mueve\n desde esa posicion hacia la izquierda del cuadro y si se encuentra alguna parte igual la suma , si esta vacia la remplaza y si no se queda igual\n */\n if (cuadricula[fila][columna].equals(\" \") == false) {\n //Empezamos el ciclo en una posicion de la izquierda de la matriz, es decir inicializada en 0\n for (int vecesMovimiento = columna; vecesMovimiento > 0; vecesMovimiento--) {\n /* Como los numeros son iguales se toma uno, se convierte el string de esa parte de la cuadricula a\n numeroA la duplica y se la agrega a la posicion de izquierda\n */\n if (cuadricula[fila][vecesMovimiento].equals(cuadricula[fila][vecesMovimiento - 1])) {\n numeroA = Integer.parseInt(cuadricula[fila][vecesMovimiento].replaceAll(\" \", \"\"));\n numeroA += numeroA;\n cuadricula[fila][vecesMovimiento - 1] = Integer.toString(numeroA);\n espacios = 4 - cuadricula[fila][vecesMovimiento - 1].length();\n for (int barras = espacios; barras > 0; barras--) {\n cuadricula[fila][vecesMovimiento - 1] += \" \";\n }\n cuadricula[fila][vecesMovimiento] = \" \";\n } //Condicion que indica si hay un espacio vacio en una posicion izquierda la sustituye la de derecha\n else if (cuadricula[fila][vecesMovimiento - 1].equals(\" \")) {\n cuadricula[fila][vecesMovimiento - 1] = cuadricula[fila][vecesMovimiento];\n cuadricula[fila][vecesMovimiento] = \" \";\n }\n }\n }\n break;\n\n //Lo mismo establecido pero orientado a la derecha, y en lugar del -1 de los vectores lo pasamos como +1 siguiendo la estructura\n //de la opcion 's'\n case 'd':\n if (cuadricula[fila][3 - columna].equals(\" \") == false) {\n for (int vecesMovimiento = 3 - columna; vecesMovimiento < 3; vecesMovimiento++) {\n if (cuadricula[fila][vecesMovimiento].equals(cuadricula[fila][vecesMovimiento + 1])) {\n numeroA = Integer.parseInt(cuadricula[fila][vecesMovimiento].replaceAll(\" \", \"\"));\n numeroA += numeroA;\n cuadricula[fila][vecesMovimiento + 1] = Integer.toString(numeroA);\n espacios = 4 - cuadricula[fila][vecesMovimiento + 1].length();\n for (int barras = espacios; barras > 0; barras--) {\n cuadricula[fila][vecesMovimiento + 1] += \" \";\n }\n cuadricula[fila][vecesMovimiento] = \" \";\n } else if (cuadricula[fila][vecesMovimiento + 1].equals(\" \")) {\n cuadricula[fila][vecesMovimiento + 1] = cuadricula[fila][vecesMovimiento];\n cuadricula[fila][vecesMovimiento] = \" \";\n }\n }\n }\n break;\n\n }\n\n }\n }\n return cuadricula;\n }", "public static void shell(int array[]) {\n\n int salto, aux, i;\n boolean cambios;\n \n for (salto = array.length / 2; salto != 0; salto /= 2) {\n cambios = true;\n while (cambios) { // Ciclo para ir intercambiando los elementos del array \n cambios = false;\n for (i = salto; i < array.length; i++) // se recorre el array elemento por elemento\n {\n if (array[i - salto] > array[i]) { // condición para determinar el orden de los elementos\n aux = array[i]; // se ordenan los elemnetos\n array[i] = array[i - salto];\n array[i - salto] = aux;\n cambios = true; // activamos la bandera para confirmar el cambio \n }\n }\n }\n }\n }", "public void divide() {\n\t\t\n\t}", "public void reduct() {\n\t\tint divider = bunmo;\n\t\tif(bunja < bunmo){\n\t\t\tdivider = bunja;\n\t\t}\n\t\twhile(divider > 1){\n//\t\twhile(!util.Uitl.isPrime(bunmo)||!util.Uitl.isPrime(bunja)){\n\t\t\tboolean canDivide = (bunmo%divider==0)&&(bunja%divider==0);\n\t\t\tif(canDivide){\n\t\t\t\tbunja/=divider;\n\t\t\t\tbunmo/=divider;\n\t\t\t\tbreak;\n\t\t\t}else{\n\t\t\t\tdivider--;\n\t\t\t}\n\t\t}\n\t}", "public LongNum div2(LongNum divided){\n LongNum res = divided.copy();\n for(int i = res.size()-1;i>=0;i--){\n if(i!=0)res.set(i-1,res.get(i-1)+(res.get(i)%2)*base);\n res.set(i , Math.floorDiv(res.get(i),2));\n }\n return res;\n }", "public void divide(int dirOp1, int dirOp2, int dirRes) {\n //traduce casos de direccionamiento indirecto\n dirOp1 = traduceDirIndirecto(dirOp1);\n dirOp2 = traduceDirIndirecto(dirOp2);\n if (ManejadorMemoria.isConstante(dirOp1)) { // OPERANDO 1 CTE\n String valor1 = this.directorioProcedimientos.getConstantes().get(dirOp1).getValorConstante();\n if (ManejadorMemoria.isGlobal(dirOp2)) { // OPERANDO 2 GLOBAL\n String valor2 = this.registroGlobal.getValor(dirOp2);\n if (ManejadorMemoria.isGlobal(dirRes)) { // RES GLOBAL\n this.registroGlobal.guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n } else { // RES LOCAL\n this.pilaRegistros.peek().guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n }\n } else if (ManejadorMemoria.isConstante(dirOp2)) { // OPERANDO 2 CTE\n String valor2 = this.directorioProcedimientos.getConstantes().get(dirOp2).getValorConstante();\n if (ManejadorMemoria.isGlobal(dirRes)) { // RES GLOBAL\n this.registroGlobal.guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n } else { // RES LOCAL\n this.pilaRegistros.peek().guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n }\n } else { // OPERANDO 2 LOCAL\n String valor2 = this.pilaRegistros.peek().getValor(dirOp2);\n if (ManejadorMemoria.isGlobal(dirRes)) { // RES GLOBAL\n this.registroGlobal.guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n } else { //RES LOCAL\n this.pilaRegistros.peek().guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n }\n }\n } else if (ManejadorMemoria.isGlobal(dirOp1)) { // OPERANDO 1 GLOBAL\n String valor1 = this.registroGlobal.getValor(dirOp1);\n if (ManejadorMemoria.isGlobal(dirOp2)) { // OPERANDO 2 GLOBAL\n String valor2 = this.registroGlobal.getValor(dirOp2);\n if (ManejadorMemoria.isGlobal(dirRes)) { // RES GLOBAL\n this.registroGlobal.guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n } else { // RES LOCAL\n this.pilaRegistros.peek().guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n }\n } else if (ManejadorMemoria.isConstante(dirOp2)) { // OPERANDO 2 CTE\n String valor2 = this.directorioProcedimientos.getConstantes().get(dirOp2).getValorConstante();\n if (ManejadorMemoria.isGlobal(dirRes)) { // RES GLOBAL\n this.registroGlobal.guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n } else { // RES LOCAL\n this.pilaRegistros.peek().guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n }\n } else { // OPERANDO 2 LOCAL\n String valor2 = this.pilaRegistros.peek().getValor(dirOp2);\n if (ManejadorMemoria.isGlobal(dirRes)) { // RES GLOBAL\n this.registroGlobal.guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n } else { // RES LOCAL\n this.pilaRegistros.peek().guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n }\n }\n } else { // OPERANDO 1 LOCAL\n String valor1 = this.pilaRegistros.peek().getValor(dirOp1);\n if (ManejadorMemoria.isGlobal(dirOp2)) { // OPERANDO 2 GLOBAL\n String valor2 = this.registroGlobal.getValor(dirOp2);\n if (ManejadorMemoria.isGlobal(dirRes)) { // RES GLOBAL\n this.registroGlobal.guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n } else { // RES 2 LOCAL\n this.pilaRegistros.peek().guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n }\n } else if (ManejadorMemoria.isConstante(dirOp2)) { // OPERANDO 2 CTE\n String valor2 = this.directorioProcedimientos.getConstantes().get(dirOp2).getValorConstante();\n if (ManejadorMemoria.isGlobal(dirRes)) { // RES GLOBAL\n this.registroGlobal.guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n } else { // RES LOCAL\n this.pilaRegistros.peek().guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n }\n } else { //OPERANDO 2 LOCAL\n String valor2 = this.pilaRegistros.peek().getValor(dirOp2);\n if (ManejadorMemoria.isGlobal(dirRes)) { // RES GLOBAL\n this.registroGlobal.guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n } else { // RES LOCAL\n this.pilaRegistros.peek().guardaValor(dirRes, auxOperacion(dirOp1, dirOp2, valor1, valor2, Codigos.DIV));\n }\n }\n }\n }", "void recorridoCero(){\n \n for(int i=0;i<8;i++)\n\t\t\tfor(int j=0;j<8;j++)\n\t\t\t\t{\n\t\t\t\t\t//marcar con cero todas las posiciones\n\t\t\t\t\trecorrido[i][j]=0;\n\t\t\t\t}\n }", "public void Reduce() {\n\t\tint gcd = MathHelper.GreatestCommonDivisor(this.numerator, this.denominator);\n\t\t\n\t\t// avoid divide by 0\n\t\tif (gcd > 0) {\n\t\t\tthis.numerator = this.numerator / gcd;\n\t\t\tthis.denominator = this.denominator / gcd;\n\t\t}\n\t}", "public static String arrayToString(double[] a, String div){\n\t\tString output = \"\";\n\t\tfor(int i=0; i<a.length; i++){\n\t\t\toutput=output+\"\"+a[i];\n\t\t\tif (i<a.length-1)\n\t\t\t\toutput=output+div;\n\t\t}\n\t\treturn output;\n\t}", "public static void main(String[] args) {\n\r\n\t\tint[] a = {23,12,45,98,54};\r\n\t\t\r\n\t\tint [] result = new int [6]; //{54,98,45,12,23}\r\n\t\t\r\n\t\tint [] b = new int[6];\r\n\t\r\n\t\t\r\n\t\tfor(int i =0; i<a.length; i++) {\r\n\t\t\tresult[5 - i] = a[i];\r\n\t\t}\r\n\t\tfor(int i : result) {\r\n\t\t\tSystem.out.println(i);\r\n\t\t}\r\n\t\t\r\n\t\t//a 배열과 b배열의 값은 index 해당하는 값을 더하고 그 결과가 3의 배수이면 result 의 \r\n\t\t//해당 index에 값을 5배 하여 저장하고 그렇지 않은 index에는 10을 저장함 \r\n\t\t\r\n\t\tfor (int i=0; i<6; i++) {\r\n\t\t\tif((a[i] + b[i])%3 ==0)\r\n\t\t\t{\r\n\t\t\t\tresult[i] = a[i] + b[i]*5;\r\n\t\t\t}\r\n\t\t\telse result[i] = 10;\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t}", "public static List<Integer> largestDivisibleSubsetUsingDp(int[] a) {\n\t\tArrays.sort(a);\n\t\tint t[] = new int[a.length];\n\t\tint r[] = new int[a.length];\n\n\t\tList<Integer> res = new ArrayList<>();\n\t\tint max_value = 1;\n\t\tint max_index = 0;\n\t\tArrays.fill(t, 1);\n\t\tr[0] = -1;\n\t\tfor (int i = 1; i < a.length; i++) {\n\t\t\tfor (int j = 0; j < i; j++) {\n\t\t\t\tif (a[i] % a[j] == 0) {\n\t\t\t\t\tif (1 + t[j] > t[i]) {\n\t\t\t\t\t\tt[i] = 1 + t[j];\n\t\t\t\t\t\tr[i] = j;\n\t\t\t\t\t\tif (t[i] > max_value) {\n\t\t\t\t\t\t\tmax_value = t[i];\n\t\t\t\t\t\t\tmax_index = i;\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\n\t\tint idx = max_index;\n\t\twhile (idx >= 0) {\n\t\t\tres.add(a[idx]);\n\t\t\tidx = r[idx];\n\t\t}\n\t\treturn res;\n\t}", "public static int[]reparacion(int[] hijo,int ttablero){\n int []hijor=new int[ttablero];\n int falta;\n int cont=0;\n int aux;\n int repite;\n ArrayList<Integer> repetidos = new ArrayList<>();\n ArrayList<Integer> faltantes = new ArrayList<>();\n for(int i=0;i<=ttablero;i++){\n aux=hijo[i];\n for(int j=0;j<=ttablero;j++){\n if(aux==hijo[j]){\n cont=cont+1;\n // System.out.println(\"contador \"+cont+\" se repite el hijo \" +hijo[j]);\n }\n if (cont>=2) {\n repite=hijo[j];\n repetidos.add(repite);\n // System.out.println(\"se repite el numero \"+repite );\n cont=0; \n } \n \n }\n cont=0; \n }\n \n //limpiar de repetidos el array repetidos\n for (int i = 0; i<repetidos.size(); i++) {\n int auxi=repetidos.get(i);\n //System.out.println(\"aux \"+ auxi );\n for (int j = i+1;j<repetidos.size() ; j++) {\n if (auxi==repetidos.get(j)) {\n //System.out.println(\"repetidos \"+ repetidos.get(i) );\n repetidos.remove(j);\n \n }\n \n }\n \n }\n \n for (int i = 0; i <repetidos.size(); i++) {\n // System.out.println(\"repetidos finalmente \"+ repetidos.get(i) );\n }\n int a=0;\n for (int i = 0; i <=ttablero; i++) {\n int auxx=i;\n for (int j = 0; j<=ttablero; j++) {\n \n }\n }\n int [] auscio=new int [ttablero];\n for (int i = 0; i <ttablero; i++) {\n auscio[i]=0;\n // System.out.println(\"auscio \"+auscio[i]);\n }\n \n for (int i = 0; i <ttablero; i++) {\n // int amp=i;\n for (int j = 0; j<ttablero; j++) {\n if (i==hijo[j]) {\n auscio[i]=1;\n }\n }\n }\n \n for (int i = 0; i <ttablero; i++) {\n // System.out.print(\"\"+auscio[i]);\n }\n for (int i = 0; i <ttablero; i++) {\n if (auscio[i]==0) {\n // System.out.println(\"falta el numero \"+(i));\n faltantes.add(i);\n }\n }\n \n return hijor;\n }", "private void reduce() {\n int gcd = gcd(this.numerator, this.denominator);\n this.numerator = this.numerator / gcd;\n this.denominator = this.denominator / gcd;\n }", "public void Semantica() {\r\n int var, etq;\r\n double marca, valor;\r\n double[] punto = new double[3];\r\n double[] punto_medio = new double[2];\r\n\r\n /* we generate the fuzzy partitions of the variables */\r\n for (var = 0; var < n_variables; var++) {\r\n marca = (extremos[var].max - extremos[var].min) /\r\n ((double) n_etiquetas[var] - 1);\r\n for (etq = 0; etq < n_etiquetas[var]; etq++) {\r\n valor = extremos[var].min + marca * (etq - 1);\r\n BaseDatos[var][etq].x0 = Asigna(valor, extremos[var].max);\r\n valor = extremos[var].min + marca * etq;\r\n BaseDatos[var][etq].x1 = Asigna(valor, extremos[var].max);\r\n BaseDatos[var][etq].x2 = BaseDatos[var][etq].x1;\r\n valor = extremos[var].min + marca * (etq + 1);\r\n BaseDatos[var][etq].x3 = Asigna(valor, extremos[var].max);\r\n BaseDatos[var][etq].y = 1;\r\n BaseDatos[var][etq].Nombre = \"V\" + (var + 1);\r\n BaseDatos[var][etq].Etiqueta = \"E\" + (etq + 1);\r\n }\r\n }\r\n }", "@Override\n protected void doPost(HttpServletRequest request, HttpServletResponse response)\n throws ServletException, IOException {\n\n String tamano = request.getParameter(\"tamano\");\n int tam = Integer.parseInt(tamano);\n int[][] m = new int[tam][tam];\n int a = 0, b = tam - 1, valor = 1;\n response.setContentType(\"text/html;charset=UTF-8\");\n PrintWriter out = response.getWriter();\n try {\n out.println(\"<!DOCTYPE html>\");\n out.println(\"<html>\");\n out.println(\"<head>\");\n out.println(\"<title>MATRIZ CARACOL</title>\");\n out.println(\"</head>\");\n out.println(\"<body>\");\n out.println(\"<h1>Conversion de divisas</h1>\");\n out.println(\"<b>MATRIZ CARACOL N= <b>\" + tamano);\n\n for (int j = 0; j < m.length; j++) {\n\n for (int i = a; i <= b; i++) {\n m[a][i] = valor;\n valor = valor + 1;\n }\n for (int i = a + 1; i <= b; i++) {\n m[i][b] = valor;\n valor = valor + 1;\n }\n\n for (int i = b - 1; i >= a; i--) {\n m[b][i] = valor;\n valor = valor + 1;\n }\n\n for (int i = b - 1; i >= a + 1; i--) {\n m[i][a] = valor;\n valor = valor + 1;\n }\n\n a = a + 1;\n b = b - 1;\n }\n\n out.println(\"<table border='2' cellspacing='1'>\");\n for (int i = 0; i <m.length; i++) {\n \n \n out.println(\"<tr>\");\n for (int j = 0; j <m[i].length; j++) {\n out.println(\"<td>\");\n out.println(m[i][j]);\n out.println(\"</td>\");\n }\n\n out.println(\"</tr>\");\n }\n out.println(\"</table>\");\n\n out.println(\"</body>\");\n out.println(\"</html>\");\n } finally {\n out.close();\n }\n }", "private static int multAndDivFixer(int size){\n return size;\n }", "static void getdonein(int arr[], int val) {\n\t\tint div = arr.length / val;\n\t\tint count = 0;\n\t\tArrayList<ArrayList<Integer>> finalarray = new ArrayList<ArrayList<Integer>>();\n\t\tCollections.sort(finalarray, (a, b) -> {\n\t\t\treturn b.get(0) - a.get(0);\n\t\t});\n\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tArrayList<Integer> store = new ArrayList<Integer>();\n\t\t\tstore.add(arr[i]);\n\t\t\tif (count == val - 1) {\n\t\t\t\tfinalarray.add(new ArrayList<Integer>(store));\n\n\t\t\t\tcount = 0;\n\t\t\t}\n\t\t\tcount++;\n\t\t}\n\t\tPriorityQueue<Integer> pr = new PriorityQueue<Integer>();\n\n\t\tfor (int i = 0; i < finalarray.size(); i++) {\n\t\t\tpr.add(finalarray.get(i).get(0));\n\t\t\tfinalarray.get(i).remove(0);\n\t\t}\n\n\t\tArrayList<Integer> finalstore = new ArrayList<Integer>();\n\t\twhile (!finalarray.isEmpty()) {\n\t\t\tfor (int i = 0; i < finalarray.size(); i++) {\n\t\t\t\tif (pr.peek() <= finalarray.get(i).get(0)) {\n\t\t\t\t\tfinalstore.add(pr.poll());\n\t\t\t\t\tpr.add(finalarray.get(i).get(0));\n\t\t\t\t\tfinalarray.get(i).remove(0);\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\t\tSystem.out.println(finalstore);\n\n\t}", "private double[] getEntradasSegundaCamada(double[] saidasPrimeiraCamada) {\n double[] entradaSegundaCamada = Arrays.copyOf(saidasPrimeiraCamada, saidasPrimeiraCamada.length + 1);\n entradaSegundaCamada[entradaSegundaCamada.length - 1] = 1.0;\n return entradaSegundaCamada;\n }", "public BigDecimal divideNumbers(List<Integer> numbers) throws Exception;", "static int[] modifiedArrayWithoutDivision(int[] original) {\n\t\tint[] newArr = new int[original.length];\n\t\tint tempProduct = 1;\n\t\t\n\t\t// For each index in new array\n\t\tfor (int i = 0; i < newArr.length; i++) {\n\t\t\t// For each int in original array\n\t\t\tfor (int j = 0; j < original.length; j++) {\n\t\t\t\t// If not the current index, multiply number by tempProduct\n\t\t\t\tif (j != i) {\n\t\t\t\t\ttempProduct *= original[j];\n\t\t\t\t}\n\t\t\t}\n\t\t\tnewArr[i] = tempProduct; // Store product in current array index\n\t\t\ttempProduct = 1; // Reset product\n\t\t}\n\t\treturn newArr;\n\t}", "@Override\r\n\tpublic void div(int x, int y) {\n\t\t\r\n\t}", "public void reduce(){\r\n int num = numerator;\r\n int denom = denominator;\r\n int greatest;\r\n \r\n // Find the greater of numerator and denominator\r\n if(numerator < 0){\r\n num = -numerator;\r\n }\r\n if(num > denom){\r\n greatest = num;\r\n }\r\n else\r\n greatest = denom;\r\n \r\n // Find the GCD\r\n int gcd = 0;\r\n // starting from the largest\r\n for(int i = greatest; i > 1; i--){\r\n if((numerator % i == 0) && (denominator % i == 0)){\r\n gcd = i;\r\n break;\r\n }\r\n }\r\n // factor out the gcd in both the numerator and denominator\r\n if(gcd != 0){\r\n numerator /= gcd;\r\n denominator /= gcd;\r\n }\r\n }", "@Override\r\n public List<Document> processDocument(Document doc) {\n if (!(doc.hasField(dividendField) && doc.hasField(divisorField))) {\r\n return null;\r\n }\r\n if (doc.getField(dividendField).size() != doc.getField(divisorField).size()) {\r\n log.warn(\"Dividend and Divisor fields of unequal length.\");\r\n return null;\r\n }\r\n ArrayList<Double> results = new ArrayList<Double>();\r\n int size = doc.getField(dividendField).size();\r\n for (int i = 0; i < size; i++) {\r\n try {\r\n // log.info(\"Compute {} divided by {}\",\r\n // doc.getField(dividendField).get(i),\r\n // doc.getField(divisorField).get(i));\r\n Double divisor = convertToDouble(doc.getField(divisorField).get(i));\r\n Double dividend = convertToDouble(doc.getField(dividendField).get(i));\r\n if (divisor == 0.0) {\r\n continue;\r\n }\r\n Double quotient = dividend / divisor;\r\n results.add(quotient);\r\n } catch (ClassCastException e) {\r\n log.warn(\"Division Error DocID: \", doc.getId());\r\n e.printStackTrace();\r\n }\r\n }\r\n\r\n if (dividendField.equals(quotentField)) {\r\n doc.removeField(quotentField);\r\n }\r\n for (Double v : results) {\r\n doc.addToField(quotentField, v);\r\n }\r\n\r\n return null;\r\n }", "private static double[] normalize(double[] data)\n {\n double sum = 0;\n \n for (double d : data)\n sum += d;\n \n if (sum != 1 && sum != 0)\n {\n for (int i = 0; i < data.length; i++)\n data[i] /= sum;\n }\n \n return data;\n }", "static Double executeDivition(List<Double> operands) {\n Double result = null;\n for (Double operand : operands) {\n if (Objects.isNull(result)) {\n result = operand;\n }\n else {\n result = result / operand;\n }\n }\n return result;\n }", "public static void calcIntegersDivBy()\r\n\t{\r\n\t\tint x = 5;\r\n\t\tint y = 20;\r\n\t\tint p = 3;\r\n\t\tint result = 0;\r\n\t\tif (x % p == 0)\r\n\t\t\tresult = (y / p - x / p + 1);\r\n\t\telse\r\n\t\t\tresult = (y / p - x / p);\r\n\t\tSystem.out.println(result);\r\n\t}", "public void reduce() {\n\tint g = this.gcd();\n\tif ( g != 0 ) {\n\t numerator /= g;\n\t denominator /= g;\n\t}\n }", "public static double[] elementWiseDivide(double[] a, double b){\n\n\t\t\tdouble[] res = new double[a.length];\n\n\t\t\tfor(int i = 0; i < a.length; i++)\n\t\t\t\tres[i] = (a[i] / b);\n\n\t\t\treturn res;\n\n }", "static int[] triDeShell(int tableau[]) {\r\n\r\n\t\tfinal Logger logger = LogManager.getLogger(TriDeShell.class.getName());\r\n\r\n\t\tif (logger.isDebugEnabled())\r\n\t\t\tlogger.debug(\"Entrée dans la fonction tri de shell\");\r\n\r\n\t\tint pas = 0;\r\n\t\tint valIns = 0;\r\n\r\n\t\twhile (pas < tableau.length) {\r\n\r\n\t\t\tpas = (pas * 3) + 1;\r\n\r\n\t\t}\r\n\r\n\t\tpas = pas / 3;\r\n\r\n\t\twhile (pas > 1) {\r\n\r\n\t\t\tpas = pas / 3;\r\n\r\n\t\t\tfor (int i = pas; i <= tableau.length - 1; i++) {\r\n\r\n\t\t\t\tvalIns = tableau[i];\r\n\r\n\t\t\t\tint j = i;\r\n\r\n\t\t\t\twhile (j >= pas && tableau[j - pas] > valIns) { // solution de la première valeur non triée reprise du\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// TP de Gabriel Bouty (merci à lui)\r\n\r\n\t\t\t\t\ttableau[j] = tableau[j - pas];\r\n\r\n\t\t\t\t\tj = j - pas;\r\n\r\n\t\t\t\t}\r\n\r\n\t\t\t\ttableau[j] = valIns;\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\treturn tableau;\r\n\r\n\t}", "private void cuentaminas() {\n\t//TODO: falta por hacer que calcule lasminas en el borde exterior\n\t//Probar a hacerlo con un try catch\n\tint minas = 0;\n\n\tfor (int i = 0; i < filas; i++) {\n\t for (int j = 0; j < columnas; j++) {\n\t\t//\t1 2 3\n\t\t//\t4 X 5\n\t\t//\t6 7 8\n\t\ttry {\n\t\t minas += arrayBotones[i - 1][j - 1].getMina();//1\n\n\t\t} catch (Exception e) {\n\t\t}\n\t\ttry {\n\t\t minas += arrayBotones[i - 1][j].getMina();//2\n\n\t\t} catch (Exception e) {\n\t\t}\n\t\ttry {\n\t\t minas += arrayBotones[i - 1][j + 1].getMina();//3\n\t\t} catch (Exception e) {\n\t\t}\n\t\ttry {\n\t\t minas += arrayBotones[i][j - 1].getMina();//4\n\n\t\t} catch (Exception e) {\n\t\t}\n\t\ttry {\n\t\t minas += arrayBotones[i][j + 1].getMina();//5\n\t\t} catch (Exception e) {\n\t\t}\n\t\ttry {\n\t\t minas += arrayBotones[i + 1][j - 1].getMina();//6 \t\t \n\t\t} catch (Exception e) {\n\t\t}\n\t\ttry {\n\t\t minas += arrayBotones[i + 1][j].getMina();//7\n\t\t} catch (Exception e) {\n\t\t}\n\t\ttry {\n\t\t minas += arrayBotones[i + 1][j + 1].getMina();//8\n\t\t} catch (Exception e) {\n\t\t}\n\t\tarrayBotones[i][j].setNumeroMinasAlrededor(minas);\n\t\t//TODO: comentar la siguiente parte para que no aparezcan los numeros al iniciar\n//\t\tif (arrayBotones[i][j].getMina() == 0 && minas != 0) {\n//\t\t arrayBotones[i][j].setText(String.valueOf(minas));\n//\t\t}\n\t\tminas = 0;\n\t }\n\t}\n }", "public static void main(String[] args) throws Exception {\r\n Scanner input = new Scanner(System.in);\r\n int n;\r\n // System.out.println(\"Enter the number of element\");\r\n n = input.nextInt();\r\n // System.out.println(\"here is n\"+n);\r\n int arr[] = new int[n];\r\n // System.out.println(\"Enter the element of the array\");\r\n for (int i = 0; i < n; i++) {\r\n arr[i] = input.nextInt();\r\n }\r\n int sol_arr_1[][] = new int[n][n], sol_arr_2[][] = new int[n][n];\r\n \r\n //*****intialization*****//\r\n for(int i=0;i<n;i++)\r\n {\r\n for(int j=0;j<n;j++)\r\n {\r\n sol_arr_1[i][j]=0;\r\n sol_arr_2[i][j]=0;\r\n }\r\n }\r\n //*****end*****//\r\n \r\n \r\n \r\n \r\n \r\n int k_for_j = 1;\r\n int i = 0, j = 1;\r\n for (int q = 0; q < n - 1; q++) {\r\n // System.out.println(\"q=\"+q);\r\n j = k_for_j;\r\n i=0;\r\n if (q == 0) {\r\n while (j < n) {\r\n sol_arr_1[i][j] = (arr[i] + arr[j]) % 100;\r\n sol_arr_2[i][j] = (arr[i] * arr[j]);\r\n i++;\r\n j++;\r\n }\r\n }\r\n else\r\n {\r\n while(j<n)\r\n {\r\n int color1,smog1;\r\n color1=(arr[j]+sol_arr_1[i][j-1])%100;\r\n smog1=sol_arr_2[i][j-1]+(arr[j]*sol_arr_1[i][j-1]);\r\n int color2,smog2;\r\n color2 =(sol_arr_1[i+1][j]+arr[j-2])%100;\r\n smog2=(sol_arr_1[i+1][j]*arr[j-2])+sol_arr_2[i+1][j];\r\n if(smog1>smog2)\r\n {\r\n sol_arr_1[i][j]=color2;\r\n sol_arr_2[i][j]=smog2;\r\n }\r\n else\r\n {\r\n sol_arr_1[i][j]=color1;\r\n sol_arr_2[i][j]=smog1;\r\n }\r\n i++;\r\n j++;\r\n }\r\n }\r\n k_for_j++;\r\n }\r\n System.out.println(sol_arr_2[0][n-1]);\r\n }", "public static int[] largestMultiple(int[] arr) {\r\n\t\tif(arr==null || arr.length==0) return arr;\r\n\t\t\r\n\t\tQueue<Integer> q1 = new PriorityQueue<Integer>();\r\n\t\tQueue<Integer> q2 = new PriorityQueue<Integer>();\r\n\t\tQueue<Integer> q3 = new PriorityQueue<Integer>();\r\n\t\t\r\n\t\tArrays.sort(arr);\r\n\t\t\r\n\t\tint sum= 0;\r\n\t\tfor(int i=0;i<arr.length;i++) {\r\n\t\t\tif(arr[i]%3==0) {\r\n\t\t\t\tq1.add(arr[i]);\r\n\t\t\t}\r\n\t\t\telse if(arr[i]%3==1) {\r\n\t\t\t\tq2.add(arr[i]);\r\n\t\t\t}\r\n\t\t\telse \r\n\t\t\t\tq3.add(arr[i]);\r\n\t\t\tsum += arr[i];\r\n\t\t}\r\n\t\t\r\n\t\tif(sum%3==2) {\r\n\t\t\tif(!q2.isEmpty()) {\r\n\t\t\t\tq2.remove();\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tif(!q1.isEmpty()) {\r\n\t\t\t\t\tq1.remove();\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t\treturn null;\r\n\t\t\t\tif(!q1.isEmpty()) {\r\n\t\t\t\t\tq1.remove();\r\n\t\t\t\t}\r\n\t\t\t\telse \r\n\t\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t}\r\n\t\telse if(sum%3==1) {\r\n\t\t\tif(!q1.isEmpty()) {\r\n\t\t\t\tq1.remove();\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tif(!q2.isEmpty()) \r\n\t\t\t\t\tq2.remove();\r\n\t\t\t\telse \r\n\t\t\t\t\treturn null;\r\n\t\t\t\tif(!q2.isEmpty()) \r\n\t\t\t\t\tq2.remove();\r\n\t\t\t\telse\r\n\t\t\t\t\treturn null;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\tint top=0;\r\n\t\twhile(!q1.isEmpty()) {\r\n\t\t\tarr[top++] = (int)q1.remove();\r\n\t\t}\r\n\t\twhile(!q2.isEmpty()) {\r\n\t\t\tarr[top++] = (int) q2.remove();\r\n\t\t}\r\n\t\t\r\n\t\twhile(!q3.isEmpty()) {\r\n\t\t\tarr[top++] = (int) q3.remove();\r\n\t\t}\r\n\t\tfor(int i=top-1;i>=0;i--){\r\n\t\t\tSystem.out.print(arr[i]+\" \");\r\n\t\t}\r\n\t\treturn arr;\r\n\t}", "public void hallarPerimetroIsosceles() {\r\n this.perimetro = 2*(this.ladoA+this.ladoB);\r\n }", "private int[] divide(int[] x, int[] y)\n {\n int xyCmp = compareTo(0, x, 0, y);\n int[] count;\n\n if (xyCmp > 0)\n {\n int[] c;\n\n int shift = calcBitLength(1, 0, x) - calcBitLength(1, 0, y);\n\n if (shift > 1)\n {\n c = shiftLeft(y, shift - 1);\n count = shiftLeft(ONE.magnitude, shift - 1);\n if (shift % 32 == 0)\n {\n // Special case where the shift is the size of an int.\n int countSpecial[] = new int[shift / 32 + 1];\n System.arraycopy(count, 0, countSpecial, 1, countSpecial.length - 1);\n countSpecial[0] = 0;\n count = countSpecial;\n }\n }\n else\n {\n c = new int[x.length];\n count = new int[1];\n\n System.arraycopy(y, 0, c, c.length - y.length, y.length);\n count[0] = 1;\n }\n\n int[] iCount = new int[count.length];\n\n subtract(0, x, 0, c);\n System.arraycopy(count, 0, iCount, 0, count.length);\n\n int xStart = 0;\n int cStart = 0;\n int iCountStart = 0;\n\n for (; ; )\n {\n int cmp = compareTo(xStart, x, cStart, c);\n\n while (cmp >= 0)\n {\n subtract(xStart, x, cStart, c);\n add(count, iCount);\n cmp = compareTo(xStart, x, cStart, c);\n }\n\n xyCmp = compareTo(xStart, x, 0, y);\n\n if (xyCmp > 0)\n {\n if (x[xStart] == 0)\n {\n xStart++;\n }\n\n shift = calcBitLength(1, cStart, c) - calcBitLength(1, xStart, x);\n\n if (shift == 0)\n {\n shiftRightOneInPlace(cStart, c);\n shiftRightOneInPlace(iCountStart, iCount);\n }\n else\n {\n shiftRightInPlace(cStart, c, shift);\n shiftRightInPlace(iCountStart, iCount, shift);\n }\n\n if (c[cStart] == 0)\n {\n cStart++;\n }\n\n if (iCount[iCountStart] == 0)\n {\n iCountStart++;\n }\n }\n else if (xyCmp == 0)\n {\n add(count, ONE.magnitude);\n for (int i = xStart; i != x.length; i++)\n {\n x[i] = 0;\n }\n break;\n }\n else\n {\n break;\n }\n }\n }\n else if (xyCmp == 0)\n {\n count = new int[1];\n count[0] = 1;\n Arrays.fill(x, 0);\n }\n else\n {\n count = new int[1];\n count[0] = 0;\n }\n\n return count;\n }", "private void reduce() {\n /** The fraction is equal to 0. The numerator is 0 in this case */\n if(this.numerator == 0)\n this.denominator = 1;\n /** The numerator and denominator are not equal */\n else if (this.numerator != this.denominator) {\n\n /** The greatest common divisor of the numerator and denominator of this fraction */\n int gcd = getGCD(Math.abs(this.numerator), Math.abs(this.denominator));\n\n /** There is a greatest common divisor greater than 1 */\n if (gcd > 1) {\n this.numerator /= gcd;\n this.denominator /= gcd;\n }\n } \n /** The fraction is equal to 1 */\n else {\n this.numerator = 1;\n this.denominator = 1;\n }\n }", "public double divisao (double numero1, double numero2){\n\t}", "public static void exArray01() {\r\n\r\n\t\tint i = 0;\r\n\t\tint K = 2;\r\n\t\tint sum = 0;\r\n\t\tint[] a = new int[5];\r\n\r\n\t\tSystem.out.println(\"Array with random numbers: \");\r\n\r\n\t\tfor (i = 0; i < a.length; i++) {\r\n\t\t\ta[i] = Helper.getRandomRange(1, 10);\r\n\t\t\tSystem.out.print(a[i] + \" \");\r\n\t\t}\r\n\r\n\t\tfor (i = 0; i < a.length; i++) {\r\n\r\n\t\t\tif ((a[i] % K) == 0) {\r\n\t\t\t\tsum += a[i];\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t\tSystem.out.println(\"\\nSum of all multiples to \" + K + \" equals to \" + sum);\r\n\r\n\t}", "private void simplify(){\n\n\t\tint gcd;\n\t\twhile(true){ \n\t \tgcd = greatestCommonDivisor(myNumerator, myDenominator);\n\t \tif (gcd ==1) return;\n\t \tmyNumerator = myNumerator / gcd;\n\t \tmyDenominator = myDenominator / gcd;\n\t\t}\n }", "public Chunks chunkDivide(List<Integer> S, int c) {\n\t\tdouble chunks = Math.ceil(c/2.0);\n\t\tList<Integer> S1 = new ArrayList<Integer>();\n\t\tList<Integer> S2 = new ArrayList<Integer>();\n\t\tint j = 0;\n\t\twhile(j < chunks) {\t\n\t\t\twhile(comps(S.get(0), S.get(1)) && S.size() > 1 && (S.get(0) < S.get(1))){\t\t//comparisons\n\t\t\t\tS1.add(S.remove(0));\n\t\t\t}\n\t\t\tS1.add(S.remove(0));\n\t\t\tj++;\n\t\t} \n\t\twhile(S.size() != 0) {\n\t\t\tS2.add(S.remove(0));\n\t\t}\t\n\t\tChunks p = new Chunks(S1, S2);\n\t\treturn p;\n\t}", "static ArrayList<Integer> getMajortiy(int arr[]){\n int num1=-1, num2=-1, count1=0, count2=0;\n for(int i:arr){\n if(i==num1) count1++;\n else if(i ==num2) count2++;\n else if(count1==0){\n num1=i;\n count1=1;\n }\n else if(count2==0){\n num2=i;\n count2=1;\n }\n else{\n count1--;\n count2--;\n }\n }\n count1=0; count2=0;\n for(int i:arr){\n if(i==num1) count1++;\n if(i==num2) count2++;\n }\n ArrayList<Integer>res= new ArrayList<>();\n if(count1>arr.length/3) res.add(num1);\n if(count2>arr.length/3) res.add(num2);\n return res;\n\n }", "private int[] divide(int[] x, int[] y)\n {\n int xyCmp = compareTo(0, x, 0, y);\n int[] count;\n\n if (xyCmp > 0)\n {\n int[] c;\n\n int shift = bitLength(0, x) - bitLength(0, y);\n\n if (shift > 1)\n {\n c = shiftLeft(y, shift - 1);\n count = shiftLeft(ONE.magnitude, shift - 1);\n if (shift % 32 == 0)\n {\n // Special case where the shift is the size of an int.\n int countSpecial[] = new int[shift / 32 + 1];\n System.arraycopy(count, 0, countSpecial, 1, countSpecial.length - 1);\n countSpecial[0] = 0;\n count = countSpecial;\n }\n }\n else\n {\n c = new int[x.length];\n count = new int[1];\n\n System.arraycopy(y, 0, c, c.length - y.length, y.length);\n count[0] = 1;\n }\n\n int[] iCount = new int[count.length];\n\n subtract(0, x, 0, c);\n System.arraycopy(count, 0, iCount, 0, count.length);\n\n int xStart = 0;\n int cStart = 0;\n int iCountStart = 0;\n\n for (; ; )\n {\n int cmp = compareTo(xStart, x, cStart, c);\n\n while (cmp >= 0)\n {\n subtract(xStart, x, cStart, c);\n add(count, iCount);\n cmp = compareTo(xStart, x, cStart, c);\n }\n\n xyCmp = compareTo(xStart, x, 0, y);\n\n if (xyCmp > 0)\n {\n if (x[xStart] == 0)\n {\n xStart++;\n }\n\n shift = bitLength(cStart, c) - bitLength(xStart, x);\n\n if (shift == 0)\n {\n c = shiftRightOne(cStart, c);\n iCount = shiftRightOne(iCountStart, iCount);\n }\n else\n {\n c = shiftRight(cStart, c, shift);\n iCount = shiftRight(iCountStart, iCount, shift);\n }\n\n if (c[cStart] == 0)\n {\n cStart++;\n }\n\n if (iCount[iCountStart] == 0)\n {\n iCountStart++;\n }\n }\n else if (xyCmp == 0)\n {\n add(count, ONE.magnitude);\n for (int i = xStart; i != x.length; i++)\n {\n x[i] = 0;\n }\n break;\n }\n else\n {\n break;\n }\n }\n }\n else if (xyCmp == 0)\n {\n count = new int[1];\n\n count[0] = 1;\n }\n else\n {\n count = new int[1];\n\n count[0] = 0;\n }\n\n return count;\n }", "public static void divisores(int n){\n for(int i=1;i<=n;i++){\n if(n%i==0){System.out.println(i+\" es divisor\");}\n }\n }", "public double divide(double a, double b, boolean rem){ return rem? a%b: a/b; }", "public static void Promedio(){\n int ISumaNotas=0;\n int IFila=0,ICol=0;\n int INota;\n float FltPromedio;\n for(IFila=0;IFila<10;IFila++)\n {\n ISumaNotas+=Integer.parseInt(StrNotas[IFila][1]);\n }\n FltPromedio=ISumaNotas/10;\n System.out.println(\"El promedio de la clase es:\"+FltPromedio);\n }", "public static void main(String[] args) {\n\t\tint[] prime= new int[1229]; //only need primes up to 10000\n\t\tint n=1;\n\t\tint index=0;\n\t\tint test=0;\n\t\tfor (int i=2; (i-n)<=1229; i++) {\n\t\t\tfor (int j=2; j<=Math.sqrt(i); j++) {\n\t\t\t\tint k=i%j;\n\t\t\t\tif (k==0) {\n\t\t\t\t\tn++;\n\t\t\t\t\ttest++;\n\t\t\t\t\tj=(int)Math.sqrt(i);\n\t\t\t\t} \n\t\t\t}\n\t\t\tif (test==0) {\n\t\t\t\tprime[index]=i;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\ttest=0;\n\t\t}\n\t\t\n\t\t//use primes to find prime factorization and sum of divisors\n\t\tint [] divides= new int[1229]; //Number of times each prime divides a number\n\t\tint [] sumOfDivisors= new int[10000]; //Sum of divisors for i at index i\n\t\tint total=0;\n\t\tint sum=1;\n\t\tindex=1;\n\t\tfor (int i=2; i<=10000; i++) {\n\t\t\tint d=i;\n\t\t\tfor (int j=0; j<1229; j++) { //find prime factorization for i\n\t\t\t\twhile (d%prime[j]==0 && d>1) {\n\t\t\t\t\td=d/prime[j];\n\t\t\t\t\tdivides[j]++;\n\t\t\t\t}\t\n\t\t\t}\n\t\t\tfor (int j=0; j<1229; j++) { //use Number theory formula for sum of divisors\n\t\t\t\tsum*=(Math.pow(prime[j], divides[j]+1)-1)/(prime[j]-1);\n\t\t\t}\n\t\t\tif (sum-i<i) { //only check if sum of divisors of i is less than i\n\t\t\t\tif (sumOfDivisors[sum-i-1]==i) { //check if amicable pair\n\t\t\t\t\ttotal=total+i+sum-i; //add both to total (only happens once)\n\t\t\t\t}\n\t\t\t}\n\t\t\tArrays.fill(divides,0); //reset divisors array\n\t\t\tsumOfDivisors[index]=sum-i; //store number of divisors\n\t\t\tsum=1;\n\t\t\tindex++;\n\t\t}\n\t\tSystem.out.print(\"The sum of all amicable numbers less than 10000 is: \");\n\t\tSystem.out.println(total);\n long endTime = System.currentTimeMillis();\n System.out.println(\"It took \" + (endTime - startTime) + \" milliseconds.\");\n\n\t}", "private int[] enquadramentoViolacaoCamadaFisica(int[] quadro) throws Exception {\n System.out.println(\"\\n\\t[Violacao da Camada Fisica]\");\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\n\\t[Violacao da Camada Fisica]\");\n Thread.sleep(velocidade);\n\n final int byteFlag = 255;//00000000 00000000 00000000 11111111\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\n\\t[Bits de Flag [11111111] = 255]\\n\\n\");\n Thread.sleep(velocidade);\n\n String auxiliar = \"\";\n Boolean SE = true;\n\n for (int inteiro : quadro) {\n int quantidadeByte = ManipuladorDeBit.quantidadeDeBytes(inteiro);\n ManipuladorDeBit.imprimirBits(inteiro);\n inteiro = ManipuladorDeBit.deslocarBits(inteiro);\n ManipuladorDeBit.imprimirBits(inteiro);\n int inteiroByte = ManipuladorDeBit.getPrimeiroByte(inteiro);\n\n if (inteiroByte == byteFlag) {//Inicio do Quadro\n SE = !SE;//Iniciar a Busca pelo Byte de Fim de Quadro\n inteiro <<= 8;//Deslocando 8 bits para a esquerda\n quantidadeByte--;\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"\\tIC [\" + inteiroByte + \"] \");\n }\n\n if (!SE) {\n\n ManipuladorDeBit.imprimirBits(inteiro);\n\n for (int i=1; i<=quantidadeByte; i++) {\n int dado = ManipuladorDeBit.getPrimeiroByte(inteiro);\n ManipuladorDeBit.imprimirBits(dado);\n\n if (dado == byteFlag) {//Verificando se encontrou o Byte de Flag\n SE = !SE;//Encontrou o Byte de Fim de Quadro\n } else {\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(\"Carga Util [ \");\n\n int novoQuadro = 0;\n\n Boolean cincoBits1 = ManipuladorDeBit.cincoBitsSequenciais(dado,1);\n if (cincoBits1) {\n\n dado = ManipuladorDeBit.deslocarBits(dado);\n ManipuladorDeBit.imprimirBits(dado);\n\n //Cria um inteiro com 1 no bit mais a esquerda e 0s em outros locais\n int displayMask = 1 << 31;//10000000 00000000 00000000 00000000\n //Para cada bit exibe 0 ou 1\n for (int b=1, cont=0; b<=8; b++) {\n //Utiliza displayMask para isolar o bit\n int bit = (dado & displayMask) == 0 ? 0 : 1;\n\n if (cont == 5) {\n cont = 0;//Zerando o contador\n dado <<= 1;//Desloca 1 bit para a esquerda\n bit = (dado & displayMask) == 0 ? 0 : 1;\n }\n\n if (b == 8) {//Quando chegar no Ultimo Bit\n inteiro <<= 8;//Deslocando 8 bits para esquerda\n dado = ManipuladorDeBit.getPrimeiroByte(inteiro);\n dado = ManipuladorDeBit.deslocarBits(dado);\n ManipuladorDeBit.imprimirBits(dado);\n\n novoQuadro <<= 1;//Deslocando 1 bit para a esquerda\n novoQuadro |= ManipuladorDeBit.pegarBitNaPosicao(dado,1);//Adicionando o bit ao novoDado\n\n ManipuladorDeBit.imprimirBits(novoQuadro);\n\n auxiliar += (char) novoQuadro;\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(novoQuadro + \" ]\\n\");\n Thread.sleep(velocidade);\n i++;\n\n } else {//Colocando o Bit no novoQuadro\n novoQuadro <<= 1;//Deslocando 1 bit para a esquerda\n novoQuadro |= bit;//Adicionando o bit ao novoDado\n dado <<= 1;//Desloca 1 bit para a esquerda\n }\n\n if (bit == 1) {//Quando for um bit 1\n cont++;\n } else {//Caso vinher um bit 0\n cont = 0;\n }\n }\n\n } else {//Caso nao tem uma sequencia de 5 Bits 1's\n auxiliar += (char) dado;\n Painel.CAMADAS_RECEPTORAS.camadaEnlace(dado + \" ]\\n\");\n Thread.sleep(velocidade);\n }\n }\n \n inteiro <<= 8;//Deslocando 8 bits para a esquerda;\n }\n\n }\n }\n\n //Novo Quadro de Carga Util\n int[] quadroDesenquadrado = new int[auxiliar.length()];\n //Adicionando as informacoes de Carga Util no QuadroDesenquadrado\n for (int i=0; i<auxiliar.length(); i++) {\n quadroDesenquadrado[i] = (int) auxiliar.charAt(i);\n ManipuladorDeBit.imprimirBits(quadroDesenquadrado[i]);\n }\n\n return quadroDesenquadrado;\n }", "@Override\r\n\tpublic int div() {\n\t\treturn 0;\r\n\t}", "public double eval(double[] data) {\r\n\t\tif (rChild.eval(data) == 0){\r\n\t\t\tSystem.out.println(\"Divisor = 0\");\r\n\t\t\tSystem.exit(0);\r\n\t\t}\r\n\t\treturn lChild.eval(data) / rChild.eval(data);\r\n\t}" ]
[ "0.6261789", "0.6210613", "0.60051775", "0.5947086", "0.5916758", "0.5904879", "0.58920306", "0.5859013", "0.5701771", "0.5696831", "0.56702244", "0.56410027", "0.5638765", "0.5627765", "0.56001985", "0.5598775", "0.55940473", "0.55773604", "0.55082214", "0.55075824", "0.5503236", "0.5472565", "0.5470214", "0.53853357", "0.53646845", "0.5362455", "0.535075", "0.53295153", "0.532771", "0.53139776", "0.5313307", "0.5312824", "0.53060156", "0.5288373", "0.5287641", "0.5285858", "0.5242603", "0.5238188", "0.5237046", "0.52363807", "0.52282965", "0.52256984", "0.51987386", "0.51856613", "0.5181992", "0.5171696", "0.51699454", "0.51670057", "0.5163869", "0.51624966", "0.51623803", "0.5157868", "0.51488405", "0.51305366", "0.512575", "0.5117591", "0.51158804", "0.51107264", "0.510636", "0.51040584", "0.5101296", "0.5098349", "0.5096403", "0.5087239", "0.5079849", "0.50791097", "0.5062481", "0.5057128", "0.50570506", "0.50501114", "0.5049343", "0.50470525", "0.50277364", "0.50220025", "0.50168955", "0.50156575", "0.50122875", "0.4999456", "0.4995814", "0.4995798", "0.499407", "0.49845228", "0.49760526", "0.49755836", "0.4974133", "0.49705708", "0.49552995", "0.4942395", "0.494103", "0.49386197", "0.49356663", "0.49228954", "0.492213", "0.49216193", "0.49190333", "0.49097776", "0.49083662", "0.49078912", "0.49034664", "0.49001482", "0.48942384" ]
0.0
-1
If the specified RemoveRandom is empty, remove it. LOCKING: Must be called with no locks held, particularly no locks on the RemoveRandom, because we take locks in order!
public void maybeRemove(RemoveRandom r, ObjectContainer container, ClientContext context);
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public T removeRandom();", "public T removeRandom ();", "public T remove() {\r\n \r\n if (this.isEmpty()) {\r\n return null;\r\n }\r\n \r\n Random r = new Random();\r\n // Randomly selects element to remove and stores in rValue.\r\n int rValue = r.nextInt(size);\r\n // Store removed element in remove\r\n T remove = elements[rValue];\r\n elements[rValue] = null;\r\n \r\n // Move last element to replace \"remove\" if \"remove\" is not last element\r\n if (rValue != (size - 1)) {\r\n elements[rValue] = elements[size - 1];\r\n elements[size - 1] = null;\r\n }\r\n size--;\r\n // If array is less than 25% full, resize to 1/2 of current size.\r\n if (size > 0 && size < elements.length / 4) {\r\n resize(elements.length / 2);\r\n }\r\n return remove;\r\n }", "public void remove() {\n if (count == 0) {\n return;\n }\n \n Random rand = new Random();\n int index = rand.nextInt(count);\n for (int i = index; i < count - 1; i++) {\n list[i] = list[i+1];\n }\n count--; \n }", "public void removeRandom() {\n Node[] nodes = getRandomNonterminalNode(false);\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 nodes[PREV].left = replacementNode;\n } else {\n nodes[PREV].right = replacementNode;\n }\n }", "public T remove() {\r\n if (size() == 0) {\r\n return null;\r\n }\r\n int r = new Random().nextInt(size());\r\n \r\n T deleted = elements[r];\r\n elements[r] = elements[size() - 1];\r\n elements[size() - 1] = null;\r\n size--;\r\n \r\n if (size() > 0 && size() < elements.length / 4) {\r\n resize(elements.length / 2);\r\n }\r\n \r\n return deleted;\r\n }", "public String remove(){\n ListIterator<String> iter = bookkeeper.listIterator();\n int random = (int)(Math.random()*bookkeeper.size());\n System.out.println(\"\\n\\n***RANDOM = \" + random);\n String retrieve = bookkeeper.get(random);\n int i = -1; while (i<random){ i++; iter.next(); } iter.remove();\n return retrieve;\n }", "public void clearRandomItems();", "public Integer remove() {\n while (true) {\n\n if (buffer.isEmpty()) {\n System.out.println(\"List is empty! Waiting..\");\n try {\n Thread.sleep(500);\n } catch (InterruptedException e) {\n System.out.println(e.getMessage());\n }\n } else {\n full.waiting();\n mutex.waiting();\n int back = buffer.removeFirst();\n mutex.signal();\n empty.signal();\n return back;\n\n }\n }\n\n\n }", "@Override public void run()\n {\n final Set<E> elements = process.elements();\n if (elements.isEmpty() || random.nextDouble() * 3 - 2/*(-2..1]*/ < 0)\n send(process.add(randomNewElement()));\n else\n send(process.remove(randomElement(elements)));\n }", "public void remove() {\n\t\tprocess temp = queue.removeFirst();\n\t}", "@Override\n public E poll() {\n if (queue.isEmpty()) {\n throw new IllegalArgumentException(\"There's no element to remove in Random Qeuue\");\n }\n\n if (r.nextInt() % 2 == 1) {\n return queue.removeFirst();\n } else {\n return queue.removeLast();\n }\n }", "public Item dequeue() {\n \t if (size==0){\n \t \tthrow new NoSuchElementException();\n \t }\n \t int index = StdRandom.uniform(size);\n // System.out.println(\"The index of the removed number is: \" + index);\n \t Node p=sentinel.next.next;\n \t for (int i = 0; i < index; i++){\n p = p.next; \n \t }\n \t p.prev.next = p.next;\n \t p.next.prev = p.prev;\n \t size = size - 1;\n \t return p.item;\n }", "public void removeArtifact() {\r\n\t\tRandom r = new Random();\r\n\t\tint num;\r\n\t\tString artifact;\r\n\t\t// Pick random artifact and remove it\r\n\t\tdo {\r\n\t\t\tnum = r.nextInt(artifacts.length);\r\n\t\t\tartifact = artifacts[num];\r\n\t\t} while (artifact == null);\r\n\t\tfor (int i = 0; i < mapContents.length; i++) {\r\n\t\t\tif (mapContents[i] != null && artifact.contentEquals(mapContents[i])) {\r\n\t\t\t\tmapContents[i] = null;\r\n\t\t\t}\r\n\t\t}\r\n\t\tartifacts[num] = null;\r\n\t}", "public boolean atomicRemove();", "@Test\n\tpublic void testRemove() {\n\t\ttry {\n\t\t\tVRDevice v1 = new VRDevice(\"Serial\", \"Name\", 0);\n\t\t\ts1.putOnWaitingList(v1);\n\t\t} catch (BadDeviceInformationException e) {\n\t\t\tSystem.out.println(e);\n\t\t}\n\n\t\ts1.remove(null, 0);\n\n\t\tassertEquals(\"\", s1.printWaitList(null));\n\t\t\n\t\ttry {\n\t\t\tVRDevice v1 = new VRDevice(\"Serial\", \"Name\", 0);\n\t\t\ts1.putOnWaitingList(v1);\n\t\t} catch (BadDeviceInformationException e) {\n\t\t\tSystem.out.println(e);\n\t\t}\n\t\t\n\t\ts1.remove(\"n\", 0);\n\t\tassertEquals(\"\", s1.printWaitList(null));\n\t}", "private void remove_elements() throws InterruptedException {\n while (buffer.getNumElementsInBuffer() > 0 || !this.threadComplete) {\n if (hasServerRemovedAllElements()) {\n return;\n }\n if (buffer.attemptRemove(this)) {\n elementsRemoved++;\n }\n //Thread.sleep(1); // For testing buffer being frequently full\n }\n }", "public synchronized Integer remove() {\r\n while (true) {\r\n if (buffer.size() == 0) {\r\n try {\r\n wait();\r\n } catch (InterruptedException e) {\r\n e.printStackTrace();\r\n }\r\n }\r\n Integer back = buffer.removeFirst();\r\n notifyAll();\r\n return back;\r\n }\r\n }", "public static boolean purge(){\r\n if((Math.random()*1000)<5) return true;\r\n return false;\r\n }", "void removeAt(final int removeIndex) {\n final Object[] items = this.items;\n if (removeIndex == takeIndex) {\n items[takeIndex] = null;\n if (++takeIndex == items.length) takeIndex = 0;\n count--;\n } else {\n final int putIndex = this.putIndex;\n for (int i = removeIndex;;) {\n int next = i + 1;\n if (next == items.length) next = 0;\n if (next != putIndex) {\n items[i] = items[next];\n i = next;\n } else {\n items[i] = null;\n this.putIndex = i;\n break;\n }\n }\n count--;\n }\n notFull.signal();\n }", "public Item dequeue() {\n if (N == 0) throw new NoSuchElementException();\n int idx = StdRandom.uniform(N);\n Item removed = s[first + idx];\n s[first + idx] = null;\n if (idx == 0) first++;\n else if (idx != N-1) {\n shrink(first+idx);\n }\n N--;\n if (N == 0) first = 0;\n return removed;\n }", "public CardCollection destroyRandom(int number) ;", "public void remove() {\n\t\t if (lastReturned == null)\n\t\t throw new IllegalStateException(\n\t\t \"Iterator call to next() \" +\n\t\t \"required before calling remove()\");\n\t\t\tif (modCount != expectedModCount)\n\t\t\t\t throw new ConcurrentModificationException();\n\n\t\t\t// remove lastReturned by calling remove() in Hash.\n\t\t\t// this call will increment modCount\n\t\t\tHashAVL.this.remove(lastReturned);\n\t\t\texpectedModCount = modCount;\n\t\t\tlastReturned = null;\n\t\t}", "public boolean remove (RandomStream stream) {\n return streams.remove (stream);\n }", "public Item dequeue() {\n if (isEmpty())\n throw new NoSuchElementException();\n\n // Get random index [0, elements) and remove from array\n int randomIndex = StdRandom.uniform(0, elements);\n Item removed = values[randomIndex];\n\n // Move last added item to fill the gap\n if (randomIndex != elements - 1)\n values[randomIndex] = values[elements - 1];\n\n values[elements - 1] = null;\n elements--;\n\n // Resize the array if necessary\n if (elements < values.length / 4)\n resize(values.length / 2);\n\n return removed;\n }", "public int generateRandom(Random ran)\n {\n if(nums.size()<=0)\n {\n Log.i(\"test\",\"No Pokemon left\");\n return 0;\n }\n return nums.remove(ran.nextInt(nums.size()));\n }", "public E remove() {\n\t\tif (mSize == 0)\n\t\t\tthrow new NoSuchElementException();\n\n\t\tE retVal = remove(mHead.next);\n\n\t\tmSize--;\n\t\tmodCount++;\n\n\t\treturn retVal;\n\t}", "public Builder clearRandomSampling() {\n if (randomSamplingBuilder_ == null) {\n randomSampling_ = null;\n onChanged();\n } else {\n randomSampling_ = null;\n randomSamplingBuilder_ = null;\n }\n\n return this;\n }", "public Item dequeue() {\r\n\t\tif (isEmpty()) {\r\n\t\t\tthrow new NullPointerException();\r\n\t\t}\r\n\t\telse {\r\n\t\t\tint index = StdRandom.uniform(0,n);\r\n\t\t\tItem toBeRemoved = queue[index];\r\n\t\t\tqueue[index] = queue[n-1];\r\n\t\t\tqueue[n-1] = null;\r\n\t\t\tn--;\r\n\t\t\tif (n > 0 && n == queue.length/4) {\r\n\t\t\t\tItem[] temp = (Item[]) new Object[queue.length/2];\r\n\t\t\t\tfor (int i = 0; i < n; i++) {\r\n\t\t\t\t\ttemp[i] = queue[i];\r\n\t\t\t\t}\r\n\t\t\t\tqueue = temp;\r\n\t\t\t}\r\n\t\t\treturn toBeRemoved;\r\n\t\t}\r\n\t}", "public T sampleWithRemoval(boolean useMostLikely) {\n\t\tT result = sample(useMostLikely);\n\t\tremove(result);\n\t\tnormaliseProbs();\n\t\treturn result;\n\t}", "public void ensureCannotRemoveNonExisitingAllergenMockito() {\n\n System.out.println(\"Ensure Cannot remove an Allergen Mockito/Functional\");\n\n Allergen allergen = new Allergen(\"al5\", \"allergen 5\");\n\n when(profile_mock.removeAllergen(Mockito.any(Allergen.class))).thenReturn(allergensList.remove(allergen)); //returns false because does not contains the allergen / CANNOT remove\n assertFalse(profile_mock.removeAllergen(allergen));\n\n\n verify(profile_mock, atLeast(1)).removeAllergen(Mockito.any(Allergen.class));\n }", "public Item dequeue() {\n if (isEmpty()) {\n throw new NoSuchElementException();\n }\n double rand = Math.random() * N;\n int randIdx = (int) Math.floor(rand);\n Item item = s[randIdx];\n N--;\n s[randIdx] = s[N];\n s[N] = null;\n if (N > 0 && N == s.length / 4) {\n resize(s.length / 2);\n }\n return item;\n }", "@Override\n\tpublic boolean isRandomizable() {\n\t\treturn false;\n\t}", "@Override\n public E remove() {\n if (size == 0){\n throw new NoSuchElementException();\n }\n E removed = heap[0];\n heap[0] = heap[--size];\n siftDown(0);\n return removed;\n }", "private boolean remove() {\r\n\t\t\treturn removed = true;\r\n\t\t}", "@Override\n\tpublic String remove(String key) {\n\t\tint hashVal = hashFunc(key);\n\t\twhile (hashArray[hashVal] != null) {\n\t\t\tif (hashArray[hashVal].value.equals(key)) {\n\t\t\t\thashArray[hashVal] = deleted;\n\t\t\t\tthis.numOfItems--;\n\t\t\t\treturn key;\n\t\t\t}\n\t\t\thashVal++;\n\t\t\thashVal = hashVal % size;\n\n\t\t}\n\t\treturn null;\n\t}", "public void clear() {\n while(taskList.size > 0)\n taskList.pop().removeSafely();\n }", "RandomizedRarestFirstSelector(Random random) {\n this.random = random;\n }", "private void testRemove() {\n System.out.println(\"------ TESTING: remove(int index) -----\");\n try{\n for(int i = 0; i < iSize; i++){\n if(iTestList.remove(0) != i)\n throw new RuntimeException(\"FAILED -> remove not working correctly\");\n }\n\n iTestList.remove(-9);\n iTestList.remove(iSize+10);\n }catch(RuntimeException e){\n System.out.println(e.getMessage());\n }\n }", "synchronized public Student removeFromWaitlist() {\n try {\n return getWaitlist().remove();\n }\n catch(NoSuchElementException e) {\n return null;\n }\n }", "@Override\n public V remove(Object key) {\n \t\n \tLinkedList<Entry> tempBucket = chooseBucket(key);\n \t\n \tfor(int i=0;i<tempBucket.size();i++) {\n\t \tEntry tempEntry = tempBucket.get(i);\n\t \t\t\n\t \tif(tempEntry.getKey() == key) {\n\t \t\tV returnValue = tempEntry.getValue();\n\t \t\ttempBucket.remove(i);\n\t \t\tsize --;\n\t \t\treturn returnValue;\n\t \t}\n\t }\n \t\n \tif(size < buckets.length*BETA) {\n \t\trehash(SHRINK_FACTOR);\n \t}\n \t\n \treturn null;\n }", "void remove(ThreadLocal<?> key) {\n cleanUp();\n\n for (int index = key.hash & mask;; index = next(index)) {\n Object reference = table[index];\n\n if (reference == key.reference) {\n // Success!\n table[index] = TOMBSTONE;\n table[index + 1] = null;\n tombstones++;\n size--;\n return;\n }\n\n if (reference == null) {\n // No entry found.\n return;\n }\n }\n }", "@Test\n public void testRemove() {\n\tFileBackedBlockingQueue<String> queue = new FileBackedBlockingQueue.Builder<String>()\n\t\t.directory(TEST_DIR)\n\t\t.serializer(new StringSerializer())\n\t\t.segmentSize((TEST_STRING.length() + Segment.ENTRY_OVERHEAD_SIZE + 10) * 100)\n\t\t.build();\n\t// init\n\tfor (int i = 0; i < 2000; i++)\n\t queue.add(TEST_STRING + i);\n\t// remove some random data.\n\tfor (int i = 110; i < 221; i++)\n\t queue.remove(TEST_STRING + i);\n\t// test size\n\tAssert.assertEquals(queue.size(), 1889);\n\tfor (int i = 0; i < 2000; i++) {\n\t if (i >= 110 && i < 221)\n\t\tcontinue;\n\t // test if they are all equal.\n\t Assert.assertEquals(TEST_STRING + i, queue.poll());\n\t}\n }", "@Override\n\t\tpublic void remove() {\n\t\t\tif ( _expectedSize != TOrderedHashMap.this.size() ) { throw new ConcurrentModificationException(); }\n\n\t\t\t// Disable auto compaction during the remove. This is a workaround\n\t\t\t// for bug 1642768.\n\t\t\ttry {\n\t\t\t\tTOrderedHashMap.this.tempDisableAutoCompaction();\n\t\t\t\tTOrderedHashMap.this.removeAt(_indicesByInsertOrder[_index]);\n\t\t\t} finally {\n\t\t\t\tTOrderedHashMap.this.reenableAutoCompaction(false);\n\t\t\t}\n\n\t\t\t_expectedSize--;\n\t\t}", "public Item dequeue() {\n if (isEmpty()) {\n throw new java.util.NoSuchElementException();\n }\n int removeIndex = StdRandom.uniform(1, size + 1);\n Item item;\n //case 1: remove first item\n if (removeIndex == 1) {\n item = first.item;\n first = first.next;\n }\n //case 2 :remove last item\n else if (removeIndex == size) {\n item = last.item;\n Node temp = first;\n while (temp.next.next != null) {\n temp = temp.next;\n }\n last = temp;\n last.next = null;\n }\n //case 3: general case in between\n else {\n Node temp = first;\n while (removeIndex != 2) {\n temp = temp.next;\n removeIndex--;\n }\n item = temp.next.item;\n Node temp2 =temp.next.next;\n temp.next = temp2;\n }\n size--;\n return item;\n }", "public T removeFirst() {\n return remove(sentinel.next);\n }", "public Item dequeue(){\n if(isEmpty()){\n throw new NoSuchElementException();\n }\n int ri = StdRandom.uniform(size);\n \n Node<Item> current = this.head;\n \n for(int i = 0; i < ri; i++){\n current = current.next;\n }\n \n Node<Item> removed = current;\n \n if(current.next != null){\n current.next.prev = current.prev;\n } else {\n this.tail = current.prev;\n }\n if(current.prev != null){\n current.prev.next = current.next;\n } else {\n this.head = current.next;\n }\n if(current.next == null && current.prev == null){\n this.head = null;\n this.tail = null;\n }\n size--;\n return removed.data;\n }", "public E removeFirst() {\n\n\t\tif (mSize == 0)\n\t\t\tthrow new NoSuchElementException();\n\n\t\tE retVal = remove(mHead.next);\n\n\t\tmSize--;\n\t\tmodCount++;\n\n\t\treturn retVal;\n\t}", "public boolean remove(E e){\n int target = e.hashCode() % this.buckets;\n return this.data[target].remove(e) == null;\n }", "@Test\n public void ensureCanRemoveExisitingAllergenMockito() {\n System.out.println(\"Ensure Can remove an Allergen Mockito/Functional\");\n\n Allergen allergen = new Allergen(\"al1\", \"allergen 1\");\n\n when(profile_mock.removeAllergen(Mockito.any(Allergen.class))).thenReturn(allergensList.remove(allergen)); //returns true because contains the allergen, and will remove it / CAN remove\n assertTrue(profile_mock.removeAllergen(allergen));\n\n\n verify(profile_mock, atLeast(1)).removeAllergen(Mockito.any(Allergen.class));\n }", "public void remove() throws QueueEmptyException {\n try{\n linkedList.deleteFirst();\n }catch(LinkedListEmptyException llee){\n throw new QueueEmptyException();\n }\n }", "public Item dequeue() {\n\n if (size == 0) {\n throw new NoSuchElementException();\n }\n\n int r = random.nextInt(size);\n Item item = queue[r];\n size--;\n queue[r] = queue[size];\n queue[size] = null;\n\n if (size > 0 && size <= queue.length / 4) {\n resizeQueue(queue.length / 2);\n }\n return item;\n }", "public void remove () {}", "private boolean distributeRemoveByKey(Entry<ProcessorDistributionKey, Collection<Geometry>> removeEntry)\n {\n boolean processorsChanged = false;\n final GeometryProcessor<? extends Geometry> processor = myGeometryProcessorsMap.get(removeEntry.getKey());\n final Collection<? extends Geometry> procRemoves = removeEntry.getValue();\n if (processor == null)\n {\n // If we are removing geometries and there is no\n // processor, then the geometries should be in one of the\n // holding lists.\n final Set<Geometry> inactive = myInactiveGeometries.get(removeEntry.getKey());\n if (inactive != null)\n {\n inactive.removeAll(procRemoves);\n if (inactive.isEmpty())\n {\n myInactiveGeometries.remove(removeEntry.getKey());\n }\n }\n }\n else\n {\n processor.receiveObjects(this, Collections.<Geometry>emptyList(), procRemoves);\n if (processor.getGeometryCount() == 0)\n {\n processorsChanged = true;\n myGeometryProcessorsMap.remove(removeEntry.getKey());\n processor.close();\n }\n if (LOGGER.isDebugEnabled())\n {\n LOGGER.debug(\"Removed \" + procRemoves.size() + \" for processor \" + processor);\n if (processorsChanged)\n {\n LOGGER.debug(\"Removed processor for distribution key \" + removeEntry.getKey());\n }\n }\n }\n\n return processorsChanged;\n }", "public T remove() throws NoSuchElementException {\n\tT result = poll();\n\tif(result == null) {\n\t throw new NoSuchElementException(\"Priority queue is empty\");\n\t} else {\n\t return result;\n\t}\n }", "@Test(timeout=1000)\n\tpublic void testRemove() {\n\t\tStudent[] array = new Student[7];\n\t\tarray[5] = s2; // This is the correct hash position of this student\n\t\thashmap.setArray(array);\n\t\thashmap.remove(s2);\n\t\t// Check if the element has been removed\n\t\tboolean success = true;\n\t\tarray = hashmap.getArray();\n\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\tStudent s = array[i];\n\t\t\tif (s2.equals(s)){\n\t\t\t\tsuccess = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tassertTrue(\"remove() failed. Element was not removed from hashtable\", success);\n\t}", "public void remove() {\n btRemove().push();\n }", "public void remove() {\n btRemove().push();\n }", "public static boolean removeProduct(int removeID){\r\n for(Product product : products){\r\n if(product.getProductID()==removeID){\r\n products.remove(product);\r\n return true;\r\n }\r\n }\r\n return false;\r\n }", "public void remove ( ) {\n\t\texecute ( handle -> handle.remove ( ) );\n\t}", "public Item dequeue() {\n if (size == 0) throw new NoSuchElementException();\n if (size > 0 && size == queue.length / 4) resizeArray(queue.length / 2);\n int randomInt = StdRandom.uniform(size);\n Item item = queue[randomInt];\n queue[randomInt] = queue[--size];\n queue[size] = null;\n return item;\n }", "Integer getNextRandomExcluding(int exclusion);", "public void remove() {\r\n return;\r\n }", "public V remove(final K key) {\n expunge();\n final int hash = hash(key);\n final int index = index(hash, entries.length);\n Entry<K, V> temp = entries[index];\n Entry<K, V> previous = temp;\n\n while (temp != null) {\n final Entry<K, V> next = temp.nextEntry;\n if (hash == temp.hash && key == temp.get()) {\n size--;\n if (previous == temp) {\n entries[index] = next;\n } else {\n previous.nextEntry = next;\n }\n return temp.value;\n }\n previous = temp;\n temp = next;\n }\n\n return null;\n }", "public Element setToRandom() {\n this.value = Math.abs(ThreadSecureRandom.get().nextLong()) % field.order;\n\n return mod();\n }", "@Override\r\n\tpublic Item dequeue() {\r\n\t\tif (isEmpty())\r\n\t\t\tthrow new NoSuchElementException(\"You cannot delete anything from the empty queue\");\r\n\t\tint index = StdRandom.uniform(count);\r\n\t\tItem item = arr[index];\r\n\t\tarr[index] = null;\r\n\t\tarr[index] = arr[--count];\r\n\t\tarr[count] = null;\r\n\t\tif (count > 0 && count == arr.length / 4)\r\n\t\t\tresize(arr.length / 2);\r\n\t\treturn item;\r\n\t}", "public E remove () throws NoSuchElementException;", "public void remove() {\n\t\t\tif (mIterModCount != modCount) {\n\t\t\t\tSystem.out.println( mIterModCount + \" : \" + modCount);\n\t\t\t\tthrow new ConcurrentModificationException();\n\t\t\t}\n\t\t\tif (mLastNodeReturned == null)\n\t\t\t\tthrow new IllegalStateException();\n\t\t\tLinkedList.this.remove(mLastNodeReturned);\n\t\t\tif (mLastIteration == NEXT)\n\t\t\t\tmCurrentIndex--;\n\t\t\tmSize--;\n\t\t\tmIterModCount++;\n\t\t\tmodCount++;\n\t\t\tmLastNodeReturned = null;\n\t\t}", "public void remove(){\r\n // Does Nothing\r\n }", "@Override\n public E remove() {\n if (isEmpty()) {\n throw new NoSuchElementException();\n }\n size--;\n array[0] = swap(array[size], array[size] = array[0]);\n siftDown(0);\n return (E) array[size];\n }", "public void removeLast() {\r\n\t\tmyCombination.removeLast();\r\n\t}", "@Override\n public void remove() {\n if(elementToRemove != null){\n if(elementToRemove == lastInternalIteratorGivenElement){\n iterator.remove();\n }\n else{\n list.remove(elementToRemove);\n }\n }\n }", "public Item dequeue()\r\n {\r\n if (isEmpty()) throw new NoSuchElementException(\"Empty randomized queue\");\r\n\r\n int randomizedIdx = StdRandom.uniform(n);\r\n Item item;\r\n\r\n item = a[randomizedIdx];\r\n a[randomizedIdx] = a[n - 1]; // move the last item to the empty position\r\n a[--n] = null; // to avoid loitering\r\n // shrink the size of array if necessary\r\n if (n > 0 && n == a.length/4) resize(a.length/2);\r\n return item;\r\n }", "public T remove() throws NoSuchElementException {\n T result = poll();\n if (result == null) {\n throw new NoSuchElementException(\"Priority queue is empty\");\n } else {\n return result;\n }\n }", "@Override\r\n public void remove() {\r\n if (nextCalled) {\r\n node.previous().setNext(node.next());\r\n node.next().setPrevious(node.previous());\r\n size--;\r\n nextCalled = false;\r\n }\r\n else {\r\n throw new IllegalStateException(\"Illegal call to remove(); \"\r\n + \"next() was not called.\");\r\n }\r\n\r\n }", "private void removeFromCache() {\n int i = 0;\n int removeItem = random.nextInt(cache.size());\n for (ScopePath className : cache.keySet()) {\n if (i == removeItem) {\n cache.remove(className);\n break;\n }\n ++i;\n }\n }", "@Override\n public Item removeFirst() {\n nextFirst = moveForward(nextFirst, 1);\n Item output = items[nextFirst];\n items[nextFirst] = null;\n size -= 1;\n return output;\n }", "public void removeLast( ) {\r\n\t\tremove(size);\r\n\t}", "public T remove() throws EmptyQueueException;", "@Override\n\tprotected void clearBuffer() {\n\t\tsynchronized (listLock) {\n\t\t\tif (deleteList != null && deleteList.size() > 0) {\n\t\t\t\tdeleteList.clear();\n\t\t\t}\n\t\t}\n\n\t}", "public String grab() {\n int index = new Random().nextInt(count);\n\n String element = ___________________\n\n contents[index] = ___________________\n\n count = ___________________\n\n return ___________________\n }\n\n // Removes an instance of 's' from the bag\n // Returns true if 's' was in the bag and was successfully removed\n // Returns false if 's' was not in the bag\n public boolean remove(String s) {\n\n for(int index = 0; ___________________; ___________________){\n\n if(___________________) {\n\n ___________________\n\n ___________________\n\n return ___________________\n }", "public static void genRandom(int addAmt, int remAmt, int colAmt) {\n Key[] add = new Key[addAmt];\n for (int i = 0; i < addAmt/colAmt + 1; i++) {\n for (int j = 0; j < colAmt; j++) {\n int index = i*colAmt + j;\n if (index >= addAmt) break;\n add[index] = new Key(i, j);\n }\n }\n //System.out.println(\"added!\");\n ArrayTools.shuffle(add);\n Key[] rem = new Key[remAmt];\n for (int i = 0; i < remAmt; i++) {\n rem[i] = add[i];\n }\n //System.out.println(\"removed!\");\n ArrayTools.shuffle(add);\n ArrayTools.shuffle(rem);\n \n int err = 0;\n //LinkedRBTree<Key> tree = new LinkedRBTree<>(Arrays.asList(add));\n RBTree<Key> tree = new RBTree<>();\n for (Key k : add) {\n if (!tree.add(k)) {\n System.err.println(\"Key was not added: \" + k);\n err++;\n }\n }\n for (Key k : rem) {\n if (!tree.remove(k)) {\n System.err.println(\"Key was not removed: \" + k);\n err++;\n }\n }\n for (Key k : rem) {\n if (tree.contains(k)) {\n System.err.println(\"ERROR: Unexpected: \" + k);\n err++;\n }\n }\n //System.out.println(\"checked removed!\");\n Set<Key> remSet = new HashSet<>(ArrayTools.asList(rem));\n for (Key k : add) {\n if (!tree.contains(k) && !remSet.contains(k)) {\n System.err.println(\"ERROR: Expected: \" + k);\n err++;\n }\n }\n if (tree.size() != addAmt - remAmt) {\n System.err.println(\"The expected size of the tree is \" + (addAmt - remAmt) +\n \", but found \" + tree.size() + \" elements!\");\n err++;\n }\n \n //System.out.println(\"checked added!\");\n if (err != 0) {\n System.out.println(\"add: \" + Arrays.toString(add).replaceAll(\"\\\\(\", \"new Key\\\\(\"));\n System.out.println(\"rem: \" + Arrays.toString(rem).replaceAll(\"\\\\(\", \"new Key\\\\(\"));\n fail(\"There were \" + err + \" errors!\");\n }\n //System.out.println(\"DONE\");\n }", "public boolean shouldRemove(){\r\n\t\tif (heat<=0){\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public void killAndHunt() {\n\t\tRandom random = new Random();\n\t\tint currentIndex = random.nextInt(N);\t\n\t\tkill(currentIndex);\n\t}", "public T removeLast()\r\n {\r\n T removedData; // holds data from removed node\r\n Node<T> walker; // for traversing the list\r\n\r\n if (numElements == 0)\r\n throw new NoSuchElementException(\r\n \"Remove attempted on empty list\\n\");\r\n removedData = rear.data;\r\n if (numElements == 1)\r\n front = rear = null;\r\n else\r\n {\r\n walker = front; \r\n while (walker.next != rear)\r\n {\r\n walker = walker.next;\r\n }\r\n walker.next = null;\r\n rear = walker;\r\n }\r\n \r\n numElements--;\r\n return removedData;\r\n }", "public boolean isRandom(){\r\n\t\treturn isRandom;\r\n\t}", "public void remove() {\n if (!canRemove)\n throw new IllegalStateException();\n\n set.remove(set.data[nextIndex - 1]);\n canRemove = false;\n }", "public int getRandom() {\r\n if ((itemSize / nextIndexInCache) < 0.25) {\r\n rebuildCache();\r\n }\r\n while (true) {\r\n int i = random.nextInt(nextIndexInCache);\r\n int v = cache[i];\r\n if (contains(v)) {\r\n return v;\r\n }\r\n }\r\n }", "public Item dequeue() {\n if(isEmpty()) throw new NoSuchElementException();\n int idx = StdRandom.uniform(size);\n Item item = arr[idx];\n size--;\n arr[idx] = arr[size];\n arr[size] = null;\n if (size > 0 && size == arr.length / 4){\n resize(arr.length / 2);\n }\n return item;\n }", "@Override\n public Node remove() {\n Node temp;\n int x = 0;\n while (isEmpty(x)) {\n x++;\n }\n temp = hashTable[x];\n hashTable[x] = temp.getNext(); \n\n return temp;\n }", "@Test\n public void remove0() {\n RBTree<Integer> tree = new RBTree<>();\n tree.add(0);\n tree.remove(0);\n assertEquals(\"Incorrect tree size!\", 0, tree.size());\n assertFalse(\"Element was not removed!\", tree.contains(0));\n }", "public void remove() {\n\t\tstopFloating();\t\n\t\tPacketHandler.toggleRedTint(player, false);\n\t\tplayer.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 30, 1));\n\t\tplayer.stopSound(Sound.MUSIC_DISC_CHIRP);\n\t\tcleanTasks();\n\t\tactiveScenarios.remove(player.getUniqueId());\n\t}", "public void setRandom(Random r) {\n this.r = r;\n }", "public static int randomNext() { return 0; }", "public void remove() {\n\t itr.remove();\n\t size--;\n\t nextCount--;\n\t }", "public void remove() {\n\t itr.remove();\n\t size--;\n\t nextCount--;\n\t }", "public void testRemove() {\r\n System.out.println(\"remove\");\r\n \r\n PartialCombinationIterator instance = null;\r\n Iterator<int[]> iterator = null;\r\n try {\r\n iterator = new PartialCombinationIterator(TestConstants.verySimpleReactionScheme, new int[] {1}, 1, 1);\r\n } catch (ReactionSchemeException ex) {\r\n ex.printStackTrace();\r\n fail(\"Unexpected exception was thrown.\");\r\n } catch (SmiLibIOException ex) {\r\n ex.printStackTrace();\r\n fail(\"Unexpected exception was thrown.\");\r\n } catch (SmiLibException ex) {\r\n ex.printStackTrace();\r\n fail(\"Unexpected exception was thrown.\");\r\n }\r\n \r\n try {\r\n iterator.remove();\r\n fail(\"No UnsupportedOperationException was thrown when executing remove().\");\r\n } catch (UnsupportedOperationException e) {\r\n }\r\n }", "protected Request barrierBlockingRemove() {\n while (((this.isEmpty() && this.shouldWait) || this.suspended ||\n (this.indexOfRequestToServe() == -1)) &&\n !this.specialExecution) {\n if (this.hasListeners()) {\n this.notifyAllListeners(new RequestQueueEvent(this.ownerID,\n RequestQueueEvent.WAIT_FOR_REQUEST));\n }\n try {\n this.wait();\n } catch (InterruptedException e) {\n }\n }\n if (this.specialExecution) {\n this.specialExecution = false;\n return this.blockingRemoveOldest(this.specialMethod);\n }\n return this.barrierRemoveOldest();\n }", "public static void remove() {\n if (create()) {\n DOM.removeChild((com.google.gwt.user.client.Element) \n tag.getParentElement(), \n (com.google.gwt.user.client.Element) tag);\n tag = null;\n removed = true;\n }\n }", "private void removeTailElement(){\n JavaBaseTask removed = items.remove(tail.getKey());\n System.out.println(\"element with index : \" + removed.getKey() + \"has been deleted doe to cache eviction\");\n tail = tail.previous;\n var headAu = head;\n while (headAu.next != null){\n headAu = headAu.next;\n }\n headAu = headAu.previous;\n headAu.next = null;\n }" ]
[ "0.7167599", "0.7076875", "0.63807184", "0.62446153", "0.6191354", "0.61082435", "0.6072256", "0.600413", "0.5875558", "0.55506265", "0.5517037", "0.5510043", "0.5419906", "0.54049724", "0.53315717", "0.52849823", "0.5256337", "0.523424", "0.5230986", "0.5219428", "0.5188676", "0.51871294", "0.5151118", "0.5101537", "0.50594705", "0.50557715", "0.50252134", "0.49999204", "0.49321508", "0.49314037", "0.4929029", "0.48830178", "0.4880963", "0.48794064", "0.48769736", "0.48753607", "0.4862731", "0.48610586", "0.48602954", "0.48595056", "0.48588577", "0.4858202", "0.4856853", "0.48538792", "0.48358107", "0.48349047", "0.48311156", "0.4819383", "0.4819147", "0.48023397", "0.47974145", "0.47969896", "0.47909823", "0.47789514", "0.47661516", "0.47454852", "0.47406644", "0.47406644", "0.47292614", "0.47285086", "0.47230008", "0.4721509", "0.47191888", "0.47172007", "0.4716846", "0.47131127", "0.47121316", "0.470671", "0.47046334", "0.4702227", "0.47013775", "0.46940705", "0.46838", "0.46820322", "0.46773553", "0.46701995", "0.46675116", "0.4664587", "0.46615365", "0.4660497", "0.46593714", "0.46486372", "0.464802", "0.46477252", "0.46428123", "0.46419266", "0.4637531", "0.46364245", "0.46323738", "0.46319258", "0.4630455", "0.46270043", "0.4626904", "0.4626106", "0.4625973", "0.4625973", "0.46257335", "0.4621571", "0.46179104", "0.46163782" ]
0.67302996
2
Get the account lockout key to check or modify.
@Nullable public String getKey() { return key; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getUnlocker();", "String getLockOwner();", "protected UUID getCurrentUtilityKey() {\n Authentication auth = SecurityContextHolder.getContext().getAuthentication();\n AuthenticatedUser user = null;\n\n if (auth.getPrincipal() instanceof AuthenticatedUser) {\n user = (AuthenticatedUser) auth.getPrincipal();\n }\n\n if (user != null) {\n return user.getUtilityKey();\n }\n\n return null;\n }", "Object getAuthInfoKey();", "public PrivateKey getKey();", "PrivateKey getPrivateKey();", "Lock getLockByKey(String key);", "public String getOutAccountNo() {\r\n return outAccountNo;\r\n }", "public Integer getOutAccountId() {\r\n return outAccountId;\r\n }", "public String getLockUser() {\n return lockUser;\n }", "@Override\n public ECKey getKey(final AionAddress _address) {\n\n Account acc = this.accounts.getIfPresent(_address);\n\n if (Optional.ofNullable(acc).isPresent()) {\n if (acc.getTimeout() >= Instant.now().getEpochSecond()) {\n return acc.getKey();\n } else {\n this.accounts.invalidate(_address);\n }\n }\n\n return null;\n }", "public PrivateKey getPrivateKey() {\n \tif(testingPrivateKey!=null){\n\t\t\t//for unit testing\n\t\t\treturn testingPrivateKey;\t\n\t\t}\n\t\treturn keypair.getPrivate();\n }", "public String getLockId() {\n return lockId;\n }", "public void unlock(int key);", "@Accessor(qualifier = \"privateKey\", type = Accessor.Type.GETTER)\n\tpublic String getPrivateKey()\n\t{\n\t\treturn getPersistenceContext().getPropertyValue(PRIVATEKEY);\n\t}", "public PrivateKey getPrivateKey(String alias) {\n if (alias != null)\n\t\t System.out.println(\"==KeyManager. Get private key for \" + alias);\n\t\tPrivateKey pk = myKeyManager.getPrivateKey(alias);\n\t\treturn pk;\n\t}", "public String getPrivateKey();", "public String getPrivateKey();", "public String getKeyPrivate() throws LibMCryptException {\n\t\t\r\n\t\tString privateK = priK.getModulus().toString(16);\r\n\t\treturn privateK;\r\n\t}", "String getSecretByKey(String key);", "public String getOTP(String key) {\n try {\n return String.valueOf(otpCache.get(key));\n } catch (Exception e) {\n return \"\";\n }\n }", "public static SecretKey getAdminSigningKey() {\n return adminSigningKey;\n }", "public Long getLockNum() {\n return lockNum;\n }", "java.lang.String getLoginAccount();", "java.lang.String getLoginAccount();", "long getInvalidLoginLockoutTime();", "public String getWaiting_account() {\n return waiting_account;\n }", "public int getUserKey() {\r\n\t\tif(email!=null&&password!=null) {\r\n\t\t\treturn (email.hashCode()+password.hashCode())/2;\r\n\t\t}else if(email!=null||password!=null) {\r\n\t\t\tif(email!=null) {\r\n\t\t\t\treturn email.hashCode();\r\n\t\t\t}else {\r\n\t\t\t\treturn password.hashCode();\r\n\t\t\t}\r\n\t\t}else {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t}", "private PrivateKey getUserKey() throws KeyChainException, InterruptedException {\n return KeyChain.getPrivateKey(getApplicationContext(), mCurrentProfile.getUserCertificateAlias());\n\n }", "public com.hps.july.persistence.OrganizationKey getOrganizationKey() throws java.rmi.RemoteException, javax.ejb.CreateException, javax.ejb.FinderException, javax.naming.NamingException {\n return (((com.hps.july.persistence.OrganizationKey) __getCache(\"organizationKey\")));\n }", "java.lang.String getClientKey();", "public static SecretKey getAdminEncryptionKey() {\n return adminEncryptionKey;\n }", "public PrivateKey getPrivKey() {\r\n\t\treturn this.privKey;\r\n\t}", "private String getKey()\r\n\t\t{\r\n\t\t\tif (key != null)\r\n\t\t\t{\r\n\t\t\t\treturn key.toString();\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\treturn \"The key has not been found\";\r\n\t\t\t}\r\n\t\t}", "MemberVdusKey getKey();", "public KeyStore.PrivateKeyEntry getPrivateKeyEntry() throws Exception {\n KeyStore.Entry entry = keyStore.getEntry(aliasName, null);\n if (!(entry instanceof KeyStore.PrivateKeyEntry)) {\n return null;\n }\n else {\n return ((KeyStore.PrivateKeyEntry) entry);\n }\n }", "public static Key getUserKey() throws IOException {\n\t\tif (localKey.get() == null) {\n\t\t\ttry {\n\t\t\t\tlocalKey.set(cipherKeyProvider.loadKey());\n\t\t\t} catch (KeyLoadingException e) {\n\t\t\t\tthrow new IOException(e.getLocalizedMessage());\n\t\t\t}\n\t\t}\n\t\treturn localKey.get();\n\t}", "java.lang.String getAccount();", "public final PrivateKey getPrivateKey() {\n return this.key;\n }", "public Long getOtherLockNum() {\n return otherLockNum;\n }", "long getLockedMetadata(String key);", "void getLock(QName lockQName, String lockToken, long timeToLive);", "public int getLockon() {\r\n return lockon;\r\n }", "private synchronized PrivateKey getPrivateKey() throws Exception {\n if (privateKey == null) {\n KeyStore keyStore = loadKeyStore();\n privateKey = (PrivateKey)keyStore.getKey(aliasName, password.toCharArray());\n }\n\t\treturn privateKey;\n\t}", "public Key getPrivateKey(String alias) throws CryptoException {\n\t\treturn getPrivateKey(alias, null);\n\t}", "public Lock getLock();", "void onKbsAccountLocked(@Nullable Long timeRemaining);", "public String getBlocking_account() {\n return blocking_account;\n }", "Lock getLock(String lockName);", "public Lock getUndoNxtLock() {\n if (nlocks == 0)\n return null;\n return locks[nlocks - 1];\n }", "public java.lang.String getLoginAccount() {\n java.lang.Object ref = loginAccount_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n loginAccount_ = s;\n return s;\n }\n }", "public java.lang.String getLoginAccount() {\n java.lang.Object ref = loginAccount_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n loginAccount_ = s;\n return s;\n }\n }", "public BigInteger getPrivateKey()\n {\n\treturn privateKey;\n }", "public BigInteger getPrivKey() {\n if (priv == null)\n throw new MissingPrivateKeyException();\n return priv;\n }", "Account getAccount(Long recvWindow, Long timestamp);", "public Key getKey()\r\n { \r\n return key; \r\n }", "public java.lang.String getLoginAccount() {\n java.lang.Object ref = loginAccount_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n loginAccount_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public java.lang.String getLoginAccount() {\n java.lang.Object ref = loginAccount_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n loginAccount_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public static String getKey() {\t\t\n\t\treturn key;\n\t}", "public CryptoKey getMyKey() {\n return myKey;\n }", "public String getPinKey() {\r\n return pinKey;\r\n }", "com.google.protobuf.ByteString\n getLoginAccountBytes();", "com.google.protobuf.ByteString\n getLoginAccountBytes();", "public String getLockType() {\n return this.lockType;\n }", "public Date getAuthLockTime() {\n return authLockTime;\n }", "com.hps.july.persistence.OrganizationKey getOrganizationKey() throws java.rmi.RemoteException;", "public int getRsaKeyB(){\n\treturn this.rsaKeyB;\n }", "public kvClient.pb.Key getK() {\n if (resultCase_ == 3) {\n return (kvClient.pb.Key) result_;\n }\n return kvClient.pb.Key.getDefaultInstance();\n }", "public String getLockUserid() {\n\t\treturn lockUserid;\n\t}", "com.google.protobuf.ByteString getMasterKey();", "public PrivateKey getPrivateKey(){\n\t\treturn this.privatekey;\n\t}", "final Object getLockObject() {\n return timeManager;\n }", "com.hps.july.persistence.StorageCardKey getAgregateKey() throws java.rmi.RemoteException;", "public CloudStackAccount getCurrentAccount() throws Exception {\n if (currentAccount != null) {\n // verify this is the same account!!!\n for (CloudStackUser user : currentAccount.getUser()) {\n if (user.getSecretkey() != null && user.getSecretkey().equalsIgnoreCase(UserContext.current().getSecretKey())) {\n return currentAccount;\n }\n }\n }\n // otherwise let's find this user/account\n List<CloudStackAccount> accounts = getApi().listAccounts(null, null, null, null, null, null, null, null);\n for (CloudStackAccount account : accounts) {\n CloudStackUser[] users = account.getUser();\n for (CloudStackUser user : users) {\n String userSecretKey = user.getSecretkey();\n if (userSecretKey != null && userSecretKey.equalsIgnoreCase(UserContext.current().getSecretKey())) {\n currentAccount = account;\n return account;\n }\n }\n }\n // if we get here, there is something wrong...\n return null;\n }", "public String getOwner() {\n return lockOwner;\n }", "public abstract \n KEYIN getCurrentKey() throws IOException, InterruptedException;", "private String key() {\n return \"secret\";\n }", "public Class<PRIV> getPrivateKeyClass() {\n return privKeyType;\n }", "public String getTicketKeyHash() {\n return this.mTicketKeyHash;\n }", "public PrivateKey getMyPrivateKey() {\n return myKeyPair.getPrivate();\n }", "public String accessKey() {\n return this.accessKey;\n }", "java.lang.String getSecret();", "public java.lang.String getAccount() {\n java.lang.Object ref = account_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n account_ = s;\n return s;\n }\n }", "public Lock getLock() {\n return lock;\n }", "@Nonnull public LockoutManagerContext setKey(@Nullable final String k) {\n key = k;\n \n return this;\n }", "public static SecretKey getAdminLoggingKey() {\n return adminLoggingKey;\n }", "public Key getKey() {\n\t\treturn getKey(settings, url);\n\t}", "String getDefaultKeyExpiry();", "public static byte[] getKey() {\n return key;\n }", "public String getAccountPassword() {\n return accountPassword;\n }", "public java.lang.String getAccount() {\n java.lang.Object ref = account_;\n if (ref instanceof java.lang.String) {\n return (java.lang.String) ref;\n } else {\n com.google.protobuf.ByteString bs = \n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n if (bs.isValidUtf8()) {\n account_ = s;\n }\n return s;\n }\n }", "public String getAccountPassword() {\n return accountPassword;\n }", "public Long getLockTypeId()\n/* */ {\n/* 58 */ return this.lockTypeId;\n/* */ }", "com.hps.july.persistence.WorkerKey getExpeditorKey() throws java.rmi.RemoteException;", "public String getTicketKey() {\n return this.mTicketKey;\n }", "public String getLoginKey() {\n\t\treturn this.loginKey;\n\t}", "public String getAccountPassword() {\n return accountPassword;\n }", "final long internalLongLock() {\n return byteBase.longLockPointer();\n }", "public java.lang.String getAccount() {\n java.lang.Object ref = account_;\n if (!(ref instanceof java.lang.String)) {\n com.google.protobuf.ByteString bs =\n (com.google.protobuf.ByteString) ref;\n java.lang.String s = bs.toStringUtf8();\n account_ = s;\n return s;\n } else {\n return (java.lang.String) ref;\n }\n }", "public String isLockedFor() {\n return (lockId == null ? \"\" : lockId);\n }", "public String getOperatorAccount() {\n\n // is there an in-memory current account?\n String currentAccount = currentAccountId();\n if (!StringUtil.isNullOrEmpty(currentAccount)) {\n return currentAccount;\n }\n // is there an on-disk default account?\n String defaultAccountNameAndId = getDefaultAccount();\n if (!defaultAccountNameAndId.isEmpty()) {\n String[] defaultArray = defaultAccountNameAndId.split(\":\");\n return defaultArray[1];\n }\n // no account, so empty string\n return \"\";\n }" ]
[ "0.58077985", "0.57124436", "0.5541464", "0.54772425", "0.54565334", "0.54029244", "0.53949755", "0.53784347", "0.5331166", "0.5310123", "0.5253816", "0.52279437", "0.52165157", "0.5212374", "0.5211568", "0.5199561", "0.5189442", "0.5189442", "0.5178641", "0.5174036", "0.517254", "0.5122971", "0.51176435", "0.51120853", "0.51120853", "0.5097794", "0.50977767", "0.50918317", "0.50876623", "0.50747687", "0.5071172", "0.50660926", "0.50320387", "0.50226736", "0.5019237", "0.5008416", "0.49990055", "0.49892673", "0.4988459", "0.49851912", "0.49824378", "0.49793395", "0.49771503", "0.49733537", "0.49655738", "0.49654683", "0.496229", "0.49545398", "0.49344924", "0.4930246", "0.49276215", "0.49276215", "0.4926149", "0.49220845", "0.4917545", "0.4903766", "0.4903712", "0.4903712", "0.48994398", "0.48976767", "0.4890377", "0.4881754", "0.4881754", "0.4881466", "0.48781896", "0.48614293", "0.48598498", "0.48594257", "0.485932", "0.48568726", "0.48537758", "0.48451892", "0.48358968", "0.4831071", "0.48281738", "0.48277766", "0.48185432", "0.48144248", "0.4810636", "0.4794192", "0.47925112", "0.47913283", "0.47900057", "0.47840714", "0.4779282", "0.47753346", "0.47751668", "0.4768885", "0.47655016", "0.47611234", "0.47550035", "0.47544613", "0.4753186", "0.47477818", "0.4746152", "0.4741165", "0.4738676", "0.47362122", "0.47344425", "0.47282556", "0.47271183" ]
0.0
-1
Set the account lockout key to check or modify.
@Nonnull public LockoutManagerContext setKey(@Nullable final String k) { key = k; return this; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void unlock(int key);", "public void setLockKey( Long lockKey ) {\n this.lockKey = lockKey;\n }", "public void setLockoutManager(@Nullable final AccountLockoutManager manager) {\n checkSetterPreconditions();\n lockoutManager = manager;\n }", "void onKbsAccountLocked(@Nullable Long timeRemaining);", "void privateSetOrganizationKey(com.hps.july.persistence.OrganizationKey inKey) throws java.rmi.RemoteException;", "void privateSetAgregateKey(com.hps.july.persistence.StorageCardKey inKey) throws java.rmi.RemoteException;", "public void lockPassword() {\n passwordLock.lock();\n }", "void setAccountNonLocked(boolean accountNonLocked);", "void updateLastLogin(@Param(\"key\") int key);", "public abstract boolean unlock(String oid, String lockKey) throws OIDDoesNotExistException, InvalidLockException;", "public final void deactivateAccount() {\n\t\tthis.setIsAccountLocked(true);\n\t}", "void setAuthInfoKey(Object key);", "public void lock(int key);", "UnlockCommand(String door, String key){\r\n this.key = key;\r\n this.door = door;\r\n }", "void setShowUnlockOption(boolean b);", "void setAccount(final Account account);", "public void setKey( Long key ) {\n this.key = key ;\n }", "@Override\n\tpublic void unlock(Lock lock) {\n\t\tBluetoothLock bluetoothLock=(BluetoothLock)lock;\n\t\t\n\t\tString out=String.format(\"%s%s蓝牙开锁,搜索MAC为%s,pwd:%ssecretKey:%s\", \n\t\t\t\tbluetoothLock.getCompany(),bluetoothLock.getSysCode(),\n\t\t\t\tbluetoothLock.getMac(),bluetoothLock.getPwd(),bluetoothLock.getSecretKey());\n\t\t\n\t\tSystem.out.println(out);\n\t}", "void accountSet(boolean admin, String username, String password, String fName, String lName, int accountId);", "public void setLockNum(Long lockNum) {\n this.lockNum = lockNum;\n }", "void unlockWriteInOMRequest();", "void setUserLocked(boolean b);", "@Override\n public void setLockOwner(Object lockOwner) {\n }", "@Override\n\tpublic void unlockAccount(String username, Map<String, User> map) {\n\t\tUser u = map.get(username);\n\t\tu.setTries(3);\n\t\tuserdata.open();\n\t\tuserdata.updateUser(u);\n\t\tuserdata.close();\n\t}", "@Test\n void testGetAndSetToken() {\n isLockedRequest2.setToken(\"Pippin\");\n assertEquals(\"Pippin\", isLockedRequest2.getToken());\n }", "void updateLockedMetadata(String key, long value);", "void unlockWrite(long stamp);", "void lockExpired(String lock);", "public void setLockOnChangeMode(LockOnChange lockOnChangeMode){\r\n this.lockOnChangeMode = lockOnChangeMode;\r\n }", "@Override\n public void onUnlock(Myo myo, long timestamp) {\n //mLockStateView.setText(R.string.unlocked);\n }", "void releaseReadLock(E key);", "public void setUpdatePrivilegeKey(long value) {\n\t\tthis.updatePrivilegeKey = value;\n\t}", "public void setKeyingTime(long keyTime) {\n\t\tthis.keyTime = keyTime;\n\t}", "private void unlock(UserInputDto inputDto) {\n // Deserialize treadmill status from token\n TreadmillStatus treadmillStatus = deserializeByToken(inputDto.getToken());\n\n // Treadmill is unlocked already\n if (TreadmillStatusEnum.UNLOCKED.getValue().equals(treadmillStatus.getLockStatus())) {\n throw new BizException(\"error.unlocked.already\", \"该跑步机已解锁\");\n }\n\n // Update treadmill status\n treadmillStatus.setAuthType(CommonConstants.DEFAULT_AUTH_TYPE);\n treadmillStatus.setLockStatus(TreadmillStatusEnum.UNLOCKED.getValue());\n treadmillStatus.setCurrentUsrId(CommonConstants.DEFAULT_USERID);\n // Unlock time\n treadmillStatus.setStartTime(new Date());\n treadmillStatus.setDuration(CommonConstants.DEFAULT_DURATION);\n\n // Update redis cache todo Not completed\n redisDbDao.setexBySerialize(TOKEN_PREFIX + inputDto.getToken(), CommonConstants.DEFAULT_DURATION, treadmillStatus);\n }", "public\n void\n setAccount(Account account)\n {\n itsAccount = account;\n }", "@Test\n public void destiny2SetItemLockStateTest() {\n InlineResponse20019 response = api.destiny2SetItemLockState();\n\n // TODO: test validations\n }", "void touchSecret(Long secretId);", "public synchronized void setAccountNumber(int number) {\n this.accountNumber = number;\n }", "public void unlockDevice() {\n ((AndroidDriver) getDriver()).pressKey(new KeyEvent().withKey(AndroidKey.HOME));\n }", "void releaseLock(QName lockQName, String lockToken);", "public final void activateAccount() {\n\t\tthis.setIsAccountLocked(false);\n\t}", "void setValueLocked(boolean valueLocked);", "@Override\n\tpublic void lock() {\n\t\tSystem.out.println(\"Card in ATM1 is locked !\");\n\t}", "@Modifying\n\t@Transactional\n\t@Query(value = \"UPDATE classes cl SET cl.locked = :unlock WHERE(cl.class_id = :classId)\", nativeQuery = true)\n\tpublic void unlockClass(@Param(\"classId\") int classId, @Param(\"unlock\") boolean unlock);", "public void setCheckingAccount(BankAccount newChecking) {\n this.checkingAccount = newChecking;\n }", "void setKey(K key);", "public void setKey(int key);", "public void setKey(int key);", "private void setAccount(SessionData sessionData, Account account) {\n \ttry {\n\t sessionData.set(\"account\", account);\n \t} catch (Exception e) {\n \t throw new RuntimeException(e.toString());\n \t}\n }", "@Override\n\tpublic void unlock() {\n\t\tSystem.out.println(\"Card in ATM1 is unlocked !\");\n\t}", "public void lockGame() {\n this.isLocked = true;\n btnLockGame.setEnabled(false);\n }", "void setKey(int key);", "private static void lockRoom(Command command) {\n if (command.getCommandWord().name().equalsIgnoreCase(CommandWord.GO.toString())) {\n if (inventory.getInventory().containsKey(\"Boardingpass\") == false) {\n System.out.println(\"You have no boardingpass, please return when you do!!!\");\n }\n }\n\n if (inventory.getInventory().containsKey(\"Boardingpass\") && !hasBoardingpass) {\n hasBoardingpass = true;\n airport.setExit(\"west\", beach);\n System.out.println(airport.getExitString());\n }\n }", "public void setAccountNumber(int accountNumberIn)\r\n\t{\r\n\t\t\r\n\t\tif (accountNumberIn >= ACCOUNT_NUM_MIN && accountNumberIn <= ACCOUNT_NUM_MAX)\r\n\t\t\r\n\t\t\taccountNumber = accountNumberIn;\r\n\t\t\r\n\t\telse\r\n\t\t\taccountNumber = -1;\r\n\t\t\r\n\t}", "public void setKey (K k) {\n key = k;\n }", "void lockMetadata(String key);", "void privateSetExpeditorKey(com.hps.july.persistence.WorkerKey inKey) throws java.rmi.RemoteException;", "void doLogicalPut(final L lockID, final Object key, final Object value);", "public void setLockTime(Date lockTime) {\n\t\tthis.lockTime = lockTime;\n\t}", "public void setLockStatus(long lockStatus) {\r\n this.lockStatus = lockStatus;\r\n }", "public final synchronized void setOpLock(OpLockDetails oplock)\n\t\tthrows ExistingOpLockException {\n\n\t\tif ( m_oplock == null)\n\t\t\tm_oplock = oplock;\n\t\telse\n\t\t\tthrow new ExistingOpLockException();\n\t}", "public static void setUserKey(Key newKey) {\n\t\tlocalKey.set(newKey);\n\t}", "public void setKey(Boolean key) {\n this.key = key;\n }", "public final void setLocked(final boolean lockedNew) {\n this.locked = lockedNew;\n }", "public void setLocked(boolean value) {\n\t\tisLocked = value;\n\t}", "public void updatePassword(String account, String password);", "public void setOtherLockNum(Long otherLockNum) {\n this.otherLockNum = otherLockNum;\n }", "public void lockMachine(@KSOAP(\"session\")ISession s, @KSOAP(\"lockType\")LockType lockType) throws IOException;", "@Override\r\n\tpublic void onLock(boolean lock) {\n\t\tthis.lock = lock;\r\n\t}", "public void setLockUser(String lockUser) {\n this.lockUser = lockUser == null ? null : lockUser.trim();\n }", "public static void setCurrentAccount(Account currentAccount) {\r\n\t\tAccount.currentAccount = currentAccount;\r\n\t}", "public void setSettlementmoney(Long settlementmoney) {\n this.settlementmoney = settlementmoney;\n }", "public void setLocked(boolean locked)\n\t{\n\t\tthis.locked = locked;\n\t}", "void setAccountNumber(java.lang.String accountNumber);", "public static void setExitKey(char exitKey) {\n\t\t\tGamePreferences.exitKey = exitKey;\n\t\t}", "public void setAccountID(Long value) {\n this.accountID = value;\n }", "public void setAccountID(Long value) {\n this.accountID = value;\n }", "@Override\n\tpublic void updateAccount(String pwd, String field, String company) {\n\t}", "public void setKey(Key key) {\n this.key = key;\n }", "public void setWriteLockValue(Vector primaryKey, Object writeLockValue) {\n CacheKey cacheKey = getCacheKey(primaryKey);\n\n if (cacheKey != null) {\n //lock/release the cache key during the lock value updating\n cacheKey.acquire();\n cacheKey.setWriteLockValue(writeLockValue);\n cacheKey.release();\n }\n }", "private void resetPattenIfNeeded() {\n if (KeyguardCfg.isBackupPinEnabled() && getSecurityMode() == SecurityMode.PIN && this.mLockPatternUtils.isLockPatternEnabled(KeyguardUpdateMonitor.getCurrentUser())) {\n Intent ai = new Intent(\"com.android.settings.action.HW_RESET_NEW_PASSWORD\");\n ai.setFlags(268435456);\n OsUtils.startUserActivity(this.mContext, ai);\n }\n }", "@Test\n public void testFailLock() {\n if (getConnection().isNis()) {\n // TODO Workaround on Solaris NIS: there doesn't seem to be a way\n // how to handle user locks on NIS.\n log.info(\"skipping test 'testLock', as LOCK attribute is not supported by the connector on NIS.\");\n return;\n }\n try {\n getFacade().update(ObjectClass.ACCOUNT, new Uid(getUsername()),\n CollectionUtil.newSet(AttributeBuilder.build(AccountAttribute.LOCK.getName())),\n null);\n AssertJUnit\n .fail(\"passing null option to Lock should cause failure. It must have a boolean value.\");\n } catch (Exception ex) {\n // OK\n }\n try {\n getFacade().create(\n ObjectClass.ACCOUNT,\n CollectionUtil.newSet(AttributeBuilder.build(Name.NAME, \"fooconn\"),\n AttributeBuilder.buildPassword(\"foo134\".toCharArray()),\n AttributeBuilder.build(AccountAttribute.LOCK.getName())), null);\n AssertJUnit\n .fail(\"passing null option to Lock should cause failure. It must have a boolean value.\");\n } catch (Exception ex) {\n // OK\n } finally {\n try {\n getFacade().delete(ObjectClass.ACCOUNT, new Uid(\"foo134\"), null);\n } catch (Exception ex) {\n // OK\n }\n }\n }", "@Override\n public void extend(int holdSec, LockCallback callback) {\n synchronized (this) {\n if (isUnavailable()) {\n return;\n }\n\n logger.info(\"lock granted: {}\", this);\n setState(LockState.ACTIVE);\n setHoldSec(holdSec);\n setCallback(callback);\n }\n\n notifyAvailable();\n }", "void doLogicalPutUnlocked(final TCServerMap map, final Object key, final Object value);", "private void writeAccount() {\n SharedPreferences pref = getSharedPreferences(\"ACCOUNT\", Context.MODE_PRIVATE);\n SharedPreferences.Editor edt = pref.edit();\n\n edt.putString(\"email\", Me.getInstance().getEmail());\n edt.putString(\"password\", txtPassword.getText().toString().trim());\n\n edt.commit();\n }", "private void addAccountLockedTokenToSession(HttpServletRequest request) {\n request.getSession().setAttribute(ACCOUNT_LOCKED_SESSION_TOKEN, ACCOUNT_LOCKED_SESSION_TOKEN);\n }", "public void testSetNewPINWithPUK() {\r\n byte old = pinCode[0];\r\n byte[] modifiedPin = pinCode;\r\n\r\n /*\r\n * Change Pin\r\n */\r\n modifiedPin[0] ^= 0xFF;\r\n try {\r\n tokenHandler.loginPUK(pukCode);\r\n tokenHandler.setPIN(modifiedPin);\r\n tokenHandler.logoutPUK();\r\n } catch (Exception e) {\r\n fail(e.toString());\r\n }\r\n\r\n /*\r\n * Test new Pin\r\n */\r\n try {\r\n tokenHandler.loginPIN(modifiedPin);\r\n tokenHandler.logoutPIN();\r\n } catch (Exception e) {\r\n fail(e.toString());\r\n }\r\n\r\n /*\r\n * Restore old PIN and restore login status\r\n */\r\n pinCode[0] = old;\r\n try {\r\n\r\n tokenHandler.loginPUK(pukCode);\r\n tokenHandler.setPIN(modifiedPin);\r\n tokenHandler.logoutPUK();\r\n } catch (Exception e) {\r\n fail(e.toString());\r\n }\r\n\r\n /*\r\n * Test Old Pin\r\n */\r\n try {\r\n tokenHandler.loginPIN(modifiedPin);\r\n tokenHandler.logoutPIN();\r\n } catch (Exception e) {\r\n fail(e.toString());\r\n }\r\n }", "public void unLock(Long userId, CurrencyName curId, BigInteger newBalance) {\n ValueOperations<String, Object> values = redisTemplate.opsForValue();\n String lockKEy = getKey(userId, curId, true);\n String wKey = getKey(userId, curId, false);\n values.set(wKey, newBalance);\n redisTemplate.delete(lockKEy);\n\n }", "public void setAssetKey(AssetKey key) {\n file.setAssetKeyData(key);\n }", "public void unlock(){\n logger.log(Level. INFO,\"unlock() \"+lockState+\".\");\n this.lock.lock();\n logger.log(Level. INFO,\"unlock taking mutex :\"+lockState+\".\");\n switch(this.lockState){\n \t\t\tcase RLT:\n \t\t\tlockState = State.RLC;\n \t\t\tbreak;\n \t\t\tcase WLT:\n \t\t\tlockState = State.WLC;\n \t\t\tcase RLT_WLC:\n \t\t\tlockState = State.WLC;\t\n break;\n default:\n logger.log(Level.WARNING,\"Unlock with : \"+lockState+\".\");\n break;\n \t\t}\n this.available.signal();\t\n logger.log(Level.WARNING,\"SIGNAL\");\n this.lock.unlock();\n \t}", "private void setLock(int tid, int varIndex, Lock.Type type) {\n List<Lock> lockList = null;\n if (_lockTable.containsKey(varIndex)) {\n lockList = _lockTable.get(varIndex);\n lockList.add(new Lock(tid, type));\n } else {\n lockList = new ArrayList<Lock>();\n lockList.add(new Lock(tid, type));\n _lockTable.put(varIndex, lockList);\n }\n }", "public void setLocked(boolean locked, Connection conn) throws SQLException, NotLoadedException {\n SqlUpdateCommand sqlUpdateCommand = new SqlUpdateCommand(\"Person\", \"\\\"Username\\\" = '\" + userName.getValue() + \"'\");\n sqlUpdateCommand.addBooleanValue(\"Locked_YN\", locked);\n conn.createStatement().execute(sqlUpdateCommand.toString());\n this.locked.setValueOnLoadedObject(locked);\n }", "@Test\n public void testAccountSetPassword() {\n try {\n Account newAcc = new Account(1, \"holder\", \"holder\", Credential.ADMIN);\n newAcc.setPassword(\"newPasswordForHolder\");\n Assert.assertEquals(\"Incorrect updated password for account after changing\",\n \"newPasswordForHolder\", newAcc.getPassword());\n } catch (Exception e) {\n Assert.fail(\"Set account password should not have failed here\");\n e.printStackTrace();\n }\n }", "public void setAuthLockTime(Date authLockTime) {\n this.authLockTime = authLockTime;\n }", "void setKey(String key);", "void setLong(String key, long val);", "void setAccountId(Long accountId);", "public Builder setAccountID(long value) {\n validate(fields()[2], value);\n this.accountID = value;\n fieldSetFlags()[2] = true;\n return this; \n }", "public void setLockFlag(Integer aLockFlag) {\n lockFlag = aLockFlag;\n }", "public void setLockFlag(Integer aLockFlag) {\n lockFlag = aLockFlag;\n }" ]
[ "0.6072722", "0.58783776", "0.5851613", "0.5487868", "0.52896595", "0.52018136", "0.5194538", "0.51739603", "0.51449525", "0.51215315", "0.50942", "0.5093214", "0.5086348", "0.5070089", "0.5067239", "0.5060967", "0.5048915", "0.50486845", "0.50305635", "0.5028827", "0.49989182", "0.49898842", "0.49795026", "0.49710137", "0.49566385", "0.49452153", "0.49440518", "0.49377796", "0.4910701", "0.48925975", "0.48875496", "0.48778468", "0.48675942", "0.48655018", "0.48409316", "0.48342612", "0.4826466", "0.48115885", "0.48089078", "0.4807504", "0.48055476", "0.47920582", "0.47905087", "0.47880095", "0.4783977", "0.47466052", "0.47440296", "0.47440296", "0.473526", "0.47301182", "0.47157514", "0.47155318", "0.4710195", "0.46993873", "0.46931332", "0.46823603", "0.46793184", "0.46769384", "0.4675665", "0.46754974", "0.46634138", "0.46567267", "0.46562728", "0.46552053", "0.46477538", "0.4640708", "0.4640668", "0.46393204", "0.46220145", "0.46183106", "0.46167955", "0.4616319", "0.46093962", "0.46041405", "0.46028316", "0.459901", "0.459901", "0.45944133", "0.45927605", "0.45916462", "0.45884103", "0.45850846", "0.45829168", "0.45824444", "0.45823574", "0.45793045", "0.45779458", "0.45709613", "0.45686647", "0.45683983", "0.456742", "0.45634443", "0.45628878", "0.45620042", "0.4560966", "0.4560913", "0.4558161", "0.45569882", "0.4554907", "0.4554907" ]
0.5287465
5
check trade history is correct
@Test public void testGetTradeHistory() { // all the previous trades for the dummy stock List<TickEvent<Trade>> completedTrades = exchange.getTradeHistory(stock); // check they are in the correct order for(int i = 0; i < completedTrades.size()-1; i++) { assertTrue(completedTrades.get(i).compareTo(completedTrades.get(i+1)) < 0); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean recordTrade(Trade trade) throws Exception;", "boolean hasTradeDate();", "@Then(\"^verify order is placed successfully in Order History$\")\r\n\tpublic void verifyOrderHistory() throws Exception {\n\t assertTrue(new ProductCheckout(driver).isOrderPlaced());\r\n\t}", "@Test\n void showStoreHistorySuccess() {\n Integer productID1 = store.getProductID(\"computer\");\n tradingSystem.AddProductToCart(EconnID,storeID, productID1,5);\n tradingSystem.subscriberPurchase(EuserId, EconnID, \"123456\",\"4\",\"2022\",\"123\",\"123456\",\"Rager\",\"Beer Sheva\",\"Israel\",\"123\");\n List<DummyShoppingHistory> list = store.ShowStoreHistory();\n assertEquals(list.size(), 1);\n assertTrue(list.get(0).getProducts().get(0).getProductName().equals(\"computer\"));\n }", "private boolean areHistoriesEqual(Path dataset) throws IOException, UnsupportedSchemaHistoryInputFormat, InvalidSchemaHistoryException\n\t{\n\t\tFile transitionsFile = new File(dataset.toFile(), \"transitions.xml\");\n\t\t\n\t\t// First i load using the HecateSchemaHistoryLoader class.\n\t\tSchemaHistoryLoadService loadService = new HecateSchemaHistoryLoadService();\n\t\t\n\t\tPath[] input = new Path[2];\n\t\tinput[0] = dataset;\n\t\tinput[1] = transitionsFile.toPath();\n\t\tforeignkeyshistory.SchemaHistory schemaHistory = loadService.load(input);\n\t\t\n\t\t\n\t\t// Now i load using HecateManager\n\t\tHecateManager hecateManager = new HecateManager();\n\t\t\n\t\tArrayList<DBVersion> lifetime = hecateManager.parseSql(dataset.toString());\n\t\t\n\t\t// i must sort the lifetime array according the version\n\t\t//Arrays.sort(lifetime);\n\t\tArrayList<Map<String,Integer>> transitions = hecateManager.parseXml(transitionsFile.toString());\n\t\t\n\t\treturn areHistoriesEqual(schemaHistory, lifetime, transitions);\n\t}", "public boolean validateDate(TradeModel tradeModel)\n {\n int i = tradeModel.getMaturityDate().compareTo(LocalDate.now());\n if (i<0)\n return false;\n else\n return true;\n }", "public boolean canTrade()\n\t{\n\t\treturn System.currentTimeMillis() - m_lastTrade > 60 * 1000 && getPartyCount() >= 2;\n\t}", "boolean canAcceptTrade();", "@Override\n public boolean canUndo(History history) {\n try {\n List<Meeting> meetings = transactionFetcher.query().getMeetings().\n get((Integer) history.getData(\"transactionId\"));\n for (Meeting meeting : meetings) {\n if (meeting.isAgreedTo()) return false;\n }\n return true;\n } catch (Exception e) {\n return false;\n }\n }", "protected boolean isDataTransactionValid(StateDataTransaction tr) {\n\t\tString address = ((StateDataTransaction)tr).address;\n\t\tString newData = ((StateDataTransaction)tr).newValue;\n\t\tint transactionNonce = ((StateDataTransaction)tr).getNonce();\n\t\t\n\t\tif (newData.equals(\"\")){\n\t\t\t// checking null data, is that an error ?\n\t\t\tServiceBus.logger.log(\"new data is null in the transaction, Id : \" + tr.getTransctionId());\n\t\t}\n\t\t\n\t\tint accountFound = 0;\n\t\t// getting the account to be modified\n\t\tAccountInterface accountToModify = null;\n\t\tfor(AccountInterface account: accounts) {\n\t\t\tString accountAddressString = account.getAddress();\n\t\t\tif (accountAddressString.equals(address)){\n\t\t\t\taccountToModify = account;\n\t\t\t\taccountFound++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (accountFound > 1) {\n\t\t\t// more than one account matches -> error\n\t\t\tServiceBus.logger.log(\"more than one account has been found at transaction, Id : \" + tr.getTransctionId());\n\t\t\treturn false;\n\t\t}\n\t\telse if (accountFound == 1) {\n\t\t\t// one account has been found to match\n\t\t\tif (tr.getNonce() != accountToModify.getNonce() + 1){\n\t\t\t\t// nonce is not valid, possible replay attack\n\t\t\t\tServiceBus.logger.log(\"Nonce is not valid at transaction, possible replay aatack, Id : \" + tr.getTransctionId());\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// seems everything cool\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t\n\t\t}else if (accountFound == 0){\n\t\t\t// no account is found -> a new account has to be added\n\t\t\t// as this is called by the validating not at the mining, this case is invalid\n\t\t\tServiceBus.logger.log(\"Target account is not found at transactio validation, Id : \" + tr.getTransctionId());\n\t\t\treturn false;\n\t\t}\t\t\n\t\t// if nothing matches return false\n\t\treturn false;\n\t}", "boolean hasKeepPropertiesHistoryInHours();", "boolean hasLedger();", "@Test\r\n\tpublic void testEndMatchToMatchLeaguePlayMatch1() {\n\t\tassertTrue(\"Error storing end stock data\", false);\r\n\t\t//Check that portfolio values have been calculated correctly\r\n\t\tassertTrue(\"Error calcuating final portfolio values\", false);\r\n\t}", "private static boolean isInOrderTimestamp(\n long timestamp,\n long prevTimestamp)\n {\n long timestampDiff = timestamp - prevTimestamp;\n\n // Assume that a diff this big must be due to reordering. Don't update\n // with reordered samples.\n return (timestampDiff < 0x80000000L);\n }", "protected boolean isTransferTransactionValid(StateTransferTransaction tr) {\n\t\tString fromAddressPublicKey = ((StateTransferTransaction)tr).from;\n\t\tString toAddressPublicKey = ((StateTransferTransaction)tr).to;\t\t\t\t\n\t\tdouble amount = ((StateTransferTransaction)tr).amount;\n\t\tint nonce = ((StateTransferTransaction)tr).getNonce();\n\t\t\t\n\t\t// getting the fromAccount to be modified\n\t\tAccountInterface accountFromModify = null;\n\t\tint accountFromModifyFound = 0;\n\t\tboolean accountFromIsGood = false;\n\t\tfor(AccountInterface account: accounts) {\n\t\t\tif (account.getAddress().equals(fromAddressPublicKey)){\n\t\t\t\taccountFromModify = account;\n\t\t\t\taccountFromModifyFound ++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (accountFromModifyFound > 1) {\n\t\t\t// more than one account is found ?? -> raise error\n\t\t\tServiceBus.logger.log(\"more than one matching account has been found at transfer transaction TrID : \" + tr.getTransctionId());\n\t\t\treturn false;\n\t\t}\n\t\telse if (accountFromModifyFound == 1) {\n\t\t\tif (tr.getNonce() != accountFromModify.getNonce() + 1) {\n\t\t\t\t// error -> nonce not matching -> pssible replay attack\n\t\t\t\tServiceBus.logger.log(\"Nonce is not valid at transaction, possible replay aatack\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\telse {\t\t\t\t\n\t\t\t\tif (accountFromModify.getBalance() < amount){\n\t\t\t\t\t// not enoguh fund on the account\n\t\t\t\t\tServiceBus.logger.log(\"Not enoguh fund on the account at transfer transaction TrID : \" + tr.getTransctionId());\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t// all cool but still not return because the second account has to be checked as well\n\t\t\t\telse {\n\t\t\t\t\taccountFromIsGood = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\t\n\t\t}else if (accountFromModifyFound == 0) {\n\t\t\t// error, if the account does not exist, you can not transfer money from that\n\t\t\tServiceBus.logger.log(\"The account from which you want to transfer the fund does not exist, TrID : \" + tr.getTransctionId());\n\t\t\treturn false;\n\t\t}\n\t\t\n\n\t\t// getting the toAccount to be modified\n\t\tAccountInterface accountToModify = null;\n\t\tint accountToModifyFound = 0;\n\t\tboolean accountToIsGood = false;\n\t\tfor(AccountInterface account: accounts) {\n\t\t\tif (account.getAddress().equals(toAddressPublicKey)){\n\t\t\t\taccountToModify = account;\n\t\t\t\taccountToModifyFound ++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (accountToModifyFound > 1) {\n\t\t\t// more than one account is found ?? -> raise error\n\t\t\tServiceBus.logger.log(\"More than one account is found at matching the transfer transaction TrID : \" + tr.getTransctionId());\n\t\t\treturn false;\n\t\t}\n\t\telse if (accountToModifyFound == 1) {\n\t\t\taccountToIsGood = true;\n\t\t\t\t\n\t\t}else if (accountToModifyFound == 0) {\n\t\t\t// error, if the account does not exist, you can not transfer money from that\n\t\t\tServiceBus.logger.log(\"The to account does not exist, TrID : \" + tr.getTransctionId());\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t// transfer is only possible if the asset type is the same, otherwise it is an exchange\n\t\tif (!accountToModify.getAssetType().equals(accountFromModify.getAssetType())){\n\t\t\t// error, from and to asset type must be the same\n\t\t\tServiceBus.logger.log(\"From and to asset type must be the same, TrID : \" + tr.getTransctionId(), Severity.WARNING);\n\t\t\treturn false;\t\t\t\n\t\t}\n\t\t\t\t\n\t\t// final check if all good return true\n\t\tif (accountFromIsGood && accountToIsGood){\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\t// default value\n\t\treturn false;\t\t\t\n\t}", "public String trade_history(String pair, int since) {\n\t\treturn this.apiCall(\"trade_history\", pair, (\"since,\" + since), false);\n\t}", "private void checksOldExpense() {\n DateUtils dateUtils = new DateUtils();\n\n // Breaking date string from date base\n String[] expenseDate = dateDue.getText().toString().split(\"-\");\n\n if((Integer.parseInt(expenseDate[GET_MONTH]) < Integer.parseInt(dateUtils.currentMonth))\n && (Integer.parseInt(expenseDate[GET_YEAR]) <= Integer.parseInt(dateUtils.currentYear))){\n\n }\n }", "public boolean isValid_ToBuyTicket() {\n if (this.tktSold < this.museum.getMaxVisit() && isNowTime_in_period()) {\r\n return true;\r\n } else {\r\n return false;\r\n }\r\n }", "@Override\n\tpublic int checkBill(MarketTransaction t) {\n\t\treturn 0;\n\t}", "public boolean hasTradeDate() {\n return ((bitField0_ & 0x00080000) == 0x00080000);\n }", "protected boolean isTransferTransactionValidEx(StateTransferTransaction tr) {\n\t\tString fromAddressPublicKey = ((StateTransferTransaction)tr).from;\n\t\tString toAddressPublicKey = ((StateTransferTransaction)tr).to;\t\t\t\t\n\t\tdouble amount = ((StateTransferTransaction)tr).amount;\n\t\tint nonce = ((StateTransferTransaction)tr).getNonce();\n\t\t\t\n\t\t// getting the fromAccount to be modified\n\t\tAccountInterface accountFromModify = null;\n\t\tint accountFromModifyFound = 0;\n\t\tboolean accountFromIsGood = false;\n\t\tfor(AccountInterface account: accounts) {\n\t\t\tif (account.getAddress().equals(fromAddressPublicKey)){\n\t\t\t\taccountFromModify = account;\n\t\t\t\taccountFromModifyFound ++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (accountFromModifyFound > 1) {\n\t\t\t// more than one account is found ?? -> raise error\n\t\t\tServiceBus.logger.log(\"more than one matching account has been found at transfer transaction TrID : \" + tr.getTransctionId());\n\t\t\treturn false;\n\t\t}\n\t\telse if (accountFromModifyFound == 1) {\n\t\t\tif (tr.getNonce() != accountFromModify.getNonce() + 1) {\n\t\t\t\t// error -> nonce not matching -> pssible replay attack\n\t\t\t\tServiceBus.logger.log(\"Nonce is not valid at transaction, possible replay aatack\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\telse {\t\t\t\t\n\t\t\t\tif (accountFromModify.getBalance() < amount){\n\t\t\t\t\t// not enoguh fund on the account\n\t\t\t\t\tServiceBus.logger.log(\"Not enoguh fund on the account at transfer transaction TrID : \" + tr.getTransctionId());\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t// all cool but still not return because the second account has to be checked as well\n\t\t\t\telse {\n\t\t\t\t\taccountFromIsGood = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\t\n\t\t}else if (accountFromModifyFound == 0) {\n\t\t\t// error, if the account does not exist, you can not transfer money from that\n\t\t\tServiceBus.logger.log(\"The account from which you want to transfer the fund does not exist, TrID : \" + tr.getTransctionId());\n\t\t\treturn false;\n\t\t}\n\t\t\n\n\t\t// getting the toAccount to be modified\n\t\tAccountInterface accountToModify = null;\n\t\tint accountToModifyFound = 0;\n\t\tboolean accountToIsGood = false;\n\t\tfor(AccountInterface account: accounts) {\n\t\t\tif (account.getAddress().equals(toAddressPublicKey)){\n\t\t\t\taccountToModify = account;\n\t\t\t\taccountToModifyFound ++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (accountToModifyFound > 1) {\n\t\t\t// more than one account is found ?? -> raise error\n\t\t\tServiceBus.logger.log(\"More than one account is found at matching the transfer transaction TrID : \" + tr.getTransctionId());\n\t\t\treturn false;\n\t\t}\n\t\telse if (accountToModifyFound == 1) {\n\t\t\taccountToIsGood = true;\n\t\t\t\t\n\t\t}else if (accountToModifyFound == 0) {\n\t\t\t// to account can be added to the state, asset type logic is questionable\n\t\t\t\n\t\t\tAccountBase account = new AccountBase(\n\t\t\t\t\t((StateTransferTransaction)tr).from,\n\t\t\t\t\t((StateTransferTransaction)tr).getNonce(),\n\t\t\t\t\t\"\",\n\t\t\t\t\t((StateTransferTransaction)tr).amount,\n\t\t\t\t\taccountFromModify.getAssetType());\t\n\t\t\taccounts.add(account);\n\t\t\t\n\t\t\taccountToIsGood = true;\n\t\t}\n\t\t\n\t\t// transfer is only possible if the asset type is the same, otherwise it is an exchange\n\t\tif (!accountToModify.getAssetType().equals(accountFromModify.getAssetType())){\n\t\t\t// error, from and to asset type must be the same\n\t\t\tServiceBus.logger.log(\"From and to asset type must be the same, TrID : \" + tr.getTransctionId(), Severity.WARNING);\n\t\t\treturn false;\t\t\t\n\t\t}\n\t\t\t\t\n\t\t// final check if all good return true\n\t\tif (accountFromIsGood && accountToIsGood){\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\t// default value\n\t\treturn false;\t\t\t\n\t}", "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 }", "@Test\n public void testMarketTransaction ()\n {\n initializeService();\n accountingService.addMarketTransaction(bob,\n timeslotRepo.findBySerialNumber(2), 0.5, -45.0);\n accountingService.addMarketTransaction(bob,\n timeslotRepo.findBySerialNumber(3), 0.7, -43.0);\n assertEquals(0, accountingService.getPendingTariffTransactions().size(), \"no tariff tx\");\n List<BrokerTransaction> pending = accountingService.getPendingTransactions();\n assertEquals(2, pending.size(), \"correct number in list\");\n MarketTransaction mtx = (MarketTransaction)pending.get(0);\n assertNotNull(mtx, \"first mtx not null\");\n assertEquals(2, mtx.getTimeslot().getSerialNumber(), \"correct timeslot id 0\");\n assertEquals(-45.0, mtx.getPrice(), 1e-6, \"correct price id 0\");\n Broker b1 = mtx.getBroker();\n Broker b2 = brokerRepo.findById(bob.getId());\n assertEquals(b1, b2, \"same broker\");\n mtx = (MarketTransaction)pending.get(1);\n assertNotNull(mtx, \"second mtx not null\");\n assertEquals(0.7, mtx.getMWh(), 1e-6, \"correct quantity id 1\");\n // broker market positions should have been updated already\n MarketPosition mp2 = bob.findMarketPositionByTimeslot(2);\n assertNotNull(mp2, \"should be a market position in slot 2\");\n assertEquals(0.5, mp2.getOverallBalance(), 1e-6, \".5 mwh in ts2\");\n MarketPosition mp3 = bob.findMarketPositionByTimeslot(3);\n assertNotNull(mp3, \"should be a market position in slot 3\");\n assertEquals(0.7, mp3.getOverallBalance(), 1e-6, \".7 mwh in ts3\");\n }", "public boolean hasTradeDate() {\n return ((bitField0_ & 0x00080000) == 0x00080000);\n }", "public boolean checkLegitTrans(JsonObject block){\n HashMap<String, Integer> balance = compute_balance(block);\n return Update_by_block(balance, block);\n }", "private boolean areHistoriesEqual(SchemaHistory schemaHistory, ArrayList<DBVersion> lifetime, ArrayList<Map<String,Integer>> transitions)\n\t{\n\t\treturn areSchemasEqual(schemaHistory, lifetime) && areTransitionsEqual(schemaHistory, transitions);\n\t}", "@Test(timeout = 4000)\n public void test54() throws Throwable {\n String string0 = EWrapperMsgGenerator.historicalData(10, \"BAG\", 1690.0, (-534), 10, (-1.0), (-4021), 1, 1495.884177489, false);\n assertEquals(\"id=10 date = BAG open=1690.0 high=-534.0 low=10.0 close=-1.0 volume=-4021 count=1 WAP=1495.884177489 hasGaps=false\", string0);\n }", "public static void main(String[] args) throws Exception {\n\t\t\n\t\tTradeImpl tf = new TradeImpl();\n\t\tDate todaysDate = Calendar.getInstance ().getTime();\n\t\tSimpleDateFormat sd = new SimpleDateFormat(\"dd/MM/yyyy\");\n\t\t\n\t\t\n\t\t\n//\t\tAdding Trade T1\n\t\tDate maturityDate=sd.parse(\"10/05/2021\");\n\t\tTradeBean t1=new TradeBean(\"T1\",1,\"CP-1\",\"B1\",maturityDate, todaysDate, 'N');\n\t\ttf.addTrade(t1);\n\t\t\n\t\t//Adding Trade T2\n\t\tmaturityDate=sd.parse(\"20/05/2021\");\n\t\tTradeBean t2=new TradeBean(\"T2\",2,\"CP-2\",\"B1\",maturityDate, todaysDate, 'N');\n\t\ttf.addTrade(t2);\t\t\n\n\t\tTradeBean t4=new TradeBean(\"T3\",5,\"CP-4\",\"B1\",maturityDate, todaysDate, 'N');\n\t\ttf.addTrade(t4);\n\t\t\n\t\t\n\t\t//Adding Trade T3\n\t\tmaturityDate=sd.parse(\"20/05/2021\");\n\t\tTradeBean t3=new TradeBean(\"T4\",5,\"CP-3\",\"B2\",maturityDate, todaysDate, 'N');\n\t\ttf.addTrade(t3);\n\t\t\n\t\t\n\t\t\n\t\t//Display all Trade\n\t\tSystem.out.println(\"\\n\\n\");\n\t\tSystem.out.println(\"Displaying total number of Trade in the list\");\n\t\ttf.printTrade();\n\t\tSystem.out.println(\"\\n\\n\");\t\n\t\t\t\t\n\t\t//Checking for all Expired Flag\n\t\tSystem.out.println(\"Checking for Expired Flag\");\n\t\tmaturityDate=sd.parse(\"20/01/2021\");\n\t\tTradeBean t6=new TradeBean(\"T2\",2,\"CP-2\",\"B1\",maturityDate, todaysDate, 'N');\n\t\ttf.tradeList.replace(\"T2\", t6);\n\t\t\n\t\tmaturityDate=sd.parse(\"20/01/2021\");\n\t\tTradeBean t7=new TradeBean(\"T4\",5,\"CP-3\",\"B2\",maturityDate, todaysDate, 'N');\n\t\ttf.tradeList.replace(\"T4\", t7);\n\t\ttf.checkExpiredDates();\n\t\ttf.printTrade();\n\t\t\n\t\t\n\n\t}", "boolean hasFinalTallyResult();", "@Test\n\tpublic void test() {\n\t\tHistoryStorage historyObj = HistoryStorage.getInstance();\n\t\tboolean result = historyObj.writeToHistory(null, MSG_1);\n\t\tassertFalse(result);\n\t}", "@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\tpublic void testEndMatchToMatchLeaguePlayMatch2() {\n\t\tassertTrue(\"Error storing end stock data\", false);\r\n\t\t//Check that portfolio values have been calculated correctly\r\n\t\tassertTrue(\"Error calcuating final portfolio values\", false);\r\n\t}", "boolean hasTxnresponse();", "boolean isIntraday();", "private boolean dataToHistory(DataEntry oldEntry) {\n\t\tif (oldEntry != null) {\n\t\t\tif (bufferIndex < MAX_HISTORY_ENTRIES) {\n\t\t\t\toldEntries[bufferIndex++] = new HistoryEntry(oldEntry.getProductId(), oldEntry);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "boolean hasTransactionChangesPending() {\n// System.out.println(transaction_mod_list);\n return transaction_mod_list.size() > 0;\n }", "@Test\n\tpublic void test2() {\n\t\tHistoryStorage historyObj = HistoryStorage.getInstance();\n\t\tboolean result = historyObj.writeToHistory(HISTORY_TXT, null);\n\t\tassertFalse(result);\n\t}", "@Test\n public void shouldAddValidGameHistory()\n {\n boolean added = DatabaseHelper.addGameToStats(\"test\", \"test\", -25, \"test\", false, 0, 5, 9);\n DatabaseHelper.deleteTestEntry();\n assertTrue(added);\n }", "public boolean saveDown() {\n if (\n cashFlow == null ||\n cashFlow.getDetail() == null ||\n cashFlow.getDetail().isEmpty()\n ) {\n System.out.println(\"invalid model store\");\n return false;\n }\n boolean cashFlowSaveResult = CashFlow.save(cashFlow);\n\n // save cash flow failure case\n if (!cashFlowSaveResult) {\n System.out.println(\"query false\");\n return false;\n }\n\n // get owe per provider\n boolean owe_log = true;\n int pointer = 0;\n final Map<String, Integer> providerIndex = new HashMap<>();\n final int nrow = cashFlow.getDetail().size();\n final int[] owe = new int[nrow];\n for (Payable p: cashFlow.getDetail()) {\n String prvId = p.getProviderId();\n if (providerIndex.containsKey(prvId)) {\n owe[ providerIndex.get(prvId) ] += p.getPrice();\n } else {\n providerIndex.put(prvId, pointer);\n owe[ pointer ] = p.getPrice();\n pointer++;\n }\n }\n for (String k: providerIndex.keySet()) {\n owe_log = owe_log &&\n db.send(\"UPDATE NhaCungCap SET NoPhaiTra = NoPhaiTra + \"\n + owe[ providerIndex.get(k) ]\n + \" WHERE MaNCC = \" + k);\n }\n if (!owe_log) {\n System.out.println(\"update own false\");\n }\n return owe_log;\n }", "protected boolean isDataTransactionValidEx(StateDataTransaction tr) {\n\t\tString address = ((StateDataTransaction)tr).address;\n\t\tString newData = ((StateDataTransaction)tr).newValue;\n\t\tint transactionNonce = ((StateDataTransaction)tr).getNonce();\n\t\t\n\t\tif (newData.equals(\"\")){\n\t\t\t// checking null data, is that an error ?\n\t\t\tServiceBus.logger.log(\"new data is null in the transaction, Id : \" + tr.getTransctionId());\n\t\t}\n\t\t\n\t\tint accountFound = 0;\n\t\t// getting the account to be modified\n\t\tAccountInterface accountToModify = null;\n\t\tfor(AccountInterface account: accounts) {\n\t\t\tString accountAddressString = account.getAddress();\n\t\t\tif (accountAddressString.equals(address)){\n\t\t\t\taccountToModify = account;\n\t\t\t\taccountFound++;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (accountFound > 1) {\n\t\t\t// more than one account matches -> error\n\t\t\tServiceBus.logger.log(\"more than one account has been found at transaction, Id : \" + tr.getTransctionId());\n\t\t\treturn false;\n\t\t}\n\t\telse if (accountFound == 1) {\n\t\t\t// one account has been found to match\n\t\t\tif (tr.getNonce() != accountToModify.getNonce() + 1){\n\t\t\t\t// nonce is not valid, possible replay attack\n\t\t\t\tServiceBus.logger.log(\"Nonce is not valid at transaction, possible replay aatack, Id : \" + tr.getTransctionId());\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\telse {\n\t\t\t\t// seems everything cool\n\t\t\t\t// apply state \n\t\t\t\taccountToModify.setData(newData);\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}else if (accountFound == 0){\n\t\t\t// no account is found -> a new account has to be added\n\t\t\t// default data transaction\n\t\t\tAccountBase account = new AccountBase(\n\t\t\t\t\t((StateDataTransaction)tr).address,\n\t\t\t\t\t((StateDataTransaction)tr).getNonce(),\n\t\t\t\t\t((StateDataTransaction)tr).newValue,\n\t\t\t\t\t0,\n\t\t\t\t\tnew char[] {'D','F','T'});\t\n\t\t\taccounts.add(account);\n\t\t}\t\t\n\t\t// if nothing matches return false\n\t\treturn false;\n\t}", "@Test\n\tpublic void test6() {\n\t\tboolean switch1 = false;\n\t\tHistoryStorage store = HistoryStorage.getInstance();\n\t\tstore.writeToHistory(HISTORY_TXT, EMPTY_STRING);\n\t\tstore.writeToHistory(HISTORY_TXT, LINE_2);\n\t\tString result = store.readFromHistory(HISTORY_TXT);\n\t\tif (result.split(\"\\n\")[0].equals(LINE_2)) {\n\t\t\tswitch1 = true;\n\t\t}\n\t\tassertTrue(switch1);\n\t}", "private void persistHistoricalData() {\n /*\n r4 = this;\n r1 = r4.mInstanceLock;\n monitor-enter(r1);\n r0 = r4.mReadShareHistoryCalled;\t Catch:{ all -> 0x000f }\n if (r0 != 0) goto L_0x0012;\n L_0x0007:\n r0 = new java.lang.IllegalStateException;\t Catch:{ all -> 0x000f }\n r2 = \"No preceding call to #readHistoricalData\";\n r0.<init>(r2);\t Catch:{ all -> 0x000f }\n throw r0;\t Catch:{ all -> 0x000f }\n L_0x000f:\n r0 = move-exception;\n monitor-exit(r1);\t Catch:{ all -> 0x000f }\n throw r0;\n L_0x0012:\n r0 = r4.mHistoricalRecordsChanged;\t Catch:{ all -> 0x000f }\n if (r0 != 0) goto L_0x0018;\n L_0x0016:\n monitor-exit(r1);\t Catch:{ all -> 0x000f }\n L_0x0017:\n return;\n L_0x0018:\n r0 = 0;\n r4.mHistoricalRecordsChanged = r0;\t Catch:{ all -> 0x000f }\n r0 = 1;\n r4.mCanReadHistoricalData = r0;\t Catch:{ all -> 0x000f }\n r0 = r4.mHistoryFileName;\t Catch:{ all -> 0x000f }\n r0 = android.text.TextUtils.isEmpty(r0);\t Catch:{ all -> 0x000f }\n if (r0 != 0) goto L_0x0031;\n L_0x0026:\n r0 = SERIAL_EXECUTOR;\t Catch:{ all -> 0x000f }\n r2 = new com.actionbarsherlock.widget.ActivityChooserModel$HistoryPersister;\t Catch:{ all -> 0x000f }\n r3 = 0;\n r2.<init>();\t Catch:{ all -> 0x000f }\n r0.execute(r2);\t Catch:{ all -> 0x000f }\n L_0x0031:\n monitor-exit(r1);\t Catch:{ all -> 0x000f }\n goto L_0x0017;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.actionbarsherlock.widget.ActivityChooserModel.persistHistoricalData():void\");\n }", "public static boolean checkFrameRates(TalonSRX t) // TODO pass in criteria (ex: CurrentLimits)?\n {\n boolean result = true;\n List<FrameCriteria> expectations = Arrays.asList(new FrameCriteria[] {\n new FrameCriteria(StatusFrameEnhanced.Status_1_General, 5, CRITERIA.NO_FASTER_THAN),\n new FrameCriteria(StatusFrameEnhanced.Status_1_General, 20, CRITERIA.NO_SLOWER_THAN),\n new FrameCriteria(StatusFrameEnhanced.Status_2_Feedback0, 5, CRITERIA.NO_FASTER_THAN),\n new FrameCriteria(StatusFrameEnhanced.Status_10_MotionMagic, 10, CRITERIA.NO_FASTER_THAN),\n new FrameCriteria(StatusFrameEnhanced.Status_13_Base_PIDF0, 100, CRITERIA.NO_FASTER_THAN),\n });\n\n ConsoleLogger.info(String.format(\"Motor %d Frames:\", t.getDeviceID()));\n for (FrameCriteria criteria : expectations)\n {\n int actual = t.getStatusFramePeriod(criteria.frame, 0);\n ConsoleLogger.info(String.format(\"%s: %d ms\", criteria.frame, actual));\n result &= criteria.verify(actual);\n }\n System.out.println(String.format(\"Motor %d frames %s\", t.getDeviceID(), (result) ? \"okay\" : \"failed\"));\n return result;\n }", "boolean hasTradingAccount();", "boolean hasGetUserHistory();", "private boolean isOutdatedTransaction(final TransactionModel transactionToBeChecked, final CreditCardTransactionDTO currentCCTransaction) {\n final long difference = DateTimeUtil.getTimeDifference(fraudConfig.getChronoUnit(), transactionToBeChecked.getTimestamp(), currentCCTransaction.getTimestamp());\n return difference > fraudConfig.getWindow();\n }", "@Test(priority = 3)\n\tpublic void isHomeDataCorrect() {\n\t\tlog.info(\"Validating the homepage data\");\n\t\tList<String> data = home.changesInElement(driver);\n\t\tAssert.assertEquals(data.get(0), \"BLR\");\n\t\tAssert.assertEquals(data.get(1), \"BOM\");\n\t\tlog.info(\"All the details of homepage are correct\");\n\t\tHomePageFlow.dateInput();\n\t}", "public boolean validateVersion(TradeModel tradeModel)\n {\n Integer version = tradeRepository.findMaxVersion(tradeModel.getTradeId());\n if (version == null)\n return true;\n else {\n if (tradeModel.getVersion() >= version)\n return true;\n else\n return false;\n }\n }", "public boolean different(LoanScheduleEntity loanInstallment) {\n if (!this.installmentId.equals(loanInstallment.getInstallmentId())) {\n // System.out.println(\"installmentId different:\" + this.installmentId + \" - \" +\n // loanInstallment.getInstallmentId());\n return true;\n }\n if (!this.actionDate.equals(loanInstallment.getActionDate())) {\n // System.out.println(\"actionDate different:\" + this.actionDate + \" - \" +\n // loanInstallment.getActionDate());\n return true;\n }\n if (!this.isPaid.equals(loanInstallment.isPaid())) {\n // System.out.println(\"isPaid different:\" + this.isPaid + \" - \" + loanInstallment.isPaid());\n return true;\n }\n if ((this.paymentDate == null && loanInstallment.getPaymentDate() != null)\n || (this.paymentDate != null && loanInstallment.getPaymentDate() == null)) {\n System.out.println(\"paymentDate null/not null different\");\n return true;\n }\n if (this.paymentDate != null) {\n if (!this.paymentDate.equals(loanInstallment.getPaymentDate())) {\n System.out.println(\"paymentDate different:\" + this.paymentDate + \" - \"\n + loanInstallment.getPaymentDate());\n return true;\n }\n }\n if (!this.principal.equals(loanInstallment.getPrincipal())) {\n // System.out.println(\"principal different:\" + this.principal + \" - \" + loanInstallment.getPrincipal());\n return true;\n }\n if (!this.interest.equals(loanInstallment.getInterest())) {\n // System.out.println(\"interest different:\" + this.interest + \" - \" + loanInstallment.getInterest());\n return true;\n }\n if (!this.miscFee.equals(loanInstallment.getMiscFee())) {\n // System.out.println(\"miscFee different:\" + this.miscFee + \" - \" + loanInstallment.getMiscFee());\n return true;\n }\n if (!this.miscPenalty.equals(loanInstallment.getMiscPenalty())) {\n // System.out.println(\"miscPenalty different:\" + this.miscPenalty + \" - \" +\n // loanInstallment.getMiscPenalty());\n return true;\n }\n if (!this.principalPaid.equals(loanInstallment.getPrincipalPaid())) {\n // System.out.println(\"principalPaid different:\" + this.principalPaid + \" - \" +\n // loanInstallment.getPrincipalPaid());\n return true;\n }\n if (!this.interestPaid.equals(loanInstallment.getInterestPaid())) {\n // System.out.println(\"interestPaid different:\" + this.interestPaid + \" - \" +\n // loanInstallment.getInterestPaid());\n return true;\n }\n if (!this.miscFeePaid.equals(loanInstallment.getMiscFeePaid())) {\n // System.out.println(\"miscFeePaid different:\" + this.miscFeePaid + \" - \" +\n // loanInstallment.getMiscFeePaid());\n return true;\n }\n if (!this.miscPenaltyPaid.equals(loanInstallment.getMiscPenaltyPaid())) {\n // System.out.println(\"miscPenaltyPaid different:\" + this.miscPenaltyPaid + \" - \" +\n // loanInstallment.getMiscPenaltyPaid());\n return true;\n }\n if ((this.loanFeeInstallments == null && loanInstallment.getAccountFeesActionDetails() != null)\n || (this.loanFeeInstallments != null && loanInstallment.getAccountFeesActionDetails() == null)) {\n // System.out.println(\"Loan Fee Installment null/not null different\");\n return true;\n }\n if (loanInstallment.getAccountFeesActionDetails() != null) {\n Integer index = 0;\n for (AccountFeesActionDetailEntity accountFeesActionDetail : loanInstallment\n .getAccountFeesActionDetails()) {\n if (this.loanFeeInstallments.get(index).different(accountFeesActionDetail)) {\n return true;\n }\n index++;\n }\n }\n\n return false;\n }", "@Test\n public void testCurrentMarketPosition ()\n {\n initializeService();\n accountingService.addMarketTransaction(bob,\n timeslotRepo.findBySerialNumber(2), 0.5, -45.0);\n accountingService.addMarketTransaction(bob,\n timeslotRepo.findBySerialNumber(2), 0.3, -31.0);\n accountingService.addMarketTransaction(bob,\n timeslotRepo.findBySerialNumber(3), 0.7, -43.0);\n accountingService.addMarketTransaction(jim,\n timeslotRepo.findBySerialNumber(2), 0.4, -35.0);\n accountingService.addMarketTransaction(jim,\n timeslotRepo.findBySerialNumber(2), -0.2, 20.0);\n assertEquals(5, accountingService.getPendingTransactions().size(), \"correct number in list\");\n accountingService.activate(timeService.getCurrentTime(), 3);\n // current timeslot is 4, should be 0 mkt posn\n assertEquals(0.0, accountingService.getCurrentMarketPosition (bob), 1e-6, \"correct position, bob, ts4\");\n assertEquals(0.0, accountingService.getCurrentMarketPosition (jim), 1e-6, \"correct position, jim, ts4\");\n // move forward to timeslot 5 and try again\n timeService.setCurrentTime(timeService.getCurrentTime().plus(TimeService.HOUR));\n assertEquals(0.8, accountingService.getCurrentMarketPosition (bob), 1e-6, \"correct position, bob, ts5\");\n assertEquals(0.2, accountingService.getCurrentMarketPosition (jim), 1e-6, \"correct position, jim, ts5\");\n // another hour and try again\n timeService.setCurrentTime(timeService.getCurrentTime().plus(TimeService.HOUR));\n assertEquals(0.7, accountingService.getCurrentMarketPosition (bob), 1e-6, \"correct position, bob, ts5\");\n assertEquals(0.0, accountingService.getCurrentMarketPosition (jim), 1e-6, \"correct position, jim, ts5\");\n }", "private boolean isHistoryEable() {\n String suid = SRMiddleManage.getInstance().getSuid();\n List<HistoryBean> confid_list_ = HistoryUtil.getInstance(mContext).getHistoryListBySuid(suid);\n if (confid_list_ == null || confid_list_.size() <= 0)\n return false;\n return true;\n }", "List<TradeInstruction> decideTrades(ConsolidatedSnapshot snapshot, double[] forecasts);", "private void botTrading(){\n if(game.isCardPositive(game.getHighestSharePriceStock())){\n int numShares = player.getFunds()/(game.getHighestSharePriceStock().getSharePrice()+3);\n player.getShares().set(game.getIndex(game.getHighestSharePriceStock()), player.getShares().get(game.getIndex(game.getHighestSharePriceStock())) + numShares);\n player.setFunds(-numShares*(game.getHighestSharePriceStock().getSharePrice()+3));\n }\n }", "private boolean checkPriceIndex(QuotationDetailsDTO[] details) {\n\t\tif (quotationDTO.getPriceIndex() != Float.parseFloat(txtPriceIndex.getText())) {\n\t\t\tfor (int i = 0; i < details.length; i++) {\n\t\t\t\tdetails[i].setBft(null);\n\t\t\t}\n\t\t\t//System.out.println(\"Price Index Changed\");\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t// round digit changed\n\t\tif (quotationDTO.getRoundOffDigits() != Integer.parseInt(txtRoundOffDigits.getText())) {\n\t\t\tfor (int i = 0; i < details.length; i++) {\n\t\t\t\tdetails[i].setBft(null);\n\t\t\t}\n\t\t\t//System.out.println(\"Price Index Changed\");\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\treturn true;\n\t}", "@Test\n\tpublic void test3() {\n\t\tHistoryStorage historyObj = HistoryStorage.getInstance();\n\t\tboolean result = historyObj.writeToHistory(HISTORY_TXT, EMPTY_STRING);\n\t\tassertTrue(result);\n\t}", "@Test\n public void testSaveOrUpdate() {\n // note these configurations should be used as time series are actually stored and retrieved from the source\n final ToolContext toolContext = StarlingTestUtils.getToolContext(\"/inmemory/marketdata-test.properties\");\n final LocalDate today = LocalDate.now();\n final MarketDataManager marketDataManager = new MarketDataManager(toolContext);\n // saves the data\n marketDataManager.saveOrUpdate(createTestMarketData(), today);\n final HistoricalTimeSeriesSource source = toolContext.getHistoricalTimeSeriesSource();\n HistoricalTimeSeries historicalTimeSeries1 = \n source.getHistoricalTimeSeries(ExternalId.of(TEST_SCHEME, \"AUDUSD\").toBundle(), DataSource.DEFAULT.getName(), \n DataProvider.DEFAULT.getName(), MARKET_VALUE);\n LocalDateDoubleTimeSeries timeSeries1 = historicalTimeSeries1.getTimeSeries();\n assertEquals(timeSeries1.size(), 1);\n assertEquals(timeSeries1.getValue(today), 1.8);\n HistoricalTimeSeries historicalTimeSeries2 = \n source.getHistoricalTimeSeries(ExternalId.of(TEST_SCHEME, \"NZDUSD\").toBundle(), DataSource.DEFAULT.getName(), \n DataProvider.DEFAULT.getName(), MARKET_VALUE);\n LocalDateDoubleTimeSeries timeSeries2 = historicalTimeSeries2.getTimeSeries();\n assertEquals(timeSeries2.size(), 1);\n assertEquals(timeSeries2.getValue(today), 2.2);\n HistoricalTimeSeries historicalTimeSeries3 = source.getHistoricalTimeSeries(ExternalId.of(TEST_SCHEME, \"GBPUSD\").toBundle(), \n DataSource.DEFAULT.getName(), DataProvider.DEFAULT.getName(), MARKET_VALUE);\n LocalDateDoubleTimeSeries timeSeries3 = historicalTimeSeries3.getTimeSeries();\n assertEquals(timeSeries3.size(), 1);\n assertEquals(timeSeries3.getValue(today), 1.5);\n HistoricalTimeSeries historicalTimeSeries4 = source.getHistoricalTimeSeries(ExternalId.of(TEST_SCHEME, \"GBP1Y\").toBundle(), \n DataSource.DEFAULT.getName(), DataProvider.DEFAULT.getName(), MARKET_VALUE);\n LocalDateDoubleTimeSeries timeSeries4 = historicalTimeSeries4.getTimeSeries();\n assertEquals(timeSeries4.size(), 2);\n assertEquals(timeSeries4.getValue(LocalDate.of(2016, 1, 1)), 0.01);\n assertEquals(timeSeries4.getValue(LocalDate.of(2016, 1, 2)), 0.02);\n // updates the data for some of the series\n final MarketDataSet updatedData = MarketDataSet.empty();\n updatedData.put(MarketDataKey.of(ExternalId.of(TEST_SCHEME, \"AUDUSD\").toBundle(), DataField.of(MarketDataRequirementNames.MARKET_VALUE)), 1.9);\n updatedData.put(MarketDataKey.of(ExternalId.of(TEST_SCHEME, \"GBP1Y\").toBundle(), DataField.of(MarketDataRequirementNames.MARKET_VALUE)),\n ImmutableLocalDateDoubleTimeSeries.builder().putAll(new LocalDate[] {LocalDate.of(2016, 1, 1), LocalDate.of(2016, 1, 2)}, \n new double[] {0.01, 0.03}).build());\n marketDataManager.saveOrUpdate(updatedData, today);\n historicalTimeSeries1 = source.getHistoricalTimeSeries(ExternalId.of(TEST_SCHEME, \"AUDUSD\").toBundle(), DataSource.DEFAULT.getName(), \n DataProvider.DEFAULT.getName(), MARKET_VALUE);\n timeSeries1 = historicalTimeSeries1.getTimeSeries();\n assertEquals(timeSeries1.size(), 1);\n assertEquals(timeSeries1.getValue(today), 1.9);\n historicalTimeSeries2 = source.getHistoricalTimeSeries(ExternalId.of(TEST_SCHEME, \"NZDUSD\").toBundle(), DataSource.DEFAULT.getName(), \n DataProvider.DEFAULT.getName(), MARKET_VALUE);\n timeSeries2 = historicalTimeSeries2.getTimeSeries();\n assertEquals(timeSeries2.size(), 1);\n assertEquals(timeSeries2.getValue(today), 2.2);\n historicalTimeSeries3 = source.getHistoricalTimeSeries(ExternalId.of(TEST_SCHEME, \"GBPUSD\").toBundle(), DataSource.DEFAULT.getName(), \n DataProvider.DEFAULT.getName(), MARKET_VALUE);\n timeSeries3 = historicalTimeSeries3.getTimeSeries();\n assertEquals(timeSeries3.size(), 1);\n assertEquals(timeSeries3.getValue(today), 1.5);\n historicalTimeSeries4 = source.getHistoricalTimeSeries(ExternalId.of(TEST_SCHEME, \"GBP1Y\").toBundle(), DataSource.DEFAULT.getName(), \n DataProvider.DEFAULT.getName(), MARKET_VALUE);\n timeSeries4 = historicalTimeSeries4.getTimeSeries();\n assertEquals(timeSeries4.size(), 2);\n assertEquals(timeSeries4.getValue(LocalDate.of(2016, 1, 1)), 0.01);\n assertEquals(timeSeries4.getValue(LocalDate.of(2016, 1, 2)), 0.03);\n }", "@Test\n public void testGetRequiredDataWithTimeSeries() {\n // the always available historical time series resolver in this configuration means that the graph will build\n final ToolContext toolContext = StarlingTestUtils.getToolContext(\"/inmemory/marketdata-test.properties\");\n final ExternalId futureTicker = ExternalSchemes.syntheticSecurityId(\"ABH6 Index\");\n final ExternalId tradeId = ExternalId.of(\"TEST_ID\", \"FUTURE\");\n final PortfolioKey portfolioKey = createSingleFuturePortfolio(toolContext, futureTicker, tradeId);\n final ViewDefinition viewDefinition = createSimpleFutureView(toolContext, portfolioKey.getUniqueId());\n final FunctionConfigurationDefinition functionDefinition = new FunctionConfigurationDefinition(\"TEST_FUNCTIONS\", Arrays.asList(\"TEST_FUNCTIONS\"),\n Arrays.asList(\n new StaticFunctionConfiguration(SimpleFuturePresentValueFunction.class.getName()),\n new StaticFunctionConfiguration(HistoricalTimeSeriesFunction.class.getName())),\n Collections.<ParameterizedFunctionConfiguration>emptyList());\n ConfigMasterUtils.storeByName(toolContext.getConfigMaster(), ConfigItem.of(functionDefinition, functionDefinition.getName(), \n FunctionConfigurationDefinition.class));\n final ViewKey viewKey = ViewKey.of(viewDefinition.getName(), viewDefinition.getUniqueId());\n final ZonedDateTime today = ZonedDateTime.now();\n final Instant now = Instant.from(today);\n final MarketDataManager marketDataManager = new MarketDataManager(toolContext);\n final MarketDataInfo requiredData = marketDataManager.getRequiredDataForView(viewKey, now);\n // test the scalar data (i.e. the live future price)\n assertEquals(requiredData.getScalars().size(), 1);\n final Map.Entry<MarketDataKey, ? extends MarketDataMetaData> scalarEntry = requiredData.getScalars().entrySet().iterator().next();\n final MarketDataKey scalarKey = scalarEntry.getKey();\n final ExternalIdBundle scalarIdBundle = scalarKey.getExternalIdBundle();\n // two ids in request - the future ticker referenced in the security and the trade id\n assertEquals(scalarIdBundle.size(), 2);\n assertEquals(scalarIdBundle.getExternalIds(ExternalSchemes.OG_SYNTHETIC_TICKER).size(), 1);\n assertEquals(scalarIdBundle.getExternalIds(ExternalSchemes.OG_SYNTHETIC_TICKER).iterator().next(), futureTicker);\n assertEquals(scalarIdBundle.getExternalIds(tradeId.getScheme()).size(), 1);\n assertEquals(scalarIdBundle.getExternalIds(tradeId.getScheme()).iterator().next(), tradeId);\n // test the time series data (i.e. the historical prices of the future)\n assertEquals(requiredData.getTimeSeries().size(), 1);\n final Map.Entry<MarketDataKey, ? extends MarketDataMetaData> tsEntry = requiredData.getTimeSeries().entrySet().iterator().next();\n final MarketDataKey tsKey = tsEntry.getKey();\n final ExternalIdBundle tsIdBundle = tsKey.getExternalIdBundle();\n // two ids in request - the future ticker referenced in the security and the trade id\n assertEquals(tsIdBundle.size(), 2);\n assertEquals(tsIdBundle.getExternalIds(ExternalSchemes.OG_SYNTHETIC_TICKER).size(), 1);\n assertEquals(tsIdBundle.getExternalIds(ExternalSchemes.OG_SYNTHETIC_TICKER).iterator().next(), futureTicker);\n assertEquals(tsIdBundle.getExternalIds(tradeId.getScheme()).size(), 1);\n assertEquals(tsIdBundle.getExternalIds(tradeId.getScheme()).iterator().next(), tradeId);\n }", "@Test\n\tpublic void test7() throws IOException {\n\t\tboolean switch1 = false;\n\t\tHistoryStorage store = HistoryStorage.getInstance();\n\t\tstore.writeToHistory(HISTORY_TXT, LINE_1);\n\t\tstore.writeToHistory(HISTORY_TXT, LINE_2);\n\n\t\tString result = store.readFromHistory(HISTORY_TXT);\n\t\tif (result.split(\"\\n\")[1].equals(LINE_1)\n\t\t\t\t&& result.split(\"\\n\")[0].equals(LINE_2)) {\n\t\t\tswitch1 = true;\n\t\t}\n\t\tassertTrue(switch1);\n\t}", "@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 }", "private boolean checkIfTransferHasBeenLongerThanAWeek(String lastTimeStamp, String currentTimeStamp) {\n // should be in same format now\n\n String[] previousDate = getDateFormatToCompare(lastTimeStamp);\n String[] currentDate = getDateFormatToCompare(currentTimeStamp);\n\n //2020-01-01T12:34:56.000Z\n //2020-01-07T13:14:52.777Z\n\n LOGGER.debug(\"Check for over week since last transfer default false\");\n return false;\n }", "private boolean validate(final Context ctx, final NumberMgmtHistory history)\r\n {\r\n return history != null && history.getTerminalId() != null && history.getTerminalId().length() > 0;\r\n }", "boolean splitTradingEmployed();", "private boolean checkExpression(String expression, boolean history) {\n try {\n Statement stat = conn.createStatement();\n ResultSet rs;\n if(history)\n rs = stat.executeQuery(\"SELECT * FROM history WHERE expression = '\" + expression + \"';\");\n else\n rs = stat.executeQuery(\"SELECT * FROM expressions WHERE expression = '\" + expression + \"';\");\n return rs.next();\n } catch (SQLException e) {\n System.err.println(e.getClass().getName() + \": \" + e.getMessage());\n System.exit(0);\n return false;\n }\n }", "boolean hasTotalBet();", "boolean hasTotalBet();", "private void checkWholesaleMarket (WholesaleMarket market)\n {\n int offset =\n market.getTimeslotSerialNumber()\n - visualizerBean.getCurrentTimeslotSerialNumber();\n if (offset == 0) {\n market.close();\n // update model:\n wholesaleService.addTradedQuantityMWh(market.getTotalTradedQuantityMWh());\n // let wholesaleMarket contribute to global charts:\n WholesaleSnapshot lastSnapshot =\n market.getLastWholesaleSnapshotWithClearing();\n if (lastSnapshot != null) {\n WholesaleServiceJSON json = wholesaleService.getJson();\n try {\n json.getGlobalLastClearingPrices()\n .put(new JSONArray().put(lastSnapshot.getTimeslot()\n .getStartInstant()\n .getMillis())\n .put(lastSnapshot.getClearedTrade()\n .getExecutionPrice()));\n json.getGlobalLastClearingVolumes()\n .put(new JSONArray().put(lastSnapshot.getTimeslot()\n .getStartInstant()\n .getMillis())\n .put(lastSnapshot.getClearedTrade()\n .getExecutionMWh()));\n\n json.getGlobalTotalClearingVolumes()\n .put(new JSONArray().put(lastSnapshot.getTimeslot()\n .getStartInstant()\n .getMillis())\n .put(market.getTotalTradedQuantityMWh()));\n }\n catch (JSONException e) {\n e.printStackTrace();\n }\n }\n }\n }", "if (payDateTime == adhocTicket.getPaidDateTime()) {\n System.out.println(\"Paid Date Time is passed\");\n }", "private void checkOcspResponseFresh(SingleResp resp) throws OCSPException\n {\n\n Date curDate = Calendar.getInstance().getTime();\n\n Date thisUpdate = resp.getThisUpdate();\n if (thisUpdate == null)\n {\n throw new OCSPException(\"OCSP: thisUpdate field is missing in response (RFC 5019 2.2.4.)\");\n }\n Date nextUpdate = resp.getNextUpdate();\n if (nextUpdate == null)\n {\n throw new OCSPException(\"OCSP: nextUpdate field is missing in response (RFC 5019 2.2.4.)\");\n }\n if (curDate.compareTo(thisUpdate) < 0)\n {\n LOG.error(curDate + \" < \" + thisUpdate);\n throw new OCSPException(\"OCSP: current date < thisUpdate field (RFC 5019 2.2.4.)\");\n }\n if (curDate.compareTo(nextUpdate) > 0)\n {\n LOG.error(curDate + \" > \" + nextUpdate);\n throw new OCSPException(\"OCSP: current date > nextUpdate field (RFC 5019 2.2.4.)\");\n }\n LOG.info(\"OCSP response is fresh\");\n }", "@Override\r\n\tpublic boolean contiene(Alarma alarma_actual) {\r\n\r\n\t\ttry {\r\n\t\t\tint tiempo_transcurrido = diferenciaEntreFechas(alarma_actual);\r\n\r\n\t\t\tif (tiempo_transcurrido >= getInicio())\r\n\t\t\t\treturn true;\r\n\t\t} catch (NullPointerException excepcion) {\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "public static void main(String[] args) {\n\n\t\tList<Trade> tradeList = new ArrayList<Trade>();\n\t\ttradeList.add(new Trade(\"ABASUS\", \"B\", 2.0, \"KRW\", \"01/01/2017\", \"03/02/2017\", 1, 10.0, 0.0, false));\n\t\ttradeList.add(new Trade(\"ABASUS\", \"B\", 1.0, \"SAR\", \"01/01/2017\", \"03/02/2017\", 2, 10.0, 0.0, false));\n\t\ttradeList.add(new Trade(\"ABASUS\", \"S\", 1.0, \"JPY\", \"01/01/2017\", \"02/02/2017\", 3, 10.0, 0.0, false));\n\t\ttradeList.add(new Trade(\"DIGECT\", \"B\", 1.0, \"AED\", \"01/02/2017\", \"11/02/2017\", 4, 20.0, 0.0, false));\n\t\ttradeList.add(new Trade(\"TECHNO\", \"B\", 2.0, \"GBP\", \"01/02/2017\", \"11/02/2017\", 1, 110.0, 0.0, false));\n\t\ttradeList.add(new Trade(\"ALPHA\", \"B\", 1.0, \"SAA\", \"01/02/2017\", \"08/03/2017\", 2, 30.0, 0.0, false));\n\t\ttradeList.add(new Trade(\"FOO\", \"S\", 1.0, \"CAD\", \"01/02/2017\", \"09/02/2017\", 3, 40.0, 0.0, false));\n\t\ttradeList.add(new Trade(\"COPE\", \"B\", 1.0, \"CHF\", \"01/02/2017\", \"09/02/2017\", 4, 50.0, 0.0, false));\n\t\ttradeList.add(new Trade(\"BETA\", \"B\", 2.0, \"SAR\", \"01/02/2017\", \"04/02/2017\", 1, 60.0, 0.0, false));\n\t\ttradeList.add(new Trade(\"GAMMA\", \"B\", 1.0, \"JPY\", \"01/02/2017\", \"10/02/2017\", 2, 70.0, 0.0, false));\n\t\ttradeList.add(new Trade(\"HUSH\", \"S\", 1.0, \"SAA\", \"01/02/2017\", \"18/02/2017\", 3, 80.0, 0.0, false));\n\t\ttradeList.add(new Trade(\"BATA\", \"S\", 1.0, \"AED\", \"01/02/2017\", \"18/02/2017\", 4, 90.0, 0.0, false));\n\t\t\n\t\t/* Edit dates based on currency***/\n\t\tfor (int i = 0; i < tradeList.size(); i++) {\n\n\t\t\tString date = tradeList.get(i).getSettlementDate();\n\t\t\tString currency = tradeList.get(i).getCurrency();\n\t\t\tString newDate = setDate(date, currency);\n\t\t\ttradeList.get(i).setSettlementDate(newDate);\n\n\t\t}\t\t\n\t\t\n\n\n\t\t/* for Lopp to calculate USD total amount of each entry */\n\t\tdouble USDamount;\n\n\t\tfor (int i = 0; i < tradeList.size(); i++) {\n\t\t\tUSDamount = (tradeList.get(i).getAgreedFx()) * (tradeList.get(i).getUnits())\n\t\t\t\t\t* (tradeList.get(i).getPricePerUnit());\n\t\t\ttradeList.get(i).setUSDSettlementAmout(USDamount);\n\n\t\t}\n\n\t\t/* New arrayList to extract data from main arrayList */\n\n\t\tList<Trade> amountList = new ArrayList<Trade>();\n\n\t\tfor (int i = 0; i < tradeList.size(); i++) {\n\t\t\tamountList.add(new Trade((tradeList.get(i).getEntity()), (tradeList.get(i).getBuySell()),\n\t\t\t\t\t(tradeList.get(i).getSettlementDate()), (tradeList.get(i).getUSDSettlementAmout()),\n\t\t\t\t\t(tradeList.get(i).getProcessFieldFlag())));\n\n\t\t}\n\n\t\tList<Trade> amountTotalList = new ArrayList<Trade>();// New list to get\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// report based\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// on incoming\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// and outgoing\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// amount\n\n\t\tfor (int i = 0; i < amountList.size(); i++) {\n\t\t\tint indexValue = 0;\n\t\t\tentityValue = amountList.get(i).getEntity();\n\t\t\tsettledate = amountList.get(i).getSettlementDate();\n\t\t\tbuysell = amountList.get(i).getBuySell();\n\t\t\tflag = amountList.get(i).getProcessFieldFlag();\n\t\t\t\n\t\t\t/* Condition to calculate total sell or buy amount based on entity and settlement date */\n\t\t\t\n\t\t\tif (buysell == \"B\") {\n\t\t\t\tbuyAmount = amountList.get(i).getUSDSettlementAmout();\n\t\t\t\tsellAmount = 0.0;\n\t\t\t} else {\n\t\t\t\tsellAmount = amountList.get(i).getUSDSettlementAmout();\n\t\t\t\tbuyAmount = 0.0;\n\t\t\t}\n\t\t\t\n\t\t\t/*If flag is true record is processed*/\n\t\t\tif (flag == false) {\n\n\t\t\t\tfor (int j = i + 1; j < amountList.size() - 1; j++) {\n\t\t\t\t\tif ((entityValue.equals(amountList.get(j).getEntity()))\n\t\t\t\t\t\t\t&& (settledate.equals(amountList.get(j).getSettlementDate()))) {\n\n\t\t\t\t\t\tif ((amountList.get(j).getBuySell()) == \"B\") {\n\t\t\t\t\t\t\tamountList.get(i).setProcessFieldFlag(true);\n\t\t\t\t\t\t\tamountList.get(j).setProcessFieldFlag(true);\n\n\t\t\t\t\t\t\tbuyAmount = buyAmount + amountList.get(j).getUSDSettlementAmout();\n\t\t\t\t\t\t} else if ((amountList.get(j).getBuySell()) == \"S\") {\n\t\t\t\t\t\t\tamountList.get(i).setProcessFieldFlag(true);\n\n\t\t\t\t\t\t\tamountList.get(j).setProcessFieldFlag(true);\n\t\t\t\t\t\t\tsellAmount = sellAmount + amountList.get(j).getUSDSettlementAmout();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n /* Create new arraylist to store the total buy or sell amount on */\n\t\t\t\tif (buyAmount != 0.0) {\n\t\t\t\t\tamountTotalList.add(indexValue, new Trade(entityValue, buysell, settledate, buyAmount));\n\t\t\t\t\tindexValue++;\n\t\t\t\t} else if (sellAmount != 0.0) {\n\t\t\t\t\tamountTotalList.add(indexValue, new Trade(entityValue, buysell, settledate, sellAmount));\n\t\t\t\t\tindexValue++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tamountTotalList\n\t\t\t\t.sort(Comparator.comparing(Trade::getSettlementDate).thenComparing(Trade::getTotalSettlementAmount));\n\t\t\n\t\t\n\t\t/* reverse the order to get the hightest amount on top row of produced record */\n\n\t\tCollections.reverse(amountTotalList);\n\t\tSystem.out.println(\"\\n\");\n\t\tSystem.out.println(\"Entity\"+\"\\t\"+\"BuySell\"+\"\\t\"+\"SettlementDate\"+\"\\t\"+\"TotalUSEDAMOUNT\"+\"\\t\");\n\t\tfor (int i = 0; i < amountTotalList.size(); i++) {\n\t\n\t\t\tSystem.out.println( amountTotalList.get(i).getEntity() + \"\\t\" \n\t\t\t\t\t+ amountTotalList.get(i).getBuySell() + \"\\t\" \n\t\t\t\t\t+ amountTotalList.get(i).getSettlementDate() + \"\\t\" + \n\t\t\t\t\t+ amountTotalList.get(i).getTotalSettlementAmount());\n\t\t}\n\t\t}", "public void checkAddTrack() {\n this.trackList.sort();\n int time = this.timeTrankiManager.getTrackTimeOfNext();\n Date dateCorruent = this.timeTrankiManager.getTime();\n\n if (time > 0) {\n Track trackIndicated = this.trackList.getTracklessTime(time);\n if (trackIndicated != null) {\n this.trackListFinal.addTrack(dateCorruent, trackIndicated);\n this.trackList.removeTrack(trackIndicated);\n this.timeTrankiManager.addMinute(trackIndicated.getTime());\n } else {\n this.trackListFinal.addTrack(dateCorruent, \"Networking Event\");\n this.trackListFinal.addEmpityEspace();\n resetTimeTrackingManager();\n }\n \n } else if (time == -1) {\n this.trackListFinal.addTrack(dateCorruent, \"Lunch\");\n this.timeTrankiManager.addMinute(60);\n } else if (time == -2) {\n this.trackListFinal.addTrack(dateCorruent, \"Networking Event\");\n this.trackListFinal.addEmpityEspace();\n resetTimeTrackingManager();\n } else {\n this.trackListFinal.addTrack(dateCorruent, \"Networking Event\");\n resetTimeTrackingManager();\n }\n }", "@Override\r\n\tpublic boolean checkIfOnTraineeship() {\n\t\treturn false;\r\n\t}", "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 }", "@Test\n void checkBidAddedAfterSubscribeBidding(){\n tradingSystem.subscriberBidding(NofetID,NconnID,storeID,1,2950,1);\n boolean added=false;\n for (Bid b:store.getBids()\n ) {\n if(b.getProductID()==1&&b.getUserID()==NofetID&&b.getPrice()==2950&&b.getQuantity()==1){\n added=true;\n }\n }\n assertTrue(added);\n }", "boolean hasTradeCurrency();", "public boolean updateBill(Bill bill){\n\t\tTraveller trav = bill.getItems().traveller();\n\t\twhile(trav.hasNext()){\n\t\t\tItem item = (Item) trav.next();\n\t\t\tString selectQuery = \"select qty from stock where item_name = ? and expire_date = ? and category = ?\"\n\t\t\t\t\t+ \" and price = ?;\";\n\t\t\ttry(PreparedStatement preStmt = connection.prepareStatement(selectQuery)){\n\t\t\t\tpreStmt.setString(1, item.getName());\n\t\t\t\tpreStmt.setDate(2, item.getExpireDate());\n\t\t\t\tpreStmt.setString(3, item.getCategory());\n\t\t\t\tpreStmt.setFloat(4, item.getPrice());\n\t\t\t\tResultSet result= preStmt.executeQuery(selectQuery);\n\t\t\t\tif(result.first()){\n\t\t\t\t\tint oldQty = result.getInt(1);\n\t\t\t\t\tItem itemClone = item.clone();\n\t\t\t\t\titemClone.setQuantity(oldQty - item.getQuantity());\n\t\t\t\t\tupdateDB(itemClone);\n\t\t\t\t}else {\n\t\t\t\t\tSystem.out.println(\"No item found on stock\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}catch(SQLException exp){\n\t\t\t\tJOptionPane.showMessageDialog(null, \"Error in Stock table processing: \"+exp.getMessage());\n\t\t\t\texp.printStackTrace();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "public boolean trade(Type type, int[] trade) {\n \t\t// validate trade\n \t\tif (!canTrade(type, trade))\n \t\t\treturn false;\n \n \t\t// check for 2:1 trader\n \t\tfor (int i = 0; i < trade.length; i++) {\n \t\t\tif (Hexagon.TYPES[i] == Type.DESERT)\n \t\t\t\tcontinue;\n \n \t\t\t// check for specific 2:1 trader\n \t\t\tif (hasTrader(Hexagon.TYPES[i])\n \t\t\t\t\t&& getResources(Hexagon.TYPES[i]) >= 2 && trade[i] >= 2) {\n \t\t\t\taddResources(type, 1);\n \t\t\t\tuseResources(Hexagon.TYPES[i], 2);\n \t\t\t\treturn true;\n \t\t\t}\n \t\t}\n \n \t\t// normal 4:1 or 3:1 trade\n \t\tint value = tradeValue;\n \t\tfor (int i = 0; i < trade.length; i++) {\n \t\t\tif (Hexagon.TYPES[i] == Type.DESERT)\n \t\t\t\tcontinue;\n \n \t\t\tint number = getResources(Hexagon.TYPES[i]);\n \n \t\t\t// deduct from number of resource cards needed\n \t\t\tif (trade[i] >= value && number >= value) {\n \t\t\t\tuseResources(Hexagon.TYPES[i], value);\n \t\t\t\taddResources(type, 1);\n \n \t\t\t\tappendAction(R.string.player_traded_for, Hexagon\n \t\t\t\t\t\t.getTypeStringResource(type));\n \n \t\t\t\tfor (int j = 0; j < value; j++) {\n \t\t\t\t\tappendAction(R.string.player_traded_away, Hexagon\n \t\t\t\t\t\t\t.getTypeStringResource(Hexagon.TYPES[i]));\n \t\t\t\t}\n \n \t\t\t\treturn true;\n \t\t\t} else if (trade[i] > 0 && number >= trade[i]) {\n \t\t\t\tuseResources(Hexagon.TYPES[i], trade[i]);\n \t\t\t\tvalue -= trade[i];\n \t\t\t}\n \t\t}\n \n \t\t// this shouldn't happen\n \t\treturn false;\n \t}", "private void readHistoricalData() {\n /*\n r4 = this;\n r1 = r4.mInstanceLock;\n monitor-enter(r1);\n r0 = r4.mCanReadHistoricalData;\t Catch:{ all -> 0x0028 }\n if (r0 == 0) goto L_0x000b;\n L_0x0007:\n r0 = r4.mHistoricalRecordsChanged;\t Catch:{ all -> 0x0028 }\n if (r0 != 0) goto L_0x000d;\n L_0x000b:\n monitor-exit(r1);\t Catch:{ all -> 0x0028 }\n L_0x000c:\n return;\n L_0x000d:\n r0 = 0;\n r4.mCanReadHistoricalData = r0;\t Catch:{ all -> 0x0028 }\n r0 = 1;\n r4.mReadShareHistoryCalled = r0;\t Catch:{ all -> 0x0028 }\n r0 = r4.mHistoryFileName;\t Catch:{ all -> 0x0028 }\n r0 = android.text.TextUtils.isEmpty(r0);\t Catch:{ all -> 0x0028 }\n if (r0 != 0) goto L_0x0026;\n L_0x001b:\n r0 = SERIAL_EXECUTOR;\t Catch:{ all -> 0x0028 }\n r2 = new com.actionbarsherlock.widget.ActivityChooserModel$HistoryLoader;\t Catch:{ all -> 0x0028 }\n r3 = 0;\n r2.<init>();\t Catch:{ all -> 0x0028 }\n r0.execute(r2);\t Catch:{ all -> 0x0028 }\n L_0x0026:\n monitor-exit(r1);\t Catch:{ all -> 0x0028 }\n goto L_0x000c;\n L_0x0028:\n r0 = move-exception;\n monitor-exit(r1);\t Catch:{ all -> 0x0028 }\n throw r0;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.actionbarsherlock.widget.ActivityChooserModel.readHistoricalData():void\");\n }", "@Test\r\n\tpublic void testGetCondition35() {\n\r\n\t\tCancerHistory h1 = new CancerHistory(\"NHI123\", \"eref1\",\r\n\t\t\t\t(short) Util.FATHER, \"\", true, (short) 50, false, false,\r\n\t\t\t\t(short) -1, false, (short) -1, \"\");\r\n\r\n\t\tCancerHistory[] td1 = { h1 };\r\n\t\tmanager.setHistories(td1);\r\n\r\n\t\tassertEquals(\"# condition 3-5 (run 1) \", false,\r\n\t\t\t\triskCalculator.getCondition35());\r\n\r\n\t\t// run 2.\r\n\t\t// father with CC, diagnosed at 49 ==> true\r\n\r\n\t\tCancerHistory h2 = new CancerHistory(\"NHI123\", \"eref1\",\r\n\t\t\t\t(short) Util.FATHER, \"\", true, (short) 49, false, false,\r\n\t\t\t\t(short) -1, false, (short) -1, \"\");\r\n\r\n\t\tCancerHistory[] td2 = { h2 };\r\n\t\tmanager.setHistories(td2);\r\n\r\n\t\tassertEquals(\"# condition 3-5 (run 2) \", true,\r\n\t\t\t\triskCalculator.getCondition35());\r\n\t\t// risk category is 2, because condition 35 has been removed.\r\n\t\tassertEquals(\" run 2\",\r\n\t\t\t\t2 , riskCalculator.calculateRisk());\r\n\r\n\t\t// run 3.\r\n\t\t// grandfather with CC, diagnosed at 49 ==> false, because\r\n\t\t// it is a secondary relative\r\n\r\n\t\tCancerHistory h3 = new CancerHistory(\"NHI123\", \"eref1\",\r\n\t\t\t\t(short) Util.PAT_GRANDFATHER, \"\", true, (short) 49, false,\r\n\t\t\t\tfalse, (short) -1, false, (short) -1, \"\");\r\n\r\n\t\tCancerHistory[] td3 = { h3 };\r\n\t\tmanager.setHistories(td3);\r\n\r\n\t\tassertEquals(\"# condition 3-5 (run 3) \", false,\r\n\t\t\t\triskCalculator.getCondition35());\r\n\r\n\t\t\r\n\t\t// run 4.\r\n\t\t// father and grandfather with CC, diagnosed at 49 ==> true\r\n\r\n\t\tCancerHistory h4 = new CancerHistory(\"NHI123\", \"eref1\",\r\n\t\t\t\t(short) Util.PAT_GRANDFATHER, \"\", true, (short) 49, false,\r\n\t\t\t\tfalse, (short) -1, false, (short) -1, \"\");\r\n\t\tCancerHistory h5 = new CancerHistory(\"NHI123\", \"eref1\",\r\n\t\t\t\t(short) Util.FATHER, \"\", true, (short) 49, false,\r\n\t\t\t\tfalse, (short) -1, false, (short) -1, \"\");\r\n\r\n\t\t\r\n\t\tCancerHistory[] td4 = { h4, h5 };\r\n\t\tmanager.setHistories(td4);\r\n\r\n\t\tassertEquals(\"# condition 3-5 (run 4) \", true,\r\n\t\t\t\triskCalculator.getCondition35());\r\n\t\tassertEquals(\" run 4 \",\r\n\t\t\t\t3 , riskCalculator.calculateRisk());\r\n\t}", "private void chkLTMST(){\n\t\ttry{\n\t\t\tM_strSQLQRY = \"Select count(*) from pr_ltmst\";\n\t\t\tM_strSQLQRY += \" where lt_CMPCD = '\"+cl_dat.M_strCMPCD_pbst+\"' and lt_prdtp = '\"+strPRDTP+\"'\";\n\t\t\tM_strSQLQRY += \" and lt_lotno = '\"+strLOTNO+\"'\";\n\t\t\tM_strSQLQRY += \" and lt_rclno = '\"+strRCLNO+\"'\";\n\t\t\t//System.out.println(\"select prltmst :\"+M_strSQLQRY);\n\t\t\tif(cl_dat.getRECCNT(M_strSQLQRY) > 0)\n\t\t\t\tupdLTMST();\n\t\t\telse\n\t\t\t{\n\t\t\t\tsetMSG(\"Record does not exist in PR_LTMST\",'E');\n\t\t\t\t//cl_dat.M_flgLCUPD_pbst = false;\n\t\t\t}\n\t\t}catch(Exception L_EX)\n\t\t{\n\t\t\tsetMSG(L_EX,\"chkLTMST\");\n\t\t}\n\t}", "public void recordLastTrade(QuoteAndSize lastTrade_, MarketDataSession marketDataSession_);", "@Test(enabled = true)\n\tpublic void viewTravelHistoryUnregistredCustomer() throws Exception {\n\n\t\t// create travel history via soap call\n\t\tSOAPClientSAAJ sClient = new SOAPClientSAAJ();\n\t\tCreditCardNumberGenerator ccGenerator = new CreditCardNumberGenerator();\n\t\tString validCCNumber = ccGenerator.generate(\"4\", 16);\n\t\tString accountID = sClient.travelHistorySOAPCall(validCCNumber);\n\t\tSystem.out.println(\"cc number being used is \" + validCCNumber);\n\t\tSystem.out.println(\"account id being returned is \" + accountID);\n\n\t\t// check cmc for travel history based on cc\n\t\t// takes around 6 minutes for travel history to show on cmc\n\t\tUtils.waitTime(360000);\n\n\t\tcoreTest.signIn(driver);\n\t\tTokenSearchPage tPage = getTokenSearchPage();\n\t\ttPage.selectTokenType(driver, TOKEN_TYPE);\n\t\ttPage.selectSubsystem(driver, SUBSYSTEM);\n\t\ttPage.enterBankNumber(driver, validCCNumber);\n\t\ttPage.selectExpMonth(driver);\n\t\ttPage.selectExpYear(driver);\n\t\ttPage.clickSearchToken(driver);\n\t\ttPage.clickViewDetails(driver);\n\t\ttPage.clickTravelHistory(driver);\n\n\t\tTravelHistoryPage tvPage = new TravelHistoryPage(driver);\n\t\tAssert.assertEquals(tvPage.getLocation(driver), LOCATION_UC);\n\t\tAssert.assertEquals(tvPage.getTravelMode(driver), TRAVEL_MODE);\n\t\tAssert.assertEquals(tvPage.getToken(driver), TOKEN);\n\t\tAssert.assertEquals(tvPage.getFare(driver), FARE);\n\t\tAssert.assertEquals(tvPage.getUnpaidFare(driver), UNPAID_FARE);\n\n\t\t// check travel history details\n\t\ttvPage.clickTiming(driver);\n\t\tTravelHistoryDetailPage tvdPage = new TravelHistoryDetailPage(driver);\n\t\tAssert.assertEquals(tvdPage.getLocation(driver), LOCATION_UC);\n\t\tAssert.assertEquals(tvdPage.getDevice(driver), DEVICE);\n\t\tAssert.assertEquals(tvdPage.getOperator(driver), OPERATOR);\n\t\tAssert.assertEquals(tvdPage.getTransactionStatus(driver), TRANSACTION_STATUS);\n\t\tAssert.assertEquals(tvdPage.getFare(driver), FARE);\n\t\tAssert.assertEquals(tvdPage.getSource(driver), SOURCE_UC);\n\t\ttvdPage.clickClose(driver);\n\n\t\tLog.info(\"viewTravelHistoryUnregistredCustomer\");\n\t\tdriver.close();\n\n\t}", "public boolean hasPassed(final long delta){\n return stamp + delta <= System.currentTimeMillis();\n }", "private void givenExchangeRateExistsForABaseAndDate() {\n }", "public boolean checkEmpty(){\n if (history.empty() || historyValues.empty()){\n return true;\n }\n else {\n return false;\n }\n }", "public String getTravelRequisitionHistoryList() {\n\t\t// default method invoked when this action is called - struts framework rule\n\t\tif (logger.isDebugEnabled())\n\t\t\tlogger.debug(\"inside expense history action\");\n\t\tString status = \"\";\n\t\ttreqMaster = (TravelReqMasters) session.get(IConstants.TRAVEL_REQUISITION_SESSION_DATA);\n\n\t\tif (treqMaster == null) {\n\t\t\tsuper.setJsonResponse(jsonParser.toJson(treqHistoryList));\n\t\t} else {\n\t\t\ttreqHistoryList = treqService.getTravelRequisitionHistory(treqMaster.getTreqeIdentifier().getTreqeIdentifier());\n\t\t\tsuper.setJsonResponse(jsonParser.toJson(treqHistoryList));\n\t\t\tstatus = treqMaster.getStatus();\n\t\t\tString nextActionCode = null;\n\t\t\tnextActionCode = treqService.getNextActionCode(treqMaster);\n\t\t\tif (nextActionCode != null) {\n\t\t\t\tsetStatus(treqService.getRemainingApprovalPaths(\n\t\t\t\t\t\ttreqMaster.getTreqmIdentifier(), getUserSubject()));\n\t\t\t}\t\t\t\n\t\t\telse\n\t\t\t\tif (status != null) {\n\t\t\t\t\tif (status.equals(IConstants.APPROVED)\n\t\t\t\t\t\t\t|| status.equals(IConstants.EXTRACTED)\n\t\t\t\t\t\t\t|| status.equals(IConstants.HOURS_ADJUSTMENT_SENT)) {\n\t\t\t\t\t\tsetStatus(IConstants.HISTORYMSG_APPROVED_EXTRACTED_HOURS_ADJUSTMENT_SENT);\n\t\t\t\t\t} else if (status.equals(IConstants.PROCESSED)) {\n\t\t\t\t\t\tsetStatus(IConstants.HISTORYMSG_PROCESSED);\n\t\t\t\t\t} else if (status.equals(IConstants.REJECTED)) {\n\t\t\t\t\t\tsetStatus(IConstants.HISTORYMSG_REJECTED);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tsetStatus(IConstants.HISTORYMSG_NEEDSTOBESUBMITTED);\n\t\t\t\t}\t\n\t\t}\n\t\t\n\t\treturn IConstants.SUCCESS;\n\t}", "@Test\n public void equals_SameBuyQuery_Test() {\n Assert.assertTrue(bq1.equals(bq0));\n }", "@Ignore\n @Test\n public void testWhenALoanIsRepaidEarlyAndThenAdjustedThatTheLoanSummaryAndSchedulesDetailsAreTheSameBeforeAndAfter()\n throws Exception {\n // relates to mifos-1986\n new DateTimeService().setCurrentDateTimeFixed(date(2010, 10, 13));\n\n loan = createLoan();\n Money initialOriginalPrincipal = loan.getLoanSummary().getOriginalPrincipal();\n Money initialOriginalInterest = loan.getLoanSummary().getOriginalInterest();\n Money initialOriginalFees = loan.getLoanSummary().getOriginalFees();\n Money initialPrincipalPaid = loan.getLoanSummary().getPrincipalPaid();\n Money initialInterestPaid = loan.getLoanSummary().getInterestPaid();\n Money initialFeesPaid = loan.getLoanSummary().getFeesPaid();\n\n // pay 3 installments\n makePayment(loan, \"333.0\");\n StaticHibernateUtil.flushAndClearSession();\n loan = (LoanBO) legacyAccountDao.getAccount(loan.getAccountId());\n loan.updateDetails(TestUtils.makeUserWithLocales());\n assertThat(loan.getLoanSummary().getOriginalPrincipal(), is(initialOriginalPrincipal));\n assertThat(loan.getLoanSummary().getOriginalInterest(), is(initialOriginalInterest));\n assertThat(loan.getLoanSummary().getOriginalFees(), is(initialOriginalFees));\n assertFalse(loan.getLoanSummary().getPrincipalPaid().equals(initialPrincipalPaid));\n assertFalse(loan.getLoanSummary().getInterestPaid().equals(initialInterestPaid));\n assertFalse(loan.getLoanSummary().getFeesPaid().equals(initialFeesPaid));\n\n List<LoanInstallment> copySchedule = copyLoanSchedule(loan);\n\n makeEarlyPayment(loan);\n StaticHibernateUtil.flushAndClearSession();\n loan = (LoanBO) legacyAccountDao.getAccount(loan.getAccountId());\n loan.updateDetails(TestUtils.makeUserWithLocales());\n // The early repayment should have caused the original interest and fees to be changed to equal the amounts\n // paid.\n assertThat(loan.getLoanSummary().getOriginalPrincipal(), is(initialOriginalPrincipal));\n assertFalse(loan.getLoanSummary().getOriginalInterest().equals(initialOriginalInterest));\n assertFalse(loan.getLoanSummary().getOriginalFees().equals(initialOriginalFees));\n assertThat(loan.getLoanSummary().getPrincipalPaid(), is(loan.getLoanSummary().getOriginalPrincipal()));\n assertThat(loan.getLoanSummary().getInterestPaid(), is(loan.getLoanSummary().getOriginalInterest()));\n assertThat(loan.getLoanSummary().getFeesPaid(), is(loan.getLoanSummary().getOriginalFees()));\n assertFalse(sameSchedule(copySchedule, loan.getAccountActionDates()));\n\n\n adjustLastLoanPayment(loan);\n StaticHibernateUtil.flushAndClearSession();\n loan = (LoanBO) legacyAccountDao.getAccount(loan.getAccountId());\n loan.updateDetails(TestUtils.makeUserWithLocales());\n // The adjustment of a completed loan should have caused the original amounts to be reset\n assertThat(loan.getLoanSummary().getOriginalPrincipal(), is(initialOriginalPrincipal));\n assertThat(loan.getLoanSummary().getOriginalInterest(), is(initialOriginalInterest));\n assertThat(loan.getLoanSummary().getOriginalFees(), is(initialOriginalFees));\n assertTrue(sameSchedule(copySchedule, loan.getAccountActionDates()));\n }", "@Test\n public void isSameLog_differentLog_returnFalse() {\n assertFalse(LOG_A.isSameLog(null));\n\n // different exercise and dateTime -> returns false\n Log editedLog = new LogBuilder(LOG_A)\n .withExercise(VALID_EXERCISE_B)\n .withDateTime(VALID_DATE_TIME_B)\n .build();\n assertFalse(LOG_A.isSameLog(editedLog));\n\n // different dateTime -> returns false\n editedLog = new LogBuilder(LOG_A).withDateTime(VALID_DATE_TIME_B).build();\n assertFalse(LOG_A.isSameLog(editedLog));\n }", "public boolean isUndoPossible() {\n return (roundsHistory.size() > 1);\n }", "@Test\n public void isSameLog_sameLog_returnTrue() {\n assertTrue(LOG_A.isSameLog(LOG_A));\n }", "public static boolean isPassOneHour(String pass)\n {\n DateFormat dateFormat = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\n Date date = new Date();\n String current = dateFormat.format(date);\n\n //Extract current data time all values\n\n int current_year = Integer.parseInt(current.substring(0, 4));\n int current_month = Integer.parseInt(current.substring(5,7))-1;\n int current_day = Integer.parseInt(current.substring(8,10));\n\n int current_hour = Integer.parseInt(current.substring(11,13));\n int current_minute = Integer.parseInt(current.substring(14,16));\n int current_seconds = Integer.parseInt(current.substring(17));\n\n //String pass = \"2016-10-05 10:14:00\";\n\n //Extract last update data (pass from parameter\n\n int year = Integer.parseInt(pass.substring(0, 4));\n int month = Integer.parseInt(pass.substring(5,7))-1;\n int day = Integer.parseInt(pass.substring(8,10));\n\n int hour = Integer.parseInt(pass.substring(11,13));\n int minute = Integer.parseInt(pass.substring(14,16));\n int seconds = Integer.parseInt(pass.substring(17));\n\n\n System.out.println(\"CURRENT: \" + current_year+\"/\"+current_month+\"/\"+current_day+\" \"+current_hour+\":\"+current_minute+\":\"+current_seconds);\n\n System.out.println(\"PASS: \" + year+\"/\"+month+\"/\"+day+\" \"+hour+\":\"+minute+\":\"+seconds);\n\n if (current_year == year)\n {\n if (current_month == month)\n {\n if (current_day == day)\n {\n if (current_hour > hour)\n {\n if ((current_hour - hour > 1))\n {\n //Bi ordu gutxienez\n System.out.println(\"Bi ordu gutxienez: \" + (current_hour) + \" / \" + hour);\n return true;\n }\n else\n {\n if (((current_minute + 60) - minute ) < 60)\n {\n //Ordu barruan dago\n System.out.println(\"Ordu barruan nago ez delako 60 minutu pasa: \" + ((current_minute + 60) - minute ));\n return false;\n }\n else\n {\n //Refresh\n System.out.println(\"Eguneratu, ordu bat pasa da gutxienez: \" + ((current_minute + 60) - minute ));\n return true;\n }\n }\n\n }\n }\n }\n }\n return false;\n }", "@Override\n\tpublic void satisfyTrade(TickEvent<Trade> tradeEvent) throws TradeException {\n\n\t}", "private boolean shouldProcessEvent(TimeSeriesEvent e) {\r\n return modCountOnLastRefresh < e.getSeriesModCount();\r\n }", "@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 }", "private void LogPurchaseHistoryTable() {\n SQLiteDatabase db = DBHelper.getReadableDatabase();\n Cursor c = db.rawQuery(\"SELECT * FROM \" + DBHelper.TABLE_PURCHASEHISTORY, null);\n Log.d(DatabaseHelper.class.getName(), \"Contents of PurchaseHistory Table:\");\n\n c.moveToFirst();\n while (!c.isAfterLast()) {\n Log.d(DatabaseHelper.class.getName(), \"\\t _id:\" + String.valueOf(c.getInt(c.getColumnIndex(DBHelper.PURCHASEHISTORY_ID))) +\n \", pid:\" + String.valueOf(c.getInt(c.getColumnIndex(DBHelper.PURCHASEHISTORY_PID))) +\n \", sid:\" + String.valueOf(c.getInt(c.getColumnIndex(DBHelper.PURCHASEHISTORY_SID))) +\n \", price:\" + String.valueOf(c.getDouble(c.getColumnIndex(DBHelper.PURCHASEHISTORY_PRICE))) +\n \", quality:\" + String.valueOf(c.getInt(c.getColumnIndex(DBHelper.PURCHASEHISTORY_QUALITY))) +\n \", timestamp:\" + String.valueOf(c.getString(c.getColumnIndex(DBHelper.PURCHASEHISTORY_DATE))) );\n c.moveToNext();\n }\n\n db.close();\n }", "private boolean isSameQuant(PlainGraph graph, String quantLvl, String prevQuant) {\n PlainNode q = graphNodeMap.get(graph).get(quantLvl);\n PlainNode prevQ = graphNodeMap.get(graph).get(prevQuant);\n\n String quantName = graph.inEdgeSet(q).stream().filter(e -> e.target() == e.source()).map(e -> e.label().text()).collect(Collectors.toList()).get(0);\n String prevQuantName = graph.inEdgeSet(prevQ).stream().filter(e -> e.target() == e.source()).map(e -> e.label().text()).collect(Collectors.toList()).get(0);\n\n return quantName.equals(prevQuantName);\n }", "private boolean checkTimeStamp(File file) {\n // uses sharedpreferences\n return (lastUpdate < file.getModifiedDate().getValue());\n }", "private void checkFrames() {\n\t\tif(tradeDetail == null){\n\t\t\tSystem.exit(0);\n\t\t}\n\t}", "public void checkIfHistoryTableExists() {\r\n\t\tWebElement element = getDriver().findElement(\r\n\t\t\t\tBy.cssSelector(\".lfr-search-container\"));\r\n\t\tboolean isDisplayed = false;\r\n\r\n\t\tif (element.isDisplayed()) {\r\n\t\t\tisDisplayed = true;\r\n\t\t}\r\n\t\tAssert.assertTrue(\"Table is not displayed\", isDisplayed);\r\n\t}" ]
[ "0.63742226", "0.60804224", "0.58986425", "0.5889927", "0.57919496", "0.5644258", "0.56355023", "0.5635432", "0.56099766", "0.55804765", "0.5574207", "0.5553625", "0.5536196", "0.5535758", "0.5530773", "0.5523995", "0.5491941", "0.5488283", "0.5481154", "0.54800284", "0.5471963", "0.5471777", "0.5461599", "0.54471046", "0.5443925", "0.5436191", "0.5425677", "0.54024225", "0.5400718", "0.5384069", "0.5360687", "0.5358924", "0.53556", "0.5352873", "0.5333173", "0.53236336", "0.5316975", "0.5315953", "0.53121215", "0.52993", "0.52895266", "0.52793986", "0.5277812", "0.52747816", "0.52726877", "0.52708614", "0.52358603", "0.5235804", "0.5233314", "0.5232625", "0.523173", "0.52290606", "0.51921856", "0.51799965", "0.51759225", "0.5175679", "0.517425", "0.51686096", "0.5167549", "0.5165739", "0.5165417", "0.5164466", "0.51510835", "0.5143142", "0.5143142", "0.51423746", "0.51371855", "0.5135646", "0.5127182", "0.51262134", "0.51163137", "0.5113763", "0.5107644", "0.50920755", "0.50917745", "0.5081987", "0.5080051", "0.5063111", "0.50618374", "0.50577563", "0.50550205", "0.5051888", "0.50507283", "0.5031214", "0.50297606", "0.502655", "0.50263715", "0.50257045", "0.5023634", "0.50197303", "0.5019415", "0.50191075", "0.5013642", "0.5006008", "0.4999902", "0.49905747", "0.49881437", "0.49833137", "0.49827194", "0.4973807" ]
0.7469473
0
get the best bid and check it matches the best simulated bid
@Test public void testGetBestBid() { assertEquals("Best bid incorrect", buyOrder2, exchange.getBestBid(stock)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n public BidDetails determineNextBid() {\r\n\r\n double time = negotiationSession.getTime();\r\n\r\n // for the first 20% of the time, offer the bid which gives max utility\r\n if(time < Offer_Max_Util_Time){\r\n BidDetails maxBid = null;\r\n try {\r\n maxBid = this.outcomespace.getMaxBidPossible();\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n System.out.println(\"Exception: cannot generate max utility bid\");\r\n }\r\n return maxBid;\r\n\r\n }else {\r\n //compute the target utility based on time\r\n double utilityGoal = p(time);\r\n // if there is no opponent model available\r\n if (opponentModel instanceof NoModel) {\r\n // generate a Bid near the Utility we wish to have\r\n nextBid = negotiationSession.getOutcomeSpace().getBidNearUtility(utilityGoal);\r\n } else {\r\n // get the best Bid for the Opponent among a list of similarly preferred bids for our Agent\r\n // Then, make an offer with that bid\r\n nextBid = omStrategy.getBid(outcomespace, utilityGoal);\r\n }\r\n }\r\n return nextBid;\r\n }", "private static Node auctionRound(Node bidder, Graph solution, Graph reference) {\n\t\tNode matchedNode = null;\n\t\tFloat bestValue = 0F;\n\n\t\tfor (Node seller : reference.getNodeListY()) {\n\t\t\tEdge edge = reference.getEdge(bidder.GetIndex(), seller.GetIndex()); // find edge\n\t\t\tFloat value = edge.GetWeight() - seller.getPrice();\n\n\t\t\tif (value > bestValue) {\n\t\t\t\tmatchedNode = seller;\n\t\t\t\tbestValue = value;\n\t\t\t}\n\t\t}\n\n\t\treturn matchedNode;\n\t}", "Bid getNewBidWithUtil(double ourUtility, BidSpace bs) {\n\t\tBidPoint bestbid = null;\n\t\tdouble bestbidutil = 0;\n\t\tfor (BidPoint p : bs.bidPoints) {\n\t\t\tif (Math.abs(\n\t\t\t\t\tourUtility - p.getUtilityA()) < ALLOWED_UTILITY_DEVIATION\n\t\t\t\t\t&& p.getUtilityB() > bestbidutil\n\t\t\t\t\t&& !myPreviousBids.contains(p.getBid())) {\n\t\t\t\tbestbid = p;\n\t\t\t\tbestbidutil = p.getUtilityB();\n\t\t\t}\n\t\t}\n\t\tif (bestbid == null)\n\t\t\treturn null;\n\t\treturn bestbid.getBid();\n\t}", "public double getCurrentBidToMatch() {\n\t\treturn currentBidToMatch;\n\t}", "@Test(expected = BidAmountException.class)\n public void bidIsLessThanHighestBidIsRejected() {\n knownUsers.login(seller.userName(), seller.password());\n knownUsers.annointSeller(seller.userName());\n\n knownUsers.login(bidder.userName(), bidder.password());\n\n Auction testAuction = new Auction(seller, item, startingPrice, startTime, endTime);\n testAuction.onStart();\n\n Bid firstBid = new Bid(bidder, startingPrice, startTime.plusMinutes(2));\n\n testAuction.submitBid(firstBid);\n\n testAuction.submitBid(firstBid);\n\n\n }", "public Bid getfinalBid(List<Bid> bids) {\n\t\t\r\n\t\tBid myBid=null;\r\n\t\tdouble lower=0,upper=0,total=0;\r\n\t\t//briskw meso oro\r\n\t for(int i=0;i<bids.size();i++)\r\n\t {\r\n\t \ttotal=total+US.getUtility(bids.get(i));\t \t\r\n\t }\t\t\r\n\t\tlower=total/bids.size();\r\n\t\tupper=lower;\r\n\t\t\r\n\t\t//anoigo ta oria ean den iparxei bid konta ston meso oro \r\n\t\twhile(myBid==null) {\r\n\t\t\t\r\n\t\t\tfor(int i=0;i<bids.size();i++) {\r\n\t\t\t\t\r\n\t\t\t\ttry {\r\n\t\t\t\t\tdouble util = US.getUtility(bids.get(i));\r\n\t\t\t\t\tif (util >= lower && util <= upper) {\r\n\t\t\t\t\t\tmyBid=bids.get(i);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t} catch (Exception e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(lower>=0.025 && upper<=0.974) {\r\n\t\t\t\tlower=lower-0.025;\r\n\t\t\t\tupper=upper+0.025;\r\n\t\t\t}\r\n\t\t\telse if (upper>0.974) {\r\n\t\t\t\tlower=lower-0.025;\r\n\t\t\t\tupper=1;\r\n\t\t\t}\r\n\t\t}\t\r\n\t\t\r\n\t\treturn myBid;\r\n\t}", "Object getBest();", "@Override\r\n public int compare(BarterOffer o1, BarterOffer o2) {\r\n return Double.compare(o1.getBestBid(), o2.getBestBid());\r\n }", "Pair<Double, Integer> bid();", "public abstract Bid chooseOpeningBid();", "public abstract Bid chooseFirstCounterBid();", "int getBid();", "public abstract boolean isAcceptable(Bid plannedBid);", "public String getNextBid(Card bidCard) {\n\n\t\tint rank=getValue(bidCard.rank);\n\t\tint min=rank/2;\n\t\tCard nextCard;\n \n\t\tfor(int i=1;i<cardsInHand.size();i++)\n\t\t{\n\t\t\tif(getValue(cardsInHand.get(i).rank) >rank)\n\t\t\t{\t\n\t\t\t\tnextCard=cardsInHand.get(i);\n\t\t\t\tcardsInHand.remove(i);\n\t\t\t\treturn nextCard.rank;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(getValue(cardsInHand.get(0).rank) >rank)\n\t\t{\t\n\t\t\tnextCard=cardsInHand.get(0);\n\t\t\tcardsInHand.remove(0);\n\t\t\treturn nextCard.rank;\n\t\t}\n\t\t\n\t\tnextCard=cardsInHand.get(cardsInHand.size()-1);\n\t\treturn nextCard.rank;\t \n\t}", "public Bid winningBid(final String itemId);", "private void checkSecondPriceAuctions() {\n\n // Get all auctions of according type.\n TypedQuery<Auction> auctionByTypeQuery = getAuctionByTypeQuery(AuctionType.SECOND_PRICE);\n List<Auction> secondPriceResultList = auctionByTypeQuery.getResultList();\n\n // Get current timestamp for comparison.\n DateTime now = new DateTime(DateTimeZone.forID(\"Europe/Berlin\"));\n Date nowDate = now.toDate();\n\n // Filter all auctions that have timed out.\n List<Auction> timeoutSecondPriceAuctions = secondPriceResultList\n .stream()\n .filter(auction -> nowDate.compareTo(auction.getEndTime()) == 1 && auction.isRunning()).collect(Collectors.toList());\n\n // Check if there are any auction that have timed out.\n if (timeoutSecondPriceAuctions.size() > 0) {\n\n for (Auction auction : timeoutSecondPriceAuctions) {\n\n // Stop auction and get its bidders.\n auction.setRunning(false);\n List<Bid> auctionBids = new ArrayList<>();\n List<Bidder> bidder = auction.getBidder();\n\n // Continue only if there are any bidders.\n if (bidder.size() > 0) {\n\n for (Bidder bidderElem : bidder) {\n auctionBids.addAll(bidderElem.getBids());\n }\n\n // Find winner only if registered bidders have bidden.\n if (auctionBids.size() > 0) {\n\n // Sort bids ascending according to their value.\n auctionBids.sort(new BidComperator());\n Bid winningBid = auctionBids.get(0);\n\n // If there is only one bid the bidder has to pay the price\n // originally entered by the article owner, which is basically the second highest\n // amount possible.\n BigDecimal priceToPay = null;\n if (auctionBids.size() == 1) {\n priceToPay = auction.getPrice();\n } else {\n // If there is more than one bid, the winner is still the bidder with\n // the highest bid, but the price he has to pay is the second highest bid.\n priceToPay = auctionBids.get(1).getAmount();\n }\n\n // Get user from Liferay to have access to user related data such as name and mail address.\n long winningUserId = winningBid.getBidder().getUserId();\n try {\n\n User userById = UserLocalServiceUtil.getUserById(winningUserId);\n AuctionResult auctionResult = new AuctionResult();\n auctionResult.setDescription(auction.getArticle().getShortDesc());\n auctionResult.setPrice(priceToPay);\n auctionResult.setFirstName(userById.getFirstName());\n auctionResult.setSurname(userById.getLastName());\n auctionResult.setMail(userById.getEmailAddress());\n auctionResult.setAuctionType(auction.getAuctionType());\n entityManager.persist(auctionResult);\n } catch (Exception e) {\n\n entityManager.getTransaction().rollback();\n }\n }\n }\n }\n }\n }", "public int getWinningBid() {\n return winningBid;\n }", "private int computeBetterResponse(int player, GameObserver go) {\n int[] devOutcome = currentOutcome.clone();\n double aspirationPayoff = eGame.getPayoff(currentOutcome, player) + aspirationLevel;\n double bestPayoff = eGame.getPayoff(currentOutcome, player);\n int bestResponse = currentOutcome[player];\n\n ///System.out.println(\"Finding BR: \" + Arrays.toString(currentOutcome));\n\n // get the order in which to test best responses\n List<Integer> order = deviationTestOrder.getDeviationTestOrder(currentOutcome, player);\n\n// if (order.size() < nActs[player]-1) {\n// System.out.println(\"To few actions in order listing: \" + order.size());\n// }\n\n int itr = 0;\n for (int a : order) {\n // skip current action\n if (a == currentOutcome[player]) continue;\n devOutcome[player] = a;\n\n //System.out.println(\"Testing dev: \" + Arrays.toString(devOutcome));\n\n // check whether this profile is \"tabu\"\n if (tabu.getValue(devOutcome)) {\n //System.out.println(\"TABU\");\n continue;\n }\n\n // sample if necessary; flag not enough samples\n if (eGame.getNumSamples(devOutcome) == 0) {\n if (go.numObsLeft() <= 0) return NO_SAMPLES_FLAG;\n sampleAndUpdate(devOutcome, go);\n //System.out.println(\"SAMPLED\");\n }\n\n // check BR\n double devPayoff = eGame.getPayoff(devOutcome, player);\n\n// if (devPayoff > aspirationPayoff) {\n// //System.out.println(\"Aspiration met.\");\n// return a;\n// } else\n\n if (devPayoff > bestPayoff) {\n //System.out.println(\"Br, but not aspiration level\");\n bestPayoff = devPayoff;\n bestResponse = a;\n }\n\n itr++;\n if (itr > minDeviationsTested &&\n bestPayoff > aspirationPayoff) {\n return bestResponse;\n }\n\n }\n\n if (bestResponse != currentOutcome[player]) {\n //System.out.println(\"return non-aspiration BR\");\n return bestResponse;\n }\n //System.out.println(\"NO BR\");\n return NO_BR_FLAG;\n }", "@Override\r\n public double getBidEvaluation(Bid bid) {\r\n double BidUtil = 0;\r\n try {\r\n BidUtil = opponentUtilitySpace.getUtility(bid);\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n }\r\n return BidUtil;\r\n }", "private void setBid() {\r\n int bid;\r\n int carInList;\r\n Car temp;\r\n input = new Scanner(System.in);\r\n\r\n cars.getListings();\r\n System.out.println(\"Which vehicle would you like to bid on?\");\r\n\r\n carInList = input.nextInt();\r\n temp = cars.getCar(carInList);\r\n\r\n System.out.println(\"How much would you like to place on the bid?\");\r\n bid = input.nextInt();\r\n\r\n if (bid <= temp.getBidPrice()) {\r\n System.out.println(\"Your bid has to be higher than the current bid price\");\r\n } else {\r\n temp.setBidPrice(bid);\r\n System.out.println(\"Your bid price of \" + temp.getBidPrice() + \" has been set.\");\r\n System.out.println(\"Please check back later to see if you have won the bid\");\r\n }\r\n }", "com.google.openrtb.OpenRtb.BidResponse getBidresponse();", "@Test\n\t\tpublic void testGetBestOffer()\n\t\t{\t\t\t\n\t\t\tassertEquals(\"Best bid incorrect\", sellOrder1, exchange.getBestOffer(stock));\n\t\t}", "private Bid onceAround(int turn) {\r\n\t\tint highestBid = 0;\r\n\t\tint highestBidder = turn;\r\n\t\tfor(int i = 0; i < players.length; i++) {\r\n\t\t\tint biddingTurn = (turn+i+1)%players.length;\r\n\t\t\tint bid = players[biddingTurn].getBid(highestBid);\r\n\t\t\tif(bid > highestBid) {\r\n\t\t\t\thighestBid = bid;\r\n\t\t\t\thighestBidder = biddingTurn;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn new Bid(highestBidder,highestBid);\r\n\t}", "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 findBPS() {\n\t\tfinal String consensus = \"UACUAAC\";\n\t\tString candidate = \"\"; \n\t\tint currentDistance;\n\t\t\n\t\tint bestDistance = Integer.MAX_VALUE;\n\t\tString bestCandidate = \"\"; \n\t\tfor( int i = 6; i < this.intron.length() - consensus.length() - 2; i++ ) {\n\t\t\tcandidate = this.intron.substring( i, (i+consensus.length()) );\n\t\t\tcurrentDistance = StringUtils.getLevenshteinDistance(consensus, candidate); \n\t\t\tif( currentDistance <= bestDistance ) {\n\t\t\t\tbestCandidate = candidate; \n\t\t\t\tbestDistance = currentDistance; \n\t\t\t}\n\t\t}\n\t\t\n\t\t//System.out.println( bestCandidate + \"\\t\" + bestDistance ); \n\t\tthis.bps = bestCandidate; \n\t}", "public void outputBBO() {\n System.out.println(\"\\nBest Bid & Offer: \");\n \n if(bestBid==null){\n \tSystem.out.println(\"No best bids\");\n }else {\n \tSystem.out.println(\"Bid\" + bestBid.ord.toString());\n }\n if(bestOffer==null){\n \tSystem.out.println(\"No best offer\");\n\n }else {\n \tSystem.out.print(\"Off\" + bestOffer.ord.toString());\n }\n System.out.println();\n }", "public Bag getGreedyBag() {\r\n bag = super.getBag();\r\n List<Integer> auxiliarHand = new LinkedList<Integer>(hand);\r\n\r\n for (int i = 0; i < bag.getCardsIds().size(); i++) {\r\n if (auxiliarHand.contains(bag.getCardsIds().get(i))) {\r\n auxiliarHand.remove(bag.getCardsIds().get(i));\r\n }\r\n }\r\n\r\n if (this.roundNumber % 2 == 0) {\r\n highestProfitIllegalCard = 0;\r\n if (bag.getCards().size() < MAX_CARDS_IN_BAG) {\r\n for (Integer cardId : auxiliarHand) {\r\n if (cardId > MAX_LEGAL_INDEX\r\n && goodsFactory.getGoodsById(cardId).getProfit()\r\n > goodsFactory.getGoodsById(highestProfitIllegalCard).getProfit()) {\r\n highestProfitIllegalCard = cardId;\r\n }\r\n }\r\n if (highestProfitIllegalCard != 0\r\n && (coins - goodsFactory\r\n .getGoodsById(highestProfitIllegalCard)\r\n .getPenalty()) > 0) {\r\n bag.addCard(goodsFactory.getGoodsById(highestProfitIllegalCard));\r\n }\r\n }\r\n }\r\n return bag;\r\n }", "com.google.openrtb.OpenRtb.BidRequest getBidrequest();", "public int solve(String infile) {\r\n\r\n\t\ttry {\r\n\t\t\treadData(infile);\r\n\t\t}\r\n\t\tcatch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\t\r\n\t\t//A temporary object array of bids\r\n\t\tBids[] numBids = populateBids();\r\n\t\t//A temporary integer array to hold the maximum value\r\n\t\tint[] storeMaxRev = new int[numBids.length];\r\n\t\t//A temporary variable for the maximum revenue that will be updated in the main loop.\r\n\t\tint maxRev = 0;\r\n\t\t\r\n\t\t//Invokes the comparator method defined earlier\r\n\t\tLotComparator compareFinishTimes = new LotComparator();\r\n\t\tArrays.sort(numBids,compareFinishTimes);\r\n\t\t\r\n\t\t\r\n\t\t//Edge case check if the number of bids is less than 0\r\n\t\tif(numBids.length <= 0) {\r\n\t\t\treturn 0;\r\n\t\t}\r\n\t\t\r\n\t\t//Choose the first bid in the object array.\r\n\t\tstoreMaxRev[0] = numBids[0].priceOfLot;\r\n\t\t\r\n\t\t//From the second element of the object array, iterate through the array and store the price\r\n\t\t//of the element that is larger than the previous element\r\n\t\tfor(int i = 1; i < numBids.length; i++) {\r\n\t\t\tstoreMaxRev[i] = Math.max(numBids[i].priceOfLot, storeMaxRev[i - 1]);\r\n\t\t\t\r\n\t\t\t//Iterating backwards from the second last element relative to i, check if the current element is compatible.\r\n\t\t\t//A compatible bid is when the ending lot number is less than the starting lot number of the next bid.\r\n\t\t\t//If it is an compatible bid, add the price of the current bid to the previous bid and take the maximum price out of the two.\r\n\t\t\tfor(int j = i - 1; j >= 0; j--) {\r\n\t\t\t\tif(numBids[j].endLot < numBids[i].beginningLot) {\r\n\t\t\t\t\tstoreMaxRev[i] = Math.max(storeMaxRev[i], numBids[i].priceOfLot + storeMaxRev[j]);\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\t\r\n\t\t\r\n\t\t//Once all of the bids in numBid object array is processed, we get an integer array that will contain the maximum revenue.\r\n\t\t//This loop iterates through storeMaxRev and selects the largest integer which is then set to the variable maxRev and returned as the answer\r\n\t\tfor(int priceIdx = 0; priceIdx < storeMaxRev.length; priceIdx++) {\r\n\t\t\tif(maxRev < storeMaxRev[priceIdx]) {\r\n\t\t\t\tmaxRev = storeMaxRev[priceIdx];\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn maxRev;\r\n\t}", "protected boolean update_best_value(Knapsack knapsack) {\n iteration+=1;\n if (knapsack.get_value()>best_value)\n {\n best_value=knapsack.get_value();\n return true;\n }\n if (iteration%100000==0)\n System.out.println(\"iteration:\"+iteration+\" time:\"+System.currentTimeMillis()+\n \" best_value:\"+best_value);\n return false;\n }", "java.math.BigDecimal getSingleBetMinimum();", "private Bid standardBidding(int turn) {\r\n\t\tboolean[] bidding = new boolean[players.length];//used to tell how many players are still bidding\r\n\t\tfor(int i = 0; i < bidding.length; i++) {//all players are bidding\r\n\t\t\tbidding[i] = true;\r\n\t\t}\r\n\r\n\t\tint highestBid = 0;\r\n\t\tint highestBidder = turn;\r\n\t\t//while there is more than 1 player bidding\r\n\t\tint stillBidding = players.length;//used for checking how many players are bidding\r\n\t\tfor(int biddingTurn = (turn+1)%players.length; stillBidding > 1; biddingTurn = (biddingTurn+1)%players.length) {\r\n\t\t\t//skip people who are no longer in\r\n\t\t\tif(!bidding[biddingTurn]) {\r\n\t\t\t\tcontinue;\r\n\t\t\t}\r\n\r\n\t\t\t//get the price a player is willing to pay\r\n\t\t\tOGS.stillBidding = Arrays.copyOf(bidding, bidding.length);//reset this so players can mess with it if they want\r\n\t\t\tint bid = players[biddingTurn].getBid(highestBid);\r\n\t\t\tif(bid==-1 || bid <= highestBid) {\r\n\t\t\t\tbidding[biddingTurn] = false;\r\n\t\t\t} else {\r\n\t\t\t\thighestBid = bid;\r\n\t\t\t\thighestBidder = biddingTurn;\r\n\t\t\t}\r\n\r\n\t\t\t//checks for winner\r\n\t\t\tstillBidding = 0;\r\n\t\t\tfor(int b = 0; b < bidding.length; b++) {\r\n\t\t\t\tif(bidding[b]) {\r\n\t\t\t\t\tstillBidding++;\r\n\t\t\t\t}\r\n\t\t\t\t//System.out.print(bidding[b] + \" \");//debug\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn new Bid(highestBidder,highestBid);\r\n\t}", "boolean isNilSingleBetMinimum();", "public int getWinningBid() {\n return this.winningBid;\n }", "private void processHighBidValue(Bid bid) {\n\t}", "public Code guess(){\n int minimumEliminated = -1;\n Code bestGuess = null;\n //Create a list of all codes in sample space (including both impossible and possible codes)\n List<Code> unusedCodes = new LinkedList<>(possibleCodes);\n unusedCodes.addAll(impossibleCodes);\n\n //MinMax part\n //For each code in the sample space\n for (Code arbitraryCode : unusedCodes) {\n //Create a new 2D miniMax table\n int[][] scoreTable = new int[Code.CODE_LENGTH + 1][Code.CODE_LENGTH + 1];\n //For each possibleCode\n for (Code possibleCode : possibleCodes) {\n Response response = arbitraryCode.getResponse(possibleCode); //Compare with the temporary arbitrary code and get response\n scoreTable[response.getStrikes()][response.getHits()]++; //Increase number of codes which have this response\n }\n //Find max in the table\n int maxScoreHits = -1;\n for (int[] row : scoreTable) {\n for (int i : row) {\n maxScoreHits = Integer.max(i, maxScoreHits);\n }\n }\n int score = possibleCodes.size() - maxScoreHits; //Evaluate score\n //Update minimumEliminated and bestGuess\n if (score > minimumEliminated) {\n minimumEliminated = score;\n bestGuess = arbitraryCode;\n }\n }\n\n //Update guess\n guess = bestGuess;\n\n return bestGuess;\n }", "@Test\n\tpublic void testFindHighestRentProperty() {\n\t\tBoard board = new Board(4);\n\t\tSquareProperty outer = (SquareProperty)board.getSquareFromBoard(84);\n\t\tSquareProperty inner = (SquareProperty)board.getSquareFromBoard(53);\n\t\touter.rent = 3000;\n\t\tinner.rent = 4000;\n\t\tBank ba = board.bank;\n\t\t\n\t\tint[] a = ba.findHighestRentProperty(3);\n\t\tint[] b = ba.findHighestRentProperty(4);\n\t\tassertTrue(\"findHighestRentProperty() works\",ba.repOk() && (outer.position == a[1] && outer.row == a[0]) && (inner.position == b[1] && inner.row == b[0]));\n\n\t\t\t\n\t}", "private void constructBid() {\n Bid rawBid;\n double maxDemand = elements.first().demandWatt;\n // Minimum demand is also Max Production.\n double minDemand = elements.last().demandWatt;\n\n double minPriority = 0.0;\n double maxPriority = 1.0;\n\n // First make the ideal, continuous bid, that does not care about discrete running modes.\n rawBid = Bid.create(marketBasis)\n .add(priceOf(minPriority), maxDemand)\n .add(priceOf(maxPriority), minDemand)\n .build();\n\n // Now construct actual bid\n double[] rawDemand = rawBid.getDemand();\n newBid = new UnconstrainedBidElement[rawDemand.length];\n for (int i = 0; i < rawDemand.length; i++) {\n newBid[i] = getClosest(rawDemand[i]);\n }\n }", "public double getBestScore();", "public double getBid(double v) {\n double[] weights = {\n 0.6601863864966815,\n -0.44050297744775085,\n -0.3288461116450685,\n 0.7354115471274265,\n 0.6528564967694372,\n -0.021270821816517627,\n -0.751090383677677\n };\n if (roundsLeft == 0) {\n return Math.min(v * weights[0], cash);\n }\n if (roundsLeft / totalRounds < weights[1] * 333) {\n if (v > avrgBids[avrgBids.length - 1]) {\n return Math.min(v * weights[2], cash);\n } else if (v > avrgBids[avrgBids.length - 2]) {\n return Math.min(avrgBids[avrgBids.length - 2] - 1, cash);\n } else if (v > avrgBids[0] && v < avrgBids[1]) {\n return Math.min(v * weights[3], cash);\n }\n }\n return Math.min(v * weights[4], cash);\n }", "private Pair[] bribeCalculateBag(final int maxCards,\n final HashMap<String, Integer> association) {\n final int minMoney = 5;\n final int maxBagSize = 3;\n if (getInventory().getMoney() < minMoney || numberOfIllegals(association) == 0) {\n return calculateBag(maxCards, association);\n }\n Pair[] result;\n if (numberOfIllegals(association) <= 2 || getInventory().getMoney() < minMoney * 2) {\n getInventory().getBagToGive().setBribe(minMoney);\n getInventory().setMoney(getInventory().getMoney() - minMoney);\n int duplicate = findIllegal(association);\n removeOneAsset(findIllegal(association));\n if (duplicate == findIllegal(association)) {\n result = new Pair[1];\n result[0] = new Pair<>(findIllegal(association), 2);\n getInventory().setNumberOfDeclared(2);\n } else {\n if (findIllegal(association) == -1) {\n result = new Pair[1];\n result[0] = new Pair<>(duplicate, 1);\n getInventory().setNumberOfDeclared(1);\n } else {\n result = new Pair[2];\n result[0] = new Pair<>(duplicate, 1);\n result[1] = new Pair<>(findIllegal(association), 1);\n getInventory().setNumberOfDeclared(2);\n }\n }\n removeOneAsset(findIllegal(association));\n getInventory().setDeclaredAssets(0);\n return result;\n } else {\n getInventory().getBagToGive().setBribe(minMoney * 2);\n getInventory().setMoney(getInventory().getMoney() - (minMoney * 2));\n int contor = maxCards - 1;\n final int contorStart = contor;\n int[] resultAux = new int[maxBagSize];\n getInventory().setDeclaredAssets(0);\n while (contor > 0 && findIllegal(association) != -1) {\n resultAux[findIllegal(association) % maxBagSize]++;\n removeOneAsset(findIllegal(association));\n contor--;\n }\n getInventory().setNumberOfDeclared(contorStart - contor);\n getInventory().setDeclaredAssets(0);\n contor = 0;\n for (int it : resultAux) {\n if (it != 0) {\n contor++;\n }\n }\n result = new Pair[contor];\n if (contor == maxBagSize) {\n result = new Pair[maxBagSize];\n result[0] = new Pair<>(association.get(\"Silk\"), resultAux[1]);\n result[1] = new Pair<>(association.get(\"Pepper\"), resultAux[2]);\n result[2] = new Pair<>(association.get(\"Barrel\"), resultAux[0]);\n } else {\n if (contor == 1) {\n result = new Pair[1];\n if (resultAux[0] > 0) {\n result[0] = new Pair<>(association.get(\"Barrel\"), resultAux[0]);\n }\n if (resultAux[1] > 0) {\n result[0] = new Pair<>(association.get(\"Silk\"), resultAux[1]);\n }\n if (resultAux[2] > 0) {\n result[0] = new Pair<>(association.get(\"Pepper\"), resultAux[2]);\n }\n } else {\n result = new Pair[2];\n int i = 0;\n if (resultAux[0] > 0) {\n result[i] = new Pair<>(association.get(\"Barrel\"), resultAux[0]);\n i++;\n }\n if (resultAux[1] > 0) {\n result[i] = new Pair<>(association.get(\"Silk\"), resultAux[1]);\n i++;\n }\n if (resultAux[2] > 0) {\n result[i] = new Pair<>(association.get(\"Pepper\"), resultAux[2]);\n }\n }\n }\n return result;\n }\n\n }", "public FishingRod getBestRod();", "public abstract Bid chooseCounterBid();", "private Bid sealed(int turn) {\r\n\t\tint highestBidder = turn;\r\n\t\tint highestPrice = 0;\r\n\t\tfor(int i = 0; i < players.length; i++) {\r\n\t\t\tint bid = players[(i+turn+1)%players.length].getBid(-1);\r\n\t\t\tif(bid > highestPrice) {\r\n\t\t\t\thighestPrice = bid;\r\n\t\t\t\thighestBidder = (i+turn+1)%players.length;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn new Bid(highestBidder,highestPrice);\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}", "private Node find(Order ord){\n\t\tNode position=head;\n\t\tOrder ItemPosition;\n\t\twhile (position!=null){\n\t\t\tItemPosition = position.ord;\n\t\t\tif(ItemPosition.equals(ord)) {\n\t\t\t\tposition=bestBid;\n\t\t\t\treturn position;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "@Override\n public int[] getBestMolecule() {\n int bestWeight = 0;\n int indexOfBestMolecule = 0;\n for (int unusedMoleculeIndex = 0; unusedMoleculeIndex < this.getUnusedMolecules().size(); unusedMoleculeIndex++) {\n int[] curr = this.getUnusedMolecules().get( unusedMoleculeIndex ).getAtoms();\n int weight = this.getUnusedParameterIndexCounts()[ curr[0] ] + this.getUnusedParameterIndexCounts()[ curr[1] ];\n log.debug(String.format(\"Pair %d: [%s,%s], Weight: %2d\", unusedMoleculeIndex, scenario.getParameterValues().get(curr[0]), scenario.getParameterValues().get (curr[1]), weight));\n \n //If the new pair is weighted more highly than the previous, make it the new \"best\"\n if (weight > bestWeight) {\n bestWeight = weight;\n indexOfBestMolecule = unusedMoleculeIndex;\n }\n }\n \n //log and return the best pair\n int[] best = this.getUnusedMolecules().get(indexOfBestMolecule).getAtoms();\n log.debug(String.format(\"Best pair is [%s, %s] at %d with weight %d\", scenario.getParameterValues().get(best[0]), scenario.getParameterValues().get(best[1]), indexOfBestMolecule, bestWeight));\n return best;\n }", "@Test(expected = BidAmountException.class)\n public void testLowballingTheInitialBid() {\n knownUsers.login(seller.userName(), seller.password());\n knownUsers.annointSeller(seller.userName());\n\n knownUsers.login(bidder.userName(), bidder.password());\n\n Auction testAuction = new Auction(seller, item, startingPrice, startTime, endTime);\n testAuction.onStart();\n\n Bid firstBid = new Bid(bidder, startingPrice - 5, startTime.plusMinutes(2));\n\n testAuction.submitBid(firstBid);\n }", "public int robBest(TreeNode root) {\n\t\treturn maxMoney(root)[1];\n\t}", "@Order(14)\n\t@Test\n\tpublic void Attempt_OfferBid()\n\t{\n\t\tBigDecimal BuyOut = new BigDecimal(405);\n\t\tItem testItem = new Item(0,\"Changed ItemName\",\"Changed Description\",new BigDecimal(505),new BigDecimal(404),\"NoOne\");\n\t\tint Expected = -1, actual = os.offerBid(BuyOut, testItem, \"NoOne\");\n\t\tassertTrue(actual > Expected);\n\t}", "public double getBidEvaluation(Bid bid) {\n\t\tdouble result = 0;\n\t\tif (issueEvaluationList.isReady()) {\n\t\t\tList<Issue> issues = negotiationSession.getUtilitySpace().getDomain().getIssues();\n\n\t\t\tdouble totalEstimatedUtility = 0;\n\t\t\tfor (Issue issue : issues) {\n\t\t\t\ttry {\n\t\t\t\t\tint issueID = issue.getNumber();\n\n\t\t\t\t\t// Get the estimated normalized weight of the issue, which\n\t\t\t\t\t// indicates how important the issue is.\n\t\t\t\t\tdouble issueWeight = this.issueEvaluationList.getNormalizedIssueWeight(issueID);\n\n\t\t\t\t\t// Get the estimated normalized weight of the value of the\n\t\t\t\t\t// issue, which corresponds to the value that has\n\t\t\t\t\t// been offered in the bid.\n\t\t\t\t\tValue offeredValue = bid.getValue(issueID);\n\t\t\t\t\tAIssueEvaluation issueEvaluation = this.issueEvaluationList.getIssueEvaluation(issueID);\n\t\t\t\t\tdouble offeredValueWeight = issueEvaluation.getNormalizedValueWeight(offeredValue);\n\n\t\t\t\t\t// Since all issueWeights combined should add up to 1, and\n\t\t\t\t\t// the maximum value of the valueWeight is 1,\n\t\t\t\t\t// the estimated utility should be exactly 1 if all offered\n\t\t\t\t\t// valueWeights are 1. So to calculate the partial estimated\n\t\t\t\t\t// utility for this specific issue-value combination, we\n\t\t\t\t\t// need to multiply the weights.\n\t\t\t\t\ttotalEstimatedUtility += (issueWeight * offeredValueWeight);\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\n\t\t\t// Make sure to remove roundoff errors from the utility.\n\t\t\tresult = Math.min(1, Math.max(0, totalEstimatedUtility));\n\t\t}\n\t\treturn result;\n\t}", "private UnconstrainedBidElement getClosest(double demandWatt) {\n UnconstrainedBidElement best = null;\n double bestDistance = Double.MAX_VALUE;\n for (UnconstrainedBidElement e : elements) {\n double distance = Math.abs(demandWatt - e.demandWatt);\n if (best == null || distance < bestDistance) {\n best = e;\n bestDistance = distance;\n }\n }\n return best;\n }", "boolean hasSingleBet();", "boolean hasBidrequest();", "public interface Strategy {\n /**\n * suggest next bid value according to current action status\n * @param auction - current auction status, must not be null\n * @return non-negative bid value according implementation less or equal than {@link Auction#getOwnCache()}\n */\n int nextBid(Auction auction);\n}", "public int getBestValue() {\n return bestValue;\n }", "public double getHighestReward() {\n if (this.highestReward == -1.0) {\n double tempHighestReward = -1.0;\n for (B bidder : this.bidders) {\n if (bidder.getReward() > tempHighestReward) {\n tempHighestReward = bidder.getReward();\n }\n }\n this.highestReward = tempHighestReward;\n }\n return this.highestReward;\n }", "private void findBest()\r\n\t{\r\n\t\tint i;\r\n\t\tint size_mature_pool;\r\n\t\tint idx_current;//index of a currently checked genotype\r\n\t\tint num_errors;//number of errors of the current chromosome\r\n\t\tdouble min_error;//smallest error among the oldest genotypes\r\n\t\tVector<Integer> idx_oldest;\r\n\t\t\r\n\t\tsize_mature_pool = _pool_of_bests.size();\r\n\t\t\r\n\t\tidx_oldest = new Vector<Integer>(0, 1);\r\n\t\t\r\n\t\t//find all oldest genotypes\r\n\t\tfor(i=0; i<size_mature_pool; i++)\r\n\t\t{\r\n\t\t\tnum_errors = _pool_of_bests.get(i)._error.all_single_squares.size();\r\n\t\t\tif(num_errors>=_min_life_span)\r\n\t\t\t{\r\n\t\t\t\tidx_oldest.add(i);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//find the best oldest gentypes with a span above a threshold\r\n\t\t_best_idx = -1;\r\n\t\tif(idx_oldest.size() > 0)\r\n\t\t{\r\n\t\t\t_best_idx = idx_oldest.get(0);\r\n\t\t\tmin_error = _pool_of_bests.get(_best_idx)._error.getAverageError();\r\n\t\t\tfor(i=1; i<idx_oldest.size(); i++)\r\n\t\t\t{\r\n\t\t\t\tidx_current = idx_oldest.get(i);\r\n\t\t\t\tif(min_error > _pool_of_bests.get(idx_current)._error.getAverageError())\r\n\t\t\t\t{\r\n\t\t\t\t\t_best_idx = idx_current;\r\n\t\t\t\t\tmin_error = _pool_of_bests.get(_best_idx)._error.getAverageError();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "java.math.BigDecimal getMultipleBetMinimum();", "Object getWorst();", "boolean isNilMultipleBetMinimum();", "boolean hasBidresponse();", "boolean isSetSingleBetMinimum();", "public int getBid() {\n return bid_;\n }", "public float getBestScore(GameModel startingState) {\n\n float bestScore = 0;\n for (int i = 0; i < NUM_SIMULATIONS; i++) {\n bestScore = max(bestScore, simulateAndGetScore(GameModel.copyOf(startingState)));\n }\n\n return bestScore;\n }", "public T getBestElement() {\n\t\tT bestElement = null;\n\t\tdouble bestProb = -1;\n\t\tfor (T element : itemProbs_.keySet()) {\n\t\t\tdouble thisProb = itemProbs_.get(element);\n\t\t\tif (thisProb > bestProb) {\n\t\t\t\tbestProb = thisProb;\n\t\t\t\tbestElement = element;\n\t\t\t}\n\t\t}\n\t\treturn bestElement;\n\t}", "public int getbestline() {\n\t\tint i=0;\n\t\tint biggest=0;\n\t\tint keep_track=0;\n\t\twhile(i < amount.length) {\n\t\t\tif(Faucets.amount[i] > biggest) {\n\t\t\t\tbiggest = Faucets.amount[i];\n\t\t\t\tkeep_track = i;\n\t\t\t}\n\t\t\ti+=1;\n\t\t\t\n\t\t}\n\t\tSystem.out.println(\"Keep_Track = \\\"\" + keep_track + \"\\\"\");\n\t\treturn keep_track;\n\t\t\n\t}", "private int checkBook(FlatShelf b) {\n\n\tIterator<Map.Entry<String, Integer>> tags = b.enumerateTags()\n\t\t.iterator();\n\t// Iterator<Map.Entry<String, String>> properties =\n\t// b.enumerateProperties();\n\n\t// InputPairSet inputPairs = new InputPairSet(); // neuron # -> weight\n\n\tdouble[] inputValues = new double[numTags];\n\n\twhile (tags.hasNext()) {\n\t Map.Entry<String, Integer> tag = tags.next();\n\t // System.out.println(\"tags: \" + tag.getKey() + \" : \" +\n\t // tag.getValue());\n\t Integer current = idPairs.get(tag.getKey());\n\t if (current == null) {\n\t\t// current = idPairs.get(OTHER);\n\t\t// inputValues[current.getValue()] += tag.getValue();\n\t } else\n\t\tinputValues[current] = tag.getValue();\n\n\t // inputPairs.add(new InputPair(current.getValue(),\n\t // (double)tag.getValue()));\n\n\t}\n\n\tNeuralData book = new BasicNeuralData(inputValues);\n\tfinal NeuralData output = brain.compute(book);\n\n\tdouble best = Double.MIN_VALUE;\n\n\tfor (int i = 0; i < numShelfs; ++i)\n\t best = Math.max(best, output.getData(i));\n\n\tint index = -1;\n\tfor (int i = 0; i < numShelfs; ++i)\n\t if (best == output.getData(i))\n\t\tindex = i;\n\n\treturn index;\n }", "private int[] calcBestOrderForB() {\n int cursor = mStrokeA.length() / 2;\n Point[] aPts = buildSnapshot(mStrokeA, cursor);\n Point[] bPts = buildSnapshot(mStrokeB, cursor);\n\n // Determine the best permutation of B to match points of A within these two\n // snapshots\n ArrayList<int[]> perms = buildPermutations(mStrokeA.size());\n int[] bestOrder = null;\n float minCost = 0;\n for (int[] order : perms) {\n float cost = orderCost(order, aPts, bPts);\n if (bestOrder == null || minCost > cost) {\n minCost = cost;\n bestOrder = order;\n }\n }\n return bestOrder;\n }", "public void testNewBid(){\n\n Thing thing = new Thing(new User());\n User borrower = new User();\n\n Bid bid = null;\n try {\n bid = new Bid(thing, borrower, 800);\n }catch(Exception e){\n fail();\n }\n assertEquals(800, bid.getAmount());\n assertEquals(Bid.Per.FLAT, bid.getPer());\n assertEquals(\"8.00\", bid.valueOf());\n assertEquals(\"$8.00\", bid.toString());\n\n }", "@Test\n\tpublic void leastPopularBike()\n\t{\t\t\n\t\tassertEquals(controller.getReport().getLeastPopularBike(), \"BIKE4\");\n\t}", "public int best(){\n List<Integer> points = count();\n Integer max = 0;\n for (Integer p: points){\n if (p <= 21 && max < p){\n max = p;\n }\n }\n return max;\n }", "private void chooseBestPiece() {\n\n int maxKillCount = 0;\n int tempKillCount;\n int piecesWithEqualMaxCount = 0;\n\n int bestPieceX = 0;\n int bestPieceY = 0;\n\n for (int y = 0; y < boardSize; y++) {\n for (int x = 0; x < boardSize; x++) {\n //check every piece\n Field field = board[y][x];\n if (field.getPiece() != null && field.getPiece().getPieceColor() == round) {\n tempKillCount = countAvailableKills(x, y, 0, this.board);\n //count piece kill score\n if (tempKillCount > maxKillCount) {\n maxKillCount = tempKillCount;\n piecesWithEqualMaxCount = 1;\n bestPieceX = x;\n bestPieceY = y;\n } else if (tempKillCount == maxKillCount) {\n piecesWithEqualMaxCount += 1;\n }\n }\n }\n }\n\n if (piecesWithEqualMaxCount == 1 && maxKillCount != 0) {\n bestPieceToMove = board[bestPieceY][bestPieceX].getPiece();\n bestPieceFound = true;\n\n findOptimalMove(bestPieceX, bestPieceY);\n\n System.out.println(\"Best piece found, kill score = \" + maxKillCount);\n } else if (piecesWithEqualMaxCount > 1) {\n bestPieceToMove = null;\n bestPieceFound = false;\n\n if (maxKillCount == 0) {\n //if every piece has same kill score equal to 0 there is no kill available\n killAvailable = false;\n System.out.println(\"No piece can kill\");\n } else {\n killAvailable = true;\n System.out.println(\"Some pieces has same kill score = \" + maxKillCount + \", user can choose which to move\");\n }\n }\n }", "private void processSuperHighValue(Bid bid) {\n\t}", "private void checkIfWon() {\r\n\r\n Car temp;\r\n int carInList;\r\n input = new Scanner(System.in);\r\n\r\n System.out.println(\"Which vehicle did you bid on?\");\r\n cars.getListings();\r\n\r\n double winningBid = rng(1, 5000);\r\n\r\n carInList = input.nextInt();\r\n temp = cars.getCar(carInList);\r\n\r\n if (winningBid <= 1000) {\r\n System.out.println(\"You have won the bid! Congratulations!\");\r\n } else {\r\n System.out.println(\"I'm sorry, the selling price was $\" + (int) winningBid + \" above your bid\");\r\n }\r\n removeYourCar(temp);\r\n\r\n }", "private Outfit getBestWithJacket(double desired_clo) {\n Cursor jacketCursor = mOuterLoaderListener.getCursor();\n Outfit best_outfit = new Outfit();\n Outfit temp_top_bottom;\n Outfit temp_dress;\n double diff = Double.MAX_VALUE;\n double jacket_clo = 0;\n int result_jacket_position = 0;\n if (jacketCursor.moveToFirst()) {\n while (!jacketCursor.isAfterLast()) {\n jacket_clo = jacketCursor.getDouble(jacketCursor.getColumnIndex(ClothesEntry.COLUMN_ARTICLE_CLO_VALUE));\n temp_top_bottom = getBestTopBottom(desired_clo - jacket_clo);\n temp_dress = getBestDress(desired_clo - jacket_clo);\n\n if (Math.abs(temp_top_bottom.getCloValue() + jacket_clo - desired_clo) < diff) {\n diff = Math.abs(temp_top_bottom.getCloValue() + jacket_clo - desired_clo);\n result_jacket_position = jacketCursor.getPosition();\n best_outfit = temp_top_bottom;\n }\n if (Math.abs(temp_dress.getCloValue() + jacket_clo - desired_clo) < diff) {\n diff = Math.abs(temp_dress.getCloValue() + jacket_clo - desired_clo);\n result_jacket_position = jacketCursor.getPosition();\n best_outfit = temp_dress;\n }\n\n jacketCursor.moveToNext();\n }\n\n if (!best_outfit.isEmpty() && jacketCursor.moveToPosition(result_jacket_position)) {\n byte[] imageByteArray = jacketCursor.getBlob(jacketCursor.getColumnIndex(ClothesEntry.COLUMN_ARTICLE_IMAGE));\n double clo = jacketCursor.getDouble(jacketCursor.getColumnIndex(ClothesEntry.COLUMN_ARTICLE_CLO_VALUE));\n\n if (imageByteArray != null && imageByteArray.length > 0)\n {\n ByteArrayInputStream imageStream = new ByteArrayInputStream(imageByteArray);\n best_outfit.addItem(new ClothingItem(Outfit.OUTER1, BitmapFactory.decodeStream(imageStream), clo));\n } else {\n best_outfit.addItem(new ClothingItem(Outfit.OUTER1, null, clo));\n }\n }\n }\n return best_outfit;\n }", "public int getBid() {\n return instance.getBid();\n }", "private boolean searchOptimalBox(Secret secretA, Secret secretB) {\n\n\t\tArrayList<Time> timesA = secretA.getTimes();\n\t\tArrayList<Time> timesB = secretB.getTimes();\n\n\t\t// first step: search optimal box\n\t\tTimeline timeline = new Timeline(\"timeline-\" + FileId.getId() + \"-\" + secretA.getFileName() + \"-smaller-\" +secretB.getFileName() + \".png\");\n\t\tthis.timelines.add(timeline);\n\t\tthis.optimalBox = BoxTest.optimalBox(timesA, timesB, timeline);\n\n\t\tif(this.optimalBox[0] != 0 || this.optimalBox[1] != 0) { \t\n\t\t\t// if a optimal box found, there are significant different results!\n\t\t\tlogger.info(secretA.getName() + \" < \" + secretB.getName() + \": optimal box \" + optimalBox[0] + \"-\" + optimalBox[1]);\n\t\t\tplotPool.plot(\"Filtered Measurments: Optimal Box (\" + secretA.getName() + \"-\" + secretB.getName() + \")\", this.optimalBox[0], this.optimalBox[1]);\n\t\t\treturn true;\n\t\t} else {\n\t\t\t// there is no significant different result found! The user needs\n\t\t\t// to measure more times.\n\t\t\tlogger.warning(secretA.getName() + \" < \" + secretB.getName() + \": no significant different result found! You need to measure more times.\");\n\t\t\treturn false;\n\t\t}\n\t}", "private void runBest() {\n }", "public Card getHighestCard() {\n Card rtrnCard = cardsPlayed[0];\n int i;\n int tempInt;\n int currentHighestRank = cardsPlayed[0].getIntValue();\n for(i = 0; i < cardsPlayed.length; i++){\n if(cardsPlayed[i].getSuit().equals(suit)){\n tempInt = cardsPlayed[i].getIntValue();\n if((currentHighestRank < tempInt)&&(!(cardsPlayed[i].equals(rtrnCard)))){\n rtrnCard = cardsPlayed[i];\n currentHighestRank = cardsPlayed[i].getIntValue();\n }\n }\n }\n return rtrnCard;\n }", "private boolean checkWinner(int secondI, int secondJ) {\n if (Start.shemaArray[secondI][secondJ].baseModel.baba == 1) {\n return true;\n }\n return false;\n }", "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 Product findBestSelling() {\n\t\tString hql=\"SELECT p FROM Row r JOIN r.product p GROUP BY p.id ORDER BY SUM(cant) DESC \";\n\t\tQuery query = this.sessionFactory.getCurrentSession().createQuery(hql);\n\t\tquery.setFirstResult(0);\n query.setMaxResults(1);\n Product prod = (Product) query.getSingleResult();\n\t\treturn prod;\n\t}", "private double[] chooseBestMove(List<double[]> possibleMoves) {\n double bestScore = 0;\n int indexBest = 0;\n for (int i = 0; i < possibleMoves.size(); i++) {\n if (possibleMoves.get(i)[4] > bestScore) {\n bestScore = possibleMoves.get(i)[4];\n indexBest = i;\n }\n }\n return possibleMoves.get(indexBest);\n }", "public List<Double> getLowestAskAndHighestBid(String asset) {\n\n Optional<List<Offer>> offerList = offerRepository.findOffersByAsset_Name(asset);\n\n if (offerList.isPresent()) {\n\n double lowestAsk = Double.MAX_VALUE;\n double highestBid = -1;\n for (Offer offer : offerList.get()) {\n if (offer.getType().equals(OfferType.SELL)) {\n if (offer.getPrice() < lowestAsk) {\n lowestAsk = offer.getPrice();\n }\n\n } else if (offer.getType().equals(OfferType.BUY)) {\n if (offer.getPrice() > highestBid) {\n highestBid = offer.getPrice();\n }\n\n }\n }\n\n if (lowestAsk == Double.MAX_VALUE) {\n lowestAsk = -1;\n }\n return Arrays.asList(lowestAsk, highestBid);\n }\n throw new NotFoundException(\"No current offers for this asset\");\n\n }", "boolean isSetMultipleBetMinimum();", "public int getBestPrice() {\n\t\treturn this.bestPrice;\n\t}", "public void setWinningBid(int winningBid) {\n this.winningBid = winningBid;\n }", "public double getCurrentBet(){\r\n\t\treturn currentBet;\r\n\t}", "@Test\n\tpublic void mostPopularBike()\n\t{\t\t\n\t\tassertEquals(controller.getReport().getMostPopularBike(), \"BIKE1\");\n\t}", "@Test\n void testForLargestCardInTrickComparingRank() {\n Dealer testDealer = new Dealer();\n\n Suit suit1 = Suit.DIAMONDS;\n Suit suit2 = Suit.SPADES;\n Suit suit3 = Suit.DIAMONDS;\n Suit suit4 = Suit.DIAMONDS;\n \n Rank rank1 = Rank.TWO;\n Rank rank2 = Rank.KING;\n Rank rank3 = Rank.ACE;\n Rank rank4 = Rank.FIVE;\n\n Card card1 = new Card(suit1,rank1,false);\n Card card2 = new Card(suit2,rank2,false);\n Card card3 = new Card(suit3,rank3,false);\n Card card4 = new Card(suit4,rank4,false);\n\n \n testDealer.addToPlayedCards(card1);\n testDealer.addToPlayedCards(card2);\n testDealer.addToPlayedCards(card3);\n testDealer.addToPlayedCards(card4);\n\n assertEquals(card3 , testDealer.getLargestCardFromTrick());\n }", "public boolean isUsingBestScore() {\n return usingBestScore;\n }", "public double getBestHeight() { return getBestHeight(-1); }", "public String getBid() {\r\n return bid;\r\n }", "@Override\n\tprotected double[] calculateNeighbourhoodBest(int i) {\n\t\t\t//System.out.println(\"Gbest particle from local typology!\");\n\t\t\tint indexBestParticle = i;\n\t\t\tint indexLeftNeighbour = (i > 0) ? i - 1 : swarmSize - 1;\n\t\t\tint indexRightNeighbour = (i < swarmSize - 1) ? i + 1 : 0;\t\t\n\t\t\t\t\t\n\t\t\tdouble nBestFitness = swarm.get(i).getPBestFitness();\n\t\t\tdouble leftNeighborParticlePBestFitness = swarm.get(indexLeftNeighbour).getPBestFitness();\n\t\t\tdouble rightNeighborParticlePBestFitness = swarm.get(indexRightNeighbour).getPBestFitness();\n\t\t\t\t\t\n\t\t\tif (leftNeighborParticlePBestFitness < nBestFitness) {\n\t\t\t\tindexBestParticle = indexLeftNeighbour;\n\t\t\t\tnBestFitness = leftNeighborParticlePBestFitness;\n\t\t\t}\n\t\t\tif (rightNeighborParticlePBestFitness < nBestFitness) {\n\t\t\t\tindexBestParticle = indexRightNeighbour;\n\t\t\t\tnBestFitness = rightNeighborParticlePBestFitness;\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\treturn swarm.get(indexBestParticle).getPBest();\n\t\t\t//return swarm.get(indexBestParticle);\n\t\t\t\n\t}", "private static int getRandBranchExcept(int brid) {\n if(noOfBranches == 1) return brid;\n int bid = rand.nextInt(noOfBranches - 1);\n if (bid < brid)\n return bid;\n return bid + 1;\n }", "private void checkStability() {\n double maxDeviation = Double.NEGATIVE_INFINITY;\n\n DeviationIterator itr = new DeviationIterator(currentOutcome, nActs);\n while (itr.hasNext()) {\n int[] devOutcome = itr.next();\n\n // this shouldn't happen\n if (eGame.getNumSamples(devOutcome) <= 0) {\n System.out.println(\"BRD: checking equilibrium with unsampled deviations!\");\n System.out.println(\"Current: \" + Arrays.toString(currentOutcome));\n System.out.println(\"Unsampled: \" + Arrays.toString(devOutcome));\n return;\n }\n\n double devBenefit = eGame.getPayoff(devOutcome, itr.getDeviatingPlayer()) -\n eGame.getPayoff(currentOutcome, itr.getDeviatingPlayer());\n\n maxDeviation = Math.max(maxDeviation, devBenefit);\n\n // terminate early; not better than one we have already confirmed\n if (maxDeviation >= confirmedStability) return;\n }\n\n if (maxDeviation < confirmedStability) {\n confirmedStability = maxDeviation;\n mostStableConfirmed = currentOutcome.clone();\n if (samplesToConfirmEquilibrium < 0 &&\n confirmedStability <= 0) {\n samplesToConfirmEquilibrium = eGame.getTotalNumSamples();\n }\n }\n }", "public void launchBall() {\n\n\t\tint contBlue = 0, contRed = 0, red = 0, blue = 0, maxScore = 0;\n\t\t// You can modify this value to play more matches (Important: Odd/Uneven value)\n\t\tint bestOf = 5;\n\n\t\tfor (int i = 0; i < bestOf; i++) {\n\n\t\t\tSystem.out.println(\"Red team launch\");\n\t\t\tred = (int) (Math.random() * (200 - 0));\n\t\t\tSystem.out.println(red);\n\t\t\tmaxScore = (red > maxScore) ? red : maxScore;\n\n\t\t\tSystem.out.println(\"Blue team launch\");\n\t\t\tblue = (int) (Math.random() * (200 - 0));\n\t\t\tSystem.out.println(blue);\n\t\t\t// Find the highest score between bluePoints and redPoints\n\t\t\tmaxScore = (blue > maxScore) ? blue : maxScore;\n\t\t\t// Count which team has more score than the other one\n\t\t\tif (red > blue)\n\n\t\t\t\tcontRed++;\n\n\t\t\telse\n\n\t\t\t\tcontBlue++;\n\n\t\t}\n\t\tint option;\n\t\t// Try: Throw error if you introduce a String or Char instead Integer\n\t\ttry {\n\t\t\tdo {\n\t\t\t\tSystem.out.println(\"What ratio was the highest score? (1.0-50/2.50-100/3.100-150/4.150-200)\");\n\t\t\t\toption = scanner.nextInt();\n\t\t\t\t// Minigame to hit the ratio of highest score\n\t\t\t\tswitch (option) {\n\n\t\t\t\tcase 1: {\n\n\t\t\t\t\tif (maxScore >= 0 && maxScore < 50)\n\t\t\t\t\t\tSystem.out.println(\"You win, the highest score is: \" + maxScore);\n\t\t\t\t\telse\n\t\t\t\t\t\tSystem.out.println(\"Sorry, that's not the highest score\");\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tcase 2: {\n\t\t\t\t\tif (maxScore >= 50 && maxScore < 100)\n\t\t\t\t\t\tSystem.out.println(\"You win, the highest score is: \" + maxScore);\n\t\t\t\t\telse\n\t\t\t\t\t\tSystem.out.println(\"Sorry, that's not the highest score\");\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\t\t\t\tcase 3: {\n\t\t\t\t\tif (maxScore >= 100 && maxScore < 150)\n\t\t\t\t\t\tSystem.out.println(\"You win, the highest score is: \" + maxScore);\n\t\t\t\t\telse\n\t\t\t\t\t\tSystem.out.println(\"Sorry, that's not the highest score\");\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t\tcase 4: {\n\t\t\t\t\tif (maxScore >= 150 && maxScore <= 200)\n\t\t\t\t\t\tSystem.out.println(\"You win, the highest score is: \" + maxScore);\n\t\t\t\t\telse\n\t\t\t\t\t\tSystem.out.println(\"Sorry, that's not the highest score\");\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t\tdefault:\n\n\t\t\t\t\tSystem.err.println(\"Insert valid value\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} while (option > 4 || option < 1);\n\t\t} catch (Exception e) {\n\t\t\tSystem.err.println(\"Please, insert an Intenger value\");\n\t\t\tscanner.next();\n\t\t}\n\t\tSystem.out.println(\"The highest score was \" + maxScore);\n\n\t\tSystem.out.println(\"The match is over Blue: \" + contBlue + \" wins, y Red: \" + contRed + \" wins\");\n\t\t// Show which team won\n\t\tif (contRed > contBlue) {\n\n\t\t\tSystem.out.println(\"Red wins\");\n\t\t\tthis.redWins = contRed;\n\n\t\t} else {\n\n\t\t\tSystem.out.println(\"Blue wins\");\n\t\t\tthis.blueWins = contBlue;\n\n\t\t}\n\t}", "public BigDecimal getActualBidPrice() {\n return actualBidPrice;\n }", "public void findNearestDriver() {\n\t\tint currentDistance, driverX, driverY, pickupX, pickupY;\n\t\tpickupX = (int)this.currentRide.getPickup().getX();\n\t\tpickupY = (int)this.currentRide.getPickup().getY();\n\t\tfor(int i = 0; i < drivers.size(); i++) {\n\t\t\tdriverX = (int)this.drivers.get(i).getLocation().getX();\n\t\t\tdriverY = (int)this.drivers.get(i).getLocation().getY();\n\t\t\tcurrentDistance = (int) Math.sqrt(Math.pow((driverX - pickupX), 2) + Math.pow((driverY - pickupY),2));\n\t\t\tthis.drivers.get(i).setDistanceFromPassenger(currentDistance);\n\t\t}\n\t\tCollections.sort(this.drivers);\n\t\tif(this.drivers.get(0).getDistanceFromPassenger() == this.drivers.get(1).getDistanceFromPassenger()){\n\t\t\tif(drivers.get(0).getRating() < drivers.get(1).getRating()) {\n\t\t\t\tdrivers.set(0, drivers.get(1));\n\t\t\t}\n\t\t}\t\t\n\t}" ]
[ "0.6821758", "0.64601773", "0.63994557", "0.6207962", "0.6189005", "0.6110189", "0.60213387", "0.60171556", "0.60099864", "0.60006344", "0.59951586", "0.5980042", "0.59711933", "0.5943161", "0.5926772", "0.58967394", "0.58937114", "0.58649063", "0.58514833", "0.5826185", "0.5795967", "0.577607", "0.57703006", "0.57677317", "0.57317114", "0.57309586", "0.57277846", "0.57251215", "0.572286", "0.56729525", "0.56530285", "0.5639686", "0.5635261", "0.5611421", "0.5610175", "0.55941844", "0.5582939", "0.5577297", "0.55702674", "0.5568391", "0.555709", "0.5542241", "0.5487634", "0.54853183", "0.5473", "0.5461647", "0.5460468", "0.5459248", "0.5455422", "0.5452987", "0.54513973", "0.54472303", "0.54322296", "0.5431471", "0.5430275", "0.5408123", "0.54066664", "0.5400267", "0.53970975", "0.5396149", "0.53817594", "0.5378769", "0.5369134", "0.53573835", "0.53517485", "0.5343083", "0.53367037", "0.5320009", "0.5311854", "0.53109473", "0.53076345", "0.5297798", "0.5293201", "0.5292641", "0.5286552", "0.5282717", "0.5275543", "0.52718806", "0.5271684", "0.52586526", "0.5245092", "0.52450573", "0.524007", "0.5238638", "0.5236638", "0.5234941", "0.5229121", "0.5224759", "0.52142775", "0.5210773", "0.51979876", "0.51970863", "0.5196615", "0.519584", "0.51956296", "0.51946044", "0.5194418", "0.51904845", "0.5189286", "0.5186498" ]
0.7026436
0
get the best offer and check it matches the best simulated offer
@Test public void testGetBestOffer() { assertEquals("Best bid incorrect", sellOrder1, exchange.getBestOffer(stock)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Object getBest();", "private static int getAcceptDecision(Offer offer) {\n\t\treturn 0;\n\t}", "@Override\r\n public BidDetails determineNextBid() {\r\n\r\n double time = negotiationSession.getTime();\r\n\r\n // for the first 20% of the time, offer the bid which gives max utility\r\n if(time < Offer_Max_Util_Time){\r\n BidDetails maxBid = null;\r\n try {\r\n maxBid = this.outcomespace.getMaxBidPossible();\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n System.out.println(\"Exception: cannot generate max utility bid\");\r\n }\r\n return maxBid;\r\n\r\n }else {\r\n //compute the target utility based on time\r\n double utilityGoal = p(time);\r\n // if there is no opponent model available\r\n if (opponentModel instanceof NoModel) {\r\n // generate a Bid near the Utility we wish to have\r\n nextBid = negotiationSession.getOutcomeSpace().getBidNearUtility(utilityGoal);\r\n } else {\r\n // get the best Bid for the Opponent among a list of similarly preferred bids for our Agent\r\n // Then, make an offer with that bid\r\n nextBid = omStrategy.getBid(outcomespace, utilityGoal);\r\n }\r\n }\r\n return nextBid;\r\n }", "@Test\n\t\tpublic void testGetBestBid()\n\t\t{\n\t\t\tassertEquals(\"Best bid incorrect\", buyOrder2, exchange.getBestBid(stock));\n\t\t\t\n\t\t}", "public String getBestofferenabled() {\r\n return bestofferenabled;\r\n }", "@Override\r\n public int compare(BarterOffer o1, BarterOffer o2) {\r\n return Double.compare(o1.getBestBid(), o2.getBestBid());\r\n }", "private int computeBetterResponse(int player, GameObserver go) {\n int[] devOutcome = currentOutcome.clone();\n double aspirationPayoff = eGame.getPayoff(currentOutcome, player) + aspirationLevel;\n double bestPayoff = eGame.getPayoff(currentOutcome, player);\n int bestResponse = currentOutcome[player];\n\n ///System.out.println(\"Finding BR: \" + Arrays.toString(currentOutcome));\n\n // get the order in which to test best responses\n List<Integer> order = deviationTestOrder.getDeviationTestOrder(currentOutcome, player);\n\n// if (order.size() < nActs[player]-1) {\n// System.out.println(\"To few actions in order listing: \" + order.size());\n// }\n\n int itr = 0;\n for (int a : order) {\n // skip current action\n if (a == currentOutcome[player]) continue;\n devOutcome[player] = a;\n\n //System.out.println(\"Testing dev: \" + Arrays.toString(devOutcome));\n\n // check whether this profile is \"tabu\"\n if (tabu.getValue(devOutcome)) {\n //System.out.println(\"TABU\");\n continue;\n }\n\n // sample if necessary; flag not enough samples\n if (eGame.getNumSamples(devOutcome) == 0) {\n if (go.numObsLeft() <= 0) return NO_SAMPLES_FLAG;\n sampleAndUpdate(devOutcome, go);\n //System.out.println(\"SAMPLED\");\n }\n\n // check BR\n double devPayoff = eGame.getPayoff(devOutcome, player);\n\n// if (devPayoff > aspirationPayoff) {\n// //System.out.println(\"Aspiration met.\");\n// return a;\n// } else\n\n if (devPayoff > bestPayoff) {\n //System.out.println(\"Br, but not aspiration level\");\n bestPayoff = devPayoff;\n bestResponse = a;\n }\n\n itr++;\n if (itr > minDeviationsTested &&\n bestPayoff > aspirationPayoff) {\n return bestResponse;\n }\n\n }\n\n if (bestResponse != currentOutcome[player]) {\n //System.out.println(\"return non-aspiration BR\");\n return bestResponse;\n }\n //System.out.println(\"NO BR\");\n return NO_BR_FLAG;\n }", "public Hotel bestHotel() {\r\n \tArrayList<Hotel> hotels = hotelDAO.getHotelList();\r\n \tHotel bestHotel=hotels.get(0);\r\n \tfor (int i=0; i<hotels.size();i++) {\r\n \t\tif(averageBewertungHotel(bestHotel)<averageBewertungHotel(hotels.get(i))) {\r\n \t\t\tbestHotel=hotels.get(i);\r\n \t\t}\r\n \t}\r\n \treturn bestHotel;\r\n }", "@Test\n public void verifyNewOfferIsApplied() {\n \tProduct product = new Product(\"Watermelon\", 0.8);\n \tProduct product2 = new Product(\"Apple\", 0.2);\n \tProduct product3 = new Product(\"Orange\", 0.5);\n \tOffer offer = new Offer(product3, 5, product3.getPrice());\n \tConfigurations.offers.add(offer);\n \tBasket basket = new Basket();\n \tbasket.getProducts().put(product, 6);\n \tbasket.getProducts().put(product2, 4);\n \tbasket.getProducts().put(product3, 5);\n \tassertTrue(\"Have to get the price of 15 items = 5.6 ==> \", (calculator.calculatePrice(basket) - 5.6) < 0.0001);\n }", "Offer getOffer();", "public void findNearestDriver() {\n\t\tint currentDistance, driverX, driverY, pickupX, pickupY;\n\t\tpickupX = (int)this.currentRide.getPickup().getX();\n\t\tpickupY = (int)this.currentRide.getPickup().getY();\n\t\tfor(int i = 0; i < drivers.size(); i++) {\n\t\t\tdriverX = (int)this.drivers.get(i).getLocation().getX();\n\t\t\tdriverY = (int)this.drivers.get(i).getLocation().getY();\n\t\t\tcurrentDistance = (int) Math.sqrt(Math.pow((driverX - pickupX), 2) + Math.pow((driverY - pickupY),2));\n\t\t\tthis.drivers.get(i).setDistanceFromPassenger(currentDistance);\n\t\t}\n\t\tCollections.sort(this.drivers);\n\t\tif(this.drivers.get(0).getDistanceFromPassenger() == this.drivers.get(1).getDistanceFromPassenger()){\n\t\t\tif(drivers.get(0).getRating() < drivers.get(1).getRating()) {\n\t\t\t\tdrivers.set(0, drivers.get(1));\n\t\t\t}\n\t\t}\t\t\n\t}", "public static boolean bestResponse(ArrayList<Integer> moves, int player) {\n \n System.out.print(\"Player: \" + player + \" \");\n System.out.println(\" Current move: \" + moves.get(player) + \" \");\n int currentUtil = util.evaluate(moves).get(player);\n int bestUtil = 0;\n int currentMove = moves.get(player);\n int bestMove = currentMove;\n int nextUtil;\n \n for(int i = 0; i < 100; i++) {\n moves.set(player, i);\n if ((nextUtil = util.evaluate(moves).get(player)) > currentUtil) {\n if (nextUtil - currentUtil > bestUtil) {\n bestUtil = nextUtil - currentUtil;\n bestMove = i;\n }\n }\n }\n \n moves.set(player, bestMove);\n \n if(bestMove == currentMove)\n System.out.println(\"No better move...\");\n else System.out.println(\"Move found: \" + bestMove);\n \n return bestMove != currentMove;\n }", "FogOSBroker findBestFogOSBroker() {\n java.util.logging.Logger.getLogger(TAG).log(Level.INFO, \"Start: findBestFogOSBroker()\");\n\n Double rtt1 = 0.0;\n Double rtt2 = 0.0;\n try {\n Process process = Runtime.getRuntime().exec(\"/system/bin/ping -c 3 \" + brokers.get(0).getName());\n BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()));\n StringBuilder builder = new StringBuilder();\n String line;\n\n while ((line = reader.readLine()) != null) {\n builder.append(line);\n }\n String result1 = builder.toString();\n\n process = Runtime.getRuntime().exec(\"/system/bin/ping -c 3 \" + brokers.get(1).getName());\n reader = new BufferedReader(new InputStreamReader(process.getInputStream()));\n builder = new StringBuilder();\n\n while ((line = reader.readLine()) != null) {\n builder.append(line);\n }\n String result2 = builder.toString();\n\n rtt1 = getPingStats(result1);\n rtt2 = getPingStats(result2);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n java.util.logging.Logger.getLogger(TAG).log(Level.INFO, \"Finish: findBestFogOSBroker()\");\n\n if (rtt1 <= rtt2)\n return brokers.get(0);\n else\n return brokers.get(1);\n }", "private boolean checkGreedyWinRate() {\r\n return myTotal.get(0) > enTotal.get(0)+2 && (myself.health > 50 || myself.health > opponent.health);\r\n }", "public boolean setBestAvailable(int tickets) {\r\n\t\tTheaterSeat previous = null;\r\n\t\tdouble closeness = 9999;\r\n\t\tdouble tempCloseness = 9999;\r\n\t\tint middle = tickets / 2;\r\n\t\tint toRight;\r\n\t\tif (middle % 2 == 0) {\r\n\t\t\ttoRight = middle - 1;\r\n\t\t} else {\r\n\t\t\ttoRight = middle;\r\n\t\t}\r\n\t\t\r\n\t\tTheaterSeat current = getFirst();\r\n\t\t\r\n\t\tfor (int i=0; i<numRows; i++) {\r\n\t\t\tfor (int j=0; j< numCols - tickets; j++) {\r\n\t\t\t\t\r\n\t\t\t\r\n\t\t\t\tif (checkAvailability(i, (char)(j + 65), tickets)) {\r\n\t\t\t\t\tfor (int i1 = 0; i1<middle; i1++) {\r\n\t\t\t\t\t\tcurrent = current.getRight();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t//distance formula w/o square root to find relative distance from center\r\n\t\t\t\t\tdouble xSquared = Math.pow(numCols/2.0 - .5 -(int)(current.getSeat() - 65), 2);\r\n\t\t\t\t\tdouble ySquared = Math.pow(numRows/2.0 - .5 - (int)(current.getRow()), 2);\r\n\t\t\t\t\ttempCloseness = xSquared + ySquared;\r\n\t\t\t\t\tSystem.out.println(current.getRow());\r\n\t\t\t\t\tfor (int i1 = 0; i1<middle; i1++) {\r\n\t\t\t\t\t\tcurrent = current.getLeft();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tSystem.out.println(tempCloseness);\r\n\t\t\t\t\t\r\n\t\t\t\t\tif (tempCloseness < closeness) {\r\n\t\t\t\t\t\tcloseness = tempCloseness;\r\n\t\t\t\t\t\tcurrent.bestAvailable = true;\r\n\t\t\t\t\t\tif (previous != null)\r\n\t\t\t\t\t\t\tprevious.bestAvailable = false;\r\n\t\t\t\t\t\tprevious = current;\r\n\t\t\t\t\t} else if (tempCloseness == closeness) {\r\n\t\t\t\t\t\t//find closest row to center\r\n\t\t\t\t\t\tdouble newYDistanceSquare = Math.pow(current.getRow() - numRows/2.0 + .5, 2);\r\n\t\t\t\t\t\tdouble oldYDistanceSquare = Math.pow(previous.getRow() - numRows/2.0 + .5, 2);\r\n\t\t\t\t\t\tSystem.out.println(\"here\");\r\n\t\t\t\t\t\tSystem.out.println(newYDistanceSquare);\r\n\t\t\t\t\t\tSystem.out.println(oldYDistanceSquare);\r\n\t\t\t\t\t\t//favors lower row in case of tie (must be less than oldYDistanceSqaure)\r\n\t\t\t\t\t\tif (newYDistanceSquare < oldYDistanceSquare) {\r\n\t\t\t\t\t\t\tcloseness = tempCloseness;\r\n\t\t\t\t\t\t\tcurrent.bestAvailable = true;\r\n\t\t\t\t\t\t\tif (previous != null)\r\n\t\t\t\t\t\t\t\tprevious.bestAvailable = false;\r\n\t\t\t\t\t\t\tprevious = current;\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\t\t\r\n\t\t\t\t}\r\n\t\t\t\tcurrent = current.getRight();\r\n\t\t\t}\r\n\t\t\t//go back to the left and down a row\r\n\t\t\tfor (int i2 = 0; i2 < numCols - tickets; i2++) {\r\n\t\t\t\tcurrent = current.getLeft();\r\n\t\t\t}\r\n\t\t\tcurrent = current.getDown();\r\n\t\t}\r\n\t\tif (closeness == 9999) {\r\n\t\t\treturn false; //shows no seats passed the availability test (very high #)\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "private static StockItem searchForProductOffered(Collection<StockItem> offeredStockItems, ProductAmountTO currentRequiredProduct) {\t\n\t\tIterator<StockItem> stockItemIterator = offeredStockItems.iterator();\n\t\tStockItem currentStockItem;\n\t\twhile(stockItemIterator.hasNext()) {\n\t\t\tcurrentStockItem = stockItemIterator.next();\n\t\t\tProductTO productTO = FillTransferObjects.fillProductTO(currentStockItem.getProduct());\n\t\t\tif(productTO.equals(currentRequiredProduct.getProduct())) {\n\t\t\t\treturn currentStockItem;\n\t\t\t}\n\t\t}\t\t\n\t\t\n\t\treturn null;\n\t}", "public double getBestScore();", "private boolean searchOptimalBox(Secret secretA, Secret secretB) {\n\n\t\tArrayList<Time> timesA = secretA.getTimes();\n\t\tArrayList<Time> timesB = secretB.getTimes();\n\n\t\t// first step: search optimal box\n\t\tTimeline timeline = new Timeline(\"timeline-\" + FileId.getId() + \"-\" + secretA.getFileName() + \"-smaller-\" +secretB.getFileName() + \".png\");\n\t\tthis.timelines.add(timeline);\n\t\tthis.optimalBox = BoxTest.optimalBox(timesA, timesB, timeline);\n\n\t\tif(this.optimalBox[0] != 0 || this.optimalBox[1] != 0) { \t\n\t\t\t// if a optimal box found, there are significant different results!\n\t\t\tlogger.info(secretA.getName() + \" < \" + secretB.getName() + \": optimal box \" + optimalBox[0] + \"-\" + optimalBox[1]);\n\t\t\tplotPool.plot(\"Filtered Measurments: Optimal Box (\" + secretA.getName() + \"-\" + secretB.getName() + \")\", this.optimalBox[0], this.optimalBox[1]);\n\t\t\treturn true;\n\t\t} else {\n\t\t\t// there is no significant different result found! The user needs\n\t\t\t// to measure more times.\n\t\t\tlogger.warning(secretA.getName() + \" < \" + secretB.getName() + \": no significant different result found! You need to measure more times.\");\n\t\t\treturn false;\n\t\t}\n\t}", "public Fruit getnearFruit(boolean fast, int src){\n Iterator<Fruit> fruitsIter = allFruits.iterator();\n Graph_Algo algorithms = new Graph_Algo(Graph);\n node_data src_node = Graph.getNode(src);\n\n\n if (fruitsIter.hasNext()){\n\n Fruit near = fruitsIter.next();\n edge_data near_e = edgeOfFruit(near.getId());\n\n while (fruitsIter.hasNext()){\n Fruit current_fruit = fruitsIter.next();\n edge_data current_edge = edgeOfFruit(current_fruit.getId());\n\n double dist1 = algorithms.shortestPathDist(src, near_e.getDest());\n double dist2 = algorithms.shortestPathDist(src, current_edge.getDest());\n\n if (fast && (dist1 > dist2) ){\n near = current_fruit;\n }else{\n double nearFToSrc = near.getLocation().distance2D(src_node.getLocation());\n double currentFToSrc = current_fruit.getLocation().distance2D(src_node.getLocation());\n if (currentFToSrc < nearFToSrc){\n near = current_fruit;\n }\n }\n\n }\n return near;\n }\n return null;\n }", "private double[] chooseBestMove(List<double[]> possibleMoves) {\n double bestScore = 0;\n int indexBest = 0;\n for (int i = 0; i < possibleMoves.size(); i++) {\n if (possibleMoves.get(i)[4] > bestScore) {\n bestScore = possibleMoves.get(i)[4];\n indexBest = i;\n }\n }\n return possibleMoves.get(indexBest);\n }", "private void getBest()\n\t{\n\t\tSystem.out.println();\n\t\tSystem.out.println();\n\t\tSystem.out.println(bestTour + \" \" + bestScore);\n\t}", "private static Node auctionRound(Node bidder, Graph solution, Graph reference) {\n\t\tNode matchedNode = null;\n\t\tFloat bestValue = 0F;\n\n\t\tfor (Node seller : reference.getNodeListY()) {\n\t\t\tEdge edge = reference.getEdge(bidder.GetIndex(), seller.GetIndex()); // find edge\n\t\t\tFloat value = edge.GetWeight() - seller.getPrice();\n\n\t\t\tif (value > bestValue) {\n\t\t\t\tmatchedNode = seller;\n\t\t\t\tbestValue = value;\n\t\t\t}\n\t\t}\n\n\t\treturn matchedNode;\n\t}", "public void setNewFittedOffer(Offer offer){ \r\n\t\t//System.out.println(\"previous offer list size= \"+ this.FittedOffers.size());\r\n\t\tthis.FittedOffers.add(offer);\r\n\t\t//System.out.println(\"current offer list size= \"+ this.FittedOffers.size());\r\n\t}", "public int getOptimalNumNearest();", "private void declareWinner(){\r\n System.out.println(\"All proposals received\");\r\n AID best = proposals.get(0).getSender();\r\n for(ACLMessage proposal: proposals){\r\n String time = proposal.getContent().replaceFirst(\"bid\\\\(\", \"\");\r\n time = time.replaceFirst(\" sec\\\\)\", \"\");\r\n String bestTimeString = \r\n proposal.getContent().\r\n replaceFirst(\"bid\\\\(\", \"\").\r\n replaceFirst(\" sec\\\\)\", \"\");\r\n int bestTime = Integer.parseInt(bestTimeString);\r\n int propTime = Integer.parseInt(time);\r\n if (bestTime > propTime) {\r\n best = proposal.getSender();\r\n }\r\n }\r\n sendMessage(best, \"\", ACLMessage.ACCEPT_PROPOSAL);\r\n Object[] ob = new Object[2];\r\n ob[0] = best;\r\n ob[1] = currentPartial;\r\n expectedReturn.add(ob);\r\n System.out.println(\"Accepting proposal from \" + best.getLocalName());\r\n for(ACLMessage proposal: proposals){\r\n if(!proposal.getSender().equals(best)){\r\n sendMessage(proposal.getSender(), \"\", ACLMessage.REJECT_PROPOSAL);\r\n }\r\n }\r\n proposals.clear();\r\n solvables.remove(0);\r\n if(!solvables.isEmpty()){\r\n \r\n auctionJob(solvables.get(0));\r\n }\r\n }", "Move getBestMove() {\n //System.out.println(\"AI chooses: \" + m.toString());\n return moves.get((int) (Math.random() * moves.size()));\n }", "private static Theory bestTheory(Collection<Point> data, Collection<Theory> theories, GoodnessOfFitCalculator gofCalculator) {\r\n boolean first = true;\r\n double bestGoodnessOfFit = 0.0;\r\n Theory bestTheory = null;\r\n for (Theory theory : theories) {\r\n double gof = gofCalculator.goodnessOfFit(data, theory);\r\n if (first) {\r\n bestTheory = theory;\r\n bestGoodnessOfFit = gof;\r\n first = false; \r\n } else if (gof < bestGoodnessOfFit) {\r\n bestTheory = theory;\r\n bestGoodnessOfFit = gof;\r\n }\r\n }\r\n return bestTheory;\r\n }", "public int getBestPrice() {\n\t\treturn this.bestPrice;\n\t}", "public int chooseElevator() {\n\t\tPair<Integer,Direction> eleLoc;\n\t\tHashMap<Integer, Pair<Integer, Direction>> mapClone = map.getElevatorsData(); //get map of up to date elevator locations\n\t\tint distance;\n\t\tint minDist=9999;\n\t\tint choice = -1;\n\t\t//iterate over all elevators in the system\n\t\tfor(int i = 1;i<=Constants.elevator;i++) {\n\t\t\teleLoc = mapClone.get(i);//get elevators current system\n\t\t\tdistance =calculateDistance(eleLoc);\n\t\t\t//System.out.println(\"Elevator \" + i + \" is \" + distance + \" away from next job\");\n\t\t\t//if distance is optimal\n\t\t\tif(distance >=0 && distance <minDist) {\n\t\t\t\tchoice = i;\n\t\t\t\tminDist = distance;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn choice;\n\t}", "public Computer findMostExpensiveComputerV2( ) { \n\t\tComputer highest= computers.get(0);\n\t\tint index=1; \n\t\twhile (index<computers.size()){\n\t\t\tif (highest.getPrice()<computers.get(index).getPrice()) {\n\t\t\t\thighest= computers.get(index);\n\n\t\t\t}\n\t\t\tindex ++;\n\t\t}\n\t\treturn highest;\n\n\t}", "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 Individual getFittest(){\n Individual fittest = individuals.get(0);\n for (Individual individual: individuals){\n if(fittest.equals(individual)){\n continue;\n }\n else if(fittest.getFitness() < individual.getFitness()){\n fittest = individual;\n }\n }\n return fittest;\n }", "@Test\n public void testGetOffer() {\n \n assertNotNull(o1.getOffer());\n assertEquals(\"testOffer\", o1.getOffer());\n \n assertNull(o2.getOffer());\n }", "public Computer findMostExpensiveComputerV4( ) { \n\n\t\tComputer highest= computers.get(0);\n\t\tIterator<Computer> it= computers.iterator();\n\t\tComputer current=null; // a temporary copy of has.next() to perform multiple actions on it inside the loop\n\t\twhile(it.hasNext()) {\n\t\t\tcurrent=it.next();\n\t\t\tif (highest.getPrice()<current.getPrice()) \n\t\t\t\thighest=current;\n\n\n\t\t}\n\n\t\treturn highest;\n\n\t}", "public static ArrayList<PEPeer> getNextOptimisticPeers(ArrayList<PEPeer> all_peers, boolean factor_reciprocated, boolean allow_snubbed,\n int num_needed) {\n ArrayList<PEPeer> optimistics = new ArrayList<PEPeer>();\n for (int i = 0; i < all_peers.size(); i++) {\n PEPeer peer = all_peers.get(i);\n\n if (isUnchokable(peer, false) && peer.isChokedByMe()) {\n optimistics.add(peer);\n }\n }\n\n if (optimistics.isEmpty() && allow_snubbed) { // try again, allowing snubbed peers as last resort\n for (int i = 0; i < all_peers.size(); i++) {\n PEPeer peer = all_peers.get(i);\n\n if (isUnchokable(peer, true) && peer.isChokedByMe()) {\n optimistics.add(peer);\n }\n }\n }\n\n if (optimistics.isEmpty())\n return null; // no unchokable peers avail\n\n // factor in peer reciprocation ratio when picking optimistic peers\n\n ArrayList<PEPeer> result = new ArrayList<PEPeer>(optimistics.size());\n\n if (factor_reciprocated) {\n\n ArrayList<PEPeerTransport> ratioed_peers = new ArrayList<PEPeerTransport>(optimistics.size());\n long[] ratios = new long[optimistics.size()];\n Arrays.fill(ratios, Long.MIN_VALUE);\n\n // order by upload ratio\n for (int i = 0; i < optimistics.size(); i++) {\n PEPeer peer = optimistics.get(i);\n\n // score of >0 means we've uploaded more, <0 means we've downloaded more\n long score = peer.getStats().getTotalDataBytesSent() - peer.getStats().getTotalDataBytesReceived();\n\n UnchokerUtil.updateLargestValueFirstSort(score, ratios, peer, ratioed_peers, 0); // higher value = worse score\n }\n\n for (int i = 0; i < num_needed && ratioed_peers.size() > 0; i++) {\n\n double factor = 1F / (0.8 + 0.2 * Math.pow(RandomUtils.nextFloat(), -1)); // map to sorted list using a logistic curve\n\n int pos = (int) (factor * ratioed_peers.size());\n\n result.add(ratioed_peers.remove(pos));\n }\n } else {\n\n for (int i = 0; i < num_needed && optimistics.size() > 0; i++) {\n\n int rand_pos = new Random().nextInt(optimistics.size());\n\n result.add(optimistics.remove(rand_pos));\n }\n }\n\n return (result);\n\n // TODO:\n // in downloading mode, we would be better off optimistically unchoking just peers we are interested in ourselves,\n // as they could potentially reciprocate. however, new peers have no pieces to share, and are not interesting to\n // us, and would never be unchoked, and thus would never get any data.\n // we could use a deterministic method for new peers to get their very first piece from us\n }", "Object getWorst();", "public FishingRod getBestRod();", "private boolean findNextAvailableAgent(ArrayList<IAgent> arrayList) {\n\n for (IAgent agent : arrayList) {\n try {\n if (agent.checkIfOnSpawn()) {\n return false;\n }\n } catch (RemoteException e) {\n return false;\n }\n }\n\n for (IAgent agent : arrayList) {\n try {\n if (arrayList.size() < Integer.parseInt(String.valueOf(dialog.getCountAgents().getSelectedItem()))) {\n if (iPlayerList.get(agent.getName()).getPoints() >= agentsValue) {\n for (int[] spawn : playingField.getSpawnFields()) {\n if (playingField.requestField(spawn[0], spawn[1])) {\n IAgent newAgent = new AgentImpl(agent.getName(), agent.getStrategy(), playingField);\n newAgent.setColor(agent.getColor());\n newAgent.setPosx(spawn[0]);\n newAgent.setPosy(spawn[1]);\n newAgent.setCapacity(Integer.parseInt(dialog.getCapacityField().getText()));\n newAgent.getRememberField().setiPlayerList(playingField.getiPlayerList());\n playingField.setOccupancy(spawn[0], spawn[1], newAgent);\n ArrayList<IAgent> templist = new ArrayList<>();\n for (IAgent list : playersAgentsMap.get(agent.getName())) {\n templist.add(list);\n }\n templist.add(newAgent);\n playersAgentsMap.put(agent.getName(), templist);\n iPlayerList.get(agent.getName()).setPoints(iPlayerList.get(agent.getName()).getPoints() - agentsValue);\n return true;\n }\n\n }\n\n }\n }\n } catch (RemoteException e) {\n System.out.println(e.getMessage());\n return false;\n }\n }\n return false;\n\n }", "@Test\n void testForLargestCardInTrick() {\n Dealer testDealer = new Dealer();\n\n Suit suit1 = Suit.DIAMONDS;\n Suit suit2 = Suit.SPADES;\n Suit suit3 = Suit.SPADES;\n Suit suit4 = Suit.DIAMONDS;\n \n Rank rank1 = Rank.TWO;\n Rank rank2 = Rank.KING;\n Rank rank3 = Rank.ACE;\n Rank rank4 = Rank.FIVE;\n\n Card card1 = new Card(suit1,rank1,false);\n Card card2 = new Card(suit2,rank2,false);\n Card card3 = new Card(suit3,rank3,false);\n Card card4 = new Card(suit4,rank4,false);\n\n \n testDealer.addToPlayedCards(card1);\n testDealer.addToPlayedCards(card2);\n testDealer.addToPlayedCards(card3);\n testDealer.addToPlayedCards(card4);\n\n assertEquals(card4 , testDealer.getLargestCardFromTrick());\n }", "public static boolean getAnswer(Player player, double bid, Library library, TransferList existingTransfers) {\n\t\tTeam team = library.getTeamForName(player.getTeam());\n\t\tArrayList<Player> playerlist = new ArrayList<Player>();\n\t\tfor (int i=0;i<team.getTeam().size();i++) {\n\t\t\tif (player.getPlayerType().equals(team.getTeam().get(i).getPlayerType())) {\n\t\t\t\tplayerlist.add(team.getTeam().get(i));\n\t\t\t}\n\t\t}\n\t\tint[] ratings = new int[playerlist.size()];\n\t\tif(player.getPlayerType().equals(\"Attacker\")) {\n\t\t\tfor (int i=0;i<playerlist.size();i++) {\n\t\t\t\tFieldPlayer p = (FieldPlayer)playerlist.get(i);\n\t\t\t\tratings[i]= (int) (0.6*p.getFinishingValue() + 0.2*p.getDribblingValue() + 0.2*p.getStaminaValue());\n\t\t\t}\n\t\t} if (player.getPlayerType().equals(\"Midfielder\")) {\n\t\t\tfor (int i=0;i<playerlist.size();i++) {\n\t\t\t\tFieldPlayer p = (FieldPlayer)playerlist.get(i);\n\t\t\t\tratings[i]=(int) (0.15*p.getFinishingValue() + 0.4*p.getDribblingValue() + 0.3*p.getStaminaValue() + 0.15*p.getDefenseValue());\n\t\t\t\t\n\t\t\t}\n\t\t} if (player.getPlayerType().equals(\"Defender\")) {\n\t\t\tfor (int i=0;i<playerlist.size();i++) {\n\t\t\t\tFieldPlayer p = (FieldPlayer)playerlist.get(i);\n\t\t\t\tratings[i]=(int) (0.05*p.getDribblingValue() + 0.25*p.getStaminaValue() + 0.7*p.getDefenseValue());\n\t\t\t\t\n\t\t\t}\n\t\t} if (player.getPlayerType().equals(\"Goalkeeper\")) {\n\t\t\tfor (int i=0;i<playerlist.size();i++) {\n\t\t\t\tGoalkeeper p = (Goalkeeper)playerlist.get(i);\n\t\t\t\tratings[i]=p.getGoalkeeperValue();\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (playerlist.size()==1) {\n\t\t\t\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tint playerid=playerlist.indexOf(player);\n\t\tint typecounter=1;\n\t\tfor (int i=0;i<ratings.length;i++) {\n\t\t\tif (i==playerid) {\n\t\t\t\t\n\t\t\t} else {\n\t\t\t\tif (ratings[playerid]<ratings[i]) {\n\t\t\t\t\ttypecounter++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tint random = GameLogic.randomGenerator(1, 100);\n\t\tdouble percentage = bid/player.getPrice().doubleValue()*100-100;\n\t\tif (typecounter==1||typecounter==2) {\n\t\t\tif(percentage<0) {\n\t\t\t\treturn false;\n\t\t\t\t\n\t\t\t} if (percentage>=0 && percentage<5) {\n\t\t\t\tif (random<=10) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else return false;\n\t\t\t\t\n\t\t\t\t\n\t\t\t} if (percentage>=5 && percentage<10) {\n\t\t\t\tif (random<=20) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else return false;\n\t\t\t} if (percentage>=10 && percentage<15) {\n\t\t\t\tif (random<=30) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else return false;\n\t\t\t} if (percentage>=15 && percentage<20) {\n\t\t\t\tif (random<=40) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else return false;\n\t\t\t} if (percentage>=20 && percentage<25) {\n\t\t\t\tif (random<=50) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else return false;\n\t\t\t} if (percentage>=25 && percentage<30) {\n\t\t\t\tif (random<=75) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else return false;\n\t\t\t} else return true;\n\t\t} if (typecounter==3 || typecounter==4 || typecounter==5) {\n\t\t\tif (percentage<-10) {\n\t\t\t\treturn false;\n\t\t\t} if (percentage>=-10 && percentage<0) {\n\t\t\t\tif (random<=5) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else return false;\n\t\t\t} if (percentage>=0 && percentage <5) {\n\t\t\t\tif (random<=15) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else return false;\n\t\t\t} if (percentage>=5 && percentage<10) {\n\t\t\t\tif (random<=30) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else return false;\n\t\t\t} if (percentage>=10 && percentage<15) {\n\t\t\t\tif (random<=45) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else return false;\n\t\t\t} if (percentage>=15 && percentage<20) {\n\t\t\t\tif (random<=60) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else return false;\n\t\t\t} if (percentage>=20 && percentage<25) {\n\t\t\t\tif (random<=80) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else return false;\n\t\t\t} else return true;\n\t\t} else {\n\t\t\tif (percentage<-10) {\n\t\t\t\treturn false;\n\t\t\t} if (percentage>=-10 && percentage<0) {\n\t\t\t\tif (random<=20) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else return false;\n\t\t\t} if (percentage>=0 && percentage<5) {\n\t\t\t\tif (random<=45) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else return false;\n\t\t\t} if (percentage>=5 && percentage<10) {\n\t\t\t\tif (random<=70) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else return false;\n\t\t\t} if (percentage>=10 && percentage<15) {\n\t\t\t\tif (random<=85) {\n\t\t\t\t\treturn true;\n\t\t\t\t} else return false;\n\t\t\t} else return true;\n\t\t}\n\t\t\n\t\t\n\t}", "@Test\n public final void testSmallerThanMax() {\n for (ArrayList<TradeGood> planetsGoods : goods) {\n for (TradeGood good : planetsGoods) {\n assertTrue(good.getPrice() < good.type.mhl);\n }\n }\n }", "@Test\n void testForLargestCardInTrickComparingRank() {\n Dealer testDealer = new Dealer();\n\n Suit suit1 = Suit.DIAMONDS;\n Suit suit2 = Suit.SPADES;\n Suit suit3 = Suit.DIAMONDS;\n Suit suit4 = Suit.DIAMONDS;\n \n Rank rank1 = Rank.TWO;\n Rank rank2 = Rank.KING;\n Rank rank3 = Rank.ACE;\n Rank rank4 = Rank.FIVE;\n\n Card card1 = new Card(suit1,rank1,false);\n Card card2 = new Card(suit2,rank2,false);\n Card card3 = new Card(suit3,rank3,false);\n Card card4 = new Card(suit4,rank4,false);\n\n \n testDealer.addToPlayedCards(card1);\n testDealer.addToPlayedCards(card2);\n testDealer.addToPlayedCards(card3);\n testDealer.addToPlayedCards(card4);\n\n assertEquals(card3 , testDealer.getLargestCardFromTrick());\n }", "@Override\n public Action chooseAction(List<Class<? extends Action>> possibleActions)\n {\n // if receive a offer from opponent\n if (null != lastOffer) {\n\n // check whether choose acceptance\n Action action = acceptanceStrategy.handleOfferFromOpponent(lastOffer);\n\n if (null != action) {\n return action;\n }\n }\n\n // if we offer first or we can not accept offer from opponent, deliver to offering strategy\n return offeringStrategy.offer(opponentModelInterface);\n }", "public boolean offerFirst(E item);", "@Override\r\n public ElementSet nextBestSet() {\r\n \r\n ElementSet bestSet = null; //initialze variables\r\n int countBest = 0;\r\n double bestScore = Double.MAX_VALUE; //arbitrarly large number CHECK ME\r\n int count = 0;\r\n double score = 0;\r\n \r\n for (ElementSet s : _copyModel.getElements()) { //go through all sets in the model\r\n count = 0; //reset count and score for each set\r\n score = 0;\r\n for (Integer i : s.getSet()) {\r\n if(_uncoveredElements.contains(i)) { //get number of covered elements\r\n count++;\r\n } \r\n }\r\n if (count != 0) { //if it contains an element\r\n score = s.getCost() / (double)count; //compute the ratio of cost per element covered\r\n if (score < bestScore) { //if score is better than best score \r\n countBest = count;\r\n bestScore = score;\r\n bestSet = s;\r\n }\r\n }\r\n }\r\n \r\n if (bestSet == null) //if no set was chosen return null\r\n return null;\r\n \r\n _copyModel.getElements().remove(bestSet); //remcoe the chosen set from the model\r\n GreedySolver.printChosenSet(bestSet); //print the chosen set\r\n \r\n return bestSet;\r\n }", "public void computeWinnerDeterminationSW()\r\n\t{\r\n\t\tif( _plans.size() == 0)\r\n\t\t{\r\n\t\t\t_allocation = new AllocationWoD();\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\t_randGenerator.setSeed(_seed);\r\n\t\t\r\n\t\tdouble maxExpectedSW = 0.;\r\n\t\tint itsIdx = -1;\r\n\t\tint itsAtom = -1;\r\n\t\tfor(int i = 0; i < _plans.size(); ++i)\t\t\t\t\t\t\t\t\t// for every buyer\r\n\t\t\tfor(int j = 0; j < _plans.get(i).getNumberOfAtoms(); ++j)\t\t\t// for every plan he has value for\r\n\t\t\t{\r\n\t\t\t\tComplexSemanticWebType plan = (ComplexSemanticWebType)(_plans.get(i).getAtom(j));\r\n\t\t\t\t\r\n\t\t\t\tif(_paymentRule.equals(\"SecondPrice\"))\r\n\t\t\t\t\tplan.resolveWithSecondPrice();\r\n\t\t\t\telse if(_paymentRule.equals(\"FirstPrice\"))\r\n\t\t\t\t\tplan.resolveWithFirstPrice();\r\n\t\t\t\telse throw new RuntimeException(\"Cannot resolve the type: \" + _paymentRule);\r\n\t\t\t\t\r\n\t\t\t\tdouble expectedSW = plan.computeExpectedValue() - plan.computeExpectedTotalCost();\r\n\t\t\t\t\r\n\t\t\t\tif( expectedSW >= maxExpectedSW )\r\n\t\t\t\t{\r\n\t\t\t\t\tmaxExpectedSW = expectedSW;\r\n\t\t\t\t\titsIdx = i;\r\n\t\t\t\t\titsAtom = j;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t_allocation = new AllocationWoD();\r\n\r\n\t\tif(itsIdx >= 0)\r\n\t\t{\r\n\t\t\tList<Integer> allocatedBundles = new LinkedList<Integer>();\r\n\t\t\tallocatedBundles.add(itsAtom);\r\n\t\t\ttry\r\n\t\t\t{\r\n\t\t\t\tComplexSemanticWebType plan = (ComplexSemanticWebType)(_plans.get( itsIdx ).getAtom( itsAtom ));\r\n\t\t\t\t\r\n\t\t\t\tList<Integer> actuallyAllocatedTuples = new LinkedList<Integer>();\r\n\t\t\t\tfor(int i = 0; i < plan.getNumberOfFragments(); ++i)\r\n\t\t\t\t\tactuallyAllocatedTuples.add( plan.getMinNumberOfRecords(i) + _randGenerator.nextInt(plan.getMaxNumberOfRecords(i) - plan.getMinNumberOfRecords(i)) );\r\n\r\n\t\t\t\tif(plan.getAllocatedSellers().size() < 1)\r\n\t\t\t\t\tthrow new RuntimeException(\"No sellers in plan: \" + plan.toString());\r\n\t\t\t\t\r\n\t\t\t\tplan.setActuallyAllocatedRecords(actuallyAllocatedTuples);\r\n\t\t\t\tList<Integer> sellersInvolved = plan.getAllocatedSellers();\r\n\t\t\t\t\r\n\t\t\t\tList<ComplexSemanticWebType> allocatedPlans = new LinkedList<ComplexSemanticWebType>();\r\n\t\t\t\tallocatedPlans.add(plan);\r\n\t\t\t\t\r\n\t\t\t\t_allocation.addAllocatedAgent(plan.getAgentId(), sellersInvolved, allocatedBundles,\r\n\t\t\t\t\t\t\t\t\t\t\t plan.computeExpectedValue(), plan.computeExpectedCosts());\r\n\t\t\t\t_allocation.addAllocatedPlans(allocatedPlans, true);\r\n\t\t\t}\r\n\t\t\tcatch (Exception e)\r\n\t\t\t{\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private static Company best_price(long input) {\n\t\tif(all_prices.isEmpty()) { //if no company was successfully parsed/empty file\n\t\t\tCompany temp = new Company(\"Empty\",new TreeMap<Long,Double>(),0,Long.MAX_VALUE,Double.MAX_VALUE);\n\t\t\treturn temp;\n\t\t}\n\t\t\n\t\tfor(int i=0; i<all_prices.size(); i++) { //for each operator\n\t\t\tCompany operatr = all_prices.elementAt(i);\n\t\t\tMap<Long,Double> operator_price_map = operatr.getPrices(); //take its ext to price map\n\t\t\t//find which extension is the longest for a certain operator.\n\t\t\t//in so doing we are able cut the input number's digit search\n\t\t\t//to the longest extension (in terms of number of digits) available \n\t\t\tint longest_extension_digits = operatr.getMost_digits_ext(); \n\t\t\tString str_input = String.valueOf(input);\n\t\t\tfor(int j=longest_extension_digits; j>0; j--) { //going from longest possible substring of input num for an operator\n\t\t\t\tString input_digit_substring = str_input.substring(0, j);\n\t\t\t\tlong digit_prefix = Long.valueOf(input_digit_substring);\n\t\t\t\tif (operator_price_map.containsKey(digit_prefix)) { //if the operator has a match with the number, we terminate search because the longest possible extension has been chosen\n\t\t\t\t\toperatr.setLongest_matching_extension(digit_prefix);\n\t\t\t\t\toperatr.setMatching_price(operator_price_map.get(digit_prefix));\n\t\t\t\t\tbreak; //break because we want to prioritize the longest extension that matches\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tCollections.sort(all_prices, new CompanyComparator());\n\t\t\n\t\tCompany result = all_prices.elementAt(0);\n\t\treturn result;\n\t}", "E getBestIncoming();", "private void findBest()\r\n\t{\r\n\t\tint i;\r\n\t\tint size_mature_pool;\r\n\t\tint idx_current;//index of a currently checked genotype\r\n\t\tint num_errors;//number of errors of the current chromosome\r\n\t\tdouble min_error;//smallest error among the oldest genotypes\r\n\t\tVector<Integer> idx_oldest;\r\n\t\t\r\n\t\tsize_mature_pool = _pool_of_bests.size();\r\n\t\t\r\n\t\tidx_oldest = new Vector<Integer>(0, 1);\r\n\t\t\r\n\t\t//find all oldest genotypes\r\n\t\tfor(i=0; i<size_mature_pool; i++)\r\n\t\t{\r\n\t\t\tnum_errors = _pool_of_bests.get(i)._error.all_single_squares.size();\r\n\t\t\tif(num_errors>=_min_life_span)\r\n\t\t\t{\r\n\t\t\t\tidx_oldest.add(i);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t//find the best oldest gentypes with a span above a threshold\r\n\t\t_best_idx = -1;\r\n\t\tif(idx_oldest.size() > 0)\r\n\t\t{\r\n\t\t\t_best_idx = idx_oldest.get(0);\r\n\t\t\tmin_error = _pool_of_bests.get(_best_idx)._error.getAverageError();\r\n\t\t\tfor(i=1; i<idx_oldest.size(); i++)\r\n\t\t\t{\r\n\t\t\t\tidx_current = idx_oldest.get(i);\r\n\t\t\t\tif(min_error > _pool_of_bests.get(idx_current)._error.getAverageError())\r\n\t\t\t\t{\r\n\t\t\t\t\t_best_idx = idx_current;\r\n\t\t\t\t\tmin_error = _pool_of_bests.get(_best_idx)._error.getAverageError();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public Computer findMostExpensiveComputerV1( ) { \n\t\tComputer highest= computers.get(0);\n\t\tfor (int index=1; index<computers.size();index++){\n\t\t\tif (highest.getPrice()<computers.get(index).getPrice()) {\n\t\t\t\thighest= computers.get(index);\n\n\t\t\t}\n\t\t}\n\t\treturn highest;\n\t}", "public boolean isUsingBestScore() {\n return usingBestScore;\n }", "@Override\n public boolean offer(Object o) {\n\n // Rank is extracted from the header\n Packet packet = (Packet) o;\n PriorityHeader header = (PriorityHeader) packet;\n int rank = (int)header.getPriority();\n\n this.reentrantLock.lock();\n boolean returnValue = false;\n try {\n\n // Keep track of the current queue bounds (Figure 13a in the SP-PIFO paper)\n for (int q=queueList.size()-1; q>=0; q--){\n if(SimulationLogger.hasQueueBoundTrackingEnabled()){\n SimulationLogger.logQueueBound(this.ownId, q, (int)queueBounds.get(q));\n }\n }\n\n // Aggregate adaptation parameters\n int currentQueueBound, currentQueueBoundPlus, currentQueueBoundMinus;\n int QLm, QLh, QLmplus, QLmminus, sumA1, sumA2, sumB1, sumB2;\n\n // SP-PIFO queue scanning process\n for (int q=queueList.size()-1; q>=0; q--){\n currentQueueBound = (int)queueBounds.get(q);\n if ((currentQueueBound <= rank) || q==0) {\n boolean result = queueList.get(q).offer(o);\n\n if (!result){\n // System.out.println(\"Greedy: Packet with rank \" + rank + \" has been dropped from queue \" + q + \".\");\n returnValue = false;\n break;\n } else {\n\n // Update general counter\n this.generalPacketCounter = this.generalPacketCounter + 1;\n\n // We compute the perceived rank\n Object[] contentPIFO = queueList.get(q).toArray();\n Arrays.sort(contentPIFO);\n Packet packet_maxrank = (Packet) contentPIFO[0];\n PriorityHeader header_maxrank = (PriorityHeader) packet_maxrank;\n int rank_perceived = (int)header_maxrank.getPriority();\n if (rank_perceived > rank){\n this.unpifoness = this.unpifoness + (rank_perceived - rank);\n }\n\n // IMPORTANT: If packet enqueued here, means that QLm <= rank < QLh\n // Packet enqueued, we update counters, and return true\n if (q==queueList.size()-1){\n QLh = rank_bound;\n QLm = (int)this.queueBounds.get(q);\n } else {\n QLh = (int)this.queueBounds.get(q+1);\n QLm = (int)this.queueBounds.get(q);\n }\n\n // To consider non continuous rank distributions, we have to keep track of the Qm+1 and Qh-1 ranks per each queue\n // This way we are sure that the boundary move we are analyzing will not be an empty rank\n currentQueueBoundPlus = (int)this.queueBoundsPlus.get(q);\n if (rank > QLm && rank < currentQueueBoundPlus){\n this.queueBoundsPlus.put(q, rank);\n }\n\n // Update counters per queue\n Object currentPackets = countersB21.get(q);\n if (currentPackets == null){\n countersB21.put(q, rank);\n } else {\n countersB21.put(q, (int)currentPackets+rank);\n }\n\n currentPackets = countersB22.get(q);\n if (currentPackets == null){\n countersB22.put(q, 1);\n } else {\n countersB22.put(q, (int)currentPackets+1);\n }\n\n if (rank != QLm){\n currentPackets = countersA21.get(q);\n if (currentPackets == null){\n countersA21.put(q, rank);\n } else {\n countersA21.put(q, (int)currentPackets+rank);\n }\n\n currentPackets = countersA22.get(q);\n if (currentPackets == null){\n countersA22.put(q, 1);\n } else {\n countersA22.put(q, (int)currentPackets+1);\n }\n }\n\n if (q!=queueList.size()-1){\n\n currentQueueBoundMinus = (int) this.queueBoundsMinus.get(q + 1);\n if (rank > currentQueueBoundMinus) {\n this.queueBoundsMinus.put(q + 1, rank);\n }\n\n currentPackets = countersA11.get(q+1);\n if (currentPackets == null){\n countersA11.put(q+1, importance(rank));\n } else {\n countersA11.put(q+1, (int)currentPackets+importance(rank));\n }\n\n currentPackets = countersA12.get(q+1);\n if (currentPackets == null){\n countersA12.put(q+1, (importance(rank))*rank);\n } else {\n countersA12.put(q+1, (int)currentPackets+(importance(rank))*rank);\n }\n\n if(rank != (int)this.queueBoundsMinus.get(q+1)){\n currentPackets = countersB11.get(q+1);\n if (currentPackets == null){\n countersB11.put(q+1, importance(rank));\n } else {\n countersB11.put(q+1, (int)currentPackets+importance(rank));\n }\n\n currentPackets = countersB12.get(q+1);\n if (currentPackets == null){\n countersB12.put(q+1, (importance(rank))*rank);\n } else {\n countersB12.put(q+1, (int)currentPackets+(importance(rank))*rank);\n }\n }\n }\n\n returnValue = true;\n break;\n }\n }\n }\n\n // When the threshold is reached, aggregate adaptation is considered based on the values in counters\n if(this.generalPacketCounter == 1000) {\n\n // Each queue bound expected unpifoness is compared to the one achieved by moving the boundaries\n for(int i=queueBounds.size()-1; i>0; i--){\n\n // Obtain the values of adjacent ranks to analyze\n QLm = (int)this.queueBounds.get(i);\n QLmplus = (int)this.queueBoundsPlus.get(i);\n QLmminus = (int)this.queueBoundsMinus.get(i);\n\n sumA1 = ((QLm) * (int)countersA11.get(i)) - (int)countersA12.get(i);\n sumA2 = (importance(QLm) * (int)countersA21.get(i)) - (importance(QLm) * (QLm) * (int)countersA22.get(i));\n\n if (i==(queueBounds.size()-1)){\n if ((sumA1 < sumA2) && (QLmplus != (int)this.rank_bound)){\n if (!this.fixQueueBounds){\n this.queueBounds.put(i, QLmplus);\n }\n } else {\n\n sumB1 = ((QLmminus) * (int)countersB11.get(i)) - (int)countersB12.get(i);\n sumB2 = (importance(QLmminus) * (int)countersB21.get(i)) - (importance(QLmminus) * (QLmminus) * (int)countersB22.get(i));\n\n if ((sumB1 > sumB2) && (QLmminus != (int)this.queueBounds.get(i-1))){\n if (!this.fixQueueBounds){\n this.queueBounds.put(i, QLmminus);\n }\n }\n }\n } else {\n if ((sumA1 < sumA2) && (QLmplus != (int)this.queueBounds.get(i+1))){\n if (!this.fixQueueBounds){\n this.queueBounds.put(i, QLmplus);\n }\n } else {\n\n sumB1 = ((QLmminus) * (int)countersB11.get(i)) - (int)countersB12.get(i);\n sumB2 = (importance(QLmminus) * (int)countersB21.get(i)) - (importance(QLmminus) * (QLmminus) * (int)countersB22.get(i));\n\n if ((sumB1 > sumB2) && (QLmminus != (int)this.queueBounds.get(i-1))){\n if (!this.fixQueueBounds){\n this.queueBounds.put(i, QLmminus);\n }\n }\n }\n }\n\n }\n\n // Reset the counters for the next iteration\n this.queueBoundsPlus.clear();\n this.queueBoundsMinus.clear();\n this.generalPacketCounter = 0;\n this.countersA11.clear();\n this.countersA12.clear();\n this.countersA21.clear();\n this.countersA22.clear();\n this.countersB11.clear();\n this.countersB12.clear();\n this.countersB21.clear();\n this.countersB22.clear();\n for (int i=0; i<queueList.size(); i++){\n countersA11.put(i,0);\n countersA12.put(i,0);\n countersA21.put(i,0);\n countersA22.put(i,0);\n countersB11.put(i,0);\n countersB12.put(i,0);\n countersB21.put(i,0);\n countersB22.put(i,0);\n }\n\n // Reinitialize the adjacent rank values based on the updated queue bounds\n for (int q=0; q<queueList.size(); q++){\n if (q==queueList.size()-1){\n this.queueBoundsPlus.put(q,this.rank_bound);\n this.queueBoundsMinus.put(q,this.queueBounds.get(q-1));\n } else if (q==0){\n this.queueBoundsPlus.put(q,this.queueBounds.get(q+1));\n this.queueBoundsMinus.put(q,0);\n } else{\n this.queueBoundsPlus.put(q,this.queueBounds.get(q+1));\n this.queueBoundsMinus.put(q,this.queueBounds.get(q-1));\n }\n }\n }\n\n } catch (Exception e){\n System.out.println(\"Exception: \" + e.getMessage());\n e.printStackTrace();\n } finally {\n this.reentrantLock.unlock();\n // System.out.println(\"Packet with rank \" + rank + \"enqueued_flag\" + returnValue);\n return returnValue;\n }\n }", "public NeuralPlayer[] bestIndividual(boolean recalculate)\n\t{\n\t\tif (recalculate)\n\t\t{\n\t\t\tCollection<Callable<Integer>> tasks = new ArrayList<Callable<Integer>>(numThreads);\n\t\t\t\n\t\t\tfor (int i = 0 ; i < hosts.length; i+=partition)\n\t\t\t{\n\t\t\t\tCallable<Integer> worker = new fitnessCalculator(i,Math.min(i+partition,hosts.length),true);\n\t\t\t\ttasks.add(worker);\n\t\t\t}\n\t\t\ttry\n\t\t\t{\n\t\t\t\texecutor.invokeAll(tasks);\n\t\t\t}\n\t\t\tcatch (Exception e)\n\t\t\t{\n\t\t\t\tSystem.out.println(\"Something bad happened...\");\n\t\t\t\tSystem.exit(-1);\n\t\t\t}\n\t\t\tArrays.sort(hRandFitnesses,new ArrayComparator(1,false));\n\t\t\tArrays.sort(pRandFitnesses,new ArrayComparator(1,false));\n\t\t\tdouble bestScore = hRandFitnesses[0][1];\n\t\t\tdouble bestIndex = hRandFitnesses[0][0];\n\t\t\t\n\t\t\tif (bestScore >= bestHost)\n\t\t\t{\n\t\t\t\tif (bestScore == 100)\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(\"WE HAVE A PERFECT HOST\");\n\t\t\t\t\tSystem.out.println(\"WE HAVE A PERFECT HOST\");\n\t\t\t\t\tReversiBoard b = new ReversiBoard(boardSize);\n\t\t\t\t\tRandomPlayer r = new RandomPlayer(-1, \"Mr Random\");\n\t\t\t\t\tGame gg = new Game(hosts[(int)bestIndex],r,b);\n\t\t\t\t\tdouble score1 = gg.playGames(1000,false)[0];\n\t\t\t\t\t\n\t\t\t\t\tgg = new Game(allTimeBestHost,r,b);\n\t\t\t\t\tdouble score2 = gg.playGames(1000,false)[0];\n\t\t\t\t\t\n\t\t\t\t\tif (score1 >= score2)\n\t\t\t\t\t{\n\t\t\t\t\t\tbestHost = bestScore;\n\t\t\t\t\t\tallTimeBestHost = new NeuralPlayer(1,\"Da best H\",(BasicNetwork)hosts[(int)bestIndex].net.clone());\n\t\t\t\t\t}\n\t\t\t\t\tperfectHosts.add(new NeuralPlayer(1,\"A good H\",(BasicNetwork)hosts[(int)bestIndex].net.clone()));\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\tbestHost = bestScore;\n\t\t\t\t\tallTimeBestHost = new NeuralPlayer(1,\"Da best H\",(BasicNetwork)hosts[(int)bestIndex].net.clone());\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tbestScore = pRandFitnesses[0][1];\n\t\t\tbestIndex = pRandFitnesses[0][0];\n\t\t\t\n\t\t\tif (bestScore >= bestPara)\n\t\t\t{\n\t\t\t\tif (bestScore == 100)\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(\"WE HAVE A PERFECT PARASITE\");\n\t\t\t\t\tSystem.out.println(\"WE HAVE A PERFECT PARASITE\");\n\t\t\t\t\tReversiBoard b = new ReversiBoard(boardSize);\n\t\t\t\t\tRandomPlayer r = new RandomPlayer(1, \"Mr Random\");\n\t\t\t\t\tGame gg = new Game(r,parasites[(int)bestIndex],b);\n\t\t\t\t\tdouble score1 = gg.playGames(1000,false)[1];\n\t\t\t\t\t\n\t\t\t\t\tgg = new Game(allTimeBestPara,r,b);\n\t\t\t\t\tdouble score2 = gg.playGames(1000,false)[1];\n\t\t\t\t\t\n\t\t\t\t\tif (score1 >= score2)\n\t\t\t\t\t{\n\t\t\t\t\t\tbestPara = bestScore;\n\t\t\t\t\t\tallTimeBestPara = new NeuralPlayer(-1,\"Da best P\",(BasicNetwork)parasites[(int)bestIndex].net.clone());\n\t\t\t\t\t}\n\t\t\t\t\tperfectParasites.add(new NeuralPlayer(-1,\"A good P\",(BasicNetwork)parasites[(int)bestIndex].net.clone()));\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tbestPara = bestScore;\n\t\t\t\t\tallTimeBestPara = new NeuralPlayer(-1,\"Da best P\",(BasicNetwork)parasites[(int)bestIndex].net.clone());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tNeuralPlayer[] result = {allTimeBestHost,allTimeBestPara};\n\t\treturn result;\n\t}", "public boolean findBestMatch() {\n\t\t\tif(nodes.size() >= nodeLimit) return false;\n\n\t\t\tdouble bestScore = 0.0;\n\t\t\tint bestLight = -1;\n\t\t\tfor(int p = 0; p < lights.size(); p++) {\n\t\t\t\tif(nodeIndex.contains(p)) continue;\n\t\t\t\tdouble score = scoreByDistance(lights.get(p));\n\t\t\t\tif(score != Double.NaN && score > bestScore) {\n\t\t\t\t\tbestScore = score;\n\t\t\t\t\tbestLight = p;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(bestLight >= 0) {\n\t\t\t\taddNode(bestLight);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}", "public Code guess(){\n int minimumEliminated = -1;\n Code bestGuess = null;\n //Create a list of all codes in sample space (including both impossible and possible codes)\n List<Code> unusedCodes = new LinkedList<>(possibleCodes);\n unusedCodes.addAll(impossibleCodes);\n\n //MinMax part\n //For each code in the sample space\n for (Code arbitraryCode : unusedCodes) {\n //Create a new 2D miniMax table\n int[][] scoreTable = new int[Code.CODE_LENGTH + 1][Code.CODE_LENGTH + 1];\n //For each possibleCode\n for (Code possibleCode : possibleCodes) {\n Response response = arbitraryCode.getResponse(possibleCode); //Compare with the temporary arbitrary code and get response\n scoreTable[response.getStrikes()][response.getHits()]++; //Increase number of codes which have this response\n }\n //Find max in the table\n int maxScoreHits = -1;\n for (int[] row : scoreTable) {\n for (int i : row) {\n maxScoreHits = Integer.max(i, maxScoreHits);\n }\n }\n int score = possibleCodes.size() - maxScoreHits; //Evaluate score\n //Update minimumEliminated and bestGuess\n if (score > minimumEliminated) {\n minimumEliminated = score;\n bestGuess = arbitraryCode;\n }\n }\n\n //Update guess\n guess = bestGuess;\n\n return bestGuess;\n }", "public Tours fittestTour(){\r\n\t\tTours fittest = tours[0];\r\n\t\t// Loops through indivuals to find best\r\n\t\tfor (int i = 1; i < sizePop(); i++){\r\n\t\t\tif(fittest.fitnessGet() <= tourGet(i).fitnessGet()){\r\n\t\t\t\tfittest = tourGet(i);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn fittest;\r\n\t}", "public void findBetterDHAvailable(List<ScanResult> allScanResults)\n {\n Map allDHAvailable = new HashMap<String, Integer>();\n\n // Put all found DH to allDHAvailable Map\n for (ScanResult scanResult : allScanResults) {\n if(scanResult.SSID.toString().contains(\"DH-\")) {\n allDHAvailable.put(scanResult.SSID,scanResult.level);\n }\n }\n\n Log.v(\"AllDH Available:\", Arrays.asList(allDHAvailable).toString());\n Logger.addRecordToLog(\"All DH available:\" + Arrays.asList(allDHAvailable).toString());\n // Find key with the maximum value from allDHAvailable\n String bestFoundSSID=\"\";\n int maxValueInMap = 0;\n try {\n maxValueInMap = (int) Collections.max(allDHAvailable.values()); // This will return max value in the Hashmap\n Iterator it = allDHAvailable.entrySet().iterator();\n while (it.hasNext()) {\n Map.Entry<String, Integer> pair = (Map.Entry) it.next();\n if (pair.getValue() == maxValueInMap) {\n Log.v(\"Best Found SSID:\", pair.getKey()); // Print the key with max value\n Logger.addRecordToLog(\"Best Found SSID\"+ ',' + pair.getKey());\n bestFoundSSID = pair.getKey().toString();\n }\n }\n }\n catch (Exception e)\n {}\n // Connect to the best found network\n String pass = \"password123\";\n WifiConfiguration wc = new WifiConfiguration();\n wc.SSID = \"\\\"\" + bestFoundSSID + \"\\\"\"; //IMPORTANT! This should be in Quotes!!\n wc.preSharedKey = \"\\\"\"+ pass +\"\\\"\";\n wc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA_PSK);\n //wc.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.NONE);\n int res = DCService.wifi.addNetwork(wc);\n boolean b = DCService.wifi.enableNetwork(res, true);\n Log.v(DCService.TAG2, \"Connected\");\n\n }", "boolean hasSingleBet();", "private void findSmallestCost() {\n int best = 0;\n fx = funFitness[0];\n for (int i = 1; i < population; i++) {\n if (funFitness[i] < fx) {\n fx = funFitness[i];\n best = i;\n }\n }\n //System.arraycopy(currentPopulation[best], 0, bestSolution, 0, dimension);\n copy(bestSolution, currentPopulation[best]);\n }", "private Fruit findClosestFruit(Robot robot) {\n double min_dist = Double.MAX_VALUE;\n Fruit ans = null;\n for (int i = 0; i < my_game.getFruits().size(); i++) {\n Fruit fruit = my_game.getFruits().get(i);\n if(fruits_status.values().contains(fruit)) {\n continue;\n }\n double dist = algo_g.shortestPathDist(robot.getSrc(), fruit.getEdge().getSrc());\n if (dist < min_dist) {\n min_dist = dist;\n ans = fruit;\n }\n\n }\n\n return ans;\n }", "@Test\n\tpublic void leastPopularBike()\n\t{\t\t\n\t\tassertEquals(controller.getReport().getLeastPopularBike(), \"BIKE4\");\n\t}", "protected boolean processPlayerOffered(int gameNum, String playerName, String offer){\n return false;\n }", "public void evaluate()\r\n {\r\n\tdouble max = ff.evaluate(chromos.get(0),generation());\r\n\tdouble min = max;\r\n\tdouble sum = 0;\r\n\tint max_i = 0;\r\n\tint min_i = 0;\r\n\r\n\tdouble temp = 0;\r\n\r\n\tfor(int i = 0; i < chromos.size(); i++)\r\n\t {\r\n\t\ttemp = ff.evaluate(chromos.get(i),generation());\r\n\t\tif(temp > max)\r\n\t\t {\r\n\t\t\tmax = temp;\r\n\t\t\tmax_i = i;\r\n\t\t }\r\n\r\n\t\tif(temp < min)\r\n\t\t {\r\n\t\t\tmin = temp;\r\n\t\t\tmin_i = i;\r\n\t\t }\r\n\t\tsum += temp;\r\n\t }\r\n\r\n\tbestFitness = max;\r\n\taverageFitness = sum/chromos.size();\r\n\tworstFitness = min;\r\n\tbestChromoIndex = max_i;;\r\n\tworstChromoIndex = min_i;\r\n\tbestChromo = chromos.get(max_i);\r\n\tworstChromo = chromos.get(min_i);\r\n\t\r\n\tevaluated = true;\r\n }", "String offer();", "private void runBest() {\n }", "private UnconstrainedBidElement getClosest(double demandWatt) {\n UnconstrainedBidElement best = null;\n double bestDistance = Double.MAX_VALUE;\n for (UnconstrainedBidElement e : elements) {\n double distance = Math.abs(demandWatt - e.demandWatt);\n if (best == null || distance < bestDistance) {\n best = e;\n bestDistance = distance;\n }\n }\n return best;\n }", "public void checkBestScoreAndChangeIt() {\n \tbestTime = readPreference(difficulty);\n \t\n \tif (currentTime < bestTime) {\n \t\tbestTime = currentTime;\n \t\tsavePreference(bestTime, difficulty);\n \t}\n }", "public TargetReport retrieveBestTarget()\n\t{\n\t\t// get targets...\n\t\tgetTargetReports(allTargets);\n//\t\tSystem.out.println(\"All Targets: \" + allTargets);\n\t\t\n\t\t// and find the best one\n\t\tTargetReport bestTarget = null;\n\t\tdouble bestScore = 0;\n\t\tfor (TargetReport target : allTargets)\n\t\t{\n\t\t\t// Eliminate targets based on range\n\t\t\tdouble targetRange = getRangeToTarget(target);\n\t\t\tif (targetRange > MAX_REASONABLE_RANGE || targetRange < MIN_REASONABLE_RANGE)\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\t// When DRIVERS are lining up, eliminate based on the assumption that the target is aligned.\n\t\t\t// (targetCloseToCenter is set to true during teleop, because we would expect it to be with human drivers)\n\t\t\tif (targetCloseToCenter && Math.abs(target.centerX - IMAGE_WIDTH / 2) > CENTER_ZONE_SIZE)\n\t\t\t\tcontinue;\n\t\t\t\n\t\t\t// add score for distance from throttle-based guess\n\t\t\tguessedRange = MAX_REASONABLE_RANGE*0.5*(-Robot.oi.UtilStick.getThrottle() + 1);\n\t\t\tif (Math.abs(guessedRange) > 0.01)\n\t\t\t{\n\t\t\t\t// give a bunch of weight (see TargetReport) based on closesness to guessedRange\n\t\t\t\ttarget.addScoreFromDistance(guessedRange, targetRange);\n\t\t\t\t\n\t\t\t\t// highly prioritize a target close to a guess (this basically overrides the above line...)\n\t\t\t\tif (Math.abs(guessedRange - targetRange) < GUESS_ACCURACY_TOLERANCE)\n\t\t\t\t{\n\t\t\t\t\tbestTarget = target;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// if a target is better than the best, it's now the best\n\t\t\tif (target.getCumulativeScore() > bestScore)\n\t\t\t{\n\t\t\t\tbestTarget = target;\n\t\t\t\tbestScore = target.getCumulativeScore();\n\t\t\t}\n\t\t}\n\t\tallTargets.clear(); // we thought this might have been taking up too much memory, so we cleared it once we were done with it. (It wasn't the issue)\n\t\t\n\t\t// determine if in launcher range to target and set notification based on this\n\t\tcurrentRangeToBestTarget = getRangeToBestTarget();\n\t\tif (Robot.launcherWheels.inRange(currentRangeToBestTarget))\n\t\t\tRobot.launcherstatus.setInRange();\n\t\telse\n\t\t\tRobot.launcherstatus.setOutOfRange();\n\n\t\t// if we've found one, cache and return it\n\t\t// otherwise, return null (it will just default to the first value of bestTarget)\n\t\tcurrentBestTarget = bestTarget;\n\t\t\n\t\t// ALSO, report bestTarget to Driver station\n//\t\tsendBestTargetReport(); // Didn't work, see below\n\t\t\n// \tSystem.out.println(currentBestTarget);\n\t\t\n\t\treturn bestTarget;\n\t}", "boolean checkCandidate(DoubleMatrix1D y){\n if(checkValidPt(y)){\n if(adaptiveScale){\n double qforward = Q(x,y,samplingScale);\n DoubleMatrix1D ySamplingScale = getScaleAdaptive(y);\n double qback = Q(y,x,ySamplingScale);\n if(qback/qforward > Math.random())//going to accept\n samplingScale = ySamplingScale;\n else\n return false;\n }\n x=y;\n return true;\n }\n else\n return false;\n }", "public void findBPS() {\n\t\tfinal String consensus = \"UACUAAC\";\n\t\tString candidate = \"\"; \n\t\tint currentDistance;\n\t\t\n\t\tint bestDistance = Integer.MAX_VALUE;\n\t\tString bestCandidate = \"\"; \n\t\tfor( int i = 6; i < this.intron.length() - consensus.length() - 2; i++ ) {\n\t\t\tcandidate = this.intron.substring( i, (i+consensus.length()) );\n\t\t\tcurrentDistance = StringUtils.getLevenshteinDistance(consensus, candidate); \n\t\t\tif( currentDistance <= bestDistance ) {\n\t\t\t\tbestCandidate = candidate; \n\t\t\t\tbestDistance = currentDistance; \n\t\t\t}\n\t\t}\n\t\t\n\t\t//System.out.println( bestCandidate + \"\\t\" + bestDistance ); \n\t\tthis.bps = bestCandidate; \n\t}", "private Pair<Integer, Double> getBestLocalCandidateAndScore(TIntDoubleHashMap entityCandidates) {\n if (entityCandidates.size() == 0) {\n return new Pair<Integer, Double>(-100, 0.0);\n }\n double bestScore = -1.0;\n int bestCandidate = -10;\n for (TIntDoubleIterator itr = entityCandidates.iterator(); itr.hasNext(); ) {\n itr.advance();\n int entityId = itr.key();\n double score = itr.value();\n if (score > bestScore) {\n bestScore = score;\n bestCandidate = entityId;\n }\n }\n\n if (computeConfidence) {\n TIntDoubleHashMap normalizedScores = CollectionUtils.normalizeValuesToSum(entityCandidates);\n bestScore = normalizedScores.get(bestCandidate);\n }\n\n return new Pair<>(new Integer(bestCandidate), new Double(bestScore));\n }", "private int searchSmallestSize(Secret secretA, Secret secretB) {\n\n\t\tint smallestSize = 0;\n\n\t\tArrayList<Time> timesA = secretA.getTimes();\n\t\tArrayList<Time> timesB = secretB.getTimes();\n\n\t\tfloat bisector = 100; \n\t\tint isSmallestSizeBisected = 0;\n\n\t\tdo {\n\n\t\t\t// in the validation phase the measurement is split\n\t\t\t// into smallest subsets, so the smallest subset \n\t\t\t// must be smaller or equal than the size of the \n\t\t\t// smallest time lists\n\t\t\tif(timesA.size() <= timesB.size()) {\n\t\t\t\tsmallestSize = timesA.size();\n\t\t\t} else {\n\t\t\t\tsmallestSize = timesB.size();\n\t\t\t}\n\n\t\t\t++isSmallestSizeBisected;\n\n\t\t\tbisector -= (bisector / 2);\n\n\t\t\ttimesA = secretA.getBisectedTimes((int)(secretA.getTimes().size() - (secretA.getTimes().size() * bisector / 100.0)));\n\t\t\ttimesB = secretB.getBisectedTimes((int)(secretB.getTimes().size() - (secretB.getTimes().size() * bisector / 100.0)));\n\n\t\t\tCollections.sort(timesA);\n\t\t\tCollections.sort(timesB);\n\t\t\t\n\t\t\tif(timesA.size() <= 10 || timesB.size() <= 10) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t} while(BoxTest.boxTest(timesA, timesB)); // tests if a box is significant different\n\n\n\t\t// because both secrets contains the smallest size\n\t\tif(isSmallestSizeBisected != 1) {\n\t\t\tlogger.info(secretA.getName() + \" < \" + secretB.getName() + \": amount of minimal measures per secret: \" + smallestSize); \n\t\t}\n\n\t\treturn smallestSize;\n\t}", "@Override\n public AlgorithmResult chooseBestMove(MinMaxEnum currentMinMax, List<AlgorithmResult> algorithmResults) {\n AlgorithmResult bestResult;\n if (currentMinMax == MinMaxEnum.MAX)\n bestResult = Collections.max(algorithmResults, Comparator.comparing(AlgorithmResult::getScore));\n else bestResult = Collections.min(algorithmResults, Comparator.comparing(AlgorithmResult::getScore));\n\n return bestResult;\n }", "public void recommended() {\n MainActivity activity = (MainActivity) getActivity();\n ArrayList<Integer> results = new ArrayList<>();\n int highest = 0;\n for (int i = 0; i < activity.getUserLocations().size(); i++) {\n int lid = activity.database.getLocID(1, activity.userLocations.get(i).getProvider());\n ArrayList<LocationMoodObject> locmood = activity.database.getLocMood(lid);\n int result = 0;\n\n for (int j = 0; j < locmood.size(); j++) {\n switch (locmood.get(j).mood) {\n case (1):\n result = result + 1;\n break;\n case (2):\n result = result + 2;\n break;\n case (3):\n result = result + 3;\n break;\n case (4):\n result = result + 4;\n break;\n case (5):\n result = result + 5;\n break;\n }\n }\n if (locmood.size()>0){\n result = result / locmood.size();\n results.add(result);}\n\n }\n\n for (int i = 0; i < results.size(); i++) {\n if (results.get(i) > highest) {\n highest = results.get(i);\n }\n }\n\n recommended = activity.userLocations.get(highest).getProvider();\n }", "public int best(){\n List<Integer> points = count();\n Integer max = 0;\n for (Integer p: points){\n if (p <= 21 && max < p){\n max = p;\n }\n }\n return max;\n }", "@Override\n\tpublic Solution<TTPVariable> run(SingleObjectiveThiefProblem thief, IEvaluator evaluator, MyRandom rand) {\n\t\tTTPVariable var = TTPVariable.create(new TourOptimalFactory(thief).next(rand), Pack.empty());\n\t\tSolution<TTPVariable> currentBest = thief.evaluate(var);\n\t\t\n\n\t\twhile (evaluator.hasNext()) {\n\n\t\t\t// now take the tour and optimize packing plan\n\t\t\tSolution<Pack> nextPack = optPack(thief, evaluator, rand, currentBest.getVariable().getTour(), currentBest.getVariable().getPack());\n\t\t\t\n\t\t\tSolution<Tour> nextTour = optTour(thief, evaluator, rand, currentBest.getVariable().getTour(), nextPack.getVariable());\n\t\t\t\n\t\t\tTTPVariable next = TTPVariable.create(nextTour.getVariable(), nextPack.getVariable());\n\t\t\tSolution<TTPVariable> s = thief.evaluate(next);\n\t\t\t\n\t\t\t//System.out.println(nextPack);\n\t\t\t//System.out.println(currentBest);\n\t\t\t//System.out.println(\"----------------\");\n\t\t\t\n\t\t\t// update the best found solution\n\t\t\tif (SolutionDominator.isDominating(s, currentBest)) {\n\t\t\t\tcurrentBest = s;\n\t\t\t\t//System.out.println(\"YES\");\n\t\t\t}\n\t\t\tevaluator.notify(currentBest);\n\n\t\t}\n\n\t\treturn currentBest;\n\t}", "public List<Double> getLowestAskAndHighestBid(String asset) {\n\n Optional<List<Offer>> offerList = offerRepository.findOffersByAsset_Name(asset);\n\n if (offerList.isPresent()) {\n\n double lowestAsk = Double.MAX_VALUE;\n double highestBid = -1;\n for (Offer offer : offerList.get()) {\n if (offer.getType().equals(OfferType.SELL)) {\n if (offer.getPrice() < lowestAsk) {\n lowestAsk = offer.getPrice();\n }\n\n } else if (offer.getType().equals(OfferType.BUY)) {\n if (offer.getPrice() > highestBid) {\n highestBid = offer.getPrice();\n }\n\n }\n }\n\n if (lowestAsk == Double.MAX_VALUE) {\n lowestAsk = -1;\n }\n return Arrays.asList(lowestAsk, highestBid);\n }\n throw new NotFoundException(\"No current offers for this asset\");\n\n }", "private void chooseBestPiece() {\n\n int maxKillCount = 0;\n int tempKillCount;\n int piecesWithEqualMaxCount = 0;\n\n int bestPieceX = 0;\n int bestPieceY = 0;\n\n for (int y = 0; y < boardSize; y++) {\n for (int x = 0; x < boardSize; x++) {\n //check every piece\n Field field = board[y][x];\n if (field.getPiece() != null && field.getPiece().getPieceColor() == round) {\n tempKillCount = countAvailableKills(x, y, 0, this.board);\n //count piece kill score\n if (tempKillCount > maxKillCount) {\n maxKillCount = tempKillCount;\n piecesWithEqualMaxCount = 1;\n bestPieceX = x;\n bestPieceY = y;\n } else if (tempKillCount == maxKillCount) {\n piecesWithEqualMaxCount += 1;\n }\n }\n }\n }\n\n if (piecesWithEqualMaxCount == 1 && maxKillCount != 0) {\n bestPieceToMove = board[bestPieceY][bestPieceX].getPiece();\n bestPieceFound = true;\n\n findOptimalMove(bestPieceX, bestPieceY);\n\n System.out.println(\"Best piece found, kill score = \" + maxKillCount);\n } else if (piecesWithEqualMaxCount > 1) {\n bestPieceToMove = null;\n bestPieceFound = false;\n\n if (maxKillCount == 0) {\n //if every piece has same kill score equal to 0 there is no kill available\n killAvailable = false;\n System.out.println(\"No piece can kill\");\n } else {\n killAvailable = true;\n System.out.println(\"Some pieces has same kill score = \" + maxKillCount + \", user can choose which to move\");\n }\n }\n }", "protected boolean isAcceptableBefore(double offeredutil) throws Exception {\n\t\treturn offeredutil * 1.03 >= utilitySpace.getUtility(myLastBid);\n\t}", "boolean CanOfferTrade(Resources offer);", "private static MapLocation getBestPastrLocNearMeBasedOnCowGrowthRate() {\n\t\tif (Clock.getRoundNum() < 1) {\n\t\t\tallCowGrowths = rc.senseCowGrowth();\t\t\t\n\t\t}\n\t\tMapLocation bestLocation = new MapLocation(curLoc.x, curLoc.y);\n\t\tdouble cowGrowthAmount = 0;\n\t\tMapLocation enemyHQLocation = rc.senseEnemyHQLocation();\n\t\tdouble distanceToEnemyHQ = curLoc.distanceSquaredTo(enemyHQLocation);\n\t\tfor (int i = 15; i-- > 0;) {\n\t\t\tfor (int j = 15; j-- > 0;) {\n\t\t\t\t// Check that it's in bounds\n\t\t\t\tif (curLoc.x - i + 8 >= 0 && curLoc.x - i + 8 < rc.getMapWidth() &&\n\t\t\t\t\tcurLoc.y - j + 8 >= 0 && curLoc.y - j + 8 < rc.getMapHeight()) {\n\t\t\t\t\tMapLocation mapLoc = new MapLocation(curLoc.x - i + 8, curLoc.y - j + 8);\n\t\t\t\t\tdouble currentLocGrowth = allCowGrowths[curLoc.x - i + 8][curLoc.y - j + 8];\n\n\t\t\t\t\t// Check that it's behind a perpendicular line and not void\n\t\t\t\t\t// and choose the best point.\n\t\t\t\t\tif (mapLoc.distanceSquaredTo(enemyHQLocation) < distanceToEnemyHQ &&\n\t\t\t\t\t\tcurrentLocGrowth > cowGrowthAmount && rc.senseTerrainTile(mapLoc) != TerrainTile.VOID) {\n\t\t\t\t\t\tcowGrowthAmount = currentLocGrowth;\n\t\t\t\t\t\tbestLocation = mapLoc;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn bestLocation;\n\t}", "public int getBestValue() {\n return bestValue;\n }", "boolean isNilSingleBetMinimum();", "public String getBestSeller ()\n {\n return (bestSeller);\n }", "public int selectionFunctionBiggestCoin(MyList<Integer> candidates){\n\n\t\t//-----------------------------\n\t\t//Output Variable --> InitialValue\n\t\t//-----------------------------\n\t\tint res = -1;\n\n\t\t//-----------------------------\n\t\t//SET OF OPS\n\t\t//-----------------------------\n\t\tint maxWeight = Integer.MIN_VALUE;\n\t\tint index = candidates.length() - 1;\n\n\n\t\twhile (index >= 0) {\n\t\t\t// OP1.1. Auxiliary variables:\n\t\t\t// We use 'e0' to compute the first item of 'candidate' just once.\n\t\t\tint e0 = candidates.getElement(index);\n\n\t\t\t// OP1.1. If a not previously considered item improves minWeight, we\n\t\t\t// update 'res' and 'minWeight'\n\t\t\tif (e0 > maxWeight) {\n\t\t\t\tres = index;\n\t\t\t\tmaxWeight = e0;\n\t\t\t}\n\n\t\t\t// OP1.2. We decrease 'index' so as to try the previous item of\n\t\t\t// 'candidates'\n\t\t\tindex--;\n\t\t}\n\n\t\t//-----------------------------\n\t\t//Output Variable --> Return FinalValue\n\t\t//-----------------------------\t\t\n\t\treturn res;\t\t\n\t}", "public String findBestMatch()\n\t{\t\t\n\t\tif (robot.containsUserAgent(\"cis455crawler\"))\n\t\t{\n\t\t\tbest_match = \"cis455crawler\";\n\t\t}\n\t\telse if (robot.containsUserAgent(\"*\"))\n\t\t{\n\t\t\tbest_match = \"*\";\n\t\t}\n\t\treturn best_match;\n\t}", "boolean isSetSingleBetMinimum();", "@Test\n\tpublic void chooseCorrectStationsWhenPlanningShortestRide()\n\t\t\tthrows InvalidBikeTypeException, InvalidRidePlanPolicyException, NoValidStationFoundException {\n\t\tRidePlan bobRidePlan = n.createRidePlan(source, destination, bob, \"SHORTEST\", \"MECH\");\n\t\tRidePlan sRidePlan = new RidePlan(source, destination, sourceStationS, destStationS, \"SHORTEST\", \"MECH\", n);\n\t\tassertTrue(bobRidePlan.equals(sRidePlan));\n\t}", "public void computeWinnerDeterminationU()\r\n\t{\r\n\t\tif( _plans.size() == 0)\r\n\t\t{\r\n\t\t\t_allocation = new AllocationWoD();\r\n\t\t\treturn;\r\n\t\t}\r\n\t\t\r\n\t\t_randGenerator.setSeed(_seed);\r\n\t\t\r\n\t\tdouble maxExpectedUtility = 0.;\r\n\t\tint itsIdx = -1;\r\n\t\tint itsAtom = -1;\r\n\t\tfor(int i = 0; i < _plans.size(); ++i)\t\t\t\t\t\t\t\t\t// for every buyer\r\n\t\t\tfor(int j = 0; j < _plans.get(i).getNumberOfAtoms(); ++j)\t\t\t// for every plan he has value for\r\n\t\t\t{\r\n\t\t\t\tComplexSemanticWebType plan = (ComplexSemanticWebType)(_plans.get(i).getAtom(j));\r\n\t\t\t\tif(_paymentRule.equals(\"SecondPrice\"))\r\n\t\t\t\t\tplan.resolveWithSecondPrice();\r\n\t\t\t\telse if(_paymentRule.equals(\"FirstPrice\"))\r\n\t\t\t\t\tplan.resolveWithFirstPrice();\r\n\t\t\t\telse throw new RuntimeException(\"Cannot resolve the type: \" + _paymentRule);\r\n\t\t\t\t\r\n\t\t\t\tdouble expectedUtility = plan.computeExpectedValue() - plan.getPlanExpectedPayment();\r\n\t\t\t\t\r\n\t\t\t\tif( expectedUtility >= maxExpectedUtility )\r\n\t\t\t\t{\r\n\t\t\t\t\tmaxExpectedUtility = expectedUtility;\r\n\t\t\t\t\titsIdx = i;\r\n\t\t\t\t\titsAtom = j;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t_allocation = new AllocationWoD();\r\n\r\n\t\tif(itsIdx >= 0)\r\n\t\t{\r\n\t\t\tList<Integer> allocatedBundles = new LinkedList<Integer>();\r\n\t\t\tallocatedBundles.add(itsAtom);\r\n\t\t\ttry\r\n\t\t\t{\r\n\t\t\t\tComplexSemanticWebType plan = (ComplexSemanticWebType)(_plans.get( itsIdx ).getAtom( itsAtom ));\r\n\t\t\t\t\r\n\t\t\t\tList<Integer> actuallyAllocatedTuples = new LinkedList<Integer>();\r\n\t\t\t\tfor(int i = 0; i < plan.getNumberOfFragments(); ++i)\r\n\t\t\t\t\tactuallyAllocatedTuples.add( plan.getMinNumberOfRecords(i) + _randGenerator.nextInt(plan.getMaxNumberOfRecords(i) - plan.getMinNumberOfRecords(i)) );\r\n\r\n\t\t\t\tif(plan.getAllocatedSellers().size() < 1)\r\n\t\t\t\t\tthrow new RuntimeException(\"No sellers in plan: \" + plan.toString());\r\n\t\t\t\t\r\n\t\t\t\tplan.setActuallyAllocatedRecords(actuallyAllocatedTuples);\r\n\t\t\t\tList<Integer> sellersInvolved = plan.getAllocatedSellers();\r\n\t\t\t\t\r\n\t\t\t\tList<ComplexSemanticWebType> allocatedPlans = new LinkedList<ComplexSemanticWebType>();\r\n\t\t\t\tallocatedPlans.add(plan);\r\n\t\t\t\t_allocation.addAllocatedAgent(plan.getAgentId(), sellersInvolved, allocatedBundles,\r\n\t\t\t\t\t\t\t\t\t\t\t plan.computeExpectedValue(), plan.computeExpectedCosts());\r\n\t\t\t\t_allocation.addAllocatedPlans(allocatedPlans, true);\r\n\t\t\t}\r\n\t\t\tcatch (Exception e)\r\n\t\t\t{\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public PentagoMove alphabetaw(PentagoBoardState boardState){\n PentagoBoardState pbs = (PentagoBoardState) boardState.clone();\n ArrayList<PentagoMove> legalmoves = pbs.getAllLegalMoves();\n\n PentagoMove bestmove = legalmoves.get(0);\n PentagoMove bestopponentmove = new PentagoMove(0,0,0,0,0);\n int bestmovescore = -9999999;\n int bestwhitescore = 0;\n //ArrayList<Integer> scores = new ArrayList<Integer>();\n for(int i = 0;i<legalmoves.size()-1;i++){\n\n PentagoBoardState newboard = (PentagoBoardState) pbs.clone();\n //System.out.println( pbs.getTurnPlayer() + \"BEFORE PROCESS\");\n PentagoMove next = legalmoves.get(i);\n\n newboard.processMove(next);\n\n int score = evaluate(newboard);\n //scores.add(score);\n //System.out.println( pbs.getTurnPlayer() + \" AFTER PROCES\");\n\n if(score > 100000){\n newboard.getWinner();\n newboard.printBoard();\n System.out.println(\"FOUND A WINNER\" + score);\n return next;\n }\n\n\n PentagoMove currentopponentmove;\n ArrayList<PentagoMove> opponentlegalmoves = newboard.getAllLegalMoves();\n if (opponentlegalmoves.size()!=0){\n currentopponentmove = opponentlegalmoves.get(0);\n }\n\n int minopponentmovescore = 999999;\n int thismovescore = -9999;\n ArrayList<PentagoMove> bestopponentmoves = new ArrayList<PentagoMove>();\n PentagoMove currentbestopponentmove = new PentagoMove(0,0,0,0,0);\n\n for(int a = 0;a<opponentlegalmoves.size()-1;a++){\n\n PentagoBoardState pbsopponent = (PentagoBoardState) newboard.clone();\n //System.out.println( pbs.getTurnPlayer() + \"BEFORE PROCESS\");\n PentagoMove opponentnext = opponentlegalmoves.get(a);\n\n pbsopponent.processMove(opponentnext);\n //System.out.println( pbs.getTurnPlayer() + \" AFTER PROCES\");\n //pbs.printBoard();\n\n int opponentscore = evaluate(pbsopponent);\n\n\n\n\n\n if (minopponentmovescore>opponentscore){\n //currentopponentmove = opponentnext;\n minopponentmovescore = opponentscore;\n bestopponentmoves.add(opponentnext);\n currentbestopponentmove = opponentnext;\n }\n\n\n }\n bestopponentmove = currentbestopponentmove;\n //lvl 3\n /*\n\n int lvl3minscore =99999;\n PentagoMove currentmaxmove;\n for (int r = 0;r<bestopponentmoves.size()-1;r++) {\n PentagoBoardState pbsopponent = (PentagoBoardState) newboard.clone();\n pbsopponent.processMove(bestopponentmoves.get(r));\n\n ArrayList<PentagoMove> maxlegalmoves = pbsopponent.getAllLegalMoves();\n if (maxlegalmoves.size() != 0) {\n currentmaxmove = maxlegalmoves.get(0);\n }\n int opponentscore = evaluate(pbsopponent);\n int findminmaxmovescore = -99999;\n for (int s = 0; s < maxlegalmoves.size() - 1; s++) {\n\n PentagoBoardState maxboard = (PentagoBoardState) pbsopponent.clone();\n //System.out.println( pbs.getTurnPlayer() + \"BEFORE PROCESS\");\n PentagoMove maxnext = maxlegalmoves.get(s);\n\n maxboard.processMove(maxnext);\n //System.out.println( pbs.getTurnPlayer() + \" AFTER PROCES\");\n //pbs.printBoard();\n\n int maxnextscore = evaluate(pbsopponent);\n if (findminmaxmovescore < maxnextscore) {\n currentmaxmove = maxnext;\n findminmaxmovescore = maxnextscore;\n }\n }\n if (thismovescore<findminmaxmovescore){\n //currentopponentmove = opponentnext;\n thismovescore = findminmaxmovescore;\n }\n\n //opponentscore = maxmovescore;\n }\n\n //end experiment\n\n\n\n\n if (mycolour ==1){\n lvl3minscore =minopponentmovescore;\n }\n */\n if (minopponentmovescore>bestmovescore){//minopponentmovescore\n System.out.println(\"max player move score: \"+score + \"Min : \" + minopponentmovescore);\n bestmovescore = minopponentmovescore;\n bestmove = next;\n bestwhitescore = score;\n\n }\n else if (minopponentmovescore == bestmovescore){\n if (score > bestwhitescore){\n System.out.println(\"max player move score: \"+score + \"Min : \" + minopponentmovescore);\n bestmovescore = minopponentmovescore;\n bestmove = next;\n bestwhitescore = score;\n }\n\n\n\n }\n\n\n }\n System.out.println(\"final max player move score: \"+ bestmovescore + \"\\n My best move: \"+bestmove.toPrettyString() + \"\\n My best move: \"+ bestopponentmove.toPrettyString());\n return bestmove;\n }", "boolean hasIsAutoBet();", "@Override\n\tpublic List<Double> getCurrentBest() {\n\t\treturn null;\n\t}", "@Test\n public final void testBiggerThanMin() {\n for (ArrayList<TradeGood> planetsGoods : goods) {\n for (TradeGood good : planetsGoods) {\n assertTrue(good.getPrice() > good.type.mtl);\n }\n }\n }", "public void matchBets(MarketRunners marketRunners);", "GamePiece furthestPiece(GamePiece from, ArrayList<GamePiece> connect) {\n HashMap<GamePiece, Integer> dists = this.distanceMap(from);\n GamePiece currMax = from;\n int max = 0;\n for (GamePiece p : connect) {\n if (p.connectedToPower(from)) {\n if (dists.get(p) > max) {\n max = dists.get(p);\n currMax = p;\n }\n }\n }\n return currMax;\n }", "protected boolean isAcceptableAfter(double offeredutil, Bid lnextBid)\n\t\t\tthrows Exception {\n\t\treturn offeredutil >= utilitySpace.getUtility(lnextBid);\n\t}", "void onMatched(List<Offer> offers);", "protected boolean update_best_value(Knapsack knapsack) {\n iteration+=1;\n if (knapsack.get_value()>best_value)\n {\n best_value=knapsack.get_value();\n return true;\n }\n if (iteration%100000==0)\n System.out.println(\"iteration:\"+iteration+\" time:\"+System.currentTimeMillis()+\n \" best_value:\"+best_value);\n return false;\n }", "private Groepen bepaalOptimaleGroep(ArrayList<Groepen> mogelijkegroepen) {\r\n\t\tGroepen beste = null;\r\n\t\tint beste_spreiding = Integer.MAX_VALUE;\r\n\t\tint beste_groepverschil = 0;\r\n\t\tdouble beste_stddev = Double.MAX_VALUE;\r\n\t\tfor (Groepen groepen : mogelijkegroepen) {\r\n\t\t\t//if (groepen.getKleinsteGroep() >= 4) {\r\n\t\t\t\tif (groepen.getSpreidingTotaal() < beste_spreiding) {\r\n\t\t\t\t\tbeste = groepen;\r\n\t\t\t\t\tbeste_spreiding = groepen.getSpreidingTotaal();\r\n\t\t\t\t\tbeste_groepverschil = groepen.getSomGroepVerschil();\r\n\t\t\t\t\tbeste_stddev = groepen.getSomStdDev();\r\n\t\t\t\t} else if (groepen.getSpreidingTotaal() == beste_spreiding) {\r\n\t\t\t\t\tif (groepen.getSomGroepVerschil() > beste_groepverschil) {\r\n\t\t\t\t\t\tbeste = groepen;\r\n\t\t\t\t\t\tbeste_spreiding = groepen.getSpreidingTotaal();\r\n\t\t\t\t\t\tbeste_groepverschil = groepen.getSomGroepVerschil();\r\n\t\t\t\t\t\tbeste_stddev = groepen.getSomStdDev();\r\n\t\t\t\t\t} else if (groepen.getSomStdDev() < beste_stddev) {\r\n\t\t\t\t\t\tbeste = groepen;\r\n\t\t\t\t\t\tbeste_spreiding = groepen.getSpreidingTotaal();\r\n\t\t\t\t\t\tbeste_groepverschil = groepen.getSomGroepVerschil();\r\n\t\t\t\t\t\tbeste_stddev = groepen.getSomStdDev();\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 beste;\r\n\t}", "@Test\n public void verifyWatermelonOfferApplied() {\n \tProduct product = new Product(\"Watermelon\", 0.8);\n \tBasket basket = new Basket();\n \tbasket.getProducts().put(product, 7);\n \tassertTrue(\"Have to get the price of 7 items = 4 ==> \", \n \t\t\tDouble.compare(calculator.calculatePrice(basket), 4) == 0);\n }" ]
[ "0.63084424", "0.6131732", "0.60406655", "0.5829993", "0.582309", "0.58074635", "0.5693967", "0.56783164", "0.56726706", "0.5623803", "0.56189626", "0.5603902", "0.56013924", "0.5543335", "0.55053884", "0.54939026", "0.54889435", "0.5472125", "0.5469024", "0.54569644", "0.54552627", "0.5435638", "0.5435259", "0.54281074", "0.5422068", "0.5419136", "0.5402671", "0.5401976", "0.53999925", "0.53800046", "0.5379722", "0.5371135", "0.5358247", "0.5350947", "0.5345703", "0.53443515", "0.53421205", "0.5341834", "0.5337651", "0.5333526", "0.5315127", "0.53136486", "0.531097", "0.53043747", "0.5297362", "0.52936095", "0.5293517", "0.5289715", "0.5289312", "0.5268438", "0.52681017", "0.52679664", "0.5265367", "0.5263162", "0.5212645", "0.5206783", "0.520265", "0.5201572", "0.5195776", "0.519098", "0.5189032", "0.5186021", "0.518561", "0.51797354", "0.5177346", "0.5167673", "0.5162681", "0.51597226", "0.51589215", "0.51564634", "0.5154554", "0.51511073", "0.51468736", "0.5146624", "0.5140775", "0.5137451", "0.5135123", "0.5134688", "0.51309955", "0.5130217", "0.5127773", "0.5127596", "0.51151395", "0.51129097", "0.50999445", "0.5092071", "0.509107", "0.508867", "0.50801235", "0.5078961", "0.50754845", "0.5074204", "0.5073571", "0.5067809", "0.5067536", "0.50541604", "0.50529444", "0.50497854", "0.50401366", "0.5031398" ]
0.6794383
0
Getter da bala do personagem.
public Bullet getBullet() { return this.bullet; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Nodo_B getPrimero(){\n return this.primero;\n }", "public java.lang.String getBloqueado(){\n return localBloqueado;\n }", "public int getBloco() {\r\n\t\treturn bloco;\r\n\t}", "public int getVelocidadBala() {\n return velocidadBala;\n }", "public String balar() {\r\n return this.SONIDO;\r\n }", "private Person getPerson() {\n String fore = this.forenameCombo.getSelectedItem().toString();\n String sur = this.surnameCombo.getSelectedItem().toString();\n String sect = this.sectionCombo.getSelectedItem().toString();\n Person myPers = pers.getPerson(fore, sur, sect);\n return myPers;\n }", "public String getBairro() {//Retorna o nome do bairro.\r\n\t\treturn bairro;\r\n\t}", "public String getPoblacion() {\r\n\t\treturn poblacion;\r\n\t}", "public String getBirth() {\n return birth;\n }", "public String getBirth() {\n return birth;\n }", "public String getBairro() {\n return bairro;\n }", "public String getBairro() {\n return bairro;\n }", "public int getIdBoleta() {\n return idBoleta;\n }", "public int getBrillo(){\n return brillo;\n }", "public String getNombreLibro()\n {\n return nombre;\n }", "public com.zzsong.netty.protobuff.two.ProtoData.Person getPerson() {\n if (personBuilder_ == null) {\n if (dataBodyCase_ == 2) {\n return (com.zzsong.netty.protobuff.two.ProtoData.Person) dataBody_;\n }\n return com.zzsong.netty.protobuff.two.ProtoData.Person.getDefaultInstance();\n } else {\n if (dataBodyCase_ == 2) {\n return personBuilder_.getMessage();\n }\n return com.zzsong.netty.protobuff.two.ProtoData.Person.getDefaultInstance();\n }\n }", "public Person getPerson()\r\n\t{\r\n\t\treturn person;\r\n\t}", "String getPrimeiroNome();", "public Empleado getEmpleado()\r\n/* 183: */ {\r\n/* 184:337 */ return this.empleado;\r\n/* 185: */ }", "@JsonGetter(\"boss\")\n public Person getBoss ( ) { \n return this.boss;\n }", "public String getBizLegalPerson() {\n return bizLegalPerson;\n }", "public Puntaje getPuntaje() \r\n {\r\n return puntaje;\r\n }", "public int getIdPersona(){\n return idPersona;\n}", "public String getTelefono(){\n return telefono;\n }", "public String getBirth()\n\t{\n\t\treturn birth;\n\t}", "java.lang.String getBunho();", "java.lang.String getBunho();", "public String getBirthday(){\n return birthday;\n\t}", "public PuntoDeVenta getPuntoDeVenta()\r\n/* 140: */ {\r\n/* 141:162 */ return this.puntoDeVenta;\r\n/* 142: */ }", "public String getNomBloque() {\n return nomBloque;\n }", "@Override // Métodos que fazem a anulação\n\tpublic void getBonificação() {\n\t\t\n\t}", "public int getBrojParcele() {\n return brojParcele;\n }", "public Bina getBina() {\r\n\t\treturn bina;\r\n\t}", "public SystemeAmendesInt.Personne getProprietaire() {\n return proprietaire;\n }", "com.zzsong.netty.protobuff.two.ProtoData.Person getPerson();", "public String getTelefono() {\r\n\treturn telefono;\r\n}", "public String getPersonNum(){\n return personNum;\n }", "public Date getBirth() {\n return birth;\n }", "public Date getBirth() {\n return birth;\n }", "public String getB() {\n return b;\n }", "public String getNombre()\r\n/* 60: */ {\r\n/* 61: 67 */ return this.nombre;\r\n/* 62: */ }", "public Tipe getTipeBilangan() /*const*/{\n\t\tassert(getTkn()==TipeToken.Bilangan);\n\t\treturn TipeBilangan;\n\t}", "public String getNome(){\r\n return this.nome;\r\n }", "public com.zzsong.netty.protobuff.two.ProtoData.Person getPerson() {\n if (dataBodyCase_ == 2) {\n return (com.zzsong.netty.protobuff.two.ProtoData.Person) dataBody_;\n }\n return com.zzsong.netty.protobuff.two.ProtoData.Person.getDefaultInstance();\n }", "public int getPerfil(){\n return this.perfil;\n }", "public String getNombre()\r\n/* 17: */ {\r\n/* 18:41 */ return this.nombre;\r\n/* 19: */ }", "public String getBunm() {\r\n return bunm;\r\n }", "public String getNome(){\n return this.nome;\n }", "@Override\n\tpublic double getBalanta() {\n\t\treturn this.balanta;\n\t}", "public Date getBirth() {\r\n return birth;\r\n }", "String getAnnoPubblicazione();", "public String getNombre(){\r\n return beneficiario[1].toString();\r\n }", "public String getNombre(){\n return nombre;\n }", "public String getBartenderName()\n {\n return bartenderName;\n }", "public String getNome () { return this.nome; }", "public String getComentario () {\n return comentario;\n }", "public void mostrarPersona(){\r\n System.out.println(\"Nombre: \" + persona.getNombre());\r\n System.out.println(\"Cedula: \" + persona.getCedula());\r\n }", "protected int get_breeding_age()\n {\n return breeding_age;\n }", "public String getNombre()\r\n/* 113: */ {\r\n/* 114:204 */ return this.nombre;\r\n/* 115: */ }", "public String getNombre(){\r\n return nombre;\r\n }", "public String getNombre(){\n return nombre;\n }", "public String getNombre(){\n return nombre;\n }", "public double getBonificacao() {\n\t\tSystem.out.println(\"Chamando o metodo de bonificacao do gerente\");\n\t\treturn super.getBonificacao() + super.salario;\n\t}", "public String getNombreCompleto();", "public String getPersonID(){\n return personID;\n }", "public String getnombre(){\n return nombre;\n }", "public String getNome(){\r\n return nome;\r\n }", "public persona getContribuyente() {\n return contribuyente;\n }", "public String getTelefono()\r\n {\r\n return telefono;\r\n }", "public abstract String getBeschreibung();", "public Payment getTarjeta(){\n return cuenta;\n }", "public Long getPersonaId();", "public String getNombre(){\n return nombre;\n }", "public int getNrBolasBrancasGanhas(){\n return jogo.getNrBolasBrancasGanhas();\n }", "public Human getPerson() {\n\t\treturn this.person;\n\t}", "public String getNivel()\r\n/* 249: */ {\r\n/* 250:278 */ return this.nivel;\r\n/* 251: */ }", "public String getPassageiro2() {\r\n\r\n if (passageiro == null) {\r\n return \"Poltrona Vazia\";\r\n } else {\r\n return passageiro.getNome();\r\n }\r\n }", "public String getProblema() {\n return problema;\n }", "public Empresa getEmpresa()\r\n/* 84: */ {\r\n/* 85:131 */ return this.empresa;\r\n/* 86: */ }", "String getAuteur();", "public String getBirthdate() {\n return birthdate;\n }", "public String getNombre () {\n return nombre;\n }", "public String getNombre() {return nombre;}", "@Override//sobrescribir metodo\n public String getDescripcion(){\n return hamburguesa.getDescripcion()+\" + lechuga\";//retorna descripcion del oobj hamburguesa y le agrega +lechuga\n }", "public String getNombre()\n {\n return nombre;\n }", "public String getNombre()\n {\n return nombre;\n }", "public Date getBirthdate()\n {\n return birthdate;\n }", "public String getnome()\n {\n return this.nome;\n }", "public String getApellido(){\n return this.apellido;\n }", "public int getTamanio(){\r\n return tamanio;\r\n }", "@Override\n\tpublic String getObjetivo() {\n\t\treturn model.getObjetivo();\n\t}", "public java.lang.String getIdentificacionBien() {\r\n return identificacionBien;\r\n }", "@Column(name = \"C_PRIMER_NOMBRE\")\n public String getPrimerNombre() {\n return primerNombre;\n }", "public Date getBirthdate()\n {\n return birthdate;\n }", "private TypedProperties getBPD() throws RemoteException\n\t{\n\t if (this.bpd != null)\n\t return this.bpd;\n\t \n\t SepaDauerauftrag auftrag = this.getTransfer();\n\t if (auftrag.isActive())\n this.bpd = DBPropertyUtil.getBPD(auftrag.getKonto(),DBPropertyUtil.BPD_QUERY_SEPADAUER_EDIT);\n\t else\n\t this.bpd = new TypedProperties(); // Der Auftrag ist noch nicht aktiv - dann gibt es noch keine Einschraenkungen\n\t \n\t return this.bpd;\n\t}", "public String getName (){\n \n return boyName;\n }", "public PersonalBio getPersonalBio() {\n PersonalBio personalBio = null;\n\n String sql = \"SELECT * FROM \" + DatabaseHelper.PERSONAL_BIO_TABLE;\n\n Cursor cursor = database.query(DatabaseHelper.PERSONAL_BIO_TABLE, null, null, null, null, null, null);\n\n if (cursor.moveToFirst()) {\n personalBio = new PersonalBio();\n personalBio.setId(cursor.getInt(0));\n personalBio.setUserName(cursor.getString(1));\n try {\n personalBio.setUserDOB(CommonUtil.ddmmmyyyy2date(cursor.getString(2)));\n } catch (ParseException e) {\n personalBio.setUserDOB(null);\n }\n personalBio.setUserIDNo(cursor.getString(3));\n personalBio.setAddress(cursor.getString(4));\n personalBio.setPostalcode(cursor.getString(5));\n personalBio.setHeight(cursor.getInt(6));\n personalBio.setBloodType(cursor.getString(7));\n }\n return personalBio;\n }", "public String getNombre() {\n return nombre;\n\n }", "public com.zzsong.netty.protobuff.two.ProtoData.Person.Builder getPersonBuilder() {\n return getPersonFieldBuilder().getBuilder();\n }", "public Bio getBio() {\n return bio;\n }", "public String getNome()\n {\n return this.nome;\n }" ]
[ "0.6909965", "0.66715163", "0.6659726", "0.6558575", "0.6537406", "0.6474761", "0.6452354", "0.6434729", "0.6397986", "0.6397986", "0.63885343", "0.63885343", "0.63221616", "0.6299058", "0.6259316", "0.6222143", "0.62093335", "0.6209182", "0.62074745", "0.6204603", "0.6194824", "0.6179268", "0.6168707", "0.61678165", "0.6158886", "0.6139469", "0.6139469", "0.6136279", "0.6130749", "0.6118414", "0.61141616", "0.6111466", "0.6110607", "0.61026573", "0.6102049", "0.6097503", "0.6092981", "0.6083737", "0.6083737", "0.60824037", "0.608126", "0.60790986", "0.6076715", "0.6071844", "0.60711837", "0.60711163", "0.6069739", "0.6066339", "0.6065204", "0.60580003", "0.6057866", "0.604454", "0.60371417", "0.60362303", "0.6031603", "0.6030164", "0.6029483", "0.60166365", "0.6008995", "0.6005231", "0.5996622", "0.5996622", "0.59923077", "0.59923", "0.59903646", "0.5988349", "0.5983476", "0.5970426", "0.5962412", "0.5957957", "0.5947017", "0.5945051", "0.59385765", "0.593855", "0.5931983", "0.5931252", "0.59303015", "0.5929653", "0.59246063", "0.59113425", "0.5907245", "0.5906287", "0.59060323", "0.5905487", "0.5904193", "0.5904193", "0.5901582", "0.5899388", "0.5896696", "0.58948493", "0.5894467", "0.5883138", "0.5878324", "0.58773834", "0.5876329", "0.5872817", "0.58693135", "0.5868514", "0.5867156", "0.58637583", "0.5860736" ]
0.0
-1
Setter da bala do personagem.
public void setBullet(Bullet bullet) { this.bullet = bullet; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void asignarAutomovilPersona(){\r\n persona.setAutomovil(automovil);\r\n }", "public void setEmpresa(Empresa empresa)\r\n/* 89: */ {\r\n/* 90:141 */ this.empresa = empresa;\r\n/* 91: */ }", "public void setBloqueado(java.lang.String param){\n \n this.localBloqueado=param;\n \n\n }", "public void setBunga(int tipeBunga){\n }", "@JsonSetter(\"boss\")\n public void setBoss (Person value) { \n this.boss = value;\n notifyObservers(this.boss);\n }", "public void damePersonaje(String personaje){\n this.personaje=personaje;\n\n\n\n }", "public void crearPersona(){\r\n persona = new Persona();\r\n persona.setNombre(\"Jose\");\r\n persona.setCedula(12345678);\r\n }", "public void setNombre(String nombre){\n this.nombre =nombre;\n }", "public void setTelefono(String telefono) {\r\n\tthis.telefono = telefono;\r\n}", "public void setNombre(String nombre) {this.nombre = nombre;}", "public void setBirthday() { this.birthday = birthday; }", "public void setTelefono(String telefono);", "public void setNombre(String nombre)\r\n/* 65: */ {\r\n/* 66: 76 */ this.nombre = nombre;\r\n/* 67: */ }", "public void setEmpleado(Empleado empleado)\r\n/* 188: */ {\r\n/* 189:347 */ this.empleado = empleado;\r\n/* 190: */ }", "void setSurname(String surname);", "public void setAnio(int p) { this.anio = p; }", "public void setPuntoDeVenta(PuntoDeVenta puntoDeVenta)\r\n/* 145: */ {\r\n/* 146:166 */ this.puntoDeVenta = puntoDeVenta;\r\n/* 147: */ }", "void setNome(String nome);", "public void asignarPersona(Jugador j){\r\n this.jugador = j;\r\n }", "@Override\n\tpublic void setObject(TemplateDeDescripcion objeto, int profundidadActual,\n\t\t\tint profundidadDeseada) {\n\n\t}", "public abstract void setNombre(java.lang.String newNombre);", "public void setNombre(String nombre)\r\n/* 118: */ {\r\n/* 119:214 */ this.nombre = nombre;\r\n/* 120: */ }", "public void setNombre(String nombre) {\r\n\tthis.nombre = nombre;\r\n}", "public void setOwner(Person person) \n {\n owner = person;\n }", "public void setObservacion(java.lang.String param){\n \n this.localObservacion=param;\n \n\n }", "public void setNama() {\n nama.postValue(\"Hello, Riyanto!\");\n }", "public void setEstadoPersona(String p) { this.estadoPersona = p; }", "public void setNome(Object nome2) {\n\t\t\n\t}", "public void setActivo(boolean activo)\r\n/* 115: */ {\r\n/* 116:142 */ this.activo = activo;\r\n/* 117: */ }", "public void setPerson( Person person )\r\n\t{\r\n\t\tthis.person = person;\r\n\t}", "public void setValor(String valor)\n/* 22: */ {\n/* 23:34 */ this.valor = valor;\n/* 24: */ }", "public void setNome(String pNome){\n this.nome = pNome;\n }", "public void setBairro(String bairro) {// Altera o nome do bairro.\r\n\t\tthis.bairro = bairro;\r\n\t}", "void setNama(String nama){\n this.nama = nama;\n }", "public void setName (String name){\n \n boyName = name;\n }", "private void setObjUser(People value) {\n if (value == null) {\n throw new NullPointerException();\n }\n objUser_ = value;\n \n }", "public void setBirth(Date birth) {\r\n this.birth = birth;\r\n }", "@Override\n public void buildPersonalidad() {\n this.personaje.setPersonalidad(\"Pacientes y estrategas.\");\n }", "void setBlue(int blue){\n \n this.blue = blue;\n }", "public void setObjeto(ObjetoVida o){\r\n\t\tobjeto = o;\r\n\t}", "public void setBirth(Date birth) {\n this.birth = birth;\n }", "public void setBirth(Date birth) {\n this.birth = birth;\n }", "public void setAge(int age) { this.age = age; }", "public void setActivo(boolean activo)\r\n/* 178: */ {\r\n/* 179:328 */ this.activo = activo;\r\n/* 180: */ }", "public void setPerson(final Personne person) {\n\t\tthis.bindingGroup.unbind();\n\t\tthis.personne = person;\n\t\tthis.initComponentBindings();\n\t\tthis.benevolatsTable.setBenevolats(ObservableCollections.observableList(this.personne.getBenevolatList()));\n\t}", "public void setDPWeiterePersonen(String value){\n\t\tthis.m_bIsDirty = (this.m_bIsDirty || (!value.equals(this.m_sDPWeiterePersonen)));\n\t\tthis.m_sDPWeiterePersonen=value;\n\t}", "private void actualizarNombre(Persona persona){\n \n String nombre=IO_ES.leerCadena(\"Inserte el nombre\");\n persona.setNombre(nombre);\n }", "public Builder setPerson(com.zzsong.netty.protobuff.two.ProtoData.Person value) {\n if (personBuilder_ == null) {\n if (value == null) {\n throw new NullPointerException();\n }\n dataBody_ = value;\n onChanged();\n } else {\n personBuilder_.setMessage(value);\n }\n dataBodyCase_ = 2;\n return this;\n }", "public void setProprietaire(SystemeAmendesInt.Personne proprietaire) {\n this.proprietaire = proprietaire;\n }", "public void setActivo(boolean activo)\r\n/* 149: */ {\r\n/* 150:255 */ this.activo = activo;\r\n/* 151: */ }", "public void setNumero(int numero)\r\n/* 195: */ {\r\n/* 196:206 */ this.numero = numero;\r\n/* 197: */ }", "public abstract void setCod_tecnico(java.lang.String newCod_tecnico);", "@Test\n public void testSetPersonaPaciente() {\n System.out.println(\"setPersonaPaciente\");\n Persona personaPaciente = null;\n Paciente instance = new Paciente();\n instance.setPersonaPaciente(personaPaciente);\n\n }", "@Override\r\n\tpublic void setForHobby(DriverVO driverVO) {\n\t\t\r\n\t}", "public void setBirth(String birth) {\n this.birth = birth;\n }", "@Test\n public void testSetPrenom() {\n String prenom = \"Pablo\";\n Beneficiaire instance = ben1;\n instance.setPrenom(prenom);\n assertTrue(prenom.equals(instance.getPrenom()));\n\n prenom = \"Nino\";\n instance = ben3;\n instance.setPrenom(prenom);\n assertTrue(prenom.equals(instance.getPrenom()));\n\n prenom = \"Lulu\";\n assertFalse(prenom.equals(instance.getPrenom()));\n }", "void setProvincia(String provincia);", "public void setMotivoLlamadoAtencion(MotivoLlamadoAtencion motivoLlamadoAtencion)\r\n/* 119: */ {\r\n/* 120:127 */ this.motivoLlamadoAtencion = motivoLlamadoAtencion;\r\n/* 121: */ }", "public void setCuentaContable(CuentaContable cuentaContable)\r\n/* 83: */ {\r\n/* 84:103 */ this.cuentaContable = cuentaContable;\r\n/* 85: */ }", "public void setTelefono(String telefono)\r\n {\r\n this.telefono = telefono;\r\n }", "@Override\n public void set(Voluntario a) {\n if (a==null) a=new Voluntario();\n \n txtNome.setText(a.getNome());\n DateFormat df = new SimpleDateFormat(\"dd/mm/yyyy\");\n txtDataN.setText(df.format(a.getDataNascimento().getTime()));\n txtNacionalidade.setText(a.getNacionalidadeIndiv());\n txtProfissao.setText(a.getProfissao());\n txtMorada.setText(a.getMorada());\n txtCodPostal.setText(a.getCodigoPostal());\n txtLocalidade.setText(a.getLocalidade());\n txtTelefone.setText(a.getTelefone());\n txtTelemovel.setText(a.getTelemovel());\n txtEmail.setText(a.getEmail());\n txtNif.setText(a.getNif()+\"\");\n txtHabilit.setText(a.getHabilitacoes());\n txtConhecimentosL.setText(a.getConhecimentosLing());\n txtFormComp.setText(a.getFormacaoComp());\n txtExpV.setText(a.getExperienciaVolunt());\n txtConhecimentosC.setText(a.getConhecimentosConstr());\n txtDispon.setText(a.getDisponibilidade());\n txtComoConheceu.setText(a.getComoConheceu());\n checkReceberInfo.setSelected(a.getReceberInfo());\n checkIsParceiro.setSelected(a.isParceiro()); \n \n voluntario = a;\n }", "private void setPerson(SmPerson tchPerId) {\n //m_person = tchPerId;\n jcbTeachers.setSelectedItem( tchPerId );\n }", "@Schema(hidden = true)\n public void setPerson(Person person) {\n this.person = person;\n }", "public void setAnio(int anio){\r\n \r\n \r\n this.anio = anio;\r\n \r\n }", "public void setIdBoleta(int value) {\n this.idBoleta = value;\n }", "public void setUsuario(java.lang.String newUsuario);", "void setTitolo(String titolo);", "@Test\n public void testSetNombre() {\n System.out.println(\"setNombre\");\n String nombre = \"T-3\";\n DboEdificio instance = new DboEdificio(1, \"T-3\");\n instance.setNombre(nombre);\n \n }", "public void set(boolean bol);", "public void setEstablecimiento(String establecimiento)\r\n/* 119: */ {\r\n/* 120:198 */ this.establecimiento = establecimiento;\r\n/* 121: */ }", "@Override\n public void setBorn(boolean[] birth){\n this.born = birth;\n }", "public String setName(String name){\n return personName = name;\n }", "public void setPapeles(int avenida, int calle, int cant);", "public void setBrojParcele(int value) {\n this.brojParcele = value;\n }", "void setCognome(String cognome);", "public void setGenero(Genero genero)\r\n/* 148: */ {\r\n/* 149:271 */ this.genero = genero;\r\n/* 150: */ }", "void setBirthDate(Date birthDate);", "public void setnombre(String nombre){\n this.nombre = nombre;\n }", "public void setApellidos(String p) { this.apellidos = p; }", "public void setNumero(int numero) { this.numero = numero; }", "public static void setPedido(Pedido pPedido){\n\t\tmiPedido = pPedido;\n\t}", "public void setC_BPartner_ID (int C_BPartner_ID);", "public void setTelefono(String aTelefono) {\n telefono = aTelefono;\n }", "public static void setPerson_to_play(int aPerson_to_play)\n {\n person_to_play = aPerson_to_play;\n }", "public void setB1(int b1)\n {\n this.b1 = b1;\n }", "public void setNome(String nome){\r\n this.nome = nome;\r\n }", "public void setNombreCompleto(String nombreCompleto);", "public void setEjercicio(Ejercicio ejercicio)\r\n/* 150: */ {\r\n/* 151:193 */ this.ejercicio = ejercicio;\r\n/* 152: */ }", "public void setMensaje(String mensaje)\r\n/* 638: */ {\r\n/* 639:714 */ this.mensaje = mensaje;\r\n/* 640: */ }", "private void setUser(People value) {\n if (value == null) {\n throw new NullPointerException();\n }\n user_ = value;\n \n }", "public abstract void setAcma_cierre(java.lang.String newAcma_cierre);", "public void setOwner(Person person) {\n _owner = person;\n }", "public void setB(boolean b) {\n\tthis.b = b;\n }", "public void setBirthday(Date birthday);", "void setAnnoPubblicazione(String annoPubblicazione);", "public void setOwner(Person owner)\n {\n this.owner = owner;\n }", "public void setFirstName(String fname){ firstName.set(fname); }", "public void setCuentaContable(CuentaContable cuentaContable)\r\n/* 304: */ {\r\n/* 305:371 */ this.cuentaContable = cuentaContable;\r\n/* 306: */ }", "public void setPeti_numero(java.lang.Long newPeti_numero);", "public void setPeti_numero(java.lang.Long newPeti_numero);", "Employee setBirthdate(Date birthdate);" ]
[ "0.67467684", "0.6721641", "0.67033756", "0.6696775", "0.6653414", "0.65612864", "0.6428183", "0.64150655", "0.64027554", "0.64019936", "0.63572013", "0.63522595", "0.63309175", "0.63248193", "0.6312173", "0.62764674", "0.6251463", "0.62257427", "0.62244356", "0.6219533", "0.6215436", "0.61934793", "0.6182528", "0.6180793", "0.61763877", "0.61719096", "0.61519724", "0.6139093", "0.6136666", "0.613591", "0.6133586", "0.6126404", "0.61100054", "0.6070145", "0.60577935", "0.60562396", "0.60474986", "0.6045735", "0.6032713", "0.6029519", "0.601587", "0.601587", "0.60019445", "0.598014", "0.59729064", "0.59665126", "0.5965666", "0.59618443", "0.5945137", "0.5944734", "0.59395206", "0.5938086", "0.5920971", "0.5912205", "0.59088606", "0.5903572", "0.5898364", "0.58971727", "0.5895426", "0.5892894", "0.5887645", "0.5885798", "0.5871291", "0.5869048", "0.58597606", "0.58551896", "0.5845214", "0.5838239", "0.58346814", "0.58214533", "0.5820383", "0.5819826", "0.58162045", "0.58113796", "0.5807817", "0.5804358", "0.58031327", "0.5801545", "0.5797749", "0.5793731", "0.57907516", "0.5789794", "0.57870895", "0.57849276", "0.578474", "0.57818526", "0.57790047", "0.5778169", "0.5777711", "0.57710713", "0.5770454", "0.5768966", "0.5764201", "0.57546484", "0.5754201", "0.5753661", "0.57521284", "0.57494134", "0.5749334", "0.5749334", "0.57455176" ]
0.0
-1
Getter do nome do personagem.
public String getName() { return name; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String getNome() {\r\n\t\treturn nome;\r\n\t}", "public String getNome() {\r\n\t\treturn nome;\r\n\t}", "public String getNome()\r\n\t{\r\n\t\treturn nome;\r\n\t}", "public String getNome()\r\n\t{\r\n\t\treturn nome;\r\n\t}", "String getNome();", "public String getNome() {\n\t\treturn nome;\n\t}", "public String getNome() {\n\t\treturn nome;\n\t}", "public String getNome() {\n\t\treturn nome;\n\t}", "public String getNome() {\n\t\treturn nome;\n\t}", "public String getNome() {\n\t\treturn nome;\n\t}", "public String getNome() {\n\t\treturn nome;\n\t}", "public String getNome() {\n\t\treturn nome;\n\t}", "public String getNome() {\n\t\treturn nome;\n\t}", "public String getNome() {\n\t\treturn nome;\n\t}", "public String getName(){\n\t\treturn this.firstName + \" \" + this.surname;\r\n\t}", "public String getNome() {\n\t\treturn this.nome;\r\n\t}", "String getPrimeiroNome();", "public String getNome() {\n\t\treturn this.nome;\n\t}", "public String getNome() {\n\t\treturn this.nome;\n\t}", "public String getNome() {\r\n return nome;\r\n }", "public String getNome() {\r\n return nome;\r\n }", "public String nome() {\n\t\treturn this.nome;\n\t}", "public Object getNome() {\n\t\treturn null;\n\t}", "@Override\n\tpublic String getName() {\n\t\treturn nombre;\n\t}", "public String getName()\n {\n return foreName + \" \" + lastName;\n }", "public String getNome(){\n\t\treturn nome;\n\t}", "public String getName() {\n return this.id + \", \" + this.nom + \" \" + this.prenom + \", \" + this.cin;\n }", "public String getName (){\r\n return firstName + \" \" + lastName;\r\n }", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "java.lang.String getName();", "public String getNome();", "String getUltimoNome();", "public String getName(){\n return personName;\n }", "public String getNome() {\n return nome;\n }", "public String getNome() {\n return nome;\n }", "public String getNome() {\n return nome;\n }", "public String getNome() {\n return nome;\n }", "public String getNome() {\n return nome;\n }", "public String getNome() {\n return nome;\n }", "public String lerNome() {\n\t\treturn JOptionPane.showInputDialog(\"Digite seu Nome:\");\n\t\t// janela de entrada\n\t}", "public String getName() {\n return firstName + \" \" + lastName;\n }", "public java.lang.String getName();", "public String getName() {\r\n\t\treturn firstName + \" \" + lastName;\r\n\t}", "public String getNome() {\n return this.nome;\n }", "public String getName() {\n return name + \"\";\n }", "public static String name(PersonEntity pe)\n\t{\n\t\tif(pe == null) return null;\n\n\t\tPerson p = pe.getOx();\n\n\t\treturn cat(null, \" \", p.getLastName(),\n\t\t p.getFirstName(), p.getMiddleName()).toString();\n\t}", "public String getCognomeNome() {\n\t\treturn this.cognome + \" \" + this.nome;\n\t}", "String getName() ;", "public String getNome(){\n return preferencias.getString(CHAVE_NOME, null);\n }", "@Nullable String getName();", "@Nullable String getName();" ]
[ "0.776213", "0.776213", "0.7758236", "0.7758236", "0.76936984", "0.76880693", "0.76880693", "0.76880693", "0.76880693", "0.76880693", "0.76880693", "0.76880693", "0.76880693", "0.76880693", "0.7625644", "0.76235664", "0.7575862", "0.7570001", "0.7570001", "0.7560303", "0.7560303", "0.75499064", "0.754817", "0.74851424", "0.748419", "0.7483877", "0.7472694", "0.74660885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465885", "0.7465509", "0.7437376", "0.7433315", "0.74166775", "0.74166775", "0.74166775", "0.74166775", "0.74166775", "0.74166775", "0.740552", "0.7375048", "0.73633045", "0.73387367", "0.73203266", "0.7297916", "0.72902215", "0.7288726", "0.728718", "0.7283332", "0.72654116", "0.72654116" ]
0.0
-1
Setter do nome do personagem.
public void setName(String name) { this.name = name; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setName(String name)\r\n\t{\r\n\t\tthis.nome = nome;\r\n\t}", "public void setName(String name) {\n\t\tthis.nome = name;\n\t}", "void setNome(String nome);", "public void setNome(String nome) {\r\n\t\t// QUALIFICADOR = THIS\r\n\t\tthis.nome = nome;\r\n\t}", "public void setName (String n) {\n name = n;\n }", "public void setName(String n) {\r\n name = n;\r\n }", "public void setName(String n)\n\t{\n\t\tfullName=n;\n\t}", "public void setNome(String pNome){\n this.nome = pNome;\n }", "public void setNome(String nome) {\n String oldNome = this.nome;\n this.nome = nome;\n propertyChangeSupport.firePropertyChange(PROP_NOME, oldNome, nome);\n }", "public void setNome (String nome) {\r\n\t\tthis.nome=nome;\r\n\t}", "public void setNome(String nomeAeroporto)\n {\n this.nome = nomeAeroporto;\n }", "public void setName(String n) {\n this.name = n;\n }", "public void setName (String n){\n\t\tname = n;\n\t}", "public void setNome(String nome){\r\n this.nome = nome;\r\n }", "public void setNome(String nome) {\r\n this.nome = nome;\r\n }", "public void setNome(String nome) {\r\n this.nome = nome;\r\n }", "public void setName(String n) {\r\n\t\tthis.name = n;\r\n\t}", "public void setName(String n){ name=n; }", "@IcalProperty(pindex = PropertyInfoIndex.NAME,\n required = true,\n eventProperty = true,\n todoProperty = true,\n journalProperty = true)\n public void setName(final String val) {\n name = val;\n }", "public void setName( String pName )\n {\n name = pName;\n }", "private void actualizarNombre(Persona persona){\n \n String nombre=IO_ES.leerCadena(\"Inserte el nombre\");\n persona.setNombre(nombre);\n }", "public void setNome(String nome) {\r\n\t\tthis.nome = nome;\r\n\t}", "public void setNome(String nome) {\n this.nome = nome;\n }", "public void setNome(String nome) {\n this.nome = nome;\n }", "public void setNome(String nome) {\n this.nome = nome;\n }", "public void setName(String name) {\n fName= name;\n }", "public static void setLastName(String name){\n setUserProperty(Constants.ZeTarget_keyForUserPropertyLName,name);\n }", "@Override\n public void setName(String name) {\n this.name = name;\n }", "@Override\n public void setName(String name) {\n this.name = name;\n }", "public void setName(String nameIn) {\n name = nameIn;\n }", "public void setName(java.lang.String value) {\n this.name = value;\n }", "public void setName(String value) {\n this.name = value;\n }", "@Override\n public void setName(String name) {\n this.name = name;\n }", "@Override\n public void setName(String name) {\n this.name = name;\n }", "public void setName(String inName)\n {\n name = inName;\n }", "public void setName(String name)\n {\n fName = name;\n }", "public String setName(String name){\n return personName = name;\n }", "public void setName(String name){\r\n gotUserName = true;\r\n this.name = name;\r\n }", "public static void setName(String n){\n\t\tname = n;\n\t}", "@Override\r\n\tpublic void setName(String name) {\n\t\tthis.name = name;\r\n\t}", "private void setNomeProfessor(String novoNome)\n\t{\n\t\tthis.nomeProfessor = novoNome;\n\t}", "public void setName(String inName)\n {\n\tname = inName;\n }", "public void setNome(String nome) {\n\t\tthis.nome = nome;\n\t}", "public void setNome(String nome) {\n\t\tthis.nome = nome;\n\t}", "public void setNome(String nome) {\n\t\tthis.nome = nome;\n\t}", "public void setNome(String nome) {\n\t\tthis.nome = nome;\n\t}", "@Override\n\tpublic void setName(String name) {\n\t\tthis.name = name;\n\t}", "public void setName(String name) {\n \tthis.name = name;\n }", "public void setName(String name) {\n \tthis.name = name;\n }", "public void setName(String name) { this.name = name; }", "public void setName(String name) { this.name = name; }", "public void setName(String name) { this.name = name; }", "public void setName(String name) { this.name = name; }", "public void setName(final String name);", "public void setName(String s) {\n this.name = s;\n }", "public void setName(String name) {\n m_Name = name;\n }", "public void setName(String name) {\n if (!name.equals(\"\")) {\r\n this.name = name;\r\n }\r\n\r\n\r\n\r\n\r\n }", "public void setName(String firstName, String lastName)\n {\n this.name = firstName +\" \"+ lastName;\n\n }", "public void setName(String name)\r\n\t{\t\t\r\n\t\tthis.name = name;\r\n\t}", "public void setName(String name) {\n this.name = name;\n }", "@Override\n\tpublic void setName(String name) {\n\t\tthis.name = name;\n\n\t}", "public void setName(final String name) {\n this.name = name;\n }", "public void setName(final String name) {\n this.name = name;\n }", "public void setName(String name){\r\n this.name = name;\r\n }", "public void setName(String name){\r\n this.name = name;\r\n }", "public void setName(String name){\r\n this.name = name;\r\n }", "public void setName(String name) \n {\n this.name = name;\n }", "public void setName(String name) {\r\n this.name = name;\r\n }", "public void setName(String name) {\r\n this.name = name;\r\n }", "public void setName(String name) {\r\n this.name = name;\r\n }", "public void setName(String newname){\n name = newname; \n }", "public void setName(String name)\r\n {\r\n this.mName = name;\r\n }", "public void setName(String name)\r\n {\r\n this.name = name;\r\n }", "public void setName(String name)\r\n {\r\n this.name = name;\r\n }", "public void setName(String name)\r\n {\r\n this.name = name;\r\n }", "public void setName(String name)\r\n {\r\n this.name = name;\r\n }", "public void setName(String name) {\n \tif (name==null)\n \t\tthis.name = \"\";\n \telse\n \t\tthis.name = name;\n\t}", "public void setName(String name) {\t\t\r\n\t\tthis.name = name;\t\t\r\n\t}", "public void setName( final String name )\r\n {\r\n this.name = name;\r\n }", "public void setName(java.lang.String value);", "public void setName(java.lang.String value);", "public void setName(String name){\r\n\t\tthis.name = name;\r\n\t}", "public void setName(String name){\r\n\t\tthis.name = name;\r\n\t}", "public void setName(String name){\r\n\t\tthis.name = name;\r\n\t}", "public void setName(String name) {\n if (!name.isEmpty()) {\n this.name = name;\n }\n }", "public void setName(String name) {\n\n if (name.isEmpty()) {\n\n System.out.println(\"Owner name must not be empty\");\n /**\n * If Owner name is ever an empty String, a NullPointerException will be thrown when the\n * listings are loaded in from the JSON file. I believe this is because the JSON parser we're\n * using stores empty Strings as \"null\" in the .json file. TODO this fix is fine for now, but\n * I want to make it safer in the future.\n */\n this.name = \" \";\n } else {\n\n this.name = name;\n }\n }", "public void setName(String name) {\r\n this.name = name;\r\n }", "public void setName(String name) {\r\n this.name = name;\r\n }", "public void setName(String name) {\r\n this.name = name;\r\n }", "public void setName(String name) {\r\n this.name = name;\r\n }", "public void setName(String name) {\r\n this.name = name;\r\n }", "public void setName(String name) {\r\n this.name = name;\r\n }", "public void setName(String name) {\r\n this.name = name;\r\n }", "public void setName(String name) {\r\n this.name = name;\r\n }", "public void setName(String name) {\r\n this.name = name;\r\n }", "public void setName(String name) {\r\n this.name = name;\r\n }", "public void setName(String name) {\r\n this.name = name;\r\n }", "public void setName(String name) {\r\n this.name = name;\r\n }", "public void setName(String name) {\r\n this.name = name;\r\n }", "public void setName(String name) {\r\n this.name = name;\r\n }", "public void setName(String name) {\r\n this.name = name;\r\n }" ]
[ "0.8031733", "0.79221785", "0.77404183", "0.7452004", "0.74070853", "0.7397259", "0.7386407", "0.7386132", "0.73740566", "0.7336995", "0.73328465", "0.73008734", "0.7296149", "0.72904944", "0.72499347", "0.72499347", "0.71919894", "0.7179916", "0.7152659", "0.7152609", "0.71447814", "0.7143128", "0.7126687", "0.7126687", "0.7126687", "0.7119159", "0.710977", "0.7108467", "0.7108467", "0.7104365", "0.71014297", "0.7096606", "0.70810807", "0.70810807", "0.7077098", "0.7061213", "0.7060176", "0.70572424", "0.70568", "0.7052882", "0.7038529", "0.70362025", "0.7017598", "0.7017598", "0.7017598", "0.7017598", "0.70143193", "0.70132506", "0.70132506", "0.7011028", "0.7011028", "0.7011028", "0.7011028", "0.7005318", "0.69915056", "0.69905096", "0.6985902", "0.6985297", "0.698026", "0.69796866", "0.6972244", "0.6970484", "0.6970484", "0.69697225", "0.69697225", "0.69697225", "0.69695", "0.696835", "0.696835", "0.696835", "0.6966836", "0.6961983", "0.69608986", "0.69608986", "0.69608986", "0.69608986", "0.69595176", "0.69550556", "0.6954723", "0.69546336", "0.69546336", "0.6949931", "0.6949931", "0.6949931", "0.69440174", "0.694366", "0.6942514", "0.6942514", "0.6942514", "0.6942514", "0.6942514", "0.6942514", "0.6942514", "0.6942514", "0.6942514", "0.6942514", "0.6942514", "0.6942514", "0.6942514", "0.6942514", "0.6942514" ]
0.0
-1
Getter de vidas do personagem.
public int getLives() { return lives; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int getVid() {\r\n return vid;\r\n }", "public Integer getVid() {\n return vid;\n }", "public java.lang.String getVid() {\r\n return localVid;\r\n }", "public int getVideos() {\n return videos;\n }", "public List<Video> getVideo() {\n\t\treturn null;\n\t}", "String getVideoId() {\r\n return videoId;\r\n }", "public void setVidas (int vidas)\r\n\t{\r\n\t\tthis.vidas= vidas;\r\n\t}", "String getVideoId() {\n return videoId;\n }", "public List<Voto> getVotos(){\n\t\treturn em.createQuery(\"SELECT c from Voto c\", Voto.class).getResultList();\n\t}", "public String getVideourl() {\n return videourl;\n }", "com.google.ads.googleads.v6.resources.Video getVideo();", "public List<Video> getVideoList() {\n return (ArrayList<Video>) mVideoServiceProxy.getVideos();\n }", "public String getVideo() {\n return video;\n }", "public List<VideoBlockModel> getVideos() {\n return (List<VideoBlockModel>) (List) getVideos(false);\n }", "public List<Video> getAllVideos() {\n\t\tList<Video> videoList = new ArrayList<Video>();\n\t\t// Select All Query\n\t\tString selectQuery = \"SELECT * FROM \" + VivaFrame.TABLE_NAME;\n\n\t\tSQLiteDatabase db = this.getWritableDatabase();\n\t\tCursor cursor = db.rawQuery(selectQuery, null);\n\n\t\t// looping through all rows and adding to list\n\t\tif (cursor.moveToFirst()) {\n\t\t\tdo {\n\t\t\t\tVideo video = new Video();\n\t\t\t\tvideo.setID(Integer.parseInt(cursor.getString(0)));\n\t\t\t\tvideo.setFolderNumber(Integer.parseInt(cursor.getString(1)));\n\t\t\t\tvideo.setName(cursor.getString(2));\n\t\t\t\tvideo.setPhoneNumber(cursor.getString(3));\n\t\t\t\t// Adding contact to list\n\t\t\t\tvideoList.add(video);\n\t\t\t} while (cursor.moveToNext());\n\t\t}\n\n\t\t// return contact list\n\t\treturn videoList;\n\t}", "int getVida()\n\t{\n\t\treturn vida;\n\t}", "public Vediotape getVedio () {\n\t\treturn vedio;\n\t}", "public void setVid(int value) {\r\n this.vid = value;\r\n }", "MovieVideo getMovieVideoByVideoid(String videoid);", "VideosClient getVideos();", "public Face getFaceVitoriosa() {\n return faceVitoriosa;\n }", "public void setVid(Integer vid) {\n this.vid = vid;\n }", "List<Video> getAll();", "@RequestMapping(value=VideoSvcApi.VIDEO_SVC_PATH, method=RequestMethod.GET)\n\tpublic @ResponseBody Collection<Video> getVideos() {\n\t\treturn videos;\n\t}", "public java.lang.String getVideoGuid() {\n return videoGuid;\n }", "public List<Aviao> getListAvioes() {\n return avioes;\n }", "@RequestMapping(value=VideoSvcApi.VIDEO_SVC_PATH, method=RequestMethod.GET)\n\tpublic @ResponseBody Collection<Video> getVideos() {\n\t\t// TODONE Implement the logic to return the list of all videos.\n\t\tassert(videos != null);\n\t\t\n\t\treturn videos.values();\n\t}", "public int getVideoJittcomp();", "public Video getVideo(int id) {\n\t\tSQLiteDatabase db = this.getReadableDatabase();\n\t\t/*\n\t\t * Cursor cursor = db.query(TABLE_CONTACTS, new String[] { KEY_ID,\n\t\t * KEY_NAME, KEY_PH_NO }, KEY_ID + \"=?\", new String[] {\n\t\t * String.valueOf(id) }, null, null, null, null);\n\t\t */\n\t\tCursor cursor = db.query(VivaFrame.TABLE_NAME, new String[] {\n\t\t\t\tVivaFrame.COLUMN_NAME_VI_ID, VivaFrame.COLUMN_NAME_VI_FOLDER,\n\t\t\t\tVivaFrame.COLUMN_NAME_VI_NAME, VivaFrame.COLUMN_NAME_VI_URL },\n\t\t\t\tVivaFrame.COLUMN_NAME_VI_ID + \"=?\",\n\t\t\t\tnew String[] { String.valueOf(id) }, null, null, null, null);\n\t\tif (cursor != null)\n\t\t\tcursor.moveToFirst();\n\n\t\tVideo video = new Video(Integer.parseInt(cursor.getString(0)),\n\t\t\t\tInteger.parseInt(cursor.getString(1)), cursor.getString(2),\n\t\t\t\tcursor.getString(3));\n\t\t// return contact\n\t\treturn video;\n\t}", "@RequestMapping(value = VideoSvcApi.VIDEO_SVC_PATH, method = RequestMethod.GET)\n\tpublic @ResponseBody Collection<Video> getVideoList() {\n\t\treturn Lists.newArrayList(videos.findAll());\n\t}", "public Iterable<DiameterAVP> getAvps() {\n\t\treturn _avps;\n\t}", "public String getViveId()\n\t{\n\t\treturn viveId;\n\t}", "private static VideoHolder getAllVideo(String ligne) throws IOException {\n String[] vid = ligne.split(\" \");\n VideoHolder videoHolder = new VideoHolder();\n for (int i = 0; i < vid.length; i++) {\n videoHolder.add(new Video(i, Integer.parseInt(vid[i])));\n }\n return videoHolder;\n }", "public int getIngresosPorVentas(){\n return this.ingresosPorVentas;\n }", "public ArrayList<String> getAllVideosName() {\n\t\tArrayList<String> videoList = new ArrayList<String>();\n\n\t\tString selectQuery = \"SELECT * FROM \" + VivaFrame.TABLE_NAME;\n\n\t\tSQLiteDatabase db = this.getWritableDatabase();\n\t\tCursor cursor = db.rawQuery(selectQuery, null);\n\n\t\t// looping through all rows and adding to list\n\t\tif (cursor.moveToFirst()) {\n\t\t\tdo {\n\t\t\t\tString videoname = new String();\n\t\t\t\tvideoname = cursor.getString(2);\n\t\t\t\t// Adding to list\n\t\t\t\tvideoList.add(videoname);\n\t\t\t} while (cursor.moveToNext());\n\t\t}\n\n\t\treturn videoList;\n\t}", "public Video getVideoByName(String name) {\n\t\tSQLiteDatabase db = this.getReadableDatabase();\n\t\t/*\n\t\t * Cursor cursor = db.query(TABLE_CONTACTS, new String[] { KEY_ID,\n\t\t * KEY_NAME, KEY_PH_NO }, KEY_ID + \"=?\", new String[] {\n\t\t * String.valueOf(id) }, null, null, null, null);\n\t\t */\n\t\tCursor cursor = db.query(VivaFrame.TABLE_NAME, new String[] {\n\t\t\t\tVivaFrame.COLUMN_NAME_VI_ID, VivaFrame.COLUMN_NAME_VI_FOLDER,\n\t\t\t\tVivaFrame.COLUMN_NAME_VI_NAME, VivaFrame.COLUMN_NAME_VI_URL },\n\t\t\t\tVivaFrame.COLUMN_NAME_VI_NAME + \"=?\",\n\t\t\t\tnew String[] { String.valueOf(name) }, null, null, null, null);\n\t\tif (cursor != null)\n\t\t\tcursor.moveToFirst();\n\n\t\tVideo video = new Video(Integer.parseInt(cursor.getString(0)),\n\t\t\t\tInteger.parseInt(cursor.getString(1)), cursor.getString(2),\n\t\t\t\tcursor.getString(3));\n\t\t// return contact\n\t\treturn video;\n\t}", "public Map<String, Properties> getVideoData() {\n return videoData;\n }", "public int getVideobitrate() {\n return videobitrate;\n }", "public java.lang.String getVideoName() {\n return videoName;\n }", "public Jogador getVencedor() {\r\n return vencedor;\r\n }", "public int getEntradasVendidas() {\n\t\treturn entradasVendidas;\n\t}", "@Override\n\tpublic UscAdvertIncome getVideoAdvertiser(Integer id) throws Exception {\n\t\tUscAdvertIncome videoAdvertiser=uscAdvertIncomeMapper.getAdvertiserByPrimaryKey(id);\n\t\treturn videoAdvertiser;\n\t}", "ImmutableList<SchemaOrgType> getVideoList();", "public Collection getListaPartidosEleicaoVotos(){\n return this.eleicaoDB.getListaPartidosEleicaoVotos();\n }", "public java.lang.String getVideoUserGuid() {\n return videoUserGuid;\n }", "public Vector2d getVve() {\n return vve;\n }", "public String getVideoUrl() {\n return videoUrl;\n }", "public ABLVideo Video() {\r\n \treturn new ABLVideo(BrickFinder.getDefault().getVideo());\r\n }", "public double[] getVentasXVendedor() {\r\n double vVendedores[] = new double[nv];\r\n int i;\r\n for (i = 0; i < nv; i++) {\r\n vVendedores[i] = getVentasVendedor(i);\r\n }\r\n return vVendedores;\r\n }", "public VrstaVezbe getVv() {\n return vv;\n }", "public String getVigencia() { return this.vigencia; }", "public int getvID() {\n return vID;\n }", "public ArrayList<PointVente> getPointV() {\n\t\t\treturn pointV;\n\t\t}", "public int getVideoDscp();", "public List<Vendedor> listarVendedor();", "@Override\n public ArrayList<Propiedad> getPropiedadesAgente(String pId) throws SQLException {\n ArrayList<Propiedad> resultado = new ArrayList<Propiedad>();\n resultado = (ArrayList<Propiedad>) bdPropiedad.selectQuery(\"SELECT * FROM PROPIEDAD WHERE ID_AGENTE \"\n + \"= '\" + pId + \"'\");\n return resultado;\n }", "public java.lang.String getVideoUserDomainGuid() {\n return videoUserDomainGuid;\n }", "List<Videoinfo> selectAll();", "public VisorPuesto getVisorPuesto() {\n return visorPuesto;\n }", "public Part getFotoPerfil(){\n return fotoPerfil;\n }", "public String getIdVenta() {\n return idVenta;\n }", "public List<Movie> getMovies(){\r\n if(person == null){\r\n return new ArrayList();\r\n }\r\n \r\n return new ArrayList(person.getMovies().values());\r\n }", "public float getMediaVoti() {\r\n\t\treturn mediaVoti;\r\n\t}", "public void listarTodosLosVideojuegosRegistrados()\n {\n System.out.println(\"Videojuegos disponibles: \");\n for(Videojuegos videojuego : listaDeVideojuegos) {\n System.out.println(videojuego.getDatosVideojuego());\n }\n }", "public String[] getVideoDevicesList();", "public byte[] getVideoBuffer()\n {\n return this.videocard.vgaMemory;\n }", "public long getVideoPosition() {\n return videoPosition;\n }", "public String getVideoDevice();", "public String mo1736b() {\n return \"video\";\n }", "public java.lang.String getVideoUserDomainCode() {\n return videoUserDomainCode;\n }", "@Override\n public String toString()\n {\n return \"Video: \" + videoTitle + \"\\nCreated By: \" + videoCreator;\n }", "public String getPav() {\r\n\t\treturn pav;\r\n\t}", "public int getVaoID() {\n\t\treturn vaoID;\n\t}", "public java.util.Calendar getDataPrimeiroVencimento() {\n return dataPrimeiroVencimento;\n }", "public RepositorioAvioes() {\n avioes = new ArrayList<Aviao>();\n }", "@ManyToMany//(cascade = {CascadeType.PERSIST, CascadeType.MERGE})\n public List<Person> getParticipants() {\n return participants;\n }", "public Integer getDistanciaVivienda() {\n return distanciaVivienda;\n }", "public double getVideoLength(){\n\t\treturn videoLength;\n\t}", "public ObjetoVida getObjeto(){\r\n\t\treturn objeto;\r\n\t}", "Videoinfo selectByPrimaryKey(Integer videoid);", "private String whoIsMVP() {\n int highestValue = 0;\n String mvp = null;\n for (String player : mvpPlayersMap.keySet()) {\n if (highestValue < mvpPlayersMap.get(player)) {\n highestValue = mvpPlayersMap.get(player);\n mvp = player;\n }\n }\n log.info(\"MVP player: {} with {} points\", mvp, highestValue);\n return mvp;\n }", "Videogioco findVideogiocoById(int id);", "public List<Personagem> findByMembroId(String id);", "List<Videogioco> retriveByPiattaforma(String piattaforma);", "public PuntoDeVenta getPuntoDeVenta()\r\n/* 140: */ {\r\n/* 141:162 */ return this.puntoDeVenta;\r\n/* 142: */ }", "public HashMap<Integer, Sprite> getVillagers() {\n\t\tfor (int i = 0; i < player.getPartyMembers().size(); i++) {\n\t\t\tint h = player.getPartyMembers().get(i).hashCode();\n\t\t\tsprites.remove(h);\n\t\t}\n\t\tupdateSpriteList();\n\t\treturn sprites;\n\t}", "public List<Object[]> getMovieByTheaterId(long ID){\n\t\treturn theMoviewRepository.getMovieByTheateID(ID);\n\t}", "@Override\n public byte[] getVideo(String cameraName) {\n throw new IllegalStateException(\"Not implemented yet!\");\n }", "public ArrayList<Reserva> getReservasDoVeiculo() {\n\t\treturn reservasDoVeiculo;\n\t}", "public Vragenlijst getVragenlijst() {\n return vragenlijst;\n }", "public String getCourseVideo() {\n return courseVideo;\n }", "public java.util.List<java.lang.Long>\n getParticipantsList() {\n return participants_;\n }", "public List<VerbPhrase> getVpList(){\n\t\tSet<NounPhrase> entitySet = this.getEntConsiderPass(\"O\");\n\t\tList<VerbPhrase> vpList = new ArrayList<VerbPhrase>();\n\t\t\n\t\tfor(NounPhrase object : entitySet){\t\t\n\t\t\t//vpList.add(new VerbPhrase(this.getActionStr(), object));\n\t\t\tvpList.add(new VerbPhrase(this.action, object));\n\t\t}\t\t\n\t\treturn vpList;\n\t}", "public int getDiasVacaciones() {\r\n\t\treturn super.getDiasVacaciones()/2;\r\n\t}", "@Override\n\tpublic java.lang.String getVcampo() {\n\t\treturn _esfShooterAffiliationChrono.getVcampo();\n\t}", "public String getVideoStreamName() {\n return videoStreamName;\n }", "public List<Movie> getMovieData() {\n return movieData;\n }", "public int getIdDetalle_Ventaf() {\n return idDetalle_Ventaf;\n }", "public int getVideoState() {\n return this.mVideoState;\n }", "public ObservableList<Movie> getFilmData() {\r\n return ser.movieData;\r\n }", "public List<Movie> dVD() {\n String url = \"http://api.rottentomatoes.com/api/public/v1.0/lists/dvds/new_releases.json?\"\n + \"apikey=yedukp76ffytfuy24zsqk7f5\";\n apicall(url);\n Gson gson = new Gson();\n MovieResponse response = gson.fromJson(data, MovieResponse.class);\n List<Movie> movies = response.getMovies();\n movieData = movies;\n System.out.println(url);\n return movieData;\n }" ]
[ "0.72075367", "0.7021209", "0.6654529", "0.6626327", "0.63308376", "0.6157437", "0.6147101", "0.60899967", "0.6087818", "0.6056954", "0.6012463", "0.5982784", "0.591003", "0.5900699", "0.5815794", "0.5811905", "0.5807783", "0.58001316", "0.5730044", "0.5711306", "0.571086", "0.566773", "0.56652844", "0.56347406", "0.5633294", "0.5624863", "0.56141126", "0.56091356", "0.5594919", "0.5548398", "0.55421454", "0.5540087", "0.5516351", "0.54799247", "0.54682255", "0.544993", "0.54466224", "0.5432762", "0.5396887", "0.53752345", "0.53728485", "0.53616214", "0.5353547", "0.5326675", "0.53191197", "0.52945954", "0.528777", "0.5275419", "0.52564454", "0.5253246", "0.5223211", "0.5222297", "0.5212144", "0.5206645", "0.5195114", "0.5188145", "0.5179373", "0.5173783", "0.51725334", "0.51687735", "0.5153822", "0.5153095", "0.5133688", "0.5127549", "0.5123468", "0.51192594", "0.510348", "0.5098842", "0.5098165", "0.50914085", "0.5090537", "0.5090279", "0.508689", "0.5064483", "0.50578845", "0.5033803", "0.50330883", "0.5032149", "0.5032123", "0.50195485", "0.50091386", "0.50067073", "0.5006614", "0.49984488", "0.49967724", "0.49960372", "0.4994619", "0.49943084", "0.49939638", "0.49854007", "0.49850836", "0.4984835", "0.49773583", "0.49765512", "0.49757758", "0.49629992", "0.49619463", "0.4959468", "0.4954421", "0.49534494", "0.49526662" ]
0.0
-1
Setter de vidas do personagem.
public void setLives(int lives) { this.lives = lives; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void setVidas (int vidas)\r\n\t{\r\n\t\tthis.vidas= vidas;\r\n\t}", "public void setVid(int value) {\r\n this.vid = value;\r\n }", "public void setVid(Integer vid) {\n this.vid = vid;\n }", "void setVida(int vida)\n\t{\n\t\t// variable declarada anteriormente igual a la declarada en el set\n\t\tthis.vida = vida;\n\t}", "public void setVid(java.lang.String param) {\r\n localVidTracker = param != null;\r\n\r\n this.localVid = param;\r\n }", "public int getVid() {\r\n return vid;\r\n }", "public void setVide() {\n\t\tvide = true;\n\t}", "public Integer getVid() {\n return vid;\n }", "public void setVideoDevice(String id);", "public void setVideourl(String videourl) {\n this.videourl = videourl;\n }", "public void setVideo(File video){\n\t\tthis.video = video;\n\t}", "public void setVedio (Vediotape vedio) {\n\t\tthis.vedio = vedio;\n\t}", "public void setObjeto(ObjetoVida o){\r\n\t\tobjeto = o;\r\n\t}", "@Override\n\tvoid postarVideo() {\n\n\t}", "public void setVideo(String video) {\n this.video = video;\n }", "public void setVideoPort(int port);", "public void setPuntoDeVenta(PuntoDeVenta puntoDeVenta)\r\n/* 145: */ {\r\n/* 146:166 */ this.puntoDeVenta = puntoDeVenta;\r\n/* 147: */ }", "public void asignarAutomovilPersona(){\r\n persona.setAutomovil(automovil);\r\n }", "public void AumentarVictorias() {\r\n\t\tthis.victorias_actuales++;\r\n\t\tif (this.victorias_actuales >= 9) {\r\n\t\t\tthis.TituloNobiliario = 3;\r\n\t\t} else if (this.victorias_actuales >= 6) {\r\n\t\t\tthis.TituloNobiliario = 2;\r\n\t\t} else if (this.victorias_actuales >= 3) {\r\n\t\t\tthis.TituloNobiliario = 1;\r\n\t\t} else {\r\n\t\t\tthis.TituloNobiliario = 0;\r\n\t\t}\r\n\t}", "public void setMotivoLlamadoAtencion(MotivoLlamadoAtencion motivoLlamadoAtencion)\r\n/* 119: */ {\r\n/* 120:127 */ this.motivoLlamadoAtencion = motivoLlamadoAtencion;\r\n/* 121: */ }", "@Override\n\tpublic void setVcampo(java.lang.String Vcampo) {\n\t\t_esfShooterAffiliationChrono.setVcampo(Vcampo);\n\t}", "public static void setPerson_to_play(int aPerson_to_play)\n {\n person_to_play = aPerson_to_play;\n }", "public java.lang.String getVid() {\r\n return localVid;\r\n }", "public void setVideoDscp(int dscp);", "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 }", "Builder addVideo(VideoObject value);", "void setVisivel(boolean visivel);", "String getVideoId() {\r\n return videoId;\r\n }", "public static void setPedido(Pedido pPedido){\n\t\tmiPedido = pPedido;\n\t}", "public void setVigencia(String vigencia) { this.vigencia = vigencia; }", "public void setPapeles(int avenida, int calle, int cant);", "@Override\r\n\tprotected void initVentajas() {\n\r\n\t}", "public void setVictimas(List<Victima> listaVictimas) {\n\t\tif ( visorEscenario != null )\n\t\t\tvisorEscenario.setVictimas(listaVictimas);\n\t}", "public Ventas() {\n setIdVenta(1);\n setIdCliente(1);\n setFecha(new Date());\n setEstado(0); \n }", "public void setVideoJittcomp(int milliseconds);", "public void setTurned(){\n\tIS_TURNED = true;\n\tvimage = turnedVimImage;\n }", "public int getVideos() {\n return videos;\n }", "public void setPreviewVideoDefinition(VideoDefinition vdef);", "String getVideoId() {\n return videoId;\n }", "private void esvaziaMensageiro() {\n\t\tMensageiro.arquivo=null;\n\t\tMensageiro.lingua = linguas.indexOf(lingua);\n\t\tMensageiro.linguas=linguas;\n\t\tMensageiro.nomeArquivo=null;\n\t}", "public void setVideo(Video video) {\r\n this.video = video;\r\n\r\n nameField.setText(video.getName());\r\n urlField.setText(video.getUrl());\r\n }", "public void setIngresosPorVentas(int ingresosPorVentas){\n this.ingresosPorVentas = ingresosPorVentas;\n }", "public void setVideoPosition(long videoPosition) {\n this.videoPosition = videoPosition;\n }", "public void assignIDtoVM(){\n\t\tint count = 0;\n\t\tfor(VirtualMachine aux : vms)\n\t\t\taux.setId(id + Integer.toString(count++));\n\t}", "public void setCamino(ArrayList<Posicion> camino)\n{\n m_camino = camino;\n}", "public void agregarVictoria(Jugador jugador) {\r\n if (!this.isReplay()) {\r\n jugador.setVictorias(jugador.getVictorias() + 1);\r\n }\r\n }", "public void setVideobitrate(int videobitrate) {\n this.videobitrate = videobitrate;\n }", "private void setMovie() {\n Movie movie = getIntent().getExtras().getParcelable(MOVIE);\n Glide.with(mMoviePoster).setDefaultRequestOptions(new RequestOptions().diskCacheStrategy(DiskCacheStrategy.ALL)).load(BuildConfig.IMG_DIR + movie.getPosterPath())\n .into(mMoviePoster);\n setTitle(movie.getTitle());\n mMovieTitle.setText(movie.getTitle());\n mMovieRating.setText(String.valueOf(movie.getVoteAverage()));\n mMovieDate.setText(movie.getReleaseDate());\n mMovieGenre.setText(movie.isAdult() ? getString(R.string.genre_type_adults) : getString(R.string.genre_type_all));\n mMovieDesc.setText(movie.getOverview());\n }", "public void setLives(int lives) {this.lives = lives;}", "void setVideoResourceId(@RawRes int resId);", "public void setIdVenta(String idVenta) {\n this.idVenta = idVenta;\n }", "public void setMesSeleccionado(Mes mesSeleccionado)\r\n/* 177: */ {\r\n/* 178:221 */ this.mesSeleccionado = mesSeleccionado;\r\n/* 179: */ }", "public void setVideoFragment(Fragment fragment) {\n this.videoRoom = (RoomActivityVideoFragment) fragment;\n eventHandler = new VideoEngineEventHandler();\n eventHandler.addEventHandler(this.videoRoom);\n mRtcEngine.addHandler(eventHandler);\n\n mRtcEngine.enableVideo();\n mRtcEngine.setVideoEncoderConfiguration(new VideoEncoderConfiguration(\n VideoEncoderConfiguration.VD_1280x720,\n VideoEncoderConfiguration.FRAME_RATE.FRAME_RATE_FPS_30,\n VideoEncoderConfiguration.STANDARD_BITRATE,\n VideoEncoderConfiguration.ORIENTATION_MODE.ORIENTATION_MODE_FIXED_PORTRAIT));\n mRtcEngine.enableLocalVideo(false);\n }", "public String getVideourl() {\n return videourl;\n }", "public void setVelocidad(int vel)\r\n\t{\r\n\t\tvelocidad=vel;\r\n\t}", "public void setCodigo_venda(int pCodigoVenda){\n this.codigoVenda = pCodigoVenda;\n }", "public void setDataPrimeiroVencimento(java.util.Calendar dataPrimeiroVencimento) {\n this.dataPrimeiroVencimento = dataPrimeiroVencimento;\n }", "private void setVoterID(String[] voterID2)\n\t{\n\t\tthis.voterID = voterID2;\n\t}", "public void verVideo(View v) {\n ViewVideo.setVideoURI(Uri.parse(getExternalFilesDir(null) + \"/\" + txtNombreArchivo.getText().toString()));\n /*Ejecutamos el video*/\n ViewVideo.start();\n }", "@Override\n public void set(Voluntario a) {\n if (a==null) a=new Voluntario();\n \n txtNome.setText(a.getNome());\n DateFormat df = new SimpleDateFormat(\"dd/mm/yyyy\");\n txtDataN.setText(df.format(a.getDataNascimento().getTime()));\n txtNacionalidade.setText(a.getNacionalidadeIndiv());\n txtProfissao.setText(a.getProfissao());\n txtMorada.setText(a.getMorada());\n txtCodPostal.setText(a.getCodigoPostal());\n txtLocalidade.setText(a.getLocalidade());\n txtTelefone.setText(a.getTelefone());\n txtTelemovel.setText(a.getTelemovel());\n txtEmail.setText(a.getEmail());\n txtNif.setText(a.getNif()+\"\");\n txtHabilit.setText(a.getHabilitacoes());\n txtConhecimentosL.setText(a.getConhecimentosLing());\n txtFormComp.setText(a.getFormacaoComp());\n txtExpV.setText(a.getExperienciaVolunt());\n txtConhecimentosC.setText(a.getConhecimentosConstr());\n txtDispon.setText(a.getDisponibilidade());\n txtComoConheceu.setText(a.getComoConheceu());\n checkReceberInfo.setSelected(a.getReceberInfo());\n checkIsParceiro.setSelected(a.isParceiro()); \n \n voluntario = a;\n }", "public void setIva(int iva) {\n\t\tproducto.setIva(iva);\n\t}", "public void cambiarVentas(int idVend, Date fecha, float ventas){\r\n\t\tthis.controlador.cambiarVentas(idVend, fecha, ventas);\r\n\t}", "public void asignarPersona(Jugador j){\r\n this.jugador = j;\r\n }", "public void setId_movimiento(Integer id_movimiento) {\r\n this.id_movimiento = id_movimiento;\r\n }", "public void setPuntoEmision(String puntoEmision)\r\n/* 129: */ {\r\n/* 130:217 */ this.puntoEmision = puntoEmision;\r\n/* 131: */ }", "Builder addVideo(String value);", "public void setvID(int vID) {\n this.vID = vID;\n }", "protected void setPartida(Partida partida) {\r\n \r\n if (this.partida != null) {\r\n\r\n /* termina la ejecución del thread de la Partida anterior */\r\n Thread thread = this.partida.getThreadMotor();\r\n if (thread != null) {\r\n \r\n thread.interrupt();\r\n }\r\n }\r\n \r\n this.partida = partida;\r\n this.rondas = null;\r\n\r\n /* se agrega como observador del Motor de la Partida */\r\n if (this.partida != null) {\r\n \r\n this.partida.getMotor().agregarObservador(this);\r\n }\r\n \r\n this.regenerarVista();\r\n }", "@Override\n\tpublic void alterar(Parcela entidade) {\n\n\t}", "@Override\n\tpublic void manejoVida(int cantVida, int tipCambio) {\n\t\t\n\t}", "public void setEjercicio(Ejercicio ejercicio)\r\n/* 150: */ {\r\n/* 151:193 */ this.ejercicio = ejercicio;\r\n/* 152: */ }", "default void setVideoPath(@Nullable String path) {\n setVideoUri(TextUtils.isEmpty(path) ? null : Uri.parse(path));\n }", "void setPlayerId(int playerId);", "public void enableVideoPreview(boolean val);", "void setMovimentoPassante(boolean passante);", "@Override\n public void setVideoEndTime(String videoId, long endTime) {\n\t\tJSONObject allVids;\n\t\ttry {\n\t\t\tallVids = super.getJSONObject(VIDEO_LIST);\n\t\t\tJSONObject vidTimes = allVids.getJSONObject(videoId);\n\t\t\tvidTimes.put(END_TIME, endTime);\n\t\t} catch (JSONException e) {\n\t\t\t//All fields are required so this should not happen\n\t\t}\n\t}", "@Override\r\n\tpublic void setForHobby(DriverVO driverVO) {\n\t\t\r\n\t}", "public void setEmpresa(Empresa empresa)\r\n/* 89: */ {\r\n/* 90:141 */ this.empresa = empresa;\r\n/* 91: */ }", "public void setV(long value) {\n this.v = value;\n }", "public void setNativeVideoWindowId(Object id);", "@Override\n public void setUserId(long userId) {\n _partido.setUserId(userId);\n }", "public List<Video> getVideo() {\n\t\treturn null;\n\t}", "@RequestMapping(value=VideoSvcApi.VIDEO_SVC_PATH, method=RequestMethod.PUT)\n\tpublic @ResponseBody Video updateVideoMetadata(@RequestBody Video v, \n\t\t\tHttpServletResponse response) {\n\t\t// TODONE Implement the logic to store the meta data.\n\t\tassert(v != null);\n\t\t\n\t\tLong id = new Long(v.getId());\n\t\tif (id != 0 && videos.containsKey(id)) {\n\t\t\tvideos.replace(id, v);\n\t\t} else{\n\t\t\tresponse.setStatus(HttpServletResponse.SC_NOT_FOUND);\n\t\t}\n\t\treturn videos.get(id);\n\t}", "public String getVideo() {\n return video;\n }", "public Video(String nombre) {\n super(nombre);\n }", "int getVida()\n\t{\n\t\treturn vida;\n\t}", "public void setIdDetalle_Ventaf(int idDetalle_Ventaf) {\n this.idDetalle_Ventaf = idDetalle_Ventaf;\n }", "@Override\n public void videoStarted() {\n super.videoStarted();\n img_playback.setImageResource(R.drawable.ic_pause);\n if (isMuted) {\n muteVideo();\n img_vol.setImageResource(R.drawable.ic_mute);\n } else {\n unmuteVideo();\n img_vol.setImageResource(R.drawable.ic_unmute);\n }\n }", "public void setVideosData(List<Video> videosList) {\n mVideosList = new ArrayList<>(videosList);\n notifyDataSetChanged();\n }", "public void pauseVideoAndRefreshUI() {\n this.mUI.pauseVideo();\n }", "MovieVideo getMovieVideoByVideoid(String videoid);", "public void setGenero(Genero genero)\r\n/* 148: */ {\r\n/* 149:271 */ this.genero = genero;\r\n/* 150: */ }", "public void setIdVozilo(long value) {\n this.idVozilo = value;\n }", "public void setPreferredVideoDefinition(VideoDefinition vdef);", "@Override\n\tpublic void ingresarFicha(VideoJuego juego) {\n\t\t\n\t}", "private void videoVisible() {\n }", "public void setMovie(Movie movie) {\n this.movie = movie;\n }", "public void setV(boolean v) {\n\tthis.v = v;\n }", "public void listarTodosLosVideojuegosRegistrados()\n {\n System.out.println(\"Videojuegos disponibles: \");\n for(Videojuegos videojuego : listaDeVideojuegos) {\n System.out.println(videojuego.getDatosVideojuego());\n }\n }", "public void setPesoV(int pesoV) \r\n\t\t{\r\n\t\t\tPesoV = pesoV;\r\n\t\t}", "public void damePersonaje(String personaje){\n this.personaje=personaje;\n\n\n\n }" ]
[ "0.74424803", "0.6702681", "0.64983743", "0.6342604", "0.62480766", "0.61671245", "0.6118479", "0.5838453", "0.57972586", "0.5753622", "0.5684398", "0.56615764", "0.56314063", "0.5591525", "0.55665416", "0.55530417", "0.5545565", "0.5484682", "0.5467985", "0.546526", "0.544874", "0.5442528", "0.5423465", "0.54228896", "0.54104227", "0.54075664", "0.5386109", "0.53298056", "0.53011316", "0.52906084", "0.528919", "0.52750653", "0.5270039", "0.52678007", "0.52605075", "0.52409625", "0.5226138", "0.52204746", "0.52069986", "0.5205722", "0.5191979", "0.5156134", "0.51531017", "0.5144671", "0.5143987", "0.513195", "0.5125785", "0.51209396", "0.51173544", "0.5112883", "0.511072", "0.51061875", "0.50988096", "0.50965834", "0.509645", "0.5094149", "0.5088085", "0.5086817", "0.5085273", "0.5070401", "0.5045758", "0.5041534", "0.50352097", "0.5018347", "0.50170887", "0.501093", "0.5007615", "0.500644", "0.5004143", "0.5000403", "0.49997663", "0.49994585", "0.4995537", "0.4978555", "0.49649426", "0.49594626", "0.49586827", "0.4948435", "0.49409953", "0.4920245", "0.49180326", "0.49095997", "0.49086386", "0.49036184", "0.48974937", "0.4896029", "0.488936", "0.48855954", "0.4883213", "0.48831654", "0.48735598", "0.4866433", "0.48660818", "0.4864161", "0.48637554", "0.48594734", "0.48487923", "0.48480764", "0.48466852", "0.48397782", "0.48352093" ]
0.0
-1
Faz com que seja descontado 1 no total de vidas do personagem.
public void lostLife(){ this.lives--; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void pierdeUnaVida() {\n numeroDeVidas--;\n }", "public void somaVezes(){\n qtVezes++;\n }", "public void mostrarVideojuegosNumeradosPorOrdenDeRegistro()\n {\n int posicActual = 0;\n while (posicActual < listaDeVideojuegos.size()) {\n System.out.println((posicActual+1) + \". \" + listaDeVideojuegos.get(posicActual).getDatosVideojuego());\n posicActual++;\n }\n }", "public void AumentarVictorias() {\r\n\t\tthis.victorias_actuales++;\r\n\t\tif (this.victorias_actuales >= 9) {\r\n\t\t\tthis.TituloNobiliario = 3;\r\n\t\t} else if (this.victorias_actuales >= 6) {\r\n\t\t\tthis.TituloNobiliario = 2;\r\n\t\t} else if (this.victorias_actuales >= 3) {\r\n\t\t\tthis.TituloNobiliario = 1;\r\n\t\t} else {\r\n\t\t\tthis.TituloNobiliario = 0;\r\n\t\t}\r\n\t}", "public void venceuRodada () {\n this.pontuacaoPartida++;\n }", "public void restarPunto ( ) {\n\t\tif ( vida > 0 )\n\t\t\tvida--;\n\t}", "public void setVidas (int vidas)\r\n\t{\r\n\t\tthis.vidas= vidas;\r\n\t}", "public int getVideos() {\n return videos;\n }", "public int getVid() {\r\n return vid;\r\n }", "private void aumentarPilha() {\n this.pilhaMovimentos++;\n }", "public void PrepareNextJogada() {\n if (vez == listaJogadores.size() - 1) {\n vez = 0;\n\n } else {\n vez++;\n }\n }", "public void diminueVies() {\n\n nbVies_restantes.set(nbVies_restantes.get()-1);\n\n }", "public void inativarMovimentacoes() {\n\n\t\ttry {\n\n\t\t\tif (((auxMovimentacao.getDataMovimentacao())\n\t\t\t\t\t.before(permitirCadastrarMovimentacao(movimentacao.getAlunoTurma()).getDataMovimentacao()))\n\t\t\t\t\t|| (auxMovimentacao.getDataMovimentacao()).equals(\n\t\t\t\t\t\t\tpermitirCadastrarMovimentacao(movimentacao.getAlunoTurma()).getDataMovimentacao())\n\t\t\t\t\t) {\n\t\t\t\tExibirMensagem.exibirMensagem(Mensagem.MOVIMENTACOES_ANTERIORES);\n\t\t\t} else {\n\n\t\t\t\tDate dataFinal = auxMovimentacao.getDataMovimentacao();\n\t\t\t\tCalendar calendarData = Calendar.getInstance();\n\t\t\t\tcalendarData.setTime(dataFinal);\n\t\t\t\tcalendarData.add(Calendar.DATE, -1);\n\t\t\t\tDate dataInicial = calendarData.getTime();\n\n\t\t\t\tMovimentacao mov = new Movimentacao();\n\t\t\t\tmov = (Movimentacao) movimentacaoAlunoDAO.listarTodos(Movimentacao.class,\n\t\t\t\t\t\t\" a.dataMovimentacao = (select max(b.dataMovimentacao) \"\n\t\t\t\t\t\t\t\t+ \" from Movimentacao b where b.alunoTurma = a.alunoTurma) \"\n\t\t\t\t\t\t\t\t+ \" and a.status is true and a.alunoTurma.status = true and dataMovimentacaoFim = null and a.alunoTurma = \"\n\t\t\t\t\t\t\t\t+ movimentacao.getAlunoTurma().getId())\n\t\t\t\t\t\t.get(0);\n\n\t\t\t\tmov.setControle(false);\n\t\t\t\tmov.setDataMovimentacaoFim(dataInicial);\n\t\t\t\tmovimentacaoService.inserirAlterar(mov);\n\n\t\t\t\tAlunoTurma aluno = new AlunoTurma();\n\t\t\t\taluno = daoAlunoTurma.buscarPorId(AlunoTurma.class, movimentacao.getAlunoTurma().getId());\n\t\t\t\taluno.setControle(0);\n\t\t\t\t\n\n\t\t\t\tauxMovimentacao.setAlunoTurma(movimentacao.getAlunoTurma());\n\t\t\t\tauxMovimentacao.setStatus(true);\n\t\t\t\tauxMovimentacao.setControle(false);\n\n\t\t\t\tmovimentacaoService.inserirAlterar(auxMovimentacao);\n\t\t\t\t\n\t\t\t\tif(auxMovimentacao.getSituacao()==5){\n//\t\t\t\t\t\n//\t\t\t\t\tCurso cursoAluno = new Curso();\n//\t\t\t\t\tcursoAluno = daoCurso.buscarPorId(Curso.class, auxMovimentacao.getAlunoTurma().getTurma().getCurso().getId());\n\t\t\t\t\t\n\t\t\t\t\taluno.setSituacao(5);\n\t\t\t\t\taluno.setLiberado(false);\n\t\t\t\t\talunoTurmaService.inserirAlterar(aluno);\n\t\t\t\t\t\n\t\t\t\t\t//liberar para responder o questionário\n\t\t\t\t\tAluno alunoResponde = new Aluno(); \n\t\t\t\t\talunoResponde = daoAluno.buscarPorId(Aluno.class, aluno.getAluno().getId());\n\t\t\t\t\t \n\t\t\t\t // email.setCursos(auxMovimentacao.getAlunoTurma().getTurma().getCurso());\n\t\t\t\t\t//email.setTurma(auxMovimentacao.getAlunoTurma().getTurma());\n\t\t\t\t\temail.setEnviado(false);\n\t\t\t\t\temail.setStatus(true);\n\t\t\t\t\temail.setAlunoTurma(auxMovimentacao.getAlunoTurma());\n\t\t\t\t\t\n\t\t\t\t\t//email.setAluno(alunoResponde);\n\t\t\t\t\temailService.inserirAlterar(email);\n\t\t\t\t\t//enviar o email para responder \n\t\t\t\t\t\n\t\t\t\t}else{\n\t\t\t\t\taluno.setSituacao(0);\n\t\t\t\t\talunoTurmaService.inserirAlterar(aluno);\n\t\t\t\t}\n\t\t\t\taluno = new AlunoTurma();\n\t\t\t\temail = new Email();\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tFecharDialog.fecharDialogAlunoCursoEditar();\n\t\t\t\tFecharDialog.fecharDialogAlunoEditarCurso();\n\t\t\t\tFecharDialog.fecharDialogAlunoTrancamento();\n\t\t\t\talterar(movimentacao);\n\n\t\t\t\tExibirMensagem.exibirMensagem(Mensagem.SUCESSO);\n\t\t\t\tauxMovimentacao = new Movimentacao();\n\n\t\t\t\talunoTurmaService.update(\" AlunoTurma set permiteCadastroCertificado = 2 where id = \"\n\t\t\t\t\t\t+ movimentacao.getAlunoTurma().getId());\n\n\t\t\t\n\t\t\t\tcriarNovoObjetoAluno();\n\t\t\t\tatualizarListas();\n\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\tExibirMensagem.exibirMensagem(Mensagem.ERRO);\n\t\t}\n\n\t}", "public static void proveraServisa() {\n\t\tSystem.out.println(\"Unesite redni broj vozila za koje racunate vreme sledeceg servisa:\");\n\t\tUtillMethod.izlistavanjeVozila();\n\t\tint redniBroj = UtillMethod.unesiteInt();\n\t\tif (redniBroj < Main.getVozilaAll().size()) {\n\t\t\tif (!Main.getVozilaAll().get(redniBroj).isVozObrisano()) {\n\t\t\t\tUtillMethod.proveraServisaVozila(Main.getVozilaAll().get(redniBroj));\n\t\t\t} else {\n\t\t\t\tSystem.out.println(\"Ovo vozilo je obrisano i ne moze da se koristi!\");\n\t\t\t}\n\t\t} else {\n\t\t\tSystem.out.println(\"Uneli ste pogresan redni broj!\");\n\t\t}\n\t}", "public void pagarAluguel(int credor, int devedor, int valor, String NomePopriedade) {\n\n Jogador JogadorDevedor = listaJogadores.get(devedor);\n Jogador JogadorCredor = listaJogadores.get(credor);\n\n\n if (listaJogadores.get(devedor).getDinheiro() >= valor) {\n JogadorDevedor.retirarDinheiro(valor);\n JogadorCredor.addDinheiro(valor);\n\n } else {\n \n\n\n if(bankruptcy){\n\n }else{\n int DinheiroRestante = listaJogadores.get(devedor).getDinheiro();\n JogadorDevedor.retirarDinheiro(DinheiroRestante);\n JogadorCredor.addDinheiro(DinheiroRestante);\n }\n this.removePlayer(devedor);\n\n }\n\n\n }", "public int getIngresosPorVentas(){\n return this.ingresosPorVentas;\n }", "private void verificaVencedor(){\n\n // Metodo para verificar o vencedor da partida\n\n if(numJogadas > 4) {\n\n String vencedor = tabuleiro.verificaVencedor();\n\n vencedor = (numJogadas == tabuleiro.TAM_TABULEIRO && vencedor == null) ? \"Deu Velha!\" : vencedor;\n\n if (vencedor != null) {\n\n mostraVencedor(vencedor);\n temVencedor = true;\n\n }\n\n }\n\n }", "private void verificarMuerte() {\n if(vidas==0){\n if(estadoJuego==EstadoJuego.JUGANDO){\n estadoJuego=EstadoJuego.PIERDE;\n //Crear escena Pausa\n if(escenaMuerte==null){\n escenaMuerte=new EscenaMuerte(vistaHUD,batch);\n }\n Gdx.input.setInputProcessor(escenaMuerte);\n efectoGameOver.play();\n if(music){\n musicaFondo.pause();\n }\n }\n guardarPuntos();\n }\n }", "public final void diminuerNbVie() {\n this.nbVie--;\n }", "public void cambiarTitulo(int codVideojuego, String tituloNuevo)\n {\n if(codVideojuego>=0 && codVideojuego<=listaDeVideojuegos.size()) {\n Videojuegos Videojuego = listaDeVideojuegos.get(codVideojuego - 1);\n Videojuego.setTitulo(tituloNuevo);\n }\n else if(codVideojuego<=0 && codVideojuego>listaDeVideojuegos.size()){\n System.out.println(\"No hay videojuegos con ese codigo, introduce otro existente.\");\n }\n }", "public int getDiasVacaciones() {\r\n\t\treturn super.getDiasVacaciones()/2;\r\n\t}", "public boolean PilaVacia() {\r\n return UltimoValorIngresado == null;\r\n }", "public int getAmountOfVideosThatWillBeSaved(){\n\t\treturn (int) (Math.ceil((videoLength/videoIterationLength)));\n\t}", "public int getVideoJittcomp();", "public boolean devolver(){\n boolean devuelto = true;\n if (cantPres == 0) {\n devuelto = false;\n } else {\n cantPres--;\n }\n return devuelto;\n }", "public Integer getVid() {\n return vid;\n }", "public void pagarSaidaDaPrisao() throws Exception {\n if (listaJogadoresNaPrisao.contains(listaJogadores.get(jogadorAtual()).getNome())) {\n listaJogadoresNaPrisao.remove(listaJogadores.get(jogadorAtual()).getNome());\n listaJogadores.get(jogadorAtual()).setTentativasSairDaPrisao(0);\n listaJogadores.get(jogadorAtual()).retirarDinheiro(50);\n\n } else {\n print(\"\\tTentou tirar \" + listaJogadores.get(jogadorAtual()).getNome());\n throw new Exception(\"player is not on jail\");\n }\n\n this.pagouPrisaoRecentemente = false;\n }", "private void priorizar() {\r\n if (ini == fin) {\r\n return;\r\n }\r\n\r\n int t1 = fin, t2 = fin - 1;\r\n TDAPrioridad aux = new TDAPrioridad(0, '0');\r\n while (t1 != ini) {\r\n if (datos[t1].getPrioridad() > datos[t2].getPrioridad()) {\r\n aux.setObjeto(datos[t1]);\r\n datos[t1].setObjeto(datos[t2]);\r\n datos[t2].setObjeto(aux);\r\n t2--;\r\n t1--;\r\n } else {\r\n break;\r\n }\r\n }\r\n }", "public int getTotal_votos() {\n return total_votos;\n }", "public boolean PilaVacia()\n {\n if(tope == 0)\n {\n return true;\n }\n else\n {\n return false;\n }\n }", "@Override\n\tpublic int sacameVida(ElementoPiedra a) {\n\t\treturn 20;\n\t}", "void evoluer()\n {\n int taille = grille.length;\n int nbVivantes = 0;\n for(int i=-1; i<2; i++)\n {\n int xx = ((x+i)+taille)%taille; // si x+i=-1, xx=taille-1. si x+i=taille, xx=0\n for(int j=-1; j<2; j++)\n {\n if (i==0 && j==0) continue;\n int yy = ((y+j)+taille)%taille;\n if (grille[xx][yy].vivante) nbVivantes++;\n }\n }\n if (nbVivantes<=1 || nbVivantes>=4) {vientDeChanger = (vivante==true); vivante = false;}\n if (nbVivantes==3) {vientDeChanger = (vivante==false); vivante = true;}\n }", "@Override\n\tpublic int contar() {\n\t\treturn comision.size();\n\t}", "@Override\n\tpublic boolean estaVivo() {\n\t\treturn estadoVida;\t\t\n\t}", "public void quitarPoder(int index ){\n\t\tif(!game.isPaused()&& game.getPersonaje(index).isPaused()){\n\t\t\tif( wait%stop == 0){\n\t\t\t\tgame.getPersonaje(index).pause();\n\t\t\t\twait = 2;\n\t\t\t}\n\t\t\telse{wait=( wait < stop )?wait +1:wait + 0;}\n\t\t}\n\t\tif( game.getPersonaje(index).isSlow()) {\n\t\t\tif( wait%stop == 0){\n\t\t\t\tgame.getPersonaje(index).restablecerVelocidad();\n\t\t\t\twait = 2;\n\t\t\t}\n\t\t\telse{wait=( wait < stop )?wait +1:wait + 0;}\t\n\t\t}\n\t}", "public void gagne()\r\n\t{\r\n\t\tthis.nbVictoires++;\r\n\t}", "@Override\n\tpublic int getVideoCommentCount(long vid) {\n\t\treturn 0;\n\t}", "public void aumentarMinas(){\n\r\n if(espM==false){\r\n minascerca++;\r\n }\r\n }", "public synchronized void abordar() {\n pedidoAbordaje++;\r\n while(!abordar){//Mientras no este habilitado el abordaje espera \r\n try {\r\n wait();\r\n } catch (InterruptedException ex) {\r\n Logger.getLogger(Vuelo.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n }\r\n //Cuando se habilita el abordaje el pasajero se sube\r\n pedidoAbordaje--;\r\n if (pedidoAbordaje == 0){ //Si es el ultimo en subir avisa que puede despegar\r\n notifyAll();\r\n }\r\n }", "public void addOneForTeamV (View v) {\n vScore = vScore +1;\n displayForTeamV(vScore);\n }", "public int getVideoCount(){\n try {\n SQLiteDatabase database = this.getReadableDatabase();\n database.enableWriteAheadLogging();\n Cursor cursor = database.rawQuery(VideoTable.selectAllVideos, null);\n\n if (cursor != null) {\n return cursor.getCount();\n }\n cursor.close();\n } catch (Exception e) {\n e.printStackTrace();\n return 0;\n }\n return 0;\n }", "@Override\n\tpublic int sacameVida(ElementoFuente a) {\n\t\treturn 10;\n\t}", "public void carroNoAgregado(){\n System.out.println(\"No hay un parqueo para su automovil\");\n }", "public int probabilidadesHastaAhora(){\n return contadorEstados + 1;\n }", "int getVida()\n\t{\n\t\treturn vida;\n\t}", "public void agregarVictoria(Jugador jugador) {\r\n if (!this.isReplay()) {\r\n jugador.setVictorias(jugador.getVictorias() + 1);\r\n }\r\n }", "private int generujViacZvierat(int pocet){\r\n int poc = 0;\r\n for (int i = 0; i < pocet; i++) {\r\n if (zoo.pridajZivocicha(vytvorZivocicha())) poc++;\r\n }\r\n return poc;\r\n }", "public void setVid(int value) {\r\n this.vid = value;\r\n }", "@Override\n\tpublic int numeroVotiListaElettorale(String nomeLista) {\n\t\tint totalVoti = 0;\n\t\tArrayList<Voto> allVoti = listaDeiVoti();\n\n\t\tfor (Voto voto : allVoti) {\n\t\t\tif (nomeLista.equals(voto.getNomeListaElettorale())) {\n\t\t\t\ttotalVoti++;\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(\"OK restituisco il numero di voti per questa lista elettorale: \" + totalVoti);\n\t\treturn totalVoti;\n\t}", "public int getNumeroVuelos() {\r\n\t\treturn vuelos.size();\r\n\t}", "public static void asignarPunteo(int puntos, String nombreJugador) {\n for (int sizeNombres = 0; sizeNombres < nombres.length - 1; sizeNombres++) {\n if ((nombreJugador.equals(nombres[sizeNombres])) && (puntos == 1)) {\n punteos[sizeNombres] += 1;\n break;\n }\n\n }\n\n }", "public void verVideo(View v) {\n ViewVideo.setVideoURI(Uri.parse(getExternalFilesDir(null) + \"/\" + txtNombreArchivo.getText().toString()));\n /*Ejecutamos el video*/\n ViewVideo.start();\n }", "public static int count(){\n return getVideoRequestCount;\n }", "public Integer getDistanciaVivienda() {\n return distanciaVivienda;\n }", "public boolean estaVacia() {\n return (top == -1); // regresa verdadero si la cima es igual a -1 \r\n }", "@Override\n\tpublic void verVehiculosDisponibles() {\n\t\tif(getCapacidad() > 0) {\n\t\t\tSystem.out.println(\"Plazas disponibles : \" + getCapacidad() + \" plazas, peso disponible : \" + getPeso() + \" kg, Carros disponibles: \" + \" 1 \" + \" Carro disponible, Capacidad de Personas : 4 personas, Peso maximo : 500 kg\");\n\t\t}else\n\t\t{\n\t\t\tSystem.out.println(\"Plazas disponibles : \" + getCapacidad() + \" plazas, peso disponible : \" + getPeso() + \" kg, Carros disponibles: \" + \" 0 \" + \" Carro disponibles, Capacidad de Personas : 4 personas, Peso maximo : 500 kg\");\n\t\t}\n\t\t\n\t}", "@Override\n public boolean esVacio(){\n return(super.esVacio());\n }", "@Override\n\tpublic int sacameVida(ElementoSoldado a) {\n\t\treturn 0;\n\t}", "@Override\n\tpublic String acelerar(int velocidad) {\n\t\tthis.velocidad+=velocidad;\n\t\tString mensaje = \"Moto con velocidad actual de \"+this.velocidad;\n\t\tif (this.velocidad>VELOCIDAD_MAXIMA) {\n\t\t\tmensaje += \" y has superado la velocidad maxima\";\n\t\t}\n\t\treturn mensaje;\n\t}", "private boolean completouVolta(int jogador, int valorDados) {\n\n if ((this.posicoes[jogador] + valorDados) >= 40 && this.posicoes[jogador] != 40) {\n this.listaJogadores.get(jogador).addDinheiro(200);\n this.print(\"\\tGanha $200 por passar pela casa 40.\");\n return true;\n }\n return false;\n\n }", "@Override\n\tpublic String frenar(int velocidad) {\n\t\tthis.velocidad-=velocidad;\n\t\tif (this.velocidad<0) {\n\t\t\tthis.velocidad=0;\n\t\t}\n\t\t\n\t\tString mensaje = \"Moto con velocidad actual de \"+this.velocidad;\n\t\tif (this.velocidad > VELOCIDAD_MAXIMA) {\n\t\t\tmensaje += \" y sigues superando la velocidad maxima\";\n\t\t}\n\t\treturn mensaje;\n\t}", "private void devolver100() {\n cambio = cambio - 100;\n de100--;\n cambio100++;\n }", "public int compterAnimaux(){\r\n\t\treturn noms.size();\r\n\t}", "public void vivir(){\r\n\t\r\n\tAtacable algo42tmp;\r\n\t\r\n\tif (!(this.muerto)){\r\n\t\tfor(int i = 0; i <= this.velY; i++){\r\n\t\t\tthis.mover();\r\n\t\t}\r\n\t\t\r\n\t\talgo42tmp = zonaDeCombate.comprobarColisionAlgo42(this);\r\n\t\tif (algo42tmp != null){\r\n\t\t\talgo42tmp.recibirDanio(20); /**hacer q se muera*/\r\n\t\t\tthis.muerto = true;\r\n\t\t}\r\n\t\t\r\n\r\n\t\t}\r\n\t}", "private static void VeureVendes (BaseDades bd) {\n ArrayList <Venda> llista = new ArrayList <Venda>();\n llista = bd.consultaVen(\"SELECT * FROM VENDES\");\n if (llista != null)\n for (int i = 0; i<llista.size(); i++) {\n Venda p = (Venda) llista.get(i);\n Producte prod = bd.consultarUnProducte(p.getIdproducte());\n System.out.println(\"ID Venda =>\"+p.getNumvenda()+\"* Producte: \"\n +prod.getDescripcio()+\"* Quantitat: \"+p.getQuantitat()\n +\"* Data: \"+p.getDatavenda());\n }\n }", "public int limitesY(){\n int v=0;\n if (columna==0 && fila>0 && fila<15){\n if(automata.getElemento(fila+1,columna)!=null && automata.getElemento(fila+1,columna).isVivo()){v++;}\n if(automata.getElemento(fila+1,columna+1)!=null && automata.getElemento(fila+1,columna+1).isVivo()){v++;}\n if(automata.getElemento(fila,columna+1)!=null && automata.getElemento(fila,columna+1).isVivo()){v++;}\n if(automata.getElemento(fila-1,columna+1)!=null && automata.getElemento(fila-1,columna+1).isVivo()){v++;}\n if(automata.getElemento(fila-1,columna)!=null && automata.getElemento(fila-1,columna).isVivo()){v++;}\n }\n else if (columna==15 && fila>0 && fila<15){\n if(automata.getElemento(fila+1,columna)!=null && automata.getElemento(fila+1,columna).isVivo()){v++;}\n if(automata.getElemento(fila+1,columna-1)!=null && automata.getElemento(fila+1,columna-1).isVivo()){v++;}\n if(automata.getElemento(fila,columna-1)!=null && automata.getElemento(fila,columna-1).isVivo()){v++;}\n if(automata.getElemento(fila-1,columna-1)!=null && automata.getElemento(fila-1,columna-1).isVivo()){v++;}\n if(automata.getElemento(fila-1,columna)!=null && automata.getElemento(fila-1,columna).isVivo()){v++;}\n }\n else{v=esquinas();}\n return v;\n }", "public boolean estaVacia() {\n if (pieza == null)\n return true;\n else\n return false;\n }", "@Override\n\t\tpublic int compare(Pecosa a, Pecosa b) {\n\t\t\tLong numa=a.getId().getPecnro();\n\t\t\tLong numb=b.getId().getPecnro();\n\t\t\treturn (int)(numa-numb);\n\t\t}", "private void dibujarArregloCamionetas() {\n\n timerCrearEnemigo += Gdx.graphics.getDeltaTime();\n if (timerCrearEnemigo>=TIEMPO_CREA_ENEMIGO) {\n timerCrearEnemigo = 0;\n TIEMPO_CREA_ENEMIGO = tiempoBase + MathUtils.random()*2;\n if (tiempoBase>0) {\n tiempoBase -= 0.01f;\n }\n\n camioneta= new Camioneta(texturaCamioneta,ANCHO,60f);\n arrEnemigosCamioneta.add(camioneta);\n\n\n }\n\n //Si el vehiculo se paso de la pantalla, lo borra\n for (int i = arrEnemigosCamioneta.size-1; i >= 0; i--) {\n Camioneta camioneta1 = arrEnemigosCamioneta.get(i);\n if (camioneta1.sprite.getX() < 0- camioneta1.sprite.getWidth()) {\n arrEnemigosCamioneta.removeIndex(i);\n\n }\n }\n }", "@Override\n public int getCount() {\n int count =0;\n if (record.getPhotosArrayObject()!=null)\n count+=record.getPhotosArrayObject().size();\n if (!record.getVideoArray().isEmpty()) count+=1;\n return count;\n }", "public void ispisiSveNapomene() {\r\n\t\tint i = 0;// redni broj napomene\r\n\t\tint brojac = 0;\r\n\t\tfor (Podsjetnik podsjetnik : lista) {\r\n\r\n\t\t\ti++;\r\n\t\t\tSystem.out.println(i + \")\" + podsjetnik);\r\n\t\t\tbrojac = i;\r\n\t\t}\r\n\t\tif (brojac == 0) {\r\n\t\t\tSystem.out.println(\"Nema unesenih napomena!!\");\r\n\t\t}\r\n\r\n\t}", "public int extraer ()\n {\n if (raiz!=null)\n {\n int informacion = raiz.edad;\n raiz = raiz.sig;\n return informacion;\n }\n else\n {\n System.out.println(\"La lista se encuentra vacia\");\n return 0;\n }\n }", "@Override\n public int getCount() {\n return arrayListVideoDTOs.size();\n }", "@Override\n public void subida(){\n // si es mayor a la eperiencia maxima sube de lo contrario no\n if (experiencia>(100*nivel)){\n System.out.println(\"Acabas de subir de nivel\");\n nivel++;\n System.out.println(\"Nievel: \"+nivel);\n }else {\n\n }\n }", "public int getCantidadAvenidas();", "public void carroPulando() {\n\t\tpulos++;\n\t\tpulo = (int) (PULO_MAXIMO/10);\n\t\tdistanciaCorrida += pulo;\n\t\tif (distanciaCorrida > distanciaTotalCorrida) {\n\t\t\tdistanciaCorrida = distanciaTotalCorrida;\n\t\t}\n\t}", "public int getEntradasVendidas() {\n\t\treturn entradasVendidas;\n\t}", "public void iniciarNovaPartida(Integer posicao);", "public List<Partida> getNextPartida(String partidaId,String jugadorId){\n String consulta = \"SELECT p FROM Partida p WHERE p.id > \" + partidaId + \" AND p.jugador1.id = \"+ \"'\" + jugadorId +\"' OR p.jugador2 = \"+ \"'\" + jugadorId+\"' ORDER BY p.id ASC\";\n\n List<Partida> partida = em.createQuery(consulta, Partida.class).getResultList();\n\n return partida;\n }", "private void añadirEnemigo() {\n\t\t\n\t\tif(enemigo.isVivo()==false){\n\t\t\tint k;\n\t\t\tk = (int)(Math.random()*1000)+1;\n\t\t\tif(k<=200){\n\t\t\t\tif(this.puntuacion<10000){\n\t\t\t\t\tenemigo.setTipo(0);\n\t\t\t\t\tenemigo.setVivo(true);\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tenemigo.setTipo(1);\n\t\t\t\t\tenemigo.setVivo(true);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "public void pridejNovePivo ()\n\t{\n\t\n\t\tpivo = pivo + PRODUKCE;\n\t\t\n\t}", "public static void jouerAuJustePrix() {\n\t\tint nbVies=Tools.inputInt(\"Combien de tentatives voulez-vous ? \");\n\t\tint limite=Tools.inputInt(\"Quel est le nombre maximum à prendre en compte?\");\n\t\tint nbATrouver=Tools.randomint(limite);\n\t\tint nbPropose;\n\t\t\n\t\twhile (nbVies>0){\n\t\t\tnbPropose=Tools.inputInt(\"Saisissez un nombre : \");\n\t\t\tif (afficherResultatProposition(nbPropose, nbATrouver)) {\n\t\t\t\tbreak;\n\t\t\t};\n\t\t\tnbVies=nbVies-1;\n\t\t}\n\t\t\n\t\tif (nbVies==0) {\n\t\t\tSystem.out.println(\"Game Over\");\n\t\t}\n\t}", "long countByExample(TVideoExample example);", "@Override\n public int size() {//por Niveles\n if (this.esArbolVacio()) {\n return 0; //Arbol Vacio\n }\n int cantidadDeNodos = 0;\n Queue<NodoBinario<T>> colaDeNodos = new LinkedList<>();\n colaDeNodos.offer(raiz);\n while (!colaDeNodos.isEmpty()) {\n NodoBinario<T> nodoActual = colaDeNodos.poll();\n cantidadDeNodos++;\n if (!nodoActual.esHijoIzquiedoVacio()) {\n colaDeNodos.offer(nodoActual.getHijoIzquierdo());\n }\n if (!nodoActual.esHijoDerechoVacio()) {\n colaDeNodos.offer(nodoActual.getHijoDerecho());\n }\n }\n return cantidadDeNodos; //Lista con los datos(En el orden de este recorrido)\n }", "public int esquinas(){\n int v=0;\n if (fila==0 && columna==0){\n if(automata.getElemento(fila,columna+1)!=null && automata.getElemento(fila,columna+1).isVivo()){v++;}\n if(automata.getElemento(fila+1,columna+1)!=null && automata.getElemento(fila+1,columna+1).isVivo()){v++;}\n if(automata.getElemento(fila+1,columna)!=null && automata.getElemento(fila+1,columna).isVivo()){v++;}\n }\n else if(fila==0 && columna==15){\n if(automata.getElemento(fila,columna-1)!=null && automata.getElemento(fila,columna-1).isVivo()){v++;}\n if(automata.getElemento(fila+1,columna-1)!=null && automata.getElemento(fila+1,columna-1).isVivo()){v++;}\n if(automata.getElemento(fila+1,columna)!=null && automata.getElemento(fila+1,columna).isVivo()){v++;}\n }\n else if(fila==15 && columna==0){\n if(automata.getElemento(fila-1,columna)!=null && automata.getElemento(fila-1,columna).isVivo()){v++;}\n if(automata.getElemento(fila-1,columna+1)!=null && automata.getElemento(fila-1,columna+1).isVivo()){v++;}\n if(automata.getElemento(fila,columna+1)!=null && automata.getElemento(fila,columna+1).isVivo()){v++;}\n }\n else if(fila==15 && columna==15){\n if(automata.getElemento(fila-1,columna)!=null && automata.getElemento(fila-1,columna).isVivo()){v++;}\n if(automata.getElemento(fila-1,columna-1)!=null && automata.getElemento(fila-1,columna-1).isVivo()){v++;}\n if(automata.getElemento(fila,columna-1)!=null && automata.getElemento(fila,columna-1).isVivo()){v++;}\n }\n return v;\n }", "public void setIngresosPorVentas(int ingresosPorVentas){\n this.ingresosPorVentas = ingresosPorVentas;\n }", "public void verVacanteMultiple(String convocatoriaselecconada, Candidato actualcandidat)\r\n\t{\r\n\t\tmultiple = new VacanteMultiple(this, convocatoriaselecconada, actualcandidat);\r\n\t\tmultiple.setVisible(true);\r\n\t}", "public boolean vacio(){\n\t\treturn esVacio;\n\t}", "public Jogo jogoMaisZerado() {\r\n\t\tJogo jogoMaisZerado = listaDeJogosComprados.get(0);\r\n\r\n\t\tfor (Jogo jogo : listaDeJogosComprados) {\r\n\t\t\tif (jogo.getVezesZeradas() >= jogoMaisZerado.getVezesZeradas()) {\r\n\t\t\t\tjogoMaisZerado = jogo;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\treturn jogoMaisZerado;\r\n\t}", "public int cantidadDispositivos() {\n return dispositivos.size();\n }", "public boolean prestamo(){\n boolean prestado = true;\n if (cantPres < cantLibro) {\n cantPres++;\n } else {\n prestado = false;\n }\n return prestado;\n }", "public int getSize(){return this.IdAgente.size();}", "public Jogo jogoComMaisJogadas() {\r\n\t\tJogo jogoComMaisJogadas = listaDeJogosComprados.get(0);\r\n\t\t\r\n\t\tfor (Jogo jogo : listaDeJogosComprados) {\r\n\t\t\tif (jogo.getVezesJogadas() >= jogoComMaisJogadas.getVezesJogadas()) {\r\n\t\t\t\tjogoComMaisJogadas = jogo;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn jogoComMaisJogadas;\r\n\t}", "public int vecinos(){\n int v=0;\n if(fila<15 && columna<15 && fila>0 && columna>0){\n if(automata.getElemento(fila,columna-1)!=null && automata.getElemento(fila,columna-1).isVivo()){v++;}\n if(automata.getElemento(fila+1,columna-1)!=null && automata.getElemento(fila+1,columna-1).isVivo()){v++;}\n if(automata.getElemento(fila+1,columna)!=null && automata.getElemento(fila+1,columna).isVivo()){v++;} \n if(automata.getElemento(fila+1,columna+1)!=null && automata.getElemento(fila+1,columna+1).isVivo()){v++;}\n if(automata.getElemento(fila,columna+1)!=null && automata.getElemento(fila,columna+1).isVivo()){v++;}\n if(automata.getElemento(fila-1,columna+1)!=null && automata.getElemento(fila-1,columna+1).isVivo()){v++;}\n if(automata.getElemento(fila-1,columna)!=null && automata.getElemento(fila-1,columna).isVivo()){v++;}\n if(automata.getElemento(fila-1,columna-1)!=null && automata.getElemento(fila-1,columna-1).isVivo()){v++;}\n }\n else{v=limitesX();}\n return v;\n }", "public List<vacante> buscarDestacadas() {\n\t\treturn vacantesrepo.findByDestacadoAndEstatusOrderByIdDesc(1,\"Aprobada\");\n\t}", "private boolean pagarImposto(String nomeImposto, int valorImposto, int jogador) {\n if (Donos.get(this.posicoes[jogador]).equals(nomeImposto)) {\n this.print(\"\\tPagando imposto \" + nomeImposto);\n this.print(\"\\tValor do imposto \" + valorImposto);\n if (listaJogadores.get(jogador).getDinheiro() >= valorImposto) {\n listaJogadores.get(jogador).retirarDinheiro(valorImposto);\n } else {\n\n\n if(bankruptcy){\n listaJogadores.get(jogador).retirarDinheiro(valorImposto);\n listaJogadores.get(jogador).setBankruptcy(true);\n }else{\n int DinheiroRestante = listaJogadores.get(jogador).getDinheiro();\n listaJogadores.get(jogador).retirarDinheiro(DinheiroRestante);\n }\n\n this.removePlayer(jogador);\n\n }\n return true;\n }\n return false;\n }", "@Override\n \tpublic int getCount() {\n \t\tif (mVideoInfos == null ) {\n \t\t\treturn 0;\n \t\t}\n \t\treturn mVideoInfos.size();\n \t}", "public ListaBrojeva izdvojElmenteNaParnimPozicijama() {\n if (prvi != null) {\n ListaBrojeva parni = new ListaBrojeva();\n \n Element tek = prvi;\n Element preth = null;\n Element parniKraj = null;\n int br = 0;\n \n while (tek.veza != null) {\n preth = tek;\n tek = tek.veza;\n \n if (br % 2 != 0) {\n preth.veza = tek.veza;\n if (parni.prvi == null) {\n parni.prvi = tek;\n parniKraj = tek;\n tek.veza = null; \n } else {\n parniKraj.veza = tek;\n tek.veza = null;\n parniKraj = parniKraj.veza;\n }\n tek = preth;\n }\n br++;\n }\n /*prvi element iz liste je paran, ali je preskocen, \n tako da ga sad izbacujemo iz liste i dodajemo u novu*/\n Element pom = prvi;\n prvi = prvi.veza;\n pom.veza = parni.prvi;\n parni.prvi = pom;\n return parni;\n }\n return null;\n }", "private void aumentarPuntos() {\r\n this.puntos++;\r\n this.form.AumentarPuntos(this.puntos);\r\n }", "public void ReservaEfetivadas () {\n Date hoje = new Date ();\n for (int z = 0; z < vecReserva.size(); z++) {\n if (((int) ((((entReserva)vecReserva.elementAt(z)).getDatain().getTime() - (hoje.getTime())) / 86400000L)) == 0){// Reserva será relaizada hj\n if (((entReserva)vecReserva.elementAt(z)).getPagamento().getSituacao() == 0){//Cliente fez todo o pagamento e o quarto será\n vecReservaEfetivadas.add(vecReserva.elementAt(z));\n }\n \n }\n }\n }", "public int getCantidadRobots();" ]
[ "0.6389026", "0.61263484", "0.5828802", "0.5738575", "0.5705123", "0.5656298", "0.5647127", "0.5576242", "0.5527997", "0.5508955", "0.5482994", "0.5429879", "0.53898585", "0.5368554", "0.53646183", "0.53424966", "0.5335926", "0.5323444", "0.5284575", "0.5259723", "0.524969", "0.5231232", "0.5225664", "0.5225033", "0.5222152", "0.5203836", "0.51975125", "0.5184406", "0.5169607", "0.5164682", "0.5164235", "0.5158539", "0.5153393", "0.5151404", "0.5137788", "0.5137257", "0.5136889", "0.5134593", "0.5117348", "0.5113759", "0.5112885", "0.5108703", "0.50788015", "0.50729996", "0.5068889", "0.5063684", "0.50565946", "0.5051183", "0.5044877", "0.5043614", "0.50420237", "0.5038002", "0.502473", "0.5016529", "0.50123435", "0.50078034", "0.4997358", "0.49779522", "0.49675128", "0.49622622", "0.49522364", "0.49513257", "0.493217", "0.49308822", "0.49250495", "0.49241933", "0.4922316", "0.49197444", "0.49193716", "0.4917183", "0.49110195", "0.49084777", "0.49032027", "0.48826164", "0.48765957", "0.487628", "0.4874159", "0.48691112", "0.48653585", "0.4865107", "0.48647147", "0.48645386", "0.4863872", "0.4860847", "0.48604974", "0.48598245", "0.48593506", "0.48579955", "0.4855993", "0.4850027", "0.4847805", "0.48427927", "0.4836697", "0.4832014", "0.4831523", "0.48303723", "0.48292562", "0.482721", "0.4826939", "0.4823033", "0.48182446" ]
0.0
-1
Faz com que o personagem perca uma vida caso um alvo encoste nele.
public void killed(Target target){ if(this.crashed(target.getShape())) this.lives--; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void aggiungiPecoraCasualmente() {\n\t\tif (((int) (Math.random() * 3)) >= 1) {\n\t\t\tPecoraAdulta nuovaPecoraAdulta = new PecoraAdulta();\n\t\t\tpecore.add(nuovaPecoraAdulta);\n\t\t\tif (nuovaPecoraAdulta.isMaschio())\n\t\t\t\tnumMontoni++;\n\t\t\telse\n\t\t\t\tnumPecoreFemmine++;\n\t\t} else {\n\t\t\tpecore.add(new Agnello());\n\t\t\tnumeroAgelli++;\n\t\t}\n\t}", "public void carroNoAgregado(){\n System.out.println(\"No hay un parqueo para su automovil\");\n }", "@Override\n\tpublic void jogavel(Participante p) {\n\t\t\n\t}", "public void registrarPersona() {\n\t\ttry {\n\t\t\tif (validaNumDocumento(getNumDocumentPersona())) {\n\t\t\t\t\tif (validaDireccion()) {\n\t\t\t\t\t\tif (validaApellidosNombres()) {\n\t\t\t\t\t\t\tPaPersona persona = new PaPersona();\n\t\t\t\t\t\t\tif (getActualizaPersona() != null && getActualizaPersona().equals(\"N\")) {\n\t\t\t\t\t\t\t\tpersona.setPersonaId(Constante.RESULT_PENDING);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tpersona.setPersonaId(getPersonaId() == null ? Constante.RESULT_PENDING: getPersonaId());\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tpersona.setTipoDocumentoId(Integer.valueOf(mapTipoDocumento.get(getTipoDocumento())));\n\t\t\t\t\t\t\tpersona.setNroDocIdentidad(getNumDocumentPersona());\n\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\tif (persona.getTipoDocumentoId() == Constante.TIPO_DOCUMENTO_RUC_ID) {\n\t\t\t\t\t\t\t\tpersona.setRazonSocial(getRazonSocial());\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tpersona.setPrimerNombre(getPrimerNombre());\n\t\t\t\t\t\t\t\tpersona.setSegundoNombre(getSegundoNombre());\n\t\t\t\t\t\t\t\tpersona.setApePaterno(getApellidoPaterno());\n\t\t\t\t\t\t\t\tpersona.setApeMaterno(getApellidoMaterno());\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tPaDireccion direccion = new PaDireccion();\n\t\t\t\t\t\t\tdireccion.setDireccionId(getDireccionId() == null ? Constante.RESULT_PENDING: getDireccionId());\n\t\t\t\t\t\t\tif (getSelectedOptBusc().intValue() == 1) {\n\t\t\t\t\t\t\t\tdireccion.setTipoViaId(mapGnTipoVia.get(getCmbtipovia().getValue()));\n\t\t\t\t\t\t\t\tdireccion.setViaId(mapGnVia.get(getCmbvia().getValue()));\n\t\t\t\t\t\t\t\tdireccion.setLugarId(null);\n\t\t\t\t\t\t\t\tdireccion.setSectorId(null);\n\t\t\t\t\t\t\t\tdireccion.setNumero(numero);\n\t\t\t\t\t\t\t\tdireccion.setPersonaId(persona.getPersonaId());\n\n\t\t\t\t\t\t\t\tString direccionCompleta = papeletaBo.getDireccionCompleta(direccion,mapIGnTipoVia, mapIGnVia);\n\t\t\t\t\t\t\t\tif (direccionCompleta != null && direccionCompleta.trim().length() > 0) {\n\t\t\t\t\t\t\t\t\tdireccion.setDireccionCompleta(direccionCompleta);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdireccion.setDireccionCompleta(getDireccionCompleta());\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tBuscarPersonaDTO personaDto = getPersonaDto(persona, direccion);\n\t\t\t\t\t\t\tString personaPapeleta = (String) getSessionMap().get(\"personaPapeleta\");\n\t\t\t\t\t\t\tif (personaPapeleta != null\n\t\t\t\t\t\t\t\t\t&& personaPapeleta.equals(\"I\")) {\n\t\t\t\t\t\t\t\tRegistroPapeletasManaged registro = (RegistroPapeletasManaged) getManaged(\"registroPapeletasManaged\");\n\t\t\t\t\t\t\t\tregistro.setDatosInfractor(personaDto);\n\t\t\t\t\t\t\t} else if (personaPapeleta != null\n\t\t\t\t\t\t\t\t\t&& personaPapeleta.equals(\"P\")) {\n\t\t\t\t\t\t\t\tRegistroPapeletasManaged registro = (RegistroPapeletasManaged) getManaged(\"registroPapeletasManaged\");\n\t\t\t\t\t\t\t\tregistro.setDatosPropietario(personaDto);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlimpiar();\n\t\t\t\t\t\t\tesContribuyente = (Boolean) getSessionMap().get(\"esContribuyente\");\n\t\t\t\t\t\t\tif (esContribuyente == true) {\t\n\t\t\t\t\t\t\t\tWebMessages.messageError(\"Es un Contribeyente s�lo se Actualiz� la Direcci�n para Papeletas, los otros datos es por DJ\");\n\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\tWebMessages\n\t\t\t\t\t\t\t\t\t.messageError(\"Apellidos y nombres no valido\");\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tWebMessages\n\t\t\t\t\t\t\t\t.messageError(\"Especifique la direccion de la persona\");\n\t\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tWebMessages\n\t\t\t\t\t\t.messageError(\"Número de documento de identidad no valido\");\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void carregarRegistroDoPrimeiroAno() {\n\t\tlimpar();\n\t\t\n\t\tlistaAlunos = repository.encontrarComQueryNomeada(AlunosMilitaresOMDS.class, \"alunosMilitaresOMDS.listarPorOMEPeriodo\",\n\t\t\t\tnew Object[]{\"periodo\", periodo},\n\t\t\t\tnew Object[]{\"organizacao\", subordinado},\n\t\t\t\tnew Object[]{\"ano\", Ano.PRIMEIRO});\n\t\t\n\t\tif (listaAlunos.size() > 0) {\n\t\t\tlistaAlunos.forEach(efetivo ->{\n\t\t\t\tif (efetivo.getTipoAlunosMilitaresOMDS().equals(TipoAlunosMilitaresOMDS.OFICIAL))\n\t\t\t\t\tsetAlunosMilitarOficial(listaAlunos.get(0));\n\t\t\t\tif(efetivo.getTipoAlunosMilitaresOMDS().equals(TipoAlunosMilitaresOMDS.PRACA))\n\t\t\t\t\tsetAlunosMilitarPraca(listaAlunos.get(0));;\n\t\t\t});\n\t\t\thabilitaBotao=false;\n\t\t}\n\t\torganizarValores();\n\t}", "void crearNuevaPersona(Persona persona);", "@Override public void realizarCobro(Persona persona){\n\tpersona.cuenta.retiro(120);\n }", "public Integer solo_guardarPaPersona(PaPersona paPersona) throws Exception;", "@Override\n\tpublic void estourada(Participante p) {\n\t\t\n\t}", "@Override\r\n\tpublic boolean lancar(Combativel origem, Combativel alvo) {\r\n DadoVermelho dado = new DadoVermelho();\r\n int valor = dado.jogar();\r\n if(valor < origem.getInteligencia()) {\r\n alvo.defesaMagica(dano);\r\n return true;\r\n }\r\n else {\r\n \tSystem.out.println(\"Voce nao conseguiu usar a magia\");\r\n }\r\n return false;\r\n }", "private void verificaVencedor(){\n\n // Metodo para verificar o vencedor da partida\n\n if(numJogadas > 4) {\n\n String vencedor = tabuleiro.verificaVencedor();\n\n vencedor = (numJogadas == tabuleiro.TAM_TABULEIRO && vencedor == null) ? \"Deu Velha!\" : vencedor;\n\n if (vencedor != null) {\n\n mostraVencedor(vencedor);\n temVencedor = true;\n\n }\n\n }\n\n }", "public synchronized void abilitarAbordaje() {\n abordar = true;\r\n notifyAll();\r\n while(pedidoAbordaje != 0){//Mientras los pasajeros esten abordando\r\n try {\r\n wait();\r\n } catch (InterruptedException ex) {\r\n Logger.getLogger(Vuelo.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n }\r\n //Cuando los pasajeros hayan abordado el vuelo sale\r\n salio = true;\r\n System.out.println(\"El vuelo \" + nro + \" de \" + aerolinea + \" ha despegado\");\r\n }", "@Override\n\tpublic boolean semelhante(Assemelhavel obj, int profundidade) {\n\t\treturn false;\n\t}", "@Override\n\tpublic synchronized void entrarAlParque(String puerta){\n\t\tif (contadoresPersonasPuerta.get(puerta) == null){\n\t\t\tcontadoresPersonasPuerta.put(puerta, 0);\n\t\t}\n\t\t\n\t\tcomprobarAntesDeEntrar();\n\t\t\n\t\t// Aumentamos el contador total y el individual\n\t\tcontadorPersonasTotales++;\t\t\n\t\tcontadoresPersonasPuerta.put(puerta, contadoresPersonasPuerta.get(puerta)+1);\n\t\t\n\t\t// Imprimimos el estado del parque\n\t\timprimirInfo(puerta, \"Entrada\");\n\t\t\n\t\tcheckInvariante();\n\t\t\n\t\tthis.notifyAll();\n\t\t\n\t}", "public void pagarSaidaDaPrisao() throws Exception {\n if (listaJogadoresNaPrisao.contains(listaJogadores.get(jogadorAtual()).getNome())) {\n listaJogadoresNaPrisao.remove(listaJogadores.get(jogadorAtual()).getNome());\n listaJogadores.get(jogadorAtual()).setTentativasSairDaPrisao(0);\n listaJogadores.get(jogadorAtual()).retirarDinheiro(50);\n\n } else {\n print(\"\\tTentou tirar \" + listaJogadores.get(jogadorAtual()).getNome());\n throw new Exception(\"player is not on jail\");\n }\n\n this.pagouPrisaoRecentemente = false;\n }", "private PersonaEnvio buscaPersonaPorNombre(PersonaEnvio personaRequest) throws NotariaException{\n\t\tPersonaEnvio respuesta = new PersonaEnvio();\n\t\tString nombrePersona = personaRequest.getNombrePersona().replaceAll(\"\\\\s+\", \" \").trim();\n\t\tList<DatoBusquedaPersona> lista = personaBo.findPersonaByName(nombrePersona);\n\t\tif (lista != null) {\n\t\t\trespuesta.setResultados(new ArrayList<DatoBusquedaPersona>(\n\t\t\t\t\tlista));\n\t\t\trespuesta.setNumeroResultados(lista.size());\n\t\t\trespuesta.setEstatus(\"Búsqueda correcta.\");\n\t\t\trespuesta.setExito(true);\n\t\t\treturn respuesta;\n\t\t} else {\n\t\t\trespuesta.setResultados(null);\n\t\t\trespuesta.setNumeroResultados(0);\n\t\t\trespuesta.setEstatus(\"No se encontraron resultados.\");\n\t\t\trespuesta.setExito(false);\n\t\t\treturn respuesta;\n\t\t}\n\t}", "public void GuardarPersonas()\r\n {\r\n System.out.print(\"Inserte su numero de cedula: \");\r\n setNumeroId(entrada.nextLine());\r\n System.out.print(\"Inserte su Primer Nombre: \");\r\n setNombre(entrada.nextLine());\r\n System.out.print(\"Inserte su Primer Apellido: \");\r\n setPrimerApellido(entrada.nextLine());\r\n System.out.print(\"Inserte su Segundo Apellido: \");\r\n setSegundoApellido(entrada.nextLine());\r\n System.out.print(\"Inserte su edad: \");\r\n setEdad(Integer.parseInt(entrada.nextLine()));\r\n System.out.print(\"Inserte su peso: \");\r\n setPeso(Float.valueOf(entrada.nextLine()));\r\n \r\n }", "public void adicionaNaPrisao(Jogador jogador) {\n print(\"\\tA prisao tinha \" + listaJogadoresNaPrisao);\n listaJogadoresNaPrisao.add(listaJogadores.get(jogadorAtual()).getNome());\n\n print(\"\\tmas chegou prisioneiro e prisao agora tem \" + listaJogadoresNaPrisao);\n }", "public static void main(String[] args) {\n\t\t\r\n\tString nombre = leerTexto(\"Ingrese un nombre:\");\r\n\tint edad = leerNumero(\"Ingrese su edad:\");\r\n\tString rut = leerTexto(\"Ingresa el RUT:\");\r\n\tchar genero = leerTexto(\"Ingresa el genero: (M/F/O)\").charAt(0);\r\n\tfloat peso = leerNumero(\"Ingrese peso:\");\r\n\tfloat altura = leerNumero(\"Ingrese la altura:\");\r\n\tPersona claudia = new Persona(nombre, rut, edad, genero, peso, altura);\r\n\t\r\n\tnombre = leerTexto(\"Ingrese un nombre:\");\r\n\tedad = leerNumero(\"Ingrese su edad:\");\r\n\trut = leerTexto(\"Ingresa el RUT:\");\r\n\tgenero = leerTexto(\"Ingresa el genero: (M/F/O)\").charAt(0);\r\n\tPersona juliano = new Persona(nombre, rut, edad, genero);\r\n\t\r\n\tPersona noelia = new Persona();\r\n\tnoelia.setNombre(leerTexto(\"Ingresa un nombre\"));\r\n\tnoelia.setEdad(leerNumero(\"Ingresa la edad\"));\r\n\tnoelia.setRut(leerTexto(\"Ingresa el RUT\"));\r\n\tnoelia.setGenero(leerTexto(\"Ingresa el genero\").charAt(0));\r\n\tnoelia.setAltura(leerNumero(\"Ingresa la altura\"));\r\n\tnoelia.setPeso(leerNumero(\"Ingresa el peso\"));\r\n\t\r\n\tPersona[] perso = new Persona[3];\r\n\tperso[0] = claudia;\r\n\tperso[1] = juliano;\r\n\tperso[2] = noelia;\r\n\t\r\n\tfor (Persona persona : perso) {\r\n\t\tif (persona.calcularIMC()==Persona.PESO_BAJO) {\r\n\t\t\tescribir(\"Pongale sus buenas cazuelas\");\r\n\t\t}else {\r\n\t\t\tif (persona.calcularIMC()==Persona.PESO_IDEAL) {\r\n\t\t\t\tescribir(\"Estamos tiki taka\");\r\n\t\t\t}else {\r\n\t\t\t\tescribir(\"Menos coffe break!\");\r\n\t\t\t}\r\n\t\t}\r\n\t\t//Mayor de edad\r\n\t\tescribir(\"La persona \" + persona.getNombre() + \" es mayor de edad? \" + persona.esMayorDeEdad());\r\n\t\t//Mostrar el toString()\r\n\t\tescribir(persona.toString());\r\n\t }\r\n\t}", "public void AumentarVictorias() {\r\n\t\tthis.victorias_actuales++;\r\n\t\tif (this.victorias_actuales >= 9) {\r\n\t\t\tthis.TituloNobiliario = 3;\r\n\t\t} else if (this.victorias_actuales >= 6) {\r\n\t\t\tthis.TituloNobiliario = 2;\r\n\t\t} else if (this.victorias_actuales >= 3) {\r\n\t\t\tthis.TituloNobiliario = 1;\r\n\t\t} else {\r\n\t\t\tthis.TituloNobiliario = 0;\r\n\t\t}\r\n\t}", "@Override\n\tpublic void parada(Participante p) {\n\t\t\n\t}", "@Override\r\n\tpublic void efectoPersonaje(Jugador uno) {\r\n\t\tthis.player = uno;\r\n\t\tSystem.out.println(\"Efecto\" + activado);\r\n\t\tif (activado) {\r\n\r\n\t\t\tactivarContador = true;\r\n\t\t\tSystem.out.println(\"EMPEZO CONTADOR\");\r\n\r\n\t\t\tif (player instanceof Verde) {\r\n\t\t\t\tSystem.out.println(\"FUE JUGADOR VERDE\");\r\n\t\t\t\tplayer.setBoost(3);\r\n\t\t\t} else if (player instanceof Morado) {\r\n\t\t\t\tSystem.out.println(\"FUE JUGADOR MORADO\");\r\n\t\t\t\tplayer.setBoost(3);\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public static boolean verificarExistenciaPersona(Personas persona)\n {\n //Este método permite verificar si el usuario a crear es vendedor, comprador o ninguno. Validacion en el main y para el metodo que agrega los tipo de usuario\n ArrayList<Personas> personas = Personas.desserializarPersonas(\"Personas.ser\");\n for(Personas pe: personas)\n {\n if(pe.getCorreoElectronico().equals(persona.getCorreoElectronico()) && pe.getTipo().equals(pe.getTipo()) ) \n \n return true;\n }\n return false;\n }", "private void reposicionarPersonajes() {\n // TODO implement here\n }", "private Candidatos calculaCandidatos(Etapa e) {\n if(debug) {\n System.out.println(\"**********************calculaCandidatos\");\n System.out.println(\"e.i: \" + e.i);\n }\n \n Candidatos c = new Candidatos();\n if(e.k <= this.G.numVertices()) {\n //crear un objeto candidato y rellenarlo para esta etapa \n c.i = -1; //no apuntamos a ninguna pos porque en la funcion seleccionaCandidato ya incrementamos este valor\n //buscar el primer vertize sin emparejar\n int size = this.sol.emparejamientos.length;\n \n c.fila = e.i;\n \n //añadimos los candidatos\n c.verticesSinPareja = new ArrayList<>();\n for(int k = 0; k < size; ++k) {\n if(this.sol.emparejamientos[c.fila][k] == 0) {\n if(debug) {\n System.out.print(\" candidato: \" + k+ \" \");\n }\n c.verticesSinPareja.add(k);\n }\n }\n \n }\n else {\n c.verticesSinPareja = new ArrayList<>();\n }\n return c;\n }", "public void hallarPerimetroIsosceles() {\r\n this.perimetro = 2*(this.ladoA+this.ladoB);\r\n }", "public void ganarDineroPorAutomoviles() {\n for (Persona p : super.getMundo().getListaDoctores()) {\n for (Vehiculo v : p.getVehiculos()) {\n v.puedeGanarInteres();\n v.setPuedeGanarInteres(false);\n }\n }\n for (Persona p : super.getMundo().getListaCocineros()) {\n for (Vehiculo v : p.getVehiculos()) {\n v.puedeGanarInteres();\n v.setPuedeGanarInteres(false);\n }\n }\n for (Persona p : super.getMundo().getListaAlbaniles()) {\n for (Vehiculo v : p.getVehiculos()) {\n v.puedeGanarInteres();\n v.setPuedeGanarInteres(false);\n }\n }\n for (Persona p : super.getMundo().getListaHerreros()) {\n for (Vehiculo v : p.getVehiculos()) {\n v.puedeGanarInteres();\n v.setPuedeGanarInteres(false);\n }\n }\n for (Persona p : super.getMundo().getListaCocineros()) {\n for (Vehiculo v : p.getVehiculos()) {\n v.puedeGanarInteres();\n v.setPuedeGanarInteres(false);\n }\n }\n }", "private void addPersonnageToGame() throws PersonnageOnMultipleJoueurException {\n\t\t\n\t\t// liste de personnage venant d'un joueur\n\t\tList<Personnage> listePersonnageFromJoueur;\n\t\t\n\t\t// liste venant de TurnManager, qui représente la totalité des personnages\n\t\tList<Personnage> listePersonnageFromTurnManager = this.getListePersonnage();\n\t\t\n\t\tIterator<Joueur> iteratorOverListeJoueur = this.getListeJoueur().iterator();\n\t\tIterator<Personnage> iteratorOverListePersonnage;\n\t\n\t\tPersonnage personnage;\n\t\n\t\t// on boucle sur la liste de joueurs\n\t\twhile(iteratorOverListeJoueur.hasNext()){\n\t\t\t\n\t\t\t// on récupère la liste des personnages du joueur suivant\n\t\t\tlistePersonnageFromJoueur = iteratorOverListeJoueur.next().getListePersonnage();\n\t\t\titeratorOverListePersonnage = listePersonnageFromJoueur.iterator();\n\t\t\t\n\t\t\t// on boucle sur la liste de personnages du joueur\n\t\t\twhile(iteratorOverListePersonnage.hasNext()){\n\t\t\t\t\n\t\t\t\t// on récupère le personnage suivant\n\t\t\t\tpersonnage = iteratorOverListePersonnage.next();\n\t\t\t\t\n\t\t\t\t// si le personnage n'existe pas on l'ajoute dans la liste\n\t\t\t\tif(!listePersonnageFromTurnManager.contains(personnage)){\n\t\t\t\t\tlistePersonnageFromTurnManager.add(personnage);\n\t\t\t\t}\n\t\t\t\t// si il existe déjà, il y a une erreur\n\t\t\t\telse {\n\t\t\t\t\tthrow new PersonnageOnMultipleJoueurException();\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "@Override\n\tpublic Boolean votaCandidato(String listaElettorale, String nomeCandidato) {\n\t\t\n\t\t//identifico l'username dell'utente registato in questo momento\n\t\tString userVotante = autenticazioneServizio.getUsername();\n\t\t\n\t\t//creo il voto\n\t\tVoto voto = new Voto(userVotante, listaElettorale, nomeCandidato);\n\t\taggiungiVoto(voto);\n\t\treturn true;\n\t\t\n//\t\t//controlla se ha già votato\n//\t\tif (verificaVotoValido(userVotante)\n//\t\t\t\t&& !listaElettoraleDaNome(listaElettorale).getSindaco().equalsIgnoreCase(nomeCandidato)) {\n//\t\t\t//aggiungi il voto\n//\t\t\taggiungiVoto(voto);\n//\t\t\treturn true;\n//\t\t} else {\n//\t\t\treturn false;\n//\t\t}\n\t\t\n\t}", "@SuppressWarnings(\"static-access\")\n\tpersonaje(int vida, int ataque, int personajes_creados)\n\t{\n\t\t// estableciendo parametros iguales a las variables\n\t\tthis.vida = vida;\n\t\tthis.ataque = ataque;\n\t\tthis.personajes_creados = personajes_creados;\n\t\t\n\t}", "public void peleaEn(int idPeleador,int idEmpresa){\n\t\t\n\t}", "public boolean asignarMascota(Perro perro){\n boolean bandera = false;\n Persona[] miembros_familia;\n familia_asignada = \"\";\n\n while (!bandera){\n //Recorrer todo el arreglo de Familia\n for (int i = 0; i <= numero_familias; i++){\n //Obtener los miembros de la familia actual \n miembros_familia = familias[i].getMiembros();\n\n //Recorrer cada miembro del arreglo de Persona\n for (int j = 0; j < miembros_familia.length; j++){ \n //Obtener edad del miembro\n int edad = miembros_familia[j].getEdad();\n\n //Verificar si el miembro al que se analiza puede tener la mascota y si esa familia puede tener perro\n if(verificarMascota(perro, edad)){\n if (familias[i].getNumeroMascotas() < 4){\n bandera = true;\n familias[i].setNumeroMascotas();\n familia_asignada = familias[i].getApellido();\n j = miembros_familia.length;\n i = familias.length;\n }\n }\n else{\n j = miembros_familia.length;\n }\n }\n }\n break;\n }\n return bandera;\n }", "public void reabrirContrato() {\n int i;\n if (hospedesCadastrados.isEmpty()) {\n System.err.println(\"Nao existe hospedes cadastrados\\n\");\n } else {\n listarHospedes();\n int cpf = verifica();\n for (i = 0; i < hospedesCadastrados.size(); i++) {\n if (hospedesCadastrados.get(i).getCpf() == cpf) {//hospede\n if (hospedesCadastrados.get(i).getContrato().isSituacao()) {//verifica se o contrato já estpa aberto\n System.err.println(\"O contrado desse hospede já encontra-se aberto\");\n\n } else {//caso o contrato encontre-se fechado\n hospedesCadastrados.get(i).getContrato().setSituacao(true);\n System.err.println(\"Contrato reaberto, agora voce pode reusufruir de nossos servicos!\");\n }\n }\n }\n }\n }", "@Override\n\tpublic void crearNuevaPoblacion() {\n\t\t/* Nos quedamos con los mejores individuos. Del resto, cruzamos la mitad, los mejores,\n\t\t * y el resto los borramos.*/\n\t\tList<IIndividuo> poblacion2 = new ArrayList<>();\n\t\tint numFijos = (int) (poblacion.size()/2);\n\t\t/* Incluimos el 50%, los mejores */\n\t\tpoblacion2.addAll(this.poblacion.subList(0, numFijos));\n\t\t\n\t\t/* De los mejores, mezclamos la primera mitad \n\t\t * con todos, juntandolos de forma aleatoria */\n\t\tList<IIndividuo> temp = poblacion.subList(0, numFijos+1);\n\t\tfor(int i = 0; i < temp.size()/2; i++) {\n\t\t\tint j;\n\t\t\tdo {\n\t\t\t\tj = Individuo.aleatNum(0, temp.size()-1);\n\t\t\t}while(j != i);\n\t\t\t\n\t\t\ttry {\n\t\t\t\tpoblacion2.addAll(cruce(temp.get(i), temp.get(j)));\n\t\t\t} catch (CruceNuloException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\t\n\t\t//this.poblacion.clear();\n\t\tthis.poblacion = poblacion2;\n\t}", "private void validarObligaciones(TituloPropiedad pTitulo, Persona pPersonaAnterior, Persona pPersonaNueva) {\n\t\tList<ObligacionRfr> locListaObligacionesParcela = Criterio.getInstance(entityManager, DocHabEspecializadoRfr.class)\n\t\t\t\t.add(Restriccion.IGUAL(\"parcela\", ((TituloPropiedadParcelario) pTitulo).getParcela())).setProyeccion(Proyeccion.PROP(\"obligacion\")).list();\n\t\tif(!locListaObligacionesParcela.isEmpty()) {\n\t\t\t// ID = 0 significa que es una persona temporal, usada en la\n\t\t\t// migración, y no debería generar actualización de deudas,\n\t\t\t// solo cambiar el titular.\n\t\t\t// if (pPersonaAnterior.getIdPersona() == 0) {\n\t\t\tfor(ObligacionRfr cadaObligacion : locListaObligacionesParcela) {\n\t\t\t\tcadaObligacion.setPersona(pPersonaNueva);\n\t\t\t}\n\t\t\t// }\n\t\t}\n\t}", "private static void eleccionJugadores() throws ListaVaciaException{\n\t\tif(jugadores.sizeJugadores()>=2){//la lista de jugadores debe ser superior a 1 para poder añadirlos a la lista de participantes\n\t\t\tdo{\n\t\t\t\t\n\t\t\t\tSystem.out.println(jugadores.toString()+\"\\n\"+\"---MAS DE 1 JUGADOR---\");\n\t\t\t\t\ttry {\n\t\t\t\t\t\tjugadorAJugar(Teclado.leerCadena(\"Nombre:\"));//nombre de los jugadores que jugaran en la partida\n\t\t\t\t\t} catch (NombreNoValidoException | JugadorYaExisteException | JugadorNoExisteException e) {\n\t\t\t\t\t\tSystem.out.println(e.getMessage());\n\t\t\t\t\t}\n\t\t\t\t\n\t\t\t}while(DeseaContinuar.deseaContinuar(\"¿Otro Jugador?(s/n)\") || jugadores.sizeJugadores()<2);\n\t\t}else\n\t\t\tthrow new ListaVaciaException(\"La lista debe contener > 1 jugadores\");\n\t}", "private void seePerso() {\n\t\tfor (int i = 0; i < persoList.size(); i++) {\n\t\t\tPersonnage perso = persoList.get(i);\n\t\t\tSystem.out.println(\"id : \" + i);\n\t\t\tSystem.out.println(perso);\n\t\t}\n\n\t\tSystem.out.println(\"souhaitez vous modifier un personnage ? o/n\");\n\t\tif (sc.nextLine().toLowerCase().contentEquals(\"o\")) {\n\t\t\tSystem.out.println(\"Lequel ? id\");\n\t\t\tint id = sc.nextInt();\n\t\t\tsc.nextLine();\n\t\t\tchangePerso(id);\n\t\t}\n\t}", "public void venceuRodada () {\n this.pontuacaoPartida++;\n }", "private void enviarRequisicaoPerguntarNome() {\n try {\n String nome = NomeDialogo.nomeDialogo(null, \"Informe o nome do jogador\", \"Digite o nome do jogador:\", true);\n if (servidor.verificarNomeJogador(nome)) {\n nomeJogador = nome;\n comunicacaoServico.criandoNome(this, nome, \"text\");\n servidor.adicionarJogador(nome);\n servidor.atualizarLugares();\n } else {\n JanelaAlerta.janelaAlerta(null, \"Este nome já existe/inválido!\", null);\n enviarRequisicaoPerguntarNome();\n }\n } catch (Exception e) {\n e.printStackTrace();\n }\n }", "private boolean poseeSaldoAnterior() {\n boolean retorno = false;\n if(saldoAnterior !=null){\n retorno = true;\n }\n return retorno;\n }", "public static void main(String args[]){\n int x = 10;\r\n List<Perro> perros = new ArrayList();\r\n \r\n Perro perro=new Perro();\r\n \r\n Persona persona = new Persona();\r\n persona.setAltura(5.5);\r\n persona.setColorPiel(\"Blanca\");\r\n persona.setEdad(16);\r\n persona.setGenero('f');\r\n persona.setNacionalidad(\"Japonesa\");\r\n persona.setPeso(130);\r\n persona.setTipoDePelo(\"Lacio\"); \r\n persona.setOcupacion(\"Dinero\");\r\n \r\n //Se dan todas las características\r\n perro.setNombre(\"Manuel\");\r\n perro.setColor(\"Negro\");\r\n perro.setTamano(10.2);\r\n perro.setRaza(\"Golden\");\r\n perro.setTipoDePelo(\"Crespo\");\r\n perro.setAdoptado(false);\r\n perro.setGenero('H');\r\n \r\n perros.add(perro);//Se añade a la instancia\r\n \r\n perro = new Perro();//Se limpia y se vuelve a llamar la instancia\r\n perro.setNombre(\"Igor\");\r\n perro.setColor(\"Negro\");\r\n perro.setTamano(10.2);\r\n perro.setRaza(\"Golden\");\r\n perro.setTipoDePelo(\"Lacio\");\r\n perro.setAdoptado(false);\r\n perro.setGenero('H');\r\n \r\n perros.add(perro);\r\n \r\n perro = new Perro();\r\n perro.setNombre(\"Luli\");\r\n perro.setColor(\"Negro\");\r\n perro.setTamano(10.2);\r\n perro.setRaza(\"Siberiano\");\r\n perro.setTipoDePelo(\"Crespo\");\r\n perro.setAdoptado(false);\r\n perro.setGenero('H');\r\n \r\n perros.add(perro);\r\n //****************CUANDO EJECUTES ESTO VE COMENTADO LOS BLOQUES QUE NO QUIERES QUE SE USEN*************\r\n //foreach y for hace la misma funcion\r\n //Uso de for\r\n for (Perro perro1:perros){\r\n System.out.println(perro1.getNombre());\r\n System.out.println(perro1.getColor());\r\n System.out.println(perro1.getTamano());\r\n System.out.println(perro1.getRaza());\r\n System.out.println(perro1.getTipoDePelo());\r\n }\r\n \r\n //Formas de uso del for each\r\n perros.forEach(perro1->\r\n System.out.println(perro1.getNombre()));\r\n \r\n perros.forEach(perro1 ->{//Se define una variable que es perro1 y esta recorrera toda la lista\r\n System.out.println(perro1.getNombre());\r\n System.out.println(perro1.getColor());\r\n System.out.println(perro1.getTamano());\r\n System.out.println(perro1.getRaza());\r\n System.out.println(perro1.getTipoDePelo()); \r\n System.out.println();\r\n \r\n });\r\n \r\n \r\n System.out.println(\"Blanco\".equals(perro.color)? \"Si es blanco\":\"No es blanco\");\r\n \r\n //Uso del if\r\n if (((4/2==0)&&(10/5 !=0))||(100/20==0)){\r\n System.out.println(\"Es bisiesto\");\r\n }else{\r\n System.out.println(\"No es bisiesto\");\r\n }\r\n \r\n //Uso del switcH\r\n switch(x){\r\n case 6:\r\n System.out.println(\"Es verdadero\");\r\n break;\r\n case 2:\r\n System.out.println(\"Es falso\");\r\n break;\r\n default:\r\n System.out.println(\"No es ninguna\");\r\n \r\n //Uso de la lista de un item en especifico \r\n System.out.println(\"Nombre: \" + perros.get(2).getNombre());//El número del get\r\n System.out.println(\"Color: \"+perros.get(2).getColor());//define que item es que tomará\r\n System.out.println(\"Raza: \"+perros.get(2).getRaza());\r\n \r\n \r\n //Demostración del uso de getters\r\n System.out.println(\"Nombre: \");\r\n System.out.println(\"Altura: \" + persona.getAltura());\r\n System.out.println(\"Color: \" + persona.getColorPiel());\r\n System.out.println(\"Edad: \"+persona.getEdad());\r\n System.out.println(\"Genero: \"+persona.getGenero());\r\n System.out.println(\"Nacionalidad: \"+persona.getNacionalidad());\r\n System.out.println(\"Peso: \"+persona.getPeso());\r\n System.out.println(\"Tipo de Pelo: \"+persona.getTipoDePelo());\r\n \r\n }\r\n \r\n}", "public void pagarAluguel(int credor, int devedor, int valor, String NomePopriedade) {\n\n Jogador JogadorDevedor = listaJogadores.get(devedor);\n Jogador JogadorCredor = listaJogadores.get(credor);\n\n\n if (listaJogadores.get(devedor).getDinheiro() >= valor) {\n JogadorDevedor.retirarDinheiro(valor);\n JogadorCredor.addDinheiro(valor);\n\n } else {\n \n\n\n if(bankruptcy){\n\n }else{\n int DinheiroRestante = listaJogadores.get(devedor).getDinheiro();\n JogadorDevedor.retirarDinheiro(DinheiroRestante);\n JogadorCredor.addDinheiro(DinheiroRestante);\n }\n this.removePlayer(devedor);\n\n }\n\n\n }", "public boolean estaVacia() {\n if (pieza == null)\n return true;\n else\n return false;\n }", "private void esqueceu() {\n\n //Declaração de Objetos\n Veterinario veterinario = new Veterinario();\n\n //Declaração de Variaveis\n int crmv;\n String senha;\n\n //Atribuição de Valores\n try {\n crmv = Integer.parseInt(TextCrmv.getText());\n senha = TextSenha.getText();\n \n //Atualizando no Banco\n veterinario.Vdao.atualizarAnimalSenhaPeloCrmv(senha, crmv);\n \n } catch (NumberFormatException ex) {\n JOptionPane.showMessageDialog(null, \"APENAS NUMEROS NO CRMV!\");\n }\n JOptionPane.showMessageDialog(null, \"SUCESSO AO ALTERAR SENHA!\");\n\n }", "public boolean NuevoAfiliado(String nombrePersona, String numeroDui) {\n if (!Afiliados.contains(nombrePersona)) { //Verificar que sta persona no este agregada.\n //Agregar nuevo afiliado.\n Afiliados.add(nombrePersona);\n FechaAfiliacion.add(ObtenerFechaActual());\n NumeroDui.add(numeroDui);\n return true;\n }\n return false;\n }", "private void muestraPersona(JSONArray genero) {\n\tJSONArray a = (JSONArray) genero.get(0);\n\t// txtId.setText(Long.toString( (Long) a.get(0)) );\n\t//txtBuscar.setText((String) a.get(1));\n\t// textFecha.setText((String) a.get(2));\n\t// textUsu.setText((String) a.get(4));\n\tcodTemporal = a.get(0).toString();\n\n\thabilita(true, false, false, false, false, true, false, true, true);\n }", "public static void asignarPunteo(int puntos, String nombreJugador) {\n for (int sizeNombres = 0; sizeNombres < nombres.length - 1; sizeNombres++) {\n if ((nombreJugador.equals(nombres[sizeNombres])) && (puntos == 1)) {\n punteos[sizeNombres] += 1;\n break;\n }\n\n }\n\n }", "public ValidaExistePersonaRespuesta() {\n\t\theader = new EncabezadoRespuesta();\n\t\t}", "public void VenderCasasOuHoteis(int idPropriedade) throws Exception {\n this.terminarAVez();\n\n if (this.sell == true) {\n if (this.listaJogadores.get(jogadorAtual()).getComandos().contains(\"sell\")) {\n\n if (idPropriedade <= 0 || idPropriedade > 40) {\n throw new Exception(\"Place doesn't exist\");\n }\n\n if (!this.tabuleiro.getLugarById(idPropriedade).isPropriedade()) {\n throw new Exception(\"Can only sell houses built on properties\");\n }\n boolean OJogadorDavezEhDono = this.listaJogadores.get(jogadorAtual()).getPropriedades().contains(this.tabuleiro.getLugarById(idPropriedade).getNome());\n if (OJogadorDavezEhDono) {\n if (this.tabuleiro.getLugarById(idPropriedade).getNivel() == 0) {\n throw new Exception(\"No house is built on this property\");\n }\n } else {\n throw new Exception(\"Player is not the owner of this property\");\n }\n\n //Procedimento De Venda\n\n if (this.tabuleiro.verificaSePodeVenderImovelDoTerreno(idPropriedade) == true) {\n RealizarProtocoloDeVendaDeCasasEHoteis(idPropriedade);\n if(bankruptcy && this.listaJogadores.get(jogadorAtual()).isBankruptcy()){\n adicionaGiveupQuandoPossivel(this.listaJogadores.get(jogadorAtual()));\n }\n if(hipotecaAtiva && verificaSeTemLugarSemConstrucao(listaJogadores.get(jogadorAtual())))\n listaJogadores.get(jogadorAtual()).adicionarComandoHipotecar();\n\n\n } else {\n throw new Exception(\"Uneven distribution of houses\");\n }\n } else {\n throw new Exception(\"Unavailable command\");\n }\n\n\n\n }\n }", "public void asignarAutomovilPersona(){\r\n persona.setAutomovil(automovil);\r\n }", "@Override\n\tpublic boolean cambiarGrafico(Personaje e) {\n\t\treturn false;\n\t}", "@Override\n\tpublic Boolean vota(String listaElettorale) {\n\t\t//definisco utente registato in questo momento\n\t\tString userVotante = autenticazioneServizio.getUsername();\n\t\tVoto voto = new Voto(userVotante, listaElettorale);\n\t\taggiungiVoto(voto);\n\t\t//controlla se l'user ha già votato\n\t\taggiungiVoto(voto);\n\t\treturn true;\n//\t\tif (verificaVotoValido(userVotante)) {\n//\t\t\t//vota\n//\t\t\taggiungiVoto(voto);\n//\t\t\t\n//\t\t\treturn true;\n//\t\t} else {\n//\t\t\treturn false;\n//\t\t}\n\t}", "public RecibeMovimientoComportamiento(Agent a) {\n super(a, MessageTemplate.and(MessageTemplate.MatchProtocol(\n FIPANames.InteractionProtocol.FIPA_PROPOSE),\n MessageTemplate.MatchPerformative(ACLMessage.PROPOSE)));\n }", "public Vendedor buscarVendedorPorNome(String nome);", "public void hacerPedido(){\n this.sucursal.procesarPedido(this.pedido, this.id);\n this.pedido = new Integer[5];\n contadorPedido = 0;\n }", "@Override\n\tpublic void emprestimo(Livros livro, Aluno usuario) {\n\t\t\n\t}", "static void jugadorAJugar(String nombre) throws NombreNoValidoException, JugadorYaExisteException, JugadorNoExisteException{\n\t\tif(jugadores.contains(nombre)&&!participantes.contains(nombre))\n\t\t\tparticipantes.volcarJugadorALista(jugadores.get(jugadores.indexOf(nombre)));\n\t\telse if(!jugadores.contains(nombre))\n\t\t\tthrow new JugadorNoExisteException(\"Jugador no existe en la lista.\");\n\t\telse\n\t\t\tthrow new JugadorYaExisteException(\"Jugador ya existe.\");\n\t\t\t\n\t}", "public boolean houveVencedor() {\r\n return (vencedor != null);\r\n }", "public void pridejNovePivo ()\n\t{\n\t\n\t\tpivo = pivo + PRODUKCE;\n\t\t\n\t}", "public static void proveraServisa() {\n\t\tSystem.out.println(\"Unesite redni broj vozila za koje racunate vreme sledeceg servisa:\");\n\t\tUtillMethod.izlistavanjeVozila();\n\t\tint redniBroj = UtillMethod.unesiteInt();\n\t\tif (redniBroj < Main.getVozilaAll().size()) {\n\t\t\tif (!Main.getVozilaAll().get(redniBroj).isVozObrisano()) {\n\t\t\t\tUtillMethod.proveraServisaVozila(Main.getVozilaAll().get(redniBroj));\n\t\t\t} else {\n\t\t\t\tSystem.out.println(\"Ovo vozilo je obrisano i ne moze da se koristi!\");\n\t\t\t}\n\t\t} else {\n\t\t\tSystem.out.println(\"Uneli ste pogresan redni broj!\");\n\t\t}\n\t}", "private void caricaRegistrazione() {\n\t\tfor(MovimentoEP movimentoEP : primaNota.getListaMovimentiEP()){\n\t\t\t\n\t\t\tif(movimentoEP.getRegistrazioneMovFin() == null) { //caso di prime note libere.\n\t\t\t\tthrow new BusinessException(ErroreCore.OPERAZIONE_NON_CONSENTITA.getErrore(\"La prima nota non e' associata ad una registrazione.\"));\n\t\t\t}\n\t\t\t\n\t\t\tthis.registrazioneMovFinDiPartenza = registrazioneMovFinDad.findRegistrazioneMovFinById(movimentoEP.getRegistrazioneMovFin().getUid());\n\t\t\t\n\t\t}\n\t\t\n\t\tif(this.registrazioneMovFinDiPartenza.getMovimento() == null){\n\t\t\tthrow new BusinessException(\"Movimento non caricato.\");\n\t\t}\n\t\t\n\t}", "public Mach buscarEmpleado(Vacante vacante) {\r\n\t\tSystem.out.println(\"buscando empleo\");\r\n\t\tMach ELpapa = null;\r\n\t\tMach nuevo = null;\r\n\t\tArrayList<Mach> maches = new ArrayList<>();\r\n\t\tfor (Persona persona : personas) {\r\n\t\t\tSystem.out.println(\"aqui\");\r\n\t\t\tif (persona instanceof Obrero) {\r\n\t\t\t\tif (vacante instanceof vacanteObrero) {\r\n\t\t\t\t\tSystem.out.println(\"estoy aqui obrero\");\r\n\t\t\t\t\tif (persona.INTERIOR().equalsIgnoreCase(((vacanteObrero) vacante).getHabilidades())) {\r\n\t\t\t\t\t\tnuevo = persona.buscarCurriculums(vacante);\r\n\t\t\t\t\t\tif (nuevo.getIdice() > 0) {\r\n\t\t\t\t\t\t\tmaches.add(nuevo);\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\tif (persona instanceof Tecnico) {\r\n\t\t\t\tif (vacante instanceof vacanteTecnico) {\r\n\t\t\t\t\tif (persona.INTERIOR().equalsIgnoreCase(((vacanteTecnico) vacante).getArea_desarrollo())) {\r\n\t\t\t\t\t\tSystem.out.println(\"esoty aqui tecnico\");\r\n\t\t\t\t\t\tnuevo = persona.buscarCurriculums(vacante);\r\n\t\t\t\t\t\tif (nuevo.getIdice() > 0) {\r\n\t\t\t\t\t\t\tmaches.add(nuevo);\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\tif (persona instanceof Universitario) {\r\n\t\t\t\tif (vacante instanceof vancanteUniversitario) {\r\n\t\t\t\t\tSystem.out.println(\"estoy aqui univeristario\");\r\n\t\t\t\t\tif (persona.INTERIOR().equalsIgnoreCase(((vancanteUniversitario) vacante).getCarreraUniv())) {\r\n\t\t\t\t\t\tnuevo = persona.buscarCurriculums(vacante);\r\n\t\t\t\t\t\tif (nuevo.getIdice() > 0) {\r\n\t\t\t\t\t\t\tmaches.add(nuevo);\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\t\r\n\t\t}\r\n\t\tELpapa = buscarmayorIndiceDeMACHES(maches);\r\n\t\tif (ELpapa != null) {\r\n\t\t\tSystem.out.println(\"no es null\");\r\n\t\t}\r\n\t\treturn ELpapa;\r\n\t}", "public String generaIDPortalEmpleo(EmpresaPorAutorizarVO vo){\n\t\tString idPortalEmpleo = \"\";\t\t\n\t\tint digitoVerificador = 1;\n\t\tFormat formatter = new SimpleDateFormat(\"yyMMdd\");\t\t\n\t\ttry {\n\t\t\tDomicilioVO domicilio = vo.getDomicilio();\n\t\t\tif(vo.getIdTipoPersona() == Constantes.TIPO_PERSONA.PERSONA_FISICA.getIdTipoPersona()){\n\t\t\t\t//Tipo de Persona Física\n\t\t\t\tif(vo.getApellido2().isEmpty()){\n\t\t\t\t\t//Primeras tres letras del apellido paterno\n\t\t\t\t\t//System.out.println(\"--original--strApellido1:\" + vo.getApellido1());\n\t\t\t\t\tString strApellido1 = convertAccents(vo.getApellido1());\n\t\t\t\t\t//System.out.println(\"--modificado--strApellido1:\" + strApellido1);\n\t\t\t\t\tidPortalEmpleo = idPortalEmpleo + strApellido1.substring(0, 3);\t\n\t\t\t\t} else {\n\t\t\t\t\t//Primeras dos letras del apellido paterno\n\t\t\t\t\t//Primera letra del apellido materno\t\t\t\t\t\n\t\t\t\t\t//System.out.println(\"--original--strApellido1:\" + vo.getApellido1());\n\t\t\t\t\tString strApellido1 = convertAccents(vo.getApellido1());\n\t\t\t\t\t//System.out.println(\"--modificado--strApellido1:\" + strApellido1);\t\t\t\t\t\n\t\t\t\t\t//System.out.println(\"--original--strApellido2:\" + vo.getApellido2());\n\t\t\t\t\tString strApellido2 = convertAccents(vo.getApellido2());\n\t\t\t\t\t//System.out.println(\"--modificado--strApellido2:\" + strApellido2);\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tidPortalEmpleo = idPortalEmpleo + strApellido1.substring(0, 2);\n\t\t\t\t\tidPortalEmpleo = idPortalEmpleo + strApellido2.substring(0, 1);\n\t\t\t\t}\n\t\t\t\t//Primera letra del nombre\n\t\t\t\t//System.out.println(\"--original--strNombre:\" + vo.getNombre());\n\t\t\t\tString strNombre = convertAccents(vo.getNombre());\n\t\t\t\t//System.out.println(\"--modificado--strNombre:\" + strNombre);\t\t\t\t\t\n\t\t\t\tidPortalEmpleo = idPortalEmpleo + strNombre.substring(0, 1);\n\t\t\t\t//Fecha de nacimiento en formato yymmdd\n\t\t\t\tidPortalEmpleo = idPortalEmpleo + formatter.format(vo.getFechaNacimiento());\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t} else {\n\t\t\t\t//Tipo de Persona Moral\t\t\t\t\t\n\t\t\t\tString strRazonSocial = convertAccents(vo.getRazonSocial());\n\t\t\t\t//Primeras tres letras de razón social\n\t\t\t\t//COMENTAR EN PRODUCCION\t\t\t\t\t\t\t\t\t\n\t\t\t\tif (strRazonSocial.length() < 3) \n\t\t\t\t\tstrRazonSocial = StringUtils.rightPad(strRazonSocial, 3, \"X\");\n\t\t\t\t/**/\t\t\n\t\t\t\t//TERMINA COMENTAR EN PRODUCCION\t\t\t\t\n\t\t\t\t//\n\t\t\t\t//System.out.println(\"--modificado--strRazonSocial:\" + strRazonSocial);\t\t\t\t\t\t\t\t\t\n\t\t\t\tidPortalEmpleo = idPortalEmpleo + strRazonSocial.substring(0, 3);\t\n\t\t\t\t//Fecha de acta en formato yymmdd\n\t\t\t\tidPortalEmpleo = idPortalEmpleo + formatter.format(vo.getFechaActa());\n\t\t\t}\n\t\t\tidPortalEmpleo = idPortalEmpleo + domicilio.getCodigoPostal();\t\t\t\n\t\t\t//Código verificador (1)\t\t\t\t\n\t\t\tEmpresaPorAutorizarDAO epaDAO = new EmpresaPorAutorizarDAO();\n\t\t\tdigitoVerificador = epaDAO.obtenerDigitoVerificador(idPortalEmpleo, vo.getIdTipoPersona());\t\n\t\t\t//rellenar\n\t\t\tint lenId = idPortalEmpleo.length();\n\t\t\t//System.out.println(\"------digitoVerificador:\" + digitoVerificador);\n\t\t\tint lenDigito = String.valueOf(digitoVerificador).length();\n\t\t\t//System.out.println(\"------lenDigito:\" + lenDigito);\n\t\t\tint intRelleno = PORTAL_ID_SIZE - (lenId + lenDigito);\n\t\t\t//System.out.println(\"------intRelleno:\" + intRelleno);\n\t\t\tString strRelleno = \"\";\n\t\t\tif(intRelleno>0){\n\t\t\t\tfor(int i=0; i<intRelleno; i++){\n\t\t\t\t\tstrRelleno = strRelleno + \"0\";\n\t\t\t\t}\t\t\t\t\n\t\t\t}\n\t\t\t//System.out.println(\"------strRelleno:\" + strRelleno);\n\t\t\tidPortalEmpleo = idPortalEmpleo + strRelleno + digitoVerificador;\n\t\t\t//System.out.println(\"------idPortalEmpleo:\" + idPortalEmpleo);\n\t\t\n\t\t} catch (RuntimeException e) {\n\t\t\tlogger.error(e.toString());\n\t\t\te.printStackTrace();\n\t\t\tthrow new PersistenceException(e);\n\t\t} catch (SQLException e) {\n\t\t\tlogger.error(e.toString());\n\t\t\te.printStackTrace();\n\t\t\tthrow new PersistenceException(e);\n\t\t} catch (Exception e) {\n\t\t\tlogger.error(e.toString());\t\t\t\n\t\t\te.printStackTrace();\n\t\t\tthrow new PersistenceException(e);\n\t\t}\t\t\n\t\treturn idPortalEmpleo;\n\t}", "Professor procurarNome(String nome) throws ProfessorNomeNExisteException;", "@Override\n\tpublic void emprestimo(Livros livro, Usuarios usuario) {\n\t\t\n\t}", "public boolean agregarFamilia(String apellido, Persona[] miembros){\n if (numero_familias < 14){\n Arrays.sort(miembros);\n //Instancia la familia y la agrega al arreglo de Familias en la posición que le corresponde \n familia = new Familia(apellido, miembros);\n numero_familias++;\n familias[numero_familias] = familia;\n return true;\n }\n else return false;\n }", "@Override\r\n\tpublic Loja procurar(String nomeEmpresa) {\n\t\treturn null;\r\n\t}", "@Override\r\n /**\r\n * *\r\n *Primero revisa si los apellidos con iguales, en el caso de que sean iguales\r\n *entra al if y compara por nombres, de lo contrario nunca entra al if y \r\n * compara normalmente por apellido\r\n * \r\n */ \r\n public void ordenarPersonas (){\r\n Comparator<Persona> comparacionPersona= (Persona persona1,Persona persona2)->{\r\n \r\n if(persona1.getApellidos().compareToIgnoreCase(persona2.getApellidos())==0){\r\n return persona1.getNombres().compareToIgnoreCase(persona2.getNombres());}\r\n return persona1.getApellidos().compareToIgnoreCase(persona2.getApellidos());\r\n }; \r\n\r\n listaPersona.sort(comparacionPersona);\r\n }", "public void posizionaPecora(Agnello pecora) {\n\t\tpecore.add(pecora);\n\t\tif (pecora instanceof PecoraAdulta) {\n\t\t\tif (((PecoraAdulta) pecora).isMaschio())\n\t\t\t\tnumMontoni++;\n\t\t\telse\n\t\t\t\tnumPecoreFemmine++;\n\t\t\treturn;\n\t\t} else if (!(pecora instanceof PecoraNera))\n\t\t\tnumeroAgelli++;\n\t}", "public void pesquisarNome() {\n\t\tSystem.out.println(this.nomePesquisa);\n\t\tthis.alunos = this.alunoDao.listarNome(this.nomePesquisa);\n\t\tthis.quantPesquisada = this.alunos.size();\n\t}", "public void acionarInadimplencia(CestaGarantiasDO cesta);", "public void damePersonaje(String personaje){\n this.personaje=personaje;\n\n\n\n }", "public void ReservaEfetivadas () {\n Date hoje = new Date ();\n for (int z = 0; z < vecReserva.size(); z++) {\n if (((int) ((((entReserva)vecReserva.elementAt(z)).getDatain().getTime() - (hoje.getTime())) / 86400000L)) == 0){// Reserva será relaizada hj\n if (((entReserva)vecReserva.elementAt(z)).getPagamento().getSituacao() == 0){//Cliente fez todo o pagamento e o quarto será\n vecReservaEfetivadas.add(vecReserva.elementAt(z));\n }\n \n }\n }\n }", "public void nascitaAgnello() {\n\t\tpecore.add(new Agnello());\n\t\tnumeroAgelli++;\n\t}", "void cadastrar(String nome, String cpf, String endereco, String email, String senha)throws ProfessorJaCadastradoException;", "public void asignarVida();", "public Persona(){\n /*super(nombresPosibles\n [r.nextInt(nombresPosibles.length)],(byte)r.nextInt(101));\n */\n super(\"Anónimo\",(byte)5);\n String[] nombresPosibles={\"Patracio\",\"Eusequio\",\"Bartolo\",\"Mortadelo\",\"Piorroncho\",\"Tiburcio\"};\n String[] apellidosPosibles={\"Sánchez\",\"López\",\"Martínez\",\"González\",\"Páramos\",\"Jiménez\",\"Parra\"};\n String[] nacionalidadesPosibles={\"Española\",\"Francesa\",\"Alemana\",\"Irlandesa\",\"Japonesa\",\"Congoleña\",\"Bielorrusa\",\"Mauritana\"};\n Random r=new Random();\n this.apellido=apellidosPosibles\n [r.nextInt(apellidosPosibles.length)];\n this.nacionalidad=nacionalidadesPosibles\n [r.nextInt(nacionalidadesPosibles.length)];\n mascota=new Mascota[5];\n this.saldo=r.nextInt(101);\n }", "@Override\n\tpublic int sacameVida(ElementoSoldado a) {\n\t\treturn 0;\n\t}", "public void crearPersona(){\r\n persona = new Persona();\r\n persona.setNombre(\"Jose\");\r\n persona.setCedula(12345678);\r\n }", "public void getPropuestasOrdenadas(int confirm) throws ParseException{\n System.out.println(\"\\nSe imprimirán las propuestas de la Sala \"+getNombreSala()+\":\");\n if (propuestas.size() == 0){\n System.out.println(\"No hay reservas para esta Sala\");\n }\n else{\n for (Propuesta propuestaF : propuestas) {\n String nombreReservador = propuestaF.getReservador().getNombreCompleto();\n if (confirm == 0){\n if (propuestaF.isForAllSem()) {\n System.out.println(\"Propuesta por todo el semestre, parte el \"+propuestaF.getFechaPuntualI(0)+\" hasta \"+\n propuestaF.getFechaPuntualF(0)+\". La reserva termina el \"+\n propuestaF.getFechaPuntualI(propuestaF.getFechasPropuestasInicio().size()-1)+\" hasta \"+\n propuestaF.getFechaPuntualF(propuestaF.getFechasPropuestasFinal().size()-1));\n System.out.println(\"Esta reserva fue hecha por:\");\n if (propuestaF.getReservador() instanceof Profesor){\n System.out.println(\"Profesor \"+ nombreReservador);\n }\n else if (propuestaF.getReservador() instanceof Estudiante){\n System.out.println(\"Estudiante \"+ nombreReservador);\n }\n else{\n System.out.println(nombreReservador);\n }\n }\n else{\n int i = 0;\n int j = 0;\n int idPropuesta = 0;\n String fecha = \"01-01-50000\";\n SimpleDateFormat parseF = new SimpleDateFormat(\"dd-MM-yyyy\");\n Date fechaMasReciente = parseF.parse(fecha);\n Date fechaAux;\n Propuesta propActual;\n while(i < propuestas.size()){\n while (j < propuestas.size()){\n propActual = propuestas.get(j);\n fechaAux = propActual.getFechaPuntualI(0);\n if (fechaAux.compareTo(fechaMasReciente) < 0){\n fechaMasReciente = fechaAux;\n }\n j++;\n }\n System.out.println(\"Desde \"+propuestas.get(i).getFechaPuntualF(0)+\" hasta \"+\n propuestas.get(i).getFechaPuntualF(0));\n fecha = \"01-01-2200\";\n fechaMasReciente = parseF.parse(fecha);\n i++;\n }\n }\n }\n else if (confirm == 1){\n if (propuestaF.isForAllSem() && propuestaF.isConfirmada()) {\n System.out.println(\"Propuesta por todo el semestre, parte el \"+propuestaF.getFechaPuntualI(0)+\" hasta \"+\n propuestaF.getFechaPuntualF(0)+\". La reserva termina el \"+\n propuestaF.getFechaPuntualI(propuestaF.getFechasPropuestasInicio().size()-1)+\" hasta \"+\n propuestaF.getFechaPuntualF(propuestaF.getFechasPropuestasFinal().size()-1));\n System.out.println(\"Esta reserva fue hecha por:\");\n if (propuestaF.getReservador() instanceof Profesor){\n System.out.println(\"Profesor \"+ nombreReservador);\n }\n else if (propuestaF.getReservador() instanceof Estudiante){\n System.out.println(\"Estudiante \"+ nombreReservador);\n }\n else{\n System.out.println(nombreReservador);\n }\n }\n else if (propuestaF.isConfirmada()){\n int i = 0;\n int j = 0;\n int idPropuesta = 0;\n String fecha = \"01-01-50000\";\n SimpleDateFormat parseF = new SimpleDateFormat(\"dd-MM-yyyy\");\n Date fechaMasReciente = parseF.parse(fecha);\n Date fechaAux;\n Propuesta propActual;\n while(i < propuestas.size()){\n while (j < propuestas.size()){\n propActual = propuestas.get(j);\n fechaAux = propActual.getFechaPuntualI(0);\n if (fechaAux.compareTo(fechaMasReciente) < 0){\n fechaMasReciente = fechaAux;\n }\n j++;\n }\n System.out.println(\"Desde \"+propuestas.get(i).getFechaPuntualF(0)+\" hasta \"+\n propuestas.get(i).getFechaPuntualF(0));\n fecha = \"01-01-2200\";\n fechaMasReciente = parseF.parse(fecha);\n i++;\n }\n }\n }\n }\n }\n }", "private static <V> boolean profPrimeroCiclos(Graph<V> pGraph, V pInicio, V vertAnterior, Set<V> pConjunto) {\n pConjunto.put(pInicio);\n List<V> adyacencias = pGraph.getAdjacentNodes(pInicio);\n for (int x = 1; x <= adyacencias.size(); x++) {\n V adyacencia = adyacencias.get(x);\n if (!adyacencia.equals(vertAnterior)) {\n if (!pConjunto.isMember(adyacencia)) {\n return profPrimeroCiclos(pGraph, adyacencia, pInicio, pConjunto);\n } else {\n return false;\n }\n }\n }\n return true;\n }", "public static void main (String[] args){\n Empleado[] listaEmpleados = new Empleado[10];\n \n //Asignamos objetos a cada posición\n listaEmpleados[0] = new Empleado(\"Manuel\", \"30965835V\");\n listaEmpleados[1] = new Empleado(\"Miguel\", \"30965835V\");\n listaEmpleados[2] = new Empleado(\"Pedro\", \"30965835V\");\n listaEmpleados[3] = new Empleado(\"Samuel\", \"30965835V\");\n listaEmpleados[4] = new Empleado(\"Vanesa\", \"30965835V\");\n listaEmpleados[5] = new Empleado(\"Alberto\", \"30965835V\");\n listaEmpleados[6] = new Empleado(\"Roberto\", \"30965835V\");\n listaEmpleados[7] = new Empleado(\"Carlos\", \"30965835V\");\n listaEmpleados[8] = new Empleado(\"Ernesto\", \"30965835V\");\n listaEmpleados[9] = new Empleado(\"Javier\", \"30965835V\");\n\n /*Empleado[] empleados = {\n empleado1, empleado2, empleado3, null,null,null, null,\n null,null,null\n }*/\n \n //Imprimimos el array sin ordenar\n imprimeArrayPersona(listaEmpleados);\n \n //Creamos el objeto de la empresa\n Empresa empresa0 = new Empresa(\"Indra\", listaEmpleados);\n \n //Usamos la clase array para ordenar el array de mayor a menos\n Arrays.sort(listaEmpleados);\n\n //Imprimimos de nuevo el array\n imprimeArrayPersona(listaEmpleados);\n \n //Imprimimos la empresa\n System.out.println(empresa0);\n \n //Guardamos en un string la lista de nombres de un objeto empresa\n String listado = Empresa.listaEmpleado(empresa0.empleado).toString();\n \n System.out.println(listado);//Imprimimos el listado como un string\n \n //Imprimimos el array de los nombres de los empleados de la empresa\n System.out.println(Arrays.toString(Empresa.listaEmpleadoArray(listado)));\n \n //Método que imprime los empleados de una empresa separados por comas\n Empresa.listaEmpleado(listado);\n \n /*Empresa[] listaEmpresa = new Empresa[4];\n \n listaEmpresa[0] = new Empresa(\"Intel\", listaEmpleados);\n listaEmpresa[1] = new Empresa(\"AMD\", listaEmpleados);\n listaEmpresa[2] = new Empresa(\"Asus\", listaEmpleados);\n listaEmpresa[3] = new Empresa(\"Shaphire\", listaEmpleados);\n System.out.println(Arrays.toString(listaEmpresa));\n Arrays.sort(listaEmpresa);\n System.out.println(Arrays.toString(listaEmpresa));*/\n \n \n }", "public void avvia() {\n /* variabili e costanti locali di lavoro */\n\n try { // prova ad eseguire il codice\n getModuloRisultati().avvia();\n } catch (Exception unErrore) { // intercetta l'errore\n Errore.crea(unErrore);\n }// fine del blocco try-catch\n\n super.avvia();\n\n }", "private boolean idSaoIguais(Service servico, Service servicoAComparar) {\n return servico.getId() == servicoAComparar.getId();\n }", "public Persona() { // constructor sin parámetros\r\n\t\t\r\n\t\tthis.nif = \"44882229Y\";\r\n\t\tthis.nombre=\"Anonimo\";\r\n\t\tthis.sexo = 'F';\r\n\t\tthis.fecha = LocalDate.now();\r\n\t\tthis.altura = 180;\r\n\t\tthis.madre = null;\r\n\t\tthis.padre = null;\r\n\t\tcontador++;\r\n\t}", "public void crearEntidad() throws EntidadNotFoundException {\r\n\t\tif (validarCampos(getNewEntidad())) {\r\n\t\t\tif (validarNomNitRepetidoEntidad(getNewEntidad())) {\r\n\t\t\t\tFacesContext.getCurrentInstance().addMessage(null,\r\n\t\t\t\t\t\tnew FacesMessage(FacesMessage.SEVERITY_WARN, \"Advertencia: \", \"Nombre, Nit o Prejifo ya existe en GIA\"));\r\n\t\t\t} else {\r\n\t\t\t\tif (entidadController.crearEntidad(getNewEntidad())) {\r\n\t\t\t\t\tmensajeGrow(\"Entidad Creada Satisfactoriamente\", getNewEntidad());\r\n\t\t\t\t\tRequestContext.getCurrentInstance().execute(\"PF('entCrearDialog').hide()\");\r\n\t\t\t\t\tsetNewEntidad(new EntidadDTO());\r\n\t\t\t\t\tresetCodigoBUA();\r\n\t\t\t\t} else {\r\n\t\t\t\t\tmensajeGrow(\"Entidad No Fue Creada\", getNewEntidad());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tlistarEntidades();\r\n\t\t\t// newEntidad = new EntidadDTO();\r\n\t\t\t// fechaActual();\r\n\t\t}\r\n\r\n\t}", "public static void establecerMano(Monton todas,Mano[] jugadores){\n int pos;\n Pieza pieza;\n for (int i = 0; i < jugadores.length; i++) {\n for (int j = 0; j < Ajustes.PIEZAS_MANO; j++) {\n if(todas.getNPiezasMonton()>0){\n pos=(int) (Math.random()*todas.getNPiezasMonton());\n pieza=todas.getUnaPieza(pos);\n jugadores[i].setUnaPieza(pieza);\n todas.eliminarPiezaMonton(pieza); \n }\n \n }\n }\n System.out.println(\"\\nCada jugador tiene \"+jugadores[0].getNPiezas()+\" piezas.\");\n if(todas.getNPiezasMonton()!=0)\n System.out.println(\"Y en el monton quedan \"+todas.getNPiezasMonton());\n else\n System.out.println(\"No quedan piezas en el monton\");\n }", "public boolean PilaVacia() {\r\n return UltimoValorIngresado == null;\r\n }", "public void jugarMaquinaSola(int turno) {\n if (suspenderJuego) {\n return;\n }\n CuadroPieza cuadroActual;\n CuadroPieza cuadroDestino;\n CuadroPieza MovDestino = null;\n CuadroPieza MovActual = null;\n for (int x = 0; x < 8; x++) {\n for (int y = 0; y < 8; y++) {\n cuadroActual = tablero[x][y];\n if (cuadroActual.getPieza() != null) {\n if (cuadroActual.getPieza().getColor() == turno) {\n for (int x1 = 0; x1 < 8; x1++) {\n for (int y1 = 0; y1 < 8; y1++) {\n cuadroDestino = tablero[x1][y1];\n if (cuadroDestino.getPieza() != null) {\n if (cuadroActual.getPieza().validarMovimiento(cuadroDestino, this)) {\n if (MovDestino == null) {\n MovActual = cuadroActual;\n MovDestino = cuadroDestino;\n } else {\n if (cuadroDestino.getPieza().getPeso() > MovDestino.getPieza().getPeso()) {\n MovActual = cuadroActual;\n MovDestino = cuadroDestino;\n }\n if (cuadroDestino.getPieza().getPeso() == MovDestino.getPieza().getPeso()) {\n //Si es el mismo, elijo al azar si moverlo o no\n if (((int) (Math.random() * 3) == 1)) {\n MovActual = cuadroActual;\n MovDestino = cuadroDestino;\n }\n }\n }\n }\n\n }\n }\n }\n }\n }\n }\n }\n if (MovActual == null) {\n boolean b = true;\n do {//Si no hay mov recomendado, entonces genero uno al azar\n int x = (int) (Math.random() * 8);\n int y = (int) (Math.random() * 8);\n tablero[x][y].getPieza();\n int x1 = (int) (Math.random() * 8);\n int y1 = (int) (Math.random() * 8);\n\n MovActual = tablero[x][y];\n MovDestino = tablero[x1][y1];\n if (MovActual.getPieza() != null) {\n if (MovActual.getPieza().getColor() == turno) {\n b = !MovActual.getPieza().validarMovimiento(MovDestino, this);\n //Si mueve la pieza, sale del while.\n }\n }\n } while (b);\n }\n if (MovActual.getPieza().MoverPieza(MovDestino, this)) {\n this.setTurno(this.getTurno() * -1);\n if (getRey(this.getTurno()).isInJacke(this)) {\n if (Pieza.isJugadorAhogado(turno, this)) {\n JOptionPane.showMessageDialog(null, \"Hacke Mate!!! - te lo dije xD\");\n if (JOptionPane.showConfirmDialog(null, \"Deseas Empezar una nueva Partida¿?\", \"Nueva Partida\", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {\n ordenarTablero();\n } else {\n suspenderJuego = true;\n }\n return;\n } else {\n JOptionPane.showMessageDialog(null, \"Rey en Hacke - ya t kgste\");\n }\n } else {\n if (Pieza.isJugadorAhogado(turno, this)) {\n JOptionPane.showMessageDialog(null, \"Empate!!!\\nComputadora: Solo por que te ahogaste...!!!\");\n if (JOptionPane.showConfirmDialog(null, \"Deseas Empezar una nueva Partida¿?\", \"Nueva Partida\", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {\n ordenarTablero();\n } else {\n suspenderJuego = true;\n }\n return;\n }\n if (Pieza.getCantMovimientosSinCambios() >= 50) {\n JOptionPane.showMessageDialog(null, \"Empate!!! \\nComputadora: Vaya, han pasado 50 turnos sin comernos jeje!!!\");\n if (JOptionPane.showConfirmDialog(null, \"Otra Partida Amistosa¿?\", \"Nueva Partida\", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {\n ordenarTablero();\n } else {\n suspenderJuego = true;\n }\n return;\n }\n }\n }\n if (this.getTurno() == turnoComputadora) {\n jugarMaquinaSola(this.getTurno());\n }\n }", "public void pagarFerrovia(int credor, int devedor, int valor, String NomePopriedade) {\n\n Jogador JogadorDevedor = listaJogadores.get(devedor);\n Jogador JogadorCredor = listaJogadores.get(credor);\n if ((NomePopriedade.equals(\"Reading Railroad\")) ||\n (NomePopriedade.equals(\"Pennsylvania Railroad\")) ||\n (NomePopriedade.equals(\"B & O Railroad\")) ||\n (NomePopriedade.equals(\"Short Line Railroad\"))) {\n int quantidadeFerrovias = DonosFerrovias[credor];\n int divida = quantidadeFerrovias * valor;\n this.print(\"Credor tem \" + quantidadeFerrovias);\n this.print(\"Divida eh \" + divida);\n\n if (listaJogadores.get(devedor).getDinheiro() >= divida) {\n JogadorDevedor.retirarDinheiro(divida);\n JogadorCredor.addDinheiro(divida);\n this.print(\"aqui\");\n\n } else {\n int DinheiroRestante = listaJogadores.get(devedor).getDinheiro();\n JogadorDevedor.retirarDinheiro(DinheiroRestante);\n\n if(bankruptcy);\n\n else\n JogadorCredor.addDinheiro(DinheiroRestante);\n this.removePlayer(devedor);\n\n }\n\n }\n }", "public void addAmigo() {\n\t\tusuarioidentificado.enviar_solicitud(Parametros.getIdUsuario(), amigo.getIdUsuario());\n\t}", "public void carroPulando() {\n\t\tpulos++;\n\t\tpulo = (int) (PULO_MAXIMO/10);\n\t\tdistanciaCorrida += pulo;\n\t\tif (distanciaCorrida > distanciaTotalCorrida) {\n\t\t\tdistanciaCorrida = distanciaTotalCorrida;\n\t\t}\n\t}", "public synchronized void abordar() {\n pedidoAbordaje++;\r\n while(!abordar){//Mientras no este habilitado el abordaje espera \r\n try {\r\n wait();\r\n } catch (InterruptedException ex) {\r\n Logger.getLogger(Vuelo.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n }\r\n //Cuando se habilita el abordaje el pasajero se sube\r\n pedidoAbordaje--;\r\n if (pedidoAbordaje == 0){ //Si es el ultimo en subir avisa que puede despegar\r\n notifyAll();\r\n }\r\n }", "@Override\n\tpublic Produto pesquisar(Produto entidade) {\n\t\treturn null;\n\t}", "public boolean PilaVacia()\n {\n if(tope == 0)\n {\n return true;\n }\n else\n {\n return false;\n }\n }", "public void mostrarPersona(){\r\n System.out.println(\"Nombre: \" + persona.getNombre());\r\n System.out.println(\"Cedula: \" + persona.getCedula());\r\n }", "public static void apagarProduto(){\n if(ListaDProduto.size() == 0){\n SaidaDados(\"Nehum produto cadastrado!!\");\n return;\n }\n \n String pesquisarNome = Entrada(\"Informe o nome do produto que deseja deletar: \");\n for(int i =0; i < ListaDProduto.size(); i++){\n \n Produto produtoProcurado = ListaDProduto.get(i);\n \n if(pesquisarNome.equalsIgnoreCase(produtoProcurado.getNome())){\n ListaDProduto.remove(i);\n SaidaDados(\"Produto deletado com sucesso!!\");\n }\n \n }\n \n }", "public void sairdaPrisao(Jogador jogador) {\n print(\"\\tA prisao tinha \" + listaJogadoresNaPrisao);\n listaJogadoresNaPrisao.remove(jogador.getNome());\n\n print(\"\\tmas saiu prisioneiro e prisao agora tem \" + listaJogadoresNaPrisao);\n }", "public void aumentarAciertos() {\r\n this.aciertos += 1;\r\n this.intentos += 1; \r\n }", "private void teletransportar(Personaje p, Celda destino) {\n // TODO implement here\n }", "public void hallarPerimetroEscaleno() {\r\n this.perimetro = this.ladoA+this.ladoB+this.ladoC;\r\n }" ]
[ "0.64418095", "0.6433997", "0.63712066", "0.6360756", "0.6351867", "0.6319188", "0.6287344", "0.6264079", "0.6225655", "0.6219447", "0.61978143", "0.6188394", "0.6178063", "0.61646855", "0.6143667", "0.61253315", "0.6094948", "0.6080231", "0.60747045", "0.60658467", "0.60556096", "0.60516393", "0.6051023", "0.6048785", "0.6029863", "0.6014407", "0.6003765", "0.5997249", "0.5983785", "0.59832007", "0.5975795", "0.59680694", "0.595467", "0.59460074", "0.5945915", "0.59435433", "0.5935602", "0.5931282", "0.591959", "0.59140235", "0.59123087", "0.58839715", "0.5875103", "0.5844802", "0.5834311", "0.5828545", "0.581006", "0.5809717", "0.58053565", "0.57829744", "0.5779613", "0.57641816", "0.5760397", "0.5754417", "0.57526743", "0.574424", "0.57175297", "0.5717016", "0.57164454", "0.5715747", "0.5714059", "0.5713751", "0.569265", "0.5691132", "0.5686984", "0.568321", "0.5681446", "0.5679272", "0.5678448", "0.56637824", "0.56594473", "0.56535715", "0.56463784", "0.5644133", "0.5643392", "0.5639021", "0.56293714", "0.5625574", "0.5623854", "0.56221825", "0.56209475", "0.56172353", "0.5616753", "0.56161904", "0.56135505", "0.5610367", "0.56098604", "0.56097496", "0.560956", "0.5605226", "0.5602878", "0.55946904", "0.55922693", "0.5591086", "0.5590027", "0.5584554", "0.55843484", "0.5570333", "0.5567997", "0.555854", "0.55540377" ]
0.0
-1
Getter de pontos do personagem.
public int getPoints(){ return this.points; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public SystemeAmendesInt.Personne getProprietaire() {\n return proprietaire;\n }", "public List<Propriedade> getPropriedadesDoJogador() {\r\n return propriedadesDoJogador;\r\n }", "public Patient getProprietaire() {\n\t\treturn proprietaire;\n\t}", "public abstract DtPropuesta[] getPropuestasPopulares();", "public int pontuacao() {\n\t\treturn this.pontuacao;\n\t}", "public int getIngresosPorVentas(){\n return this.ingresosPorVentas;\n }", "@Override\r\n\tpublic int getPuntuacion() {\n\t\treturn super.getPuntuacion();\r\n\t}", "public String getRespostaPersonagemX() {\n\t\treturn respostaPersonagem;\n\t}", "public int getPuntos() {\n return puntos;\n }", "public int getPuntos() {\n return puntos;\n }", "public String getPoblacion() {\r\n\t\treturn poblacion;\r\n\t}", "public Pessoa getPessoa() {\r\n\t\treturn pessoa;\r\n\t}", "public String getProperts() {\n\t\t// TODO Auto-generated method stub\n\t\treturn arquivo+\" - \"+tamanho;\n\t}", "@javax.jdo.annotations.Column(allowsNull = \"false\")\n\t@Title(sequence = \"2\")\n\t@MemberOrder(sequence = \"5\")\n\tpublic PuntoInteres getPuntoInteres() {\n\t\treturn this.puntoInteres;\n\t}", "public Punto getCentro() {\r\n\treturn centro;\r\n}", "public java.util.List<viaggi.Pacchetto> getPacchetti();", "public int getPerfil(){\n return this.perfil;\n }", "public int getPodbrojParcele() {\n return podbrojParcele;\n }", "public Puntaje getPuntaje() \r\n {\r\n return puntaje;\r\n }", "public Number getPesocont()\n {\n return (Number)getAttributeInternal(PESOCONT);\n }", "public Person[] getPerson() {\n\t\treturn person;\n\t}", "public ArrayList<ProdottoOrdineBean> getProdotti() {\n\t\t\treturn prodotti;\n\t\t}", "@Override\n public ArrayList<Propiedad> getPrecioAgente(double pMenor, double pMayor, String pId) throws SQLException {\n ArrayList<Propiedad> resultado = new ArrayList<Propiedad>();\n resultado = (ArrayList<Propiedad>) bdPropiedad.selectQuery(\"SELECT * FROM PROPIEDAD WHERE ID_AGENTE = '\" + pId + \"' AND \"\n + \"PRECIO >= \" + pMenor + \" AND PRECIO <= \" + pMayor);\n return resultado;\n }", "public String getPuntoEmision()\r\n/* 124: */ {\r\n/* 125:207 */ return this.puntoEmision;\r\n/* 126: */ }", "@Override\n public java.lang.String getNombre() {\n return _partido.getNombre();\n }", "public int getPrecios()\r\n {\r\n for(int i = 0; i < motos.size(); i++)\r\n {\r\n precio_motos += motos.get(i).getCoste();\r\n }\r\n \r\n return precio_motos;\r\n }", "public P primeiro() {\n\t\treturn this.primeiro;\n\t}", "public int[] puntajes(){\n return partida.puntajes();\n }", "@Override\n\tpublic List<Personne> findAllPErsonne() {\n\t\treturn dao.findAllPErsonne();\n\t}", "public int getProfundidad() {\n return this.profundidad;\n }", "public int getPerdidas(){\n\t\treturn perdidas;\n\t}", "public String getProdotto() {\r\n\t\treturn prodotto;\r\n\t}", "@Column(name = \"C_PUESTO\")\n public String getPuesto() {\n return puesto;\n }", "public ArrayList<String> getNombrePropiedades(){\n ArrayList<String> listaPropiedades = new ArrayList();\n \n for(TituloPropiedad propiedad :propiedades){\n listaPropiedades.add(propiedad.getNombre());\n }\n return listaPropiedades;\n }", "Nodo_B getPrimero(){\n return this.primero;\n }", "private PiattoModulo getModuloPiatto() {\n return (PiattoModulo)Progetto.getModulo(Ristorante.MODULO_PIATTO);\n }", "@Override\r\n\tpublic List<Person> getPeople() {\n\t\tList<Person> personList = new ArrayList<Person>();\r\n\t\tpersonList.add(getPerson(234L));\r\n\t\tpersonList.add(getPerson(123L));\r\n\t\tpersonList.add(getPerson(345L));\r\n\t\tpersonList.add(getPerson(42L));\r\n\t\treturn personList ;\r\n\t}", "public int getProteinsNumber() {\n return proteinsNumber;\n }", "public Person getPerson()\r\n\t{\r\n\t\treturn person;\r\n\t}", "public PuntoDeVenta getPuntoDeVenta()\r\n/* 140: */ {\r\n/* 141:162 */ return this.puntoDeVenta;\r\n/* 142: */ }", "public List<Poubelle> getLesPoubelles() {\r\n\t\treturn lesPoubelles;\r\n\t}", "public String getNumeroPersona() {\n\t\treturn numeroPersona;\n\t}", "public List<BeanPantalla> getPantallas() {\n\t\treturn pantallas;\n\t}", "public String getPersonNum(){\n return personNum;\n }", "public Deplacement getProchainMouvement();", "public List<Prodotto> getListaProdotti() {\n\t\treturn Shop.getInstance().getProdotti();\n\t}", "public ArrayList<Persona> getLProfesorado() {\n return LProfesorado;\n }", "public void mostrarPersona(){\r\n System.out.println(\"Nombre: \" + persona.getNombre());\r\n System.out.println(\"Cedula: \" + persona.getCedula());\r\n }", "public String[] imprimeProfessores() {\n\t\tString[] st = new String[PROFESSORES.size()];\n\n\t\tfor (int i = 0; i < st.length; i++) {\n\n\t\t\tst[i] = PROFESSORES.get(i).getCodProfessor() + \" \" + PROFESSORES.get(i).getNome();\n\t\t}\n\n\t\treturn st;\n\t}", "public TreeMap<Integer, Person> getPersons() {\n return _persons;\n }", "public String getProptel() {\r\n\t\treturn proptel;\r\n\t}", "public double getPeso() {\r\n return peso;\r\n }", "public String getPeso() {\r\n return peso;\r\n }", "@Override\r\n\tpublic String getTipoPersona() {\n\t\treturn \"alumno del curso \" + curso + \" de \" + grupo + \" de \" + tipoEstudios ;\r\n\t\t\r\n\t}", "String getPrimeiroNome();", "Collection<GestionPrecioDTO> findCampaniasPendientes() ;", "public RespostasPendentes getRespostaPendente() {\n return respostaPendente;\n }", "public int getPrecio(){\n return precio;\n }", "public PanelPerfil getPerfil(){\n return perfil;\n }", "@Column(name = \"C_PRIMER_APELLIDO\")\n public String getPrimerApellido() {\n return primerApellido;\n }", "public String getOtherProteins() {\n return otherProteins;\n }", "public List<String> getTiposEmpleados() {\n List<String> tipos = new ArrayList<String>();\n tipos.add(TipoEmpleado.EmpleadoAsalarido.name());\n tipos.add(TipoEmpleado.EmpleadoBaseMasComision.name());\n tipos.add(TipoEmpleado.EmpleadoPorComision.name());\n tipos.add(TipoEmpleado.EmpleadoPorHora.name());\n\n return tipos;\n }", "public abstract DtPropuestaMinificado[] listarPropuestas() throws PropuestaNoExisteException;", "public Perfil getPerfilSesion(){\n return this.perfilSesion;\n }", "public Point getP1(){\n return this.p1;\n }", "public Paciente getPaciente() {\n\t\treturn paciente;\n\t}", "public ReporteProblema getProb() {\n return prob;\n }", "public int getPais() {\n return pais;\n }", "@Override\n public String toString() {\n return \"Person{\" + getId() + \" : \" + getUsername() + \" : \" + getJmeno() + \" \" + getPrijmeni() + '}';\n }", "public java.lang.Double getPorcentaje() {\n return porcentaje;\n }", "public int getOtherPersons() {\n\t\treturn _tempNoTiceShipMessage.getOtherPersons();\n\t}", "public String [ ] getNombresProteinas() {\n int cantidad = 0;\n \n for(int i = 0; i < this.ingredientes.size(); i++) {\n \n if(this.ingredientes.get(i) instanceof Proteina) {\n cantidad++;\n }\n }\n\n String arreglo[] = new String[cantidad];\n \n for(int i = 0; i < cantidad; i ++) {\n arreglo[i] = this.ingredientes.get(i).toString();\n }\n \n return arreglo;\n }", "private String getPais()\n throws Exception,MareException\n\t{\n\t\tLong pais = UtilidadesSession.getPais(this);\n\t\treturn pais.toString();\n\t}", "@SuppressWarnings(\"unchecked\")\n\tpublic com.trascender.framework.recurso.persistent.Persona getPropietario(com.trascender.catastro.recurso.persistent.Parcela pParcela) throws Exception {\n\n\t\tList locListaPropietarios = pParcela.getTituloPropiedad().getListaRegistrosPropietarios();\n\t\t// if ((pParcela != null) && (pParcela.getIdParcela() != -1)) {\n\t\t// locListaPropietarios = Criterio\n\t\t// .getInstance(this.entityManager, RegistroPropietario.class)\n\t\t// .crearAlias(\"tituloPropiedad.parcela\", \"locParcela\")\n\t\t// .add(Restriccion.IGUAL(\"locParcela\", pParcela)).list();\n\t\t// }\n\n\t\tif((locListaPropietarios != null) && (!locListaPropietarios.isEmpty())) {\n\t\t\tRegistroPropietario locRegistroPropietario = (RegistroPropietario) locListaPropietarios.get(0);\n\n\t\t\treturn locRegistroPropietario.getPersona();\n\t\t}\n\n\t\treturn null;\n\n\t}", "@Column(name = \"C_PRIMER_NOMBRE\")\n public String getPrimerNombre() {\n return primerNombre;\n }", "public int getProgeny() {\n return this.progeny;\n }", "@ManyToOne\r\n\t@JoinColumn(name=\"PST_ID\")\r\n\tpublic Puesto getPuesto() {\r\n\t\treturn this.puesto;\r\n\t}", "public ArrayList<Personne> getListPersonne() {\n\t\treturn listPersonne;\n\t}", "public Part getFotoPerfil(){\n return fotoPerfil;\n }", "public Float getPuntuacion( )\n\t{\n\t\treturn puntuacion;\n\t}", "@Override\r\n\tpublic List<PersonneDTO> getAllPersonne() {\n\t\treturn daoPersonne.getAllPersonne();\r\n\t}", "@Override\n public ArrayList<Propiedad> getPropiedadesAgente(String pId) throws SQLException {\n ArrayList<Propiedad> resultado = new ArrayList<Propiedad>();\n resultado = (ArrayList<Propiedad>) bdPropiedad.selectQuery(\"SELECT * FROM PROPIEDAD WHERE ID_AGENTE \"\n + \"= '\" + pId + \"'\");\n return resultado;\n }", "public abstract co\n\t\t.com\n\t\t.telefonica\n\t\t.atiempo\n\t\t.ejb\n\t\t.eb\n\t\t.Estado_ps_peticionLocal getEstado_ps_peticion();", "int getParticipation();", "public int getTipusPartida() {\r\n\t\treturn tipus;\r\n\t}", "public GPerson getPerson() {\r\n\t\treturn person;\r\n\t}", "public abstract java.util.Collection getTecnico_peticion();", "public int getPilotPoints() {\n\n return this.pilotPoints;\n }", "public Pasajero[] getPasajeros() {\r\n\t\t\treturn pasajeros;\r\n\t\t}", "public double getPricePerPerson() {\n return pricePerPerson_;\n }", "public String[] nombres(){\n return partida.nombres();\n }", "@Override\n public ArrayList<Propiedad> getPrecioCliente(double pMenor, double pMayor) throws SQLException {\n ArrayList<Propiedad> resultado = new ArrayList<Propiedad>();\n resultado = (ArrayList<Propiedad>) bdPropiedad.selectQuery(\"SELECT * FROM PROPIEDAD WHERE ESTADO = 'ACTIVO' AND \"\n + \"PRECIO >= \" + pMenor + \" AND PRECIO <= \" + pMayor);\n return resultado;\n }", "public int getPeptidesNumber() {\n return peptidesNumber;\n }", "public Parametro[] getParametros() {\n return parametros;\n }", "public List<Person> getPersonList(){\n return personList;\n }", "public Player getP1() {\n return p1;\n }", "public List<Parcheggio> getListParcheggi() {\n return mListParcheggi;\n }", "public Long getPersonaId();", "public List<PersonEntity> obtenerDatosPersonas() {\n\n\t\ttry {\n\n\t\t\tlog.info(\"Procediendo a obtener el detalle de los clientes\");\n\t\t\tStoredProcedureQuery storedProcedureQuery = entityManager\n\t\t\t\t\t\n\t\t\t\t\t// Definicion\n\t\t\t\t\t.createStoredProcedureQuery(prop.getPROCEDURE_OBTENER_PERSONAS(), PersonEntity.class);\n\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tList<PersonEntity> res = storedProcedureQuery.getResultList();\n\n\t\t\tlog.info(\"Lista consultada exitosamente\");\n\t\t\tlog.info(\"Recorriendo lista de salida...\");\n\t\t\tfor (PersonEntity p : res) {\n\t\t\t\tlog.info(\"Persona : \" + p);\n\t\t\t}\n\n\t\t\treturn res;\n\n\t\t} catch (Exception e) {\n\t\t\tlog.error(\"Error al consultar procedure [\" + prop.getPROCEDURE_OBTENER_PERSONAS() + \"] , Detalle > \" + e.getMessage());\n\t\t}\n\n\t\treturn null;\n\t}", "public String getNomeProfessor()\n\t{\n\t\treturn nomeProfessor;\n\t}", "public String getPrenom() {\r\n return prenom;\r\n }" ]
[ "0.6904533", "0.6786748", "0.66621614", "0.6661818", "0.6637426", "0.6580559", "0.65638155", "0.64813554", "0.6458739", "0.64423734", "0.64062524", "0.63951486", "0.6387938", "0.63854665", "0.6376622", "0.6326372", "0.6320527", "0.6316915", "0.63094616", "0.6300218", "0.6288174", "0.62826025", "0.62689716", "0.624593", "0.6242029", "0.6230191", "0.6214428", "0.61941445", "0.61881375", "0.6185168", "0.6181713", "0.6169506", "0.6150961", "0.6139975", "0.6129106", "0.61288136", "0.6114525", "0.60986763", "0.6089473", "0.608848", "0.60872245", "0.60830456", "0.6080271", "0.6075133", "0.6068003", "0.606712", "0.60606414", "0.60531586", "0.6048354", "0.6035139", "0.6031646", "0.60147077", "0.5993681", "0.5987408", "0.598469", "0.5983623", "0.5983401", "0.59679335", "0.59650904", "0.59649", "0.59646714", "0.5964646", "0.5960267", "0.5957247", "0.59491974", "0.59491175", "0.5946927", "0.5935982", "0.5930054", "0.5925599", "0.59241813", "0.59185636", "0.59116435", "0.5901994", "0.5899896", "0.5898809", "0.58984274", "0.58924717", "0.58923817", "0.58920753", "0.58904296", "0.5885084", "0.58844054", "0.58750623", "0.5871212", "0.58702207", "0.58658206", "0.5858525", "0.58560425", "0.5842595", "0.5841828", "0.58417946", "0.58405536", "0.5839942", "0.5839706", "0.583383", "0.5833326", "0.5823403", "0.58199126", "0.5810902", "0.5810883" ]
0.0
-1
Gerencia o tiro do personagem.
public void isShooting(GameContainer gc) throws LineUnavailableException{ if(gc.getInput().isKeyPressed(Input.KEY_SPACE) || gc.getInput().isKeyPressed(Input.KEY_UP)){ if(!this.bullet.isMoved()){ this.playSound(); animation = this.shooting; this.bullet.position.x = super.getShape().getCenterX(); this.bullet.position.y = super.getShape().getCenterY(); this.getBullet().setMoved(true); return; } } if(this.getBullet().isMoved()){ this.bullet.move(); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tpublic String getTipoPersona() {\n\t\treturn \"alumno del curso \" + curso + \" de \" + grupo + \" de \" + tipoEstudios ;\r\n\t\t\r\n\t}", "void crearNuevaPersona(Persona persona);", "public JogadorTradutor() {\n this.nome= \"Sem Registro\";\n this.pontuacao = pontuacao;\n id = id;\n \n geradorDesafioItaliano = new GerarPalavra(); // primeira palavra ja é gerada para o cliente\n }", "public void crearPersona(){\r\n persona = new Persona();\r\n persona.setNombre(\"Jose\");\r\n persona.setCedula(12345678);\r\n }", "public void damePersonaje(String personaje){\n this.personaje=personaje;\n\n\n\n }", "@Override\n public void buildPersonalidad() {\n this.personaje.setPersonalidad(\"Pacientes y estrategas.\");\n }", "@Override\r\n\tpublic String falar() {\r\n\t\treturn \"[ \"+getNome()+\" ] Sou Um Professor\";\r\n\t}", "public void mostrarPersona(){\r\n System.out.println(\"Nombre: \" + persona.getNombre());\r\n System.out.println(\"Cedula: \" + persona.getCedula());\r\n }", "private void muestraPersona(JSONArray genero) {\n\tJSONArray a = (JSONArray) genero.get(0);\n\t// txtId.setText(Long.toString( (Long) a.get(0)) );\n\t//txtBuscar.setText((String) a.get(1));\n\t// textFecha.setText((String) a.get(2));\n\t// textUsu.setText((String) a.get(4));\n\tcodTemporal = a.get(0).toString();\n\n\thabilita(true, false, false, false, false, true, false, true, true);\n }", "private void reposicionarPersonajes() {\n // TODO implement here\n }", "public Participante() {\n\t\tsuper();\n\t\tthis.nombreCompleto = \"\";\n\t\tthis.dni = \"\";\n\t\tthis.telefono = \"\";\n\t\tthis.fechaDeNacimiento = Date.valueOf(\"1977-11-14\");\n\t\tthis.direccion = \"\";\n\t\tthis.codigoPostal = \"\";\n\t\tthis.municipio = \"\";\n\t\tthis.provincia = \"\";\n\t\tthis.erte = false;\n\t\tthis.situacionLaboral = \"\";\n\t\tthis.situacionAdministrativa = \"\";\n\t\tthis.titulacion = \"\";\n\t\tthis.guardado = false;\n\t}", "@Override\n public String toString() {\n return \"Person{\" + getId() + \" : \" + getUsername() + \" : \" + getJmeno() + \" \" + getPrijmeni() + '}';\n }", "@Override public void realizarCobro(Persona persona){\n\tpersona.cuenta.retiro(120);\n }", "public Persona(){\n /*super(nombresPosibles\n [r.nextInt(nombresPosibles.length)],(byte)r.nextInt(101));\n */\n super(\"Anónimo\",(byte)5);\n String[] nombresPosibles={\"Patracio\",\"Eusequio\",\"Bartolo\",\"Mortadelo\",\"Piorroncho\",\"Tiburcio\"};\n String[] apellidosPosibles={\"Sánchez\",\"López\",\"Martínez\",\"González\",\"Páramos\",\"Jiménez\",\"Parra\"};\n String[] nacionalidadesPosibles={\"Española\",\"Francesa\",\"Alemana\",\"Irlandesa\",\"Japonesa\",\"Congoleña\",\"Bielorrusa\",\"Mauritana\"};\n Random r=new Random();\n this.apellido=apellidosPosibles\n [r.nextInt(apellidosPosibles.length)];\n this.nacionalidad=nacionalidadesPosibles\n [r.nextInt(nacionalidadesPosibles.length)];\n mascota=new Mascota[5];\n this.saldo=r.nextInt(101);\n }", "public Persona() {\n\t\t// TODO Auto-generated constructor stub\n\t}", "public Persona(int idPersona){\n this.idPersona = idPersona;\n }", "public void setProprietaire(SystemeAmendesInt.Personne proprietaire) {\n this.proprietaire = proprietaire;\n }", "public void setEstadoPersona(String p) { this.estadoPersona = p; }", "public Persona() { // constructor sin parámetros\r\n\t\t\r\n\t\tthis.nif = \"44882229Y\";\r\n\t\tthis.nombre=\"Anonimo\";\r\n\t\tthis.sexo = 'F';\r\n\t\tthis.fecha = LocalDate.now();\r\n\t\tthis.altura = 180;\r\n\t\tthis.madre = null;\r\n\t\tthis.padre = null;\r\n\t\tcontador++;\r\n\t}", "@Override\n public String IDTipoHabitacion() {\n // TODO Auto-generated method stub\n return \"Habitacion Privada\";\n }", "private void teletransportar(Personaje p, Celda destino) {\n // TODO implement here\n }", "public Persona()\n\t{\n\t\tnombre = \"--\"; //DEFINES POR DEFAULT LAS VARIABLES;\n\t\tapellido = \"--\"; //DEFINES POR DEFAULT LAS VARIABLES;\n\t\tedad = 0; //DEFINES POR DEFAULT LAS VARIABLES;\n\t\talias = \"--\"; //DEFINES POR DEFAULT LAS VARIABLES;\t\t\n\t}", "private TIPO_REPORTE(String nombre)\r\n/* 55: */ {\r\n/* 56: 58 */ this.nombre = nombre;\r\n/* 57: */ }", "public Persona(String nombre) {\n this.nombre = nombre;\n }", "public Persona(){\n \n }", "public Persona(){\n \n }", "public void setTiempo(String tiempo) {\r\n this.tiempo = tiempo;\r\n }", "public void registrarPersona() {\n\t\ttry {\n\t\t\tif (validaNumDocumento(getNumDocumentPersona())) {\n\t\t\t\t\tif (validaDireccion()) {\n\t\t\t\t\t\tif (validaApellidosNombres()) {\n\t\t\t\t\t\t\tPaPersona persona = new PaPersona();\n\t\t\t\t\t\t\tif (getActualizaPersona() != null && getActualizaPersona().equals(\"N\")) {\n\t\t\t\t\t\t\t\tpersona.setPersonaId(Constante.RESULT_PENDING);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tpersona.setPersonaId(getPersonaId() == null ? Constante.RESULT_PENDING: getPersonaId());\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tpersona.setTipoDocumentoId(Integer.valueOf(mapTipoDocumento.get(getTipoDocumento())));\n\t\t\t\t\t\t\tpersona.setNroDocIdentidad(getNumDocumentPersona());\n\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\tif (persona.getTipoDocumentoId() == Constante.TIPO_DOCUMENTO_RUC_ID) {\n\t\t\t\t\t\t\t\tpersona.setRazonSocial(getRazonSocial());\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tpersona.setPrimerNombre(getPrimerNombre());\n\t\t\t\t\t\t\t\tpersona.setSegundoNombre(getSegundoNombre());\n\t\t\t\t\t\t\t\tpersona.setApePaterno(getApellidoPaterno());\n\t\t\t\t\t\t\t\tpersona.setApeMaterno(getApellidoMaterno());\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tPaDireccion direccion = new PaDireccion();\n\t\t\t\t\t\t\tdireccion.setDireccionId(getDireccionId() == null ? Constante.RESULT_PENDING: getDireccionId());\n\t\t\t\t\t\t\tif (getSelectedOptBusc().intValue() == 1) {\n\t\t\t\t\t\t\t\tdireccion.setTipoViaId(mapGnTipoVia.get(getCmbtipovia().getValue()));\n\t\t\t\t\t\t\t\tdireccion.setViaId(mapGnVia.get(getCmbvia().getValue()));\n\t\t\t\t\t\t\t\tdireccion.setLugarId(null);\n\t\t\t\t\t\t\t\tdireccion.setSectorId(null);\n\t\t\t\t\t\t\t\tdireccion.setNumero(numero);\n\t\t\t\t\t\t\t\tdireccion.setPersonaId(persona.getPersonaId());\n\n\t\t\t\t\t\t\t\tString direccionCompleta = papeletaBo.getDireccionCompleta(direccion,mapIGnTipoVia, mapIGnVia);\n\t\t\t\t\t\t\t\tif (direccionCompleta != null && direccionCompleta.trim().length() > 0) {\n\t\t\t\t\t\t\t\t\tdireccion.setDireccionCompleta(direccionCompleta);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tdireccion.setDireccionCompleta(getDireccionCompleta());\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tBuscarPersonaDTO personaDto = getPersonaDto(persona, direccion);\n\t\t\t\t\t\t\tString personaPapeleta = (String) getSessionMap().get(\"personaPapeleta\");\n\t\t\t\t\t\t\tif (personaPapeleta != null\n\t\t\t\t\t\t\t\t\t&& personaPapeleta.equals(\"I\")) {\n\t\t\t\t\t\t\t\tRegistroPapeletasManaged registro = (RegistroPapeletasManaged) getManaged(\"registroPapeletasManaged\");\n\t\t\t\t\t\t\t\tregistro.setDatosInfractor(personaDto);\n\t\t\t\t\t\t\t} else if (personaPapeleta != null\n\t\t\t\t\t\t\t\t\t&& personaPapeleta.equals(\"P\")) {\n\t\t\t\t\t\t\t\tRegistroPapeletasManaged registro = (RegistroPapeletasManaged) getManaged(\"registroPapeletasManaged\");\n\t\t\t\t\t\t\t\tregistro.setDatosPropietario(personaDto);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlimpiar();\n\t\t\t\t\t\t\tesContribuyente = (Boolean) getSessionMap().get(\"esContribuyente\");\n\t\t\t\t\t\t\tif (esContribuyente == true) {\t\n\t\t\t\t\t\t\t\tWebMessages.messageError(\"Es un Contribeyente s�lo se Actualiz� la Direcci�n para Papeletas, los otros datos es por DJ\");\n\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\tWebMessages\n\t\t\t\t\t\t\t\t\t.messageError(\"Apellidos y nombres no valido\");\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tWebMessages\n\t\t\t\t\t\t\t\t.messageError(\"Especifique la direccion de la persona\");\n\t\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tWebMessages\n\t\t\t\t\t\t.messageError(\"Número de documento de identidad no valido\");\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public static void main(String[] args) {\n\t\t\r\n\tString nombre = leerTexto(\"Ingrese un nombre:\");\r\n\tint edad = leerNumero(\"Ingrese su edad:\");\r\n\tString rut = leerTexto(\"Ingresa el RUT:\");\r\n\tchar genero = leerTexto(\"Ingresa el genero: (M/F/O)\").charAt(0);\r\n\tfloat peso = leerNumero(\"Ingrese peso:\");\r\n\tfloat altura = leerNumero(\"Ingrese la altura:\");\r\n\tPersona claudia = new Persona(nombre, rut, edad, genero, peso, altura);\r\n\t\r\n\tnombre = leerTexto(\"Ingrese un nombre:\");\r\n\tedad = leerNumero(\"Ingrese su edad:\");\r\n\trut = leerTexto(\"Ingresa el RUT:\");\r\n\tgenero = leerTexto(\"Ingresa el genero: (M/F/O)\").charAt(0);\r\n\tPersona juliano = new Persona(nombre, rut, edad, genero);\r\n\t\r\n\tPersona noelia = new Persona();\r\n\tnoelia.setNombre(leerTexto(\"Ingresa un nombre\"));\r\n\tnoelia.setEdad(leerNumero(\"Ingresa la edad\"));\r\n\tnoelia.setRut(leerTexto(\"Ingresa el RUT\"));\r\n\tnoelia.setGenero(leerTexto(\"Ingresa el genero\").charAt(0));\r\n\tnoelia.setAltura(leerNumero(\"Ingresa la altura\"));\r\n\tnoelia.setPeso(leerNumero(\"Ingresa el peso\"));\r\n\t\r\n\tPersona[] perso = new Persona[3];\r\n\tperso[0] = claudia;\r\n\tperso[1] = juliano;\r\n\tperso[2] = noelia;\r\n\t\r\n\tfor (Persona persona : perso) {\r\n\t\tif (persona.calcularIMC()==Persona.PESO_BAJO) {\r\n\t\t\tescribir(\"Pongale sus buenas cazuelas\");\r\n\t\t}else {\r\n\t\t\tif (persona.calcularIMC()==Persona.PESO_IDEAL) {\r\n\t\t\t\tescribir(\"Estamos tiki taka\");\r\n\t\t\t}else {\r\n\t\t\t\tescribir(\"Menos coffe break!\");\r\n\t\t\t}\r\n\t\t}\r\n\t\t//Mayor de edad\r\n\t\tescribir(\"La persona \" + persona.getNombre() + \" es mayor de edad? \" + persona.esMayorDeEdad());\r\n\t\t//Mostrar el toString()\r\n\t\tescribir(persona.toString());\r\n\t }\r\n\t}", "Persona obtenerPersonaPorRut(Integer rut);", "public Persona(int idPersona, String nombre, String apellido, String email, String telefono){\n this.idPersona = idPersona;\n this.nombre = nombre;\n this.apellido = apellido;\n this.email = email;\n this.telefono = telefono;\n \n }", "@Override\n\tpublic void tipoMovimento() {\n\t\tSystem.out.println(super.getNome() + \" anda com 4 patas.\");\n\t}", "public String getPuntoEmision()\r\n/* 124: */ {\r\n/* 125:207 */ return this.puntoEmision;\r\n/* 126: */ }", "@Override\n public void reset() {\n // Crea instancia y define el tipo del personaje.\n this.personaje = new Personaje();\n this.personaje.setTipo(\"Agua\");\n }", "public String getTiempo() {\r\n return tiempo;\r\n }", "@Override\r\n\tpublic void seleccionarPersona() {\n\t\t\r\n\t}", "public PersonaFisica() {}", "private String addPerson()\n {\n String phone = getPhone();\n System.out.println(\"Person tilføjet.\");\n System.out.println(\"\");\n return phone;\n }", "private void seePerso() {\n\t\tfor (int i = 0; i < persoList.size(); i++) {\n\t\t\tPersonnage perso = persoList.get(i);\n\t\t\tSystem.out.println(\"id : \" + i);\n\t\t\tSystem.out.println(perso);\n\t\t}\n\n\t\tSystem.out.println(\"souhaitez vous modifier un personnage ? o/n\");\n\t\tif (sc.nextLine().toLowerCase().contentEquals(\"o\")) {\n\t\t\tSystem.out.println(\"Lequel ? id\");\n\t\t\tint id = sc.nextInt();\n\t\t\tsc.nextLine();\n\t\t\tchangePerso(id);\n\t\t}\n\t}", "public TipoPrestamo() {\n\t\tsuper();\n\t}", "public Encuesta(Persona persona, Distrito distrito){\n ID = IDautogenerado++;\n this.persona = persona;\n this.distrito = distrito;\n }", "@Override\n\tpublic String damePatente() {\n\t\treturn \"TJH 123\";\n\t}", "public Trabajador(String nombre, String puesto) {\n\t\t\n\t\tthis.nombre = nombre;\n\t\tthis.puesto = puesto;\n\t}", "public Long getPersonaId();", "@Override\n\tpublic int getID()\n\t{\n\t\treturn Main.creaPersonaggio;\n\t}", "public void asignarPersona(Jugador j){\r\n this.jugador = j;\r\n }", "public static void main(String[] args) {\n \n PersonaIMC persona1 = new PersonaIMC();\n \n \n /* PersonaIMC persona2 = new PersonaIMC(nombre, edad, sexo);\n PersonaIMC persona3 = new PersonaIMC(nombre, edad, sexo, peso, altura);\n \n persona1.setNombre(\"Luisa\");\n persona1.setEdad(28);\n persona1.setSexo('F');\n persona1.setPeso(60);\n persona1.setAltura(1.8);\n \n persona2.setPeso(80.5);\n persona2.setAltura(1.75);\n \n System.out.println(\"Persona 1\");\n muestraMensajePeso(persona1);\n muestraMayorDeEdad(persona1);\n System.out.println(persona1.toString());\n \n System.out.println(\"Persona 2\");\n muestraMensajePeso(persona2);\n muestraMayorDeEdad(persona2);\n System.out.println(persona2.toString());\n \n System.out.println(\"Persona 3\");\n muestraMensajePeso(persona3);\n muestraMayorDeEdad(persona3);\n System.out.println(persona3.toString());*/\n }", "public Puertas(String via, int iden, int tipo){\r\n this.viaje=via;\r\n this.identi=iden;\r\n this.tipoPriori=tipo;\r\n switch(tipo){\r\n case(1):\r\n this.namePriori=\"Oro\";\r\n break;\r\n case(2):\r\n this.namePriori=\"Platino\";\r\n break;\r\n case(3):\r\n this.namePriori=\"Especial\";\r\n break;\r\n case(4):\r\n this.namePriori=\"Económico\";\r\n break;\r\n default:\r\n this.namePriori=\"\";\r\n break;\r\n } \r\n }", "public String getPersonID(){\n return personID;\n }", "public Persona() {\n \t\n }", "public void primerPunto() {\n\t\tp = new PuntoAltaPrecision(this.xCoord, this.yCoord);\n\t\t// Indicamos la trayectoria por la que va la pelota\n\t\tt = new TrayectoriaRecta(1.7f, p, false);\n\t}", "public int getIdPersona(){\n return idPersona;\n}", "public Puntaje(String nom, int puntaje) {\n this.nombre = nom;\n this.puntos = puntaje;\n }", "public void setOtorgante(java.lang.String otorgante) {\n this.otorgante = otorgante;\n }", "@Override\r\n\tprotected void agregarObjeto() {\r\n\t\t// opcion 1 es agregar nuevo justificativo\r\n\t\tthis.setTitle(\"PROCESOS - PERMISOS INDIVIDUALES (AGREGANDO)\");\r\n\t\tthis.opcion = 1;\r\n\t\tactivarFormulario();\r\n\t\tlimpiarTabla();\r\n\t\tthis.panelBotones.habilitar();\r\n\t}", "public java.lang.String getOtorgante() {\n return otorgante;\n }", "@Override\n\tpublic void tipoComunicacao() {\n\t\tSystem.out.println(super.getNome() + \" se comunica miando.\");\n\t}", "public void construirCargo() {\n persona.setCargo(Cargos.SUPERVISOR);\n }", "public String getTipo(){\r\n return Tipo;\r\n }", "void populateFrom(Person r) {\n // nombre.setText(r.mail1);\n // apellido.setText(r.apellido1);\n usu.setText(r.nom_usuario1);\n // mail.setText(r.mail1);\n }", "public void tocarTelefone() {\n System.out.println(\"Telefone \" + getNumero() + \" está tocando!\");\n notificarTodos();\n }", "public Persona(String nombre, String apellido, String email, String telefono){\n this.nombre = nombre;\n this.apellido = apellido;\n this.email = email;\n this.telefono = telefono;\n }", "public String getTelefonoTI() {\n return this.telefonoTI;\n }", "public String getCreateperson() {\r\n return createperson;\r\n }", "public abstract Anuncio creaAnuncioIndividualizado();", "public PersonType_Tp getPersonType() { return personType; }", "@Override\n\tpublic void emprestimo(Livros livro, Aluno usuario) {\n\t\t\n\t}", "@Override\n\tpublic void estourada(Participante p) {\n\t\t\n\t}", "public Personnage attaqueSurPersonnage() {\n\t\tdouble rand = Math.random();\n\t\t\tif (rand >= 0.85){\n\t\t\t\tfrappeMonstre = monstre.getCaracter().getForce() * 2;\n\t\t\t\tjoueur.setDiminutionPV(frappeMonstre);\n\t\t\t\tsetVictimeKO(joueur);\n\t\t\t\tetatAttaque = 'C';\n\t\t\t\treturn joueur;\n\t\t\t}\n\t\t\telse if ((rand < 0.85) && (rand >= 0.15)){\n\t\t\t\tfrappeMonstre = monstre.getCaracter().getForce();\n\t\t\t\tjoueur.setDiminutionPV(frappeMonstre);\n\t\t\t\tsetVictimeKO(joueur);\n\t\t\t\tetatAttaque = 'N';\n\t\t\t\treturn joueur;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tetatAttaque = 'F';\n\t\t\t\tfrappeMonstre = 0;\n\t\t\t\treturn joueur;\n\t\t\t}\n\t\t}", "public void presenta_Estudiante(){\r\n System.out.println(\"Universidad Técnica Particular de Loja\\nInforme Semestral\\nEstudiante: \"+nombre+\r\n \"\\nAsignatura: \"+nAsignatura+\"\\nNota 1 Bimestre: \"+nota1B+\"\\nNota 2 Bimestre: \"+nota2B+\r\n \"\\nPromedio: \"+promedio()+\"\\nEstado de la Materia: \"+estado());\r\n }", "public void Ordenamiento() {\n\n\t}", "@SuppressWarnings(\"static-access\")\n\tpersonaje(int vida, int ataque, int personajes_creados)\n\t{\n\t\t// estableciendo parametros iguales a las variables\n\t\tthis.vida = vida;\n\t\tthis.ataque = ataque;\n\t\tthis.personajes_creados = personajes_creados;\n\t\t\n\t}", "public void setPersonType(PersonType_Tp type) { this.personType = type; }", "ParqueaderoEntidad agregar(ParqueaderoEntidad parqueadero);", "@Override\r\n\tpublic void create(Person p) \r\n\t{\n\t\t\r\n\t}", "public String getPersonNum(){\n return personNum;\n }", "public void parler() {\n\t System.out.println(this.formulerMonNom()); // appel d'une méthode de l'objet\n\t System.out.println(\"Je suis un animal et j'ai \" + this.nombreDePatte + \" pattes\");\n\t }", "public String getNome () { return this.nome; }", "public Tecnico(){\r\n\t\tthis.matricula = 0;\r\n\t\tthis.nome = \"NULL\";\r\n\t\tthis.email = \"NULL\";\r\n\t\tthis.telefone = \"TELEFONE\";\r\n\t\tlistaDeServicos = new ArrayList<Servico>();\r\n\t}", "public String getRespostaPersonagemX() {\n\t\treturn respostaPersonagem;\n\t}", "public static void main(String args[]){\n int x = 10;\r\n List<Perro> perros = new ArrayList();\r\n \r\n Perro perro=new Perro();\r\n \r\n Persona persona = new Persona();\r\n persona.setAltura(5.5);\r\n persona.setColorPiel(\"Blanca\");\r\n persona.setEdad(16);\r\n persona.setGenero('f');\r\n persona.setNacionalidad(\"Japonesa\");\r\n persona.setPeso(130);\r\n persona.setTipoDePelo(\"Lacio\"); \r\n persona.setOcupacion(\"Dinero\");\r\n \r\n //Se dan todas las características\r\n perro.setNombre(\"Manuel\");\r\n perro.setColor(\"Negro\");\r\n perro.setTamano(10.2);\r\n perro.setRaza(\"Golden\");\r\n perro.setTipoDePelo(\"Crespo\");\r\n perro.setAdoptado(false);\r\n perro.setGenero('H');\r\n \r\n perros.add(perro);//Se añade a la instancia\r\n \r\n perro = new Perro();//Se limpia y se vuelve a llamar la instancia\r\n perro.setNombre(\"Igor\");\r\n perro.setColor(\"Negro\");\r\n perro.setTamano(10.2);\r\n perro.setRaza(\"Golden\");\r\n perro.setTipoDePelo(\"Lacio\");\r\n perro.setAdoptado(false);\r\n perro.setGenero('H');\r\n \r\n perros.add(perro);\r\n \r\n perro = new Perro();\r\n perro.setNombre(\"Luli\");\r\n perro.setColor(\"Negro\");\r\n perro.setTamano(10.2);\r\n perro.setRaza(\"Siberiano\");\r\n perro.setTipoDePelo(\"Crespo\");\r\n perro.setAdoptado(false);\r\n perro.setGenero('H');\r\n \r\n perros.add(perro);\r\n //****************CUANDO EJECUTES ESTO VE COMENTADO LOS BLOQUES QUE NO QUIERES QUE SE USEN*************\r\n //foreach y for hace la misma funcion\r\n //Uso de for\r\n for (Perro perro1:perros){\r\n System.out.println(perro1.getNombre());\r\n System.out.println(perro1.getColor());\r\n System.out.println(perro1.getTamano());\r\n System.out.println(perro1.getRaza());\r\n System.out.println(perro1.getTipoDePelo());\r\n }\r\n \r\n //Formas de uso del for each\r\n perros.forEach(perro1->\r\n System.out.println(perro1.getNombre()));\r\n \r\n perros.forEach(perro1 ->{//Se define una variable que es perro1 y esta recorrera toda la lista\r\n System.out.println(perro1.getNombre());\r\n System.out.println(perro1.getColor());\r\n System.out.println(perro1.getTamano());\r\n System.out.println(perro1.getRaza());\r\n System.out.println(perro1.getTipoDePelo()); \r\n System.out.println();\r\n \r\n });\r\n \r\n \r\n System.out.println(\"Blanco\".equals(perro.color)? \"Si es blanco\":\"No es blanco\");\r\n \r\n //Uso del if\r\n if (((4/2==0)&&(10/5 !=0))||(100/20==0)){\r\n System.out.println(\"Es bisiesto\");\r\n }else{\r\n System.out.println(\"No es bisiesto\");\r\n }\r\n \r\n //Uso del switcH\r\n switch(x){\r\n case 6:\r\n System.out.println(\"Es verdadero\");\r\n break;\r\n case 2:\r\n System.out.println(\"Es falso\");\r\n break;\r\n default:\r\n System.out.println(\"No es ninguna\");\r\n \r\n //Uso de la lista de un item en especifico \r\n System.out.println(\"Nombre: \" + perros.get(2).getNombre());//El número del get\r\n System.out.println(\"Color: \"+perros.get(2).getColor());//define que item es que tomará\r\n System.out.println(\"Raza: \"+perros.get(2).getRaza());\r\n \r\n \r\n //Demostración del uso de getters\r\n System.out.println(\"Nombre: \");\r\n System.out.println(\"Altura: \" + persona.getAltura());\r\n System.out.println(\"Color: \" + persona.getColorPiel());\r\n System.out.println(\"Edad: \"+persona.getEdad());\r\n System.out.println(\"Genero: \"+persona.getGenero());\r\n System.out.println(\"Nacionalidad: \"+persona.getNacionalidad());\r\n System.out.println(\"Peso: \"+persona.getPeso());\r\n System.out.println(\"Tipo de Pelo: \"+persona.getTipoDePelo());\r\n \r\n }\r\n \r\n}", "public void setNombreTI(String nombreTI) {\n this.nombreTI = nombreTI;\n }", "public ServicioPersona() throws CustomErrorException {\n\t\ttry {\n\t\t\tgPersona = new GestorPersona();\n\t\t\tgDireccion = new GestorDireccion();\n\t\t\tgTelefono = new GestorTelefono();\n\t\t\tgCorreoElectronico = new GestorCorreoElectronico();\n\t\t}catch (CustomErrorException cer) {\n\t\t\tthrow cer;\n\t\t}catch (Exception e) {\n\t\t\tthrow new CustomErrorException(CustomErrorException.ERROR_SERVICIO,this.getClass().getSimpleName(),e.getStackTrace());\n\t\t}\n\t}", "@Override\n\tpublic void emprestimo(Livros livro, Usuarios usuario) {\n\t\t\n\t}", "public PantallaPersonal(GeoWallStart game) {\n\t\t\tsuper(game);\n\t\t\tuser= new Usuario();\n\t\t\n\t}", "public String getNome(){\r\n return this.nome;\r\n }", "public SystemeAmendesInt.Personne getProprietaire() {\n return proprietaire;\n }", "@Override\r\n public void mostrarProfesores(){\n for(Persona i: listaPersona){\r\n if(i instanceof Profesor){\r\n i.mostrar();\r\n }\r\n }\r\n }", "public PersonaBean() {\n domicilio = new Domicilio();\n telefono = new Telefono();\n correoElectronico = new CorreoElectronico();\n persona = new Persona();\n this.tipoOperacion = \"Alta\";\n\n }", "public void setTelefono(String telefono) {\r\n\tthis.telefono = telefono;\r\n}", "public Personaje(Juego juego,Celda c) {\r\n\t\tsuper(juego,c);\r\n\t}", "public String getPassageiro2() {\r\n\r\n if (passageiro == null) {\r\n return \"Poltrona Vazia\";\r\n } else {\r\n return passageiro.getNome();\r\n }\r\n }", "public void estiloAcierto() {\r\n\t\t /**Bea y Jose**/\t\t\r\n \r\n\t}", "public Punto getCentro() {\r\n\treturn centro;\r\n}", "public String getDepartamentoTI() {\n return this.departamentoTI;\n }", "public TipoUsuario(int id_tipousuario) {\n this.id_tipousuario = id_tipousuario;\n }", "@Override\r\n\tpublic void crearVehiculo() {\n\t\t\r\n\t}", "@Override\n public String descripcion() {\n return \"Viaje incentivo que te envia la empresa \" + empresa;\n }", "@Override\n\t\t\tpublic String toString() {\n\t\t\t\treturn nome;\n\t\t\t}", "public String getNome(){\n return this.nome;\n }", "@Override//sobrescribir metodo\n public String getDescripcion(){\n return hamburguesa.getDescripcion()+\" + lechuga\";//retorna descripcion del oobj hamburguesa y le agrega +lechuga\n }" ]
[ "0.72368324", "0.6812848", "0.66806346", "0.6624993", "0.65794855", "0.6513436", "0.6459159", "0.64345896", "0.643047", "0.6333398", "0.6304873", "0.62943757", "0.6215135", "0.62107754", "0.61841035", "0.6141409", "0.613129", "0.610901", "0.6106043", "0.6083094", "0.6060553", "0.60570043", "0.60559005", "0.604998", "0.6042685", "0.6042685", "0.60217255", "0.59947836", "0.59924436", "0.5982529", "0.5963571", "0.5958178", "0.5948361", "0.59400034", "0.5936714", "0.592686", "0.5922414", "0.58811826", "0.58727914", "0.58693033", "0.58676726", "0.5866319", "0.585781", "0.5857598", "0.58561605", "0.58508474", "0.58499306", "0.58484775", "0.5840761", "0.58404", "0.58342093", "0.58282155", "0.5828016", "0.5820859", "0.5819296", "0.5816048", "0.5800909", "0.5797525", "0.5783309", "0.57786155", "0.57772344", "0.5773412", "0.5773029", "0.5772629", "0.577193", "0.5767825", "0.57674986", "0.57658553", "0.5763335", "0.5757737", "0.5753156", "0.5751697", "0.5750913", "0.5750571", "0.5748452", "0.57470304", "0.5746892", "0.574672", "0.5742829", "0.5741761", "0.5740965", "0.57403976", "0.5735827", "0.57332534", "0.5719964", "0.5718692", "0.57087964", "0.57067204", "0.5705475", "0.5705274", "0.57026875", "0.5702186", "0.57003975", "0.57003295", "0.56996495", "0.5695663", "0.5691037", "0.56883675", "0.5686251", "0.56847113", "0.5681537" ]
0.0
-1
Tells whether the the user is Authorized or not
public boolean isAuthorized(){ return authorized; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean getIsAuthorized();", "private boolean isAuthorized() {\n return true;\n }", "public Boolean isAuthorized(String userId);", "public boolean getAuthorisedUser() {\n return authorisedUser;\n }", "public boolean isAuthorized() {\n return authorized;\n }", "public boolean isAuthorized() {\n return isAuthorized;\n }", "boolean isAuthenticated();", "public boolean isAuthorized() {\r\n // TODO - implement User.isAuthorized\r\n throw new UnsupportedOperationException();\r\n }", "public static boolean authorize(User user) {\n\t\t\n\t\treturn true;\n\t}", "boolean hasAuth();", "private Boolean authorize() {\n\n return Session.getInstance().login(user.getText(), password.getText());\n }", "public boolean isUserLoggedIn();", "public boolean isAuthenticated() {\r\n\t\treturn user != null;\r\n\t}", "@Test\n public void authorisedTest() {\n assertTrue(authResponse.isAuthorised());\n }", "boolean authNeeded();", "public boolean isAuthenticated() {\n \t\treturn authenticated;\n \t}", "boolean hasCustomerUserAccess();", "public boolean isAuthorised(SessionObjectDTO sessionDTO) {\n\t\ttry {\n\t\t\tIUserService service = (IUserService) BusinessServiceLocator.locate(IUserService.class);\n\t\t\tsessionDTO = (SessionObjectDTO) session.get(\"sessionDTO\");\n\t\t\tservice.getAuthorisations(userDetailsDTO, sessionDTO.getRoleId());\n\t\t\tservice.getAuthorisedPagesForUser(sessionDTO.getRoleId(), sessionDTO.getUserId(), userDetailsDTO);\n\t \tif(userDetailsDTO.getAuthorisedPagesList() != null && userDetailsDTO.getAuthorisedPagesList().contains((LinMobileConstants.APP_VIEWS[2]).split(LinMobileConstants.ARRAY_SPLITTER)[1].trim())) {\n\t \t\tsessionDTO.setPageName((LinMobileConstants.APP_VIEWS[2]).split(LinMobileConstants.ARRAY_SPLITTER)[1].trim());\n\t \t\treturn true;\n\t \t}\n\t \t}\n\t\tcatch (Exception e) {\n\t\t\t\n\t\t\tlog.severe(\"Exception in execution of isAuthorised : \" + e.getMessage());\n\t\t}\n\t\treturn false;\n\t}", "public void doAuthorize() {\n authorizeBehavior.authorizd();\n }", "public void setAuthorized(boolean value) {\n this.authorized = value;\n }", "boolean isSignedIn();", "@Override\n public boolean isAuthenticated() {\n return !person.isGuest();\n }", "public boolean authorize(String username, String principal) {\n return getAuthorized(username).contains(principal);\n }", "private boolean isAuthenticated(final ContainerRequestContext requestContext) {\n // Return true if the user is authenticated or false otherwise\n return requestContext.getSecurityContext().getUserPrincipal() != null;\n }", "private void authorize() {\r\n\r\n\t}", "private void userIsAuthenticated() {\n this.setResult(RC_USER_LOGGED_IN, null);\n this.finish();\n }", "default T calendarAccessAuthorized() {\n return amend(CALENDAR_ACCESS_AUTHORIZED_OPTION, true);\n }", "private boolean isUserExplicitlyLoggedIn() {\n // User is explicitly logged in, if his securityStatus is more than or equal to security status login.\n String securityStatusPropertyName = getStorePropertyManager().getSecurityStatusPropertyName();\n int securityStatus = ((Integer) getProfile().getPropertyValue(securityStatusPropertyName)).intValue();\n return securityStatus >= getStorePropertyManager().getSecurityStatusLogin();\n }", "@Override\n\tpublic boolean isAuthenticated() {\n\t\treturn isAuthenticated;\n\t}", "private static Boolean isAuthorised(Page page, List<GrantedAuthority> userAuthorities ) {\n if ( page.getAllowedRoles().size() == 0 ) {\n return true;\n }\n \n for ( GrantedAuthority role : userAuthorities ) {\n for ( String requiredRole : page.getAllowedRoles() ) {\n if ( role.getAuthority().equals(requiredRole) ) {\n return true;\n }\n }\n }\n return false;\n }", "boolean isAuthorized(SiteUser user, Long transmissionId);", "boolean hasLoggedIn();", "public String getAUTHORIZED_BY() {\r\n return AUTHORIZED_BY;\r\n }", "public String getAUTHORIZED_BY() {\r\n return AUTHORIZED_BY;\r\n }", "public boolean granted(){\n\t\treturn this.granted;\n\t}", "private void checkUserAuthorities() {\n\t\tAuthority auth = authorityRepository.findTop1ByName(AuthorityType.ROLE_ADMIN);\n\t\tif (null == auth) {\n\t\t\tauth = Authority.createAdmin();\n\t\t\tauthorityRepository.save(auth);\n\t\t}\n\t\tAuthority authUser = authorityRepository.findTop1ByName(AuthorityType.ROLE_USER);\n\t\tif (null == authUser) {\n\t\t\tauthUser = Authority.createUser();\n\t\t\tauthorityRepository.save(authUser);\n\t\t}\n\t}", "void setAnAuthorized(int userAuth, int acctAuth) {\n\t\tthis.isAnAuth = userAuth == 1 || acctAuth == 1;\n\t}", "@Override\n protected boolean isAuthorized(PipelineData pipelineData) throws Exception\n {\n \t// use data.getACL() \n \treturn true;\n }", "private boolean isLoggedInUser(){\n return true;\n }", "@Override\n\tpublic boolean checkAuthorization(HttpServletRequest request) {\n\t\treturn true;\n\t}", "public boolean isUserAuthenticated() {\n SharedPreferences settings = mContext.getSharedPreferences(\"UserData\", Context.MODE_PRIVATE);\n if(settings!=null){\n String user=settings.getString(\"userid\",null);\n String area=settings.getString(\"areaid\",null);\n if (user != null && !user.equals(\"\")) {\n mUserId=user;\n mAreaId=area;\n return true;\n }\n else{\n return false;\n }\n }\n else{\n return false;\n }\n }", "public boolean isAuthorized(Priviliges priviliges) {\n return priviliges.equals(this.priviliges);\n }", "public String getAuthorizationStatus(){\n\t\treturn accessToken;\n\t}", "public void assignAuthorisedUser(final boolean val) {\n authorisedUser = val;\n }", "public boolean isAuthenticated() {\r\n return SecurityContextHolder.getContext().getAuthentication() != null;\r\n }", "boolean hasPrincipal();", "public boolean isAuthRequired() {\n return !AfUtil.anyEmpty(_username);\n }", "default Optional<Boolean> doesCalendarAccessAuthorized() {\n return Optional.ofNullable(toSafeBoolean(getCapability(CALENDAR_ACCESS_AUTHORIZED_OPTION)));\n }", "public boolean checkAuth() {\n SharedPreferences sharedPreferences = getSharedPreferences(SHARED_PREFS, MODE_PRIVATE);\n return sharedPreferences.getBoolean(AUTH, false);\n }", "@JsonProperty(\"granted\")\n public boolean isGranted() {\n return granted;\n }", "public boolean isSetIsauthenticated() {\n return __isset_bit_vector.get(__ISAUTHENTICATED_ISSET_ID);\n }", "@XmlTransient\n\tpublic boolean isCanActivateUser() {\n\t\treturn (isSecurityAdministrator() && isSelfRegistrationEnabled());\n\t}", "public boolean isAuthRequired() {\n\t\treturn false;\n\t}", "public boolean isUserApproval() {\n\n if (!ACTION_UserChoice.equals(getAction())) {\n return false;\n }\n\n return (getColumn() != null) && \"IsApproved\".equals(getColumn().getColumnName());\n\n }", "public boolean isToolsAuthorized() {\n\t\treturn isFdAuth || isGaAuth || isPeAuth;\n\t}", "public static boolean isAuthenticated() {\n SecurityContext securityContext = SecurityContextHolder.getContext();\n Authentication authentication = securityContext.getAuthentication();\n if (authentication != null) {\n return authentication.getAuthorities().stream()\n .noneMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(Authorities.ANONYMOUS));\n }\n return false;\n }", "@Override\n\tpublic boolean isCommandAuthorized(){\n\t\treturn true;\n\t}", "private static boolean isAuthorized(\n @Nonnull Authorizer authorizer,\n @Nonnull String actor,\n @Nonnull ConjunctivePrivilegeGroup requiredPrivileges,\n @Nonnull Optional<ResourceSpec> resourceSpec) {\n for (final String privilege : requiredPrivileges.getRequiredPrivileges()) {\n // Create and evaluate an Authorization request.\n final AuthorizationRequest request = new AuthorizationRequest(actor, privilege, resourceSpec);\n final AuthorizationResult result = authorizer.authorize(request);\n if (AuthorizationResult.Type.DENY.equals(result.getType())) {\n // Short circuit.\n return false;\n }\n }\n return true;\n }", "public boolean isLoggedIn()\n {\n AccessToken accessToken = AccessToken.getCurrentAccessToken();\n return (accessToken != null);\n }", "private void checkIfUserIsAuthenticated() {\n splashViewModel.checkIfUserIsAuthenticated();\n splashViewModel.getIsUserAuthenticated().observe(this, user -> {\n if (!user.isAuthenticated()) {\n startAuthActivity();\n finish();\n } else {\n getUserFromDatabase(user.getUid());\n }\n });\n }", "public boolean isAuthenticated() {\n return false;\n }", "boolean isSecureAccess();", "@GET\n @Path(\"LoggedIn\")\n public boolean isLoggedIn() {\n return SecurityUtils.getSubject().isRemembered() || SecurityUtils.getSubject().isAuthenticated();\n }", "public void isAllowed(String user) {\n \r\n }", "public boolean canPrincipalManage(IAuthorizationPrincipal principal, PortletLifecycleState state, String categoryId)\n throws AuthorizationException;", "default T setCalendarAccessAuthorized(boolean value) {\n return amend(CALENDAR_ACCESS_AUTHORIZED_OPTION, value);\n }", "public abstract boolean isLoggedIn();", "public boolean auth() throws IOException {\r\n \treturn auth(false);\r\n }", "@Override\n public boolean isPermitted(HttpServletRequest request, int permittedRole) {\n boolean result = false;\n HttpSession session = request.getSession();\n String userName = (String) session.getAttribute(\"userName\");\n String token = (String) session.getAttribute(\"token\");\n int role = Integer.parseInt((String) session.getAttribute(\"role\"));\n if (userName != null && token != null) {\n CrUser user = userRepo.findByUserName(userName);\n if (user != null && isTokenValid(user, token) && role == permittedRole) {\n result = true;\n }\n }\n return result;\n }", "public boolean isCustomerLoggedIn()\r\n {\r\n return customerLoggedIn;\r\n }", "@Override\n public User getUserInfo() {\n return User.AUTHORIZED_USER;\n }", "boolean hasQueryAuthorizations();", "public static boolean isAuthenticated() {\n\t\treturn ((activeAccount != null) && (activeAccount.password != null));\n\t}", "public boolean isLoggedIn() {\n AccessToken accessToken = AccessToken.getCurrentAccessToken();\n if (accessToken == null) {\n return false;\n }\n return !accessToken.isExpired();\n }", "public boolean checkIfLoggedIn() \n {\n if(this.getLoggedUser() != null)\n {\n return true;\n }\n return false;\n }", "@Override\n public boolean hasAccessPermission(String user, NamespaceKey key, DatasetConfig datasetConfig) {\n return userPredicate.test(user);\n }", "public void checkAuthority() {\n }", "public Boolean isAuthorizedForDataset() {\n return (attributes.containsKey(KEY_IS_AUTHORIZED_FOR_DS) ? (Boolean) attributes\n .get(KEY_IS_AUTHORIZED_FOR_DS) : null);\n }", "public abstract boolean checkPolicy(User user);", "@Override\n public boolean hasAccess(User user) {\n return user.hasRole(RoleValue.APP_ADMIN) || this.equals(user.company);\n }", "boolean hasCustomerUserAccessInvitation();", "boolean hasUser();", "boolean hasUser();", "boolean hasUser();", "boolean hasUser();", "boolean hasUser();", "boolean hasUser();", "boolean hasUser();", "public boolean checkLoggedIn() {\n FirebaseUser user = firebaseAuth.getCurrentUser();\n\n if(user != null) {\n return user.isEmailVerified();\n }\n\n return false;\n }", "public static boolean isUserAuthorized(DSUser user) {\n\t\tDSUsers dsUsers = getUsersFromFile();\n\t\treturn (existedUser(dsUsers, user) != null && passwordCorrect(dsUsers,\n\t\t\t\tuser));\n\t}", "@Override\n\tpublic boolean isUserLoggedIn() {\n\t\treturn sessionService.getCurrentUserId() != null;\n\t}", "public boolean isLoggedIn() {\n return mAuth.getCurrentUser() != null;\n }", "@Test\n\tpublic void testIsPermitted_1()\n\t\tthrows Exception {\n\t\tSimpleAuthorizingAccount fixture = new SimpleAuthorizingAccount();\n\t\tfixture.setSimpleRoles(new HashSet());\n\t\tList<Permission> permissions = null;\n\n\t\tboolean[] result = fixture.isPermitted(permissions);\n\n\t\t// add additional test code here\n\t\tassertNotNull(result);\n\t}", "@GetMapping(\"/authenticate\")\n @Timed\n public String isAuthenticated(HttpServletRequest request) {\n log.debug(\"REST request to check if the current user is authenticated\");\n return request.getRemoteUser();\n }", "public boolean isUserSignedIn(){\n mFirebaseAuth = FirebaseAuth.getInstance();\n mFirebaseUser = mFirebaseAuth.getCurrentUser();\n if (mFirebaseUser == null) { return false;}\n else return true;\n }", "protected boolean isLoggedIn() {\n FirebaseUser currentUser = mAuth.getCurrentUser();\n return currentUser != null && prefs.isVerified();\n }", "public boolean isLoggedIn()\n {\n return this.isLoggedIn;\n }", "private void checkAuthorization(RoutingContext context, List<CaptureMap> resolvedCaptureCollections,\n Handler<AsyncResult<Boolean>> handler) {\n AuthHandler auth = context.get(AuthenticationController.AUTH_HANDLER_PROP);\n if (auth != null && auth instanceof RedirectAuthHandlerBt) {\n MemberUtil.getCurrentUser(context, getNetRelay(), result -> {\n if (result.failed()) {\n handler.handle(Future.failedFuture(result.cause()));\n } else {\n IAuthenticatable member = result.result();\n if (member == null) {\n // this is an error\n handler.handle(Future.failedFuture(\n new IllegalArgumentException(\"This should not happen, we need an instance of IAuthenticatable here\")));\n } else {\n checkAuthorization(resolvedCaptureCollections, auth, member, handler);\n }\n }\n });\n } else {\n handler.handle(Future.succeededFuture(true));\n }\n }", "boolean hasUserManaged();", "public Boolean isLoggedIn() {\n return this.loggedIn;\n }" ]
[ "0.77592754", "0.7751337", "0.76383984", "0.7506", "0.75051755", "0.7407797", "0.7128761", "0.7112434", "0.7054827", "0.69424367", "0.68881834", "0.6758398", "0.67485046", "0.6703518", "0.66991055", "0.6622541", "0.6596706", "0.65945315", "0.6592952", "0.6528163", "0.65220624", "0.64989704", "0.64871895", "0.64687794", "0.6436957", "0.643475", "0.6367341", "0.63637567", "0.63536906", "0.63426876", "0.6328709", "0.63248175", "0.6322087", "0.6322087", "0.6306309", "0.62777793", "0.62764263", "0.6275226", "0.6272318", "0.6247956", "0.6232926", "0.6232451", "0.61841303", "0.6170567", "0.6146862", "0.6132408", "0.61160344", "0.61123073", "0.61079466", "0.6101492", "0.6085049", "0.6073622", "0.60644364", "0.60634875", "0.6059265", "0.6049516", "0.60356057", "0.6032127", "0.6022496", "0.60173666", "0.6015138", "0.6014989", "0.6011502", "0.6006827", "0.6000717", "0.59606373", "0.5960015", "0.59597796", "0.5953474", "0.5952757", "0.59330696", "0.59310395", "0.59250784", "0.59247357", "0.5921808", "0.5888662", "0.5886388", "0.5876214", "0.586889", "0.58661354", "0.58657277", "0.5838192", "0.5838192", "0.5838192", "0.5838192", "0.5838192", "0.5838192", "0.5838192", "0.583641", "0.5824105", "0.58139664", "0.5800749", "0.5787774", "0.57857853", "0.57841504", "0.5781528", "0.5781278", "0.57681113", "0.576283", "0.575944" ]
0.7667757
2
Gets the Cookies if the User is Authorized, else throws exception
public String[] getCookies() throws GGException{ if(!authorized){ throw new GGException(GGErrorCodes.GG_UNABLE_TO_AUTH); } return cookies; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Cookie[] getCookies();", "public abstract Cookie[] getResponseCookies();", "public Collection<Cookie> getCookies()\n\t{\n\t\tparseCookiesIfNecessary();\n\t\tif (this.cookies != null)\n\t\t\treturn this.cookies.values();\n\t\telse\n\t\t\treturn null;\n\t}", "private void authorize(){\n\t\t\n\t\tURL authURL = null;\n\t\tURL homeURL = null;\n\t\tURLConnection homeCon = null;\n\t\t\n\t\tString loginPage = GG.GG_LOGIN+\"?ACCOUNT=\"+GG.GG_UID\n\t\t\t+\"&PASSWORD=\"+GG.GG_PASS;\n\t\tString cookieString = \"\";\n\t\tString cookieString1 = \"\";\n\t\t\n\t\ttry{\n\t\t\thomeURL = new URL(GG.GG_HOME);\n\t\t\thomeCon = homeURL.openConnection();\n\t\t\t\n\t\t\t// Look At the headers\n\t\t\tMap headerMap = homeCon.getHeaderFields();\n\t\t\t\n\t\t\t// Look for the Cookie\n\t\t\tif(headerMap.containsKey(\"Set-Cookie\")){\n\t\t\t\t\n\t\t\t\t// this gets the exact value of the header\n\t\t\t\t// otherwise gets some formatted string\n\t\t\t\tcookieString = homeCon.getHeaderField(\"Set-Cookie\");\n\t\t\t\t//log.finest(\"cookie1: \"+cookieString);\n\t\t\t\t\n\t\t\t\tauthURL = new URL(loginPage);\n\t\t\t\tHttpURLConnection.setFollowRedirects(false);\n\t\t\t\tHttpURLConnection loginCon = (HttpURLConnection) authURL.openConnection();\n\t\t\t\t\n\t\t\t\t// doOutput must be set before connecting\n\t\t\t\tloginCon.setAllowUserInteraction(true);\n\t\t\t\tloginCon.setUseCaches(false);\n\t\t\t\tloginCon.setDoOutput(true);\n\t\t\t\tloginCon.setRequestProperty(\"Cookie\", cookieString);\n\t\t\t\tloginCon.connect();\n\t\t\t\t\n\t\t\t\t// Look At the headers\n\t\t\t\tMap headerMap1 = loginCon.getHeaderFields();\n\t\t\t\t\n\t\t\t\tcookieString1 = loginCon.getHeaderField(\"Set-Cookie\");\n\t\t\t\t//log.finest(\"cookie2: \"+cookieString1);\n\t\t\t\tif(!Pattern.matches(\".*\\\\.\"+GG.GG_UID+\"\\\\.\\\\d+.*\", cookieString1)){\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tString location = loginCon.getHeaderField(\"Location\");\n\t\t\t\tURL gotURL = new URL(location);\n\t\t\t\tHttpURLConnection gotCon = (HttpURLConnection) gotURL.openConnection();\n\t\t\t\t// doOutput must be set before connecting\n\t\t\t\tgotCon.setAllowUserInteraction(true);\n\t\t\t\tgotCon.setUseCaches(false);\n\t\t\t\tgotCon.setDoOutput(true);\n\t\t\t\tgotCon.setRequestProperty(\"Cookie\", cookieString);\n\t\t\t\tgotCon.setRequestProperty(\"Cookie\", cookieString1);\n\t\t\t\t\n\t\t\t\tgotCon.connect();\n\t\t\t\t\n\t\t\t\t// Got the Cookies\n\t\t\t\tcookies[0] = cookieString;\n\t\t\t\tcookies[1] = cookieString1;\n\t\t\t\t\n\t\t\t}else{\n\t\t\t\tlog.info(\"Unable to find the Cookie\");\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}\t\t\n\t\tauthorized = true;\n\t}", "public Cookie[] getCookieObjects() {\n\t\tCookie[] result = request.getCookies();\n\t\treturn result != null ? result : new Cookie[0];\n\t}", "private static Cookie getCookie() {\n if (cookie == null) {\n synchronized (DefaultEntityManagerImpl.class) {\n if (cookie == null) {\n cookie = new Cookie(cookieName, getAppTokenId());\n }\n }\n }\n return cookie;\n }", "public List<Cookie> getCookies() {\n return cookies == null ? Collections.EMPTY_LIST : cookies;\n }", "@Override\n\t\tpublic Cookie[] getCookies() {\n\t\t\treturn null;\n\t\t}", "public Map<String, String> getCookies() {\r\n return _cookies;\r\n }", "public static Series<Cookie> getResourceCookies() {\n return getRequest() == null ? null : getRequest().getCookies();\n }", "public Cookies cookies() {\n return new Cookies() {\n @Override\n public Optional<Cookie> get(String name) {\n return cookies.stream().filter(c -> c.name().equals(name)).findFirst();\n }\n\n @Override\n public Iterator<Cookie> iterator() {\n return cookies.iterator();\n }\n };\n }", "@Override\r\n public void getAllCookies()\r\n {\n\r\n }", "String getCookie(HttpServletRequest request, String name) throws ValidationException;", "public boolean isSetCookies() {\n return this.cookies != null;\n }", "public void checkAddAuthCookies(DnCxt cxt, DnRequestHandler handler) throws DnException {\n UserAuthHook.prepAuthCookies.callHook(cxt, this, handler);\n if (handler.setAuthCookie && handler.userAuthCookie != null) {\n var authCookie = handler.userAuthCookie;\n String cookieString = authCookie.toString();\n String cookieVal = coreNode.encryptString(cookieString);\n // Let old cookies hang out for 400 days, even if the cookie only provides a login\n // for day or so.\n Date cookieExpireDate = DnDateUtil.addDays(authCookie.modifiedDate, 400);\n handler.addResponseCookie(AUTH_COOKIE_NAME, cookieVal, cookieExpireDate);\n }\n }", "private boolean validateAccess(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{\r\n\t\t/*institutionalEmail=request.getParameter(\"institutional_email\");\r\n\t\t\t\t\tpassword=request.getParameter(\"password\");*/\r\n\r\n\t\t//check if user has cookies with a logged session\r\n\t\tif(institutionalEmail==null || password==null){\r\n\t\t\tusercookie=getCookie(request,\"institutional_email\");\r\n\t\t\tpasscookie=getCookie(request,\"password\");\r\n\r\n\t\t\tif(usercookie!=null && passcookie!=null){\r\n\t\t\t\tinstitutionalEmail=usercookie.getValue();\r\n\t\t\t\tpassword=passcookie.getValue();\r\n\t\t\t}\r\n\t\t}\r\n\t\t//create cookies if he just logged in\r\n\t\telse{\r\n\t\t\tusercookie=new Cookie(\"user\",institutionalEmail);\r\n\t\t\tpasscookie=new Cookie(\"pass\",password);\r\n\t\t\tusercookie.setMaxAge(30);\r\n\t\t\tpasscookie.setMaxAge(30);\r\n\t\t}\r\n\r\n\t\tif(institutionalEmail==null || password==null){\r\n\t\t\tresponse.sendRedirect(response.encodeRedirectURL(\"Login\"));\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t//user doesn't exist or isn't an allowed to view content\r\n\t\tif(ALLOWED.indexOf(ejb.login(institutionalEmail, password))==-1){\r\n\t\t\tresponse.setContentType(\"text/html\");\r\n\r\n\t\t\tif(usercookie!=null && passcookie!=null){\r\n\t\t\t\tusercookie.setMaxAge(0);\r\n\t\t\t\tpasscookie.setMaxAge(0);\r\n\t\t\t\tresponse.addCookie(usercookie);\r\n\t\t\t\tresponse.addCookie(passcookie);\r\n\r\n\t\t\t}\r\n\t\t\tresponse.sendRedirect(response.encodeRedirectURL(\"Login\"));\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\tresponse.setContentType(\"text/html\");\r\n\t\tresponse.addCookie(usercookie);\r\n\t\tresponse.addCookie(passcookie);\r\n\r\n\t\trequest.setAttribute(\"institutional_email\", institutionalEmail);\r\n\t\trequest.setAttribute(\"password\", password);\r\n\r\n\t\treturn true;\r\n\t}", "@Test\n\t //Extracting a string from the response\n\t public void getBasicAuthTestResultCookies() {\n\t Cookies cookies = given ()\n\t \t.spec(requestSpec)\n\t .when()\n\t .get (\"/maps/api/place/textsearch/json\")\n\t .detailedCookies();\n\t System.out.println(\"Cookies\"+cookies.size());\n\t System.out.println(\"CookiesList\"+cookies.getList(\"cookie1\").size());\n\t //System.out.println(\"Cookies\"+cookies.values().toString());\n\t //Assert.assertEquals(statusCode.toString(), \"200\");\n\t }", "Boolean checkCredentials(ClientCredentialsData clientData) throws AuthenticationException;", "@Test\n\tpublic void testDetailedCookies() {\n\t\tResponse response = get(\"http://jsonplaceholder.typicode.com/photos\");\n\t\t\n\t\tCookie o = response.getDetailedCookie(\"__cfduid\");\n\t\t\n\t\tSystem.out.println(\"Detailed: \"+o.hasExpiryDate());\n\t\tSystem.out.println(\"Detailed: \"+o.getExpiryDate());\n\t\tSystem.out.println(\"Detailed: \"+o.hasValue());\n\t}", "public Optional<Cookie> cookie(String name) {\n return cookies().get(name);\n }", "public Cookie Found(HttpServletRequest request) {\n\t\tfor(Cookie c : request.getCookies()) {\n\t\t\tif(c.getName().equals(\"CS5300J17\")) return c;\n\t\t}\n\t\treturn null;\n\t}", "public String getAccessCookie(final String authCode) throws IOException,\n\t\t\tJSONException {\n\t\tCredential credential = getUsercredential(authCode);\n\t\tString accessToken = credential.getAccessToken();\n\t\tSystem.out.println(accessToken);\n\t\treturn accessToken;\n\t}", "private void checkIfUserIsAuthenticated() {\n splashViewModel.checkIfUserIsAuthenticated();\n splashViewModel.getIsUserAuthenticated().observe(this, user -> {\n if (!user.isAuthenticated()) {\n startAuthActivity();\n finish();\n } else {\n getUserFromDatabase(user.getUid());\n }\n });\n }", "public Series<Cookie> getCookies() {\n // Lazy initialization with double-check.\n Series<Cookie> c = this.cookies;\n if (c == null) {\n synchronized (this) {\n c = this.cookies;\n if (c == null) {\n this.cookies = c = new CookieSeries();\n }\n }\n }\n return c;\n }", "private Cookie getCookie(HttpServletRequest request,String name) {\r\n\t\tCookie[] cookies=request.getCookies();\r\n\r\n\t\tfor(Cookie c:cookies){\r\n\t\t\tif(c.getName().equals(name))\r\n\t\t\t\treturn c;\r\n\t\t}\r\n\r\n\t\treturn null;\r\n\t}", "public Cookie getCookieObject(String name) {\n\t\tCookie[] cookies = request.getCookies();\n\t\tif (cookies != null)\n\t\t\tfor (Cookie cookie : cookies)\n\t\t\t\tif (cookie.getName().equals(name))\n\t\t\t\t\treturn cookie;\n\t\treturn null;\n\t}", "public OriginRequestPolicyCookiesConfig getCookiesConfig() {\n return this.cookiesConfig;\n }", "boolean isAuthenticated();", "public Object getUnderlying() {\n return ahcCookie;\n }", "Set<Authority> getAuthorities(User user);", "Credential<?>[] readAuthorization(HttpServletRequest request)\n throws IOException,ServletException;", "public static void acceptCookies() {\n WebElement acceptButton = Browser.driver.findElement(ACCEPT_COOKIES_BUTTON);\n if(acceptButton.isDisplayed()){\n click(ACCEPT_COOKIES_BUTTON);\n }\n }", "@Override\r\n public void getCookie(String name)\r\n {\n\r\n }", "protected UserDetails processAutoLoginCookie(String[] cookieTokens, HttpServletRequest request, HttpServletResponse response) {\n\n String username = validateToken(cookieTokens, request, response);\n\n //shane\n\n String[] userNameOrgId = splitUserNameOrgId(username);\n //check to make sure we have at least two elements from the split\n if (userNameOrgId != null && userNameOrgId.length == 2) {\n //the second element we are assuming is the orgid - set it in the session\n HttpSession session = request.getSession();\n session.setAttribute(ORGID_SESSION_KEY, userNameOrgId[1]);\n //the first element is the username - load the user details from the first element\n return getUserDetailsService().loadUserByUsername(userNameOrgId[0]);\n }\n\n throw new RememberMeAuthenticationException(\"Cookie username in wrong format\" + username);\n }", "public ServerCookie checkCookie(String cookieText) throws GameException \n\t{\n\t\t//Check to see if the cookie map has this particular cookie text\n\t\tif (!cookies.containsKey(cookieText))\n\t\t\tthrow new GameException(\"No cookie found\");\n\t\tServerCookie sc = cookies.get(cookieText);\n\t\tif (sc.isExpired())\n\t\t{\n\t\t\tcookies.remove(cookieText);\n\t\t\tthrow new GameException(\"Cookie has gone stale!\");\n\t\t}\n\t\treturn sc;\n\t}", "Node.Cookie getCookie( Class type ) {\n return null;\n }", "public boolean getHasCookie ()\n\t{\n\t\treturn hasCookie;\n\t}", "private Cookie getCookieByName(String name) {\n Cookie[] cookies = VaadinService.getCurrentRequest().getCookies();\n\n // Iterate to find cookie by its name\n for (Cookie cookie : cookies) {\n if (name.equals(cookie.getName())) {\n return cookie;\n }\n }\n\n return null;\n }", "private Cookie getCookieByName(HttpServletRequest request, String name) {\n Map<String, Cookie> cookieMap = readCookieMap(request);\n if (cookieMap.containsKey(name)) {\n Cookie cookie = (Cookie) cookieMap.get(name);\n return cookie;\n } else {\n return null;\n }\n }", "private boolean loginUsingCookie(HttpServletRequest request, HttpServletResponse response, String userName, String password) {\n IUserDAO iUserDAOHibernate = UserDAOHibernate.getInstance();\n try {\n User user = iUserDAOHibernate.validateUserAndPassword(userName, password);\n if (user != null)\n {\n request.getSession().setAttribute(\"user\", user);\n response.sendRedirect(\"http://localhost:8010/CostsManagerHit/login/userLogged\");\n }\n else{\n removeAppCookie(response);\n response.sendRedirect(\"http://localhost:8010/CostsManagerHit/login\");\n }\n } catch (UserDAOException e) {\n System.out.println(e.getMessage());\n return false;\n } catch (IOException e) {\n e.printStackTrace();\n return false;\n }\n return true;\n }", "public c get() {\n return this.e.providesCookieManager();\n }", "@RequestMapping(\"login\")\n public boolean Authenticate(String userName, String password, HttpServletResponse res, @CookieValue(value = \"userInfo\", defaultValue = \"\") String userCookie){\n\n if(userCookie != null && !userCookie.equals(\"\")){\n String user = userCookie.split(\"~~~\")[0];\n String pass = userCookie.split(\"~~~\")[1];\n String valid = userCookie.split(\"~~~\")[2];\n\n if(Boolean.valueOf(valid) && userService.authenticate(user, pass).isAuthenticated()) return true;\n }\n\n LoginViewModel viewModel = userService.authenticate(userName, password);\n if(viewModel.isAuthenticated()){\n String[] userInfo = new String[4];\n userInfo[0] = userName;\n userInfo[1] = password;\n userInfo[2] = String.valueOf(viewModel.getUserId());\n\n String userString = Joiner.on(\"~~~\").skipNulls().join(userInfo);\n\n Cookie cookie = new Cookie(\"userInfo\", userString);\n\n res.addCookie(cookie);\n return true;\n }\n return false;\n }", "@SuppressWarnings(\"unchecked\")\n\tpublic Collection<Object> getVerifiableCredentials() {\n\t\tObject list = jsonObject.get(JSONLD_KEY_VERIFIABLE_CREDENTIAL);\n\t\tif (list != null) {\n\t\t\treturn Collections.unmodifiableCollection((Collection<Object>)list);\n\t\t}\n\t\treturn null;\n\t}", "private List<HttpCookie> parseCookiesFromHeaders(HttpHeaders httpHeaders) {\n List<HttpCookie> cookies = Lists.newArrayList();\n List<String> cookieHeaders = httpHeaders.get(HttpHeaders.SET_COOKIE);\n if (cookieHeaders != null) {\n cookieHeaders.forEach(header -> cookies.addAll(HttpCookie.parse(header)));\n }\n\n cookieHeaders = httpHeaders.get(HttpHeaders.SET_COOKIE2);\n if (cookieHeaders != null) {\n cookieHeaders.forEach(header -> cookies.addAll(HttpCookie.parse(header)));\n }\n return cookies;\n }", "protected static void initializeCookieStatus(HttpURLConnection urlConnection) {\n CookieHandler.setDefault(new CookieManager(null, CookiePolicy.ACCEPT_ALL));\n cookies = urlConnection.getHeaderFields().get(\"Set-Cookie\");\n }", "@Before(unless = { \"signin\", \"doLogin\" })\n\tprivate static void checkAuthentification() {\n\t\t// get ID from secure social plugin\n\t\tString uid = session.get(PLAYUSER_ID);\n\t\tif (uid == null) {\n\t\t\tsignin(null);\n\t\t}\n\n\t\t// get the user from the store. TODO Can also get it from the cache...\n\t\tUser user = null;\n\t\tif (Cache.get(uid) == null) {\n\t\t\ttry {\n\t\t\t\tuser = UserClient.getUserFromID(uid);\n\t\t\t\tCache.set(uid, user);\n\t\t\t} catch (ApplicationException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t\tflash.error(\"Problem while getting user from store...\");\n\t\t\t}\n\t\t} else {\n\t\t\tuser = (User) Cache.get(uid);\n\t\t}\n\n\t\tif (user == null) {\n\t\t\tflash.error(\"Problem while getting user from store...\");\n\t\t\tAuthentifier.logout();\n\t\t}\n\n\t\tif (user.avatarURL == null) {\n\t\t\tuser.avatarURL = Gravatar.get(user.email, 100);\n\t\t}\n\n\t\t// push the user object in the request arguments for later display...\n\t\trenderArgs.put(PLAYUSER, user);\n\t}", "Optional<User> findUserWithCookies(String login, String userHash) throws ServiceException;", "@DOMSupport(DomLevel.ONE)\r\n @Property String getCookie();", "public void getResponseCookies(@NonNull Uri uri, @NonNull Callback<List<String>> callback) {\n ThreadCheck.ensureOnUiThread();\n if (WebLayer.getSupportedMajorVersionInternal() < 101) {\n throw new UnsupportedOperationException();\n }\n try {\n ValueCallback<List<String>> valueCallback = (List<String> result) -> {\n callback.onResult(result);\n };\n mImpl.getResponseCookies(uri.toString(), ObjectWrapper.wrap(valueCallback));\n } catch (RemoteException e) {\n throw new APICallException(e);\n }\n }", "private boolean _credList() \n {\n\n //File file = new File(loginFileLocation);\n File file = this._loginReader.getFile();\n String fileLocation = (file == null) ? null : file.getAbsolutePath();\n \n if (!file.canRead())\n {\n this._logger.info(\"No credentials exist.\");\n //this._logger.severe(\"Login Error! Please acquire credentials \"\n // + \"with login utility.\");\n System.exit(-1);\n }\n \n String format1 = \"EEE, d MMM yyyy HH:mm:ss Z\";\n String format2 = \"yyyy-MM-dd'T'HH:mm:ss.SSSZ\";\n DateFormat dateFormat = new SimpleDateFormat(format2);\n \n Date timeStamp = new Date(file.lastModified());\n this._logger.info(Constants.COPYRIGHT);\n this._logger.info(Constants.CLIENTVERSIONSTR);\n this._logger.info(Constants.APIVERSIONSTR);\n this._logger.info(\"\"); // empty line\n this._logger.info(\"Credential cache file: \" + fileLocation);\n this._logger.info(\"File modified on: \" + timeStamp.toString());\n String defUser = this._loginReader.getUsername();\n if (defUser != null)\n this._logger.info(\"Default principal: \" + defUser);\n else\n this._logger.info(\"No default principal specified.\");\n \n String[] sgroups = this._loginReader.getNamespaces();\n for (int i = 0; i < sgroups.length; ++i)\n {\n String ns = sgroups[i];\n if (!ns.equals(LoginFile.DEFAULT_NAMESPACE))\n {\n String user = this._loginReader.getUsername(ns, false);\n long expiry = this._loginReader.getExpiry(ns);\n if (user != null)\n {\n String line = \"Principal for group '\"+ns+\"' : \" + user;\n if (expiry != Constants.NO_EXPIRATION)\n {\n String date = dateFormat.format(new Date(expiry));\n if (expiry < System.currentTimeMillis())\n {\n line = line + \" (expired \"+date+\")\"; \n }\n else\n {\n line = line + \" (expires \"+date+\")\"; \n }\n }\n this._logger.info(line);\n }\n }\n }\n\n return true;\n }", "public Set<Cookie> getCookies(String name) {\r\n Set<Cookie> matchCookies = new HashSet<Cookie>();\r\n if (lastCookies != null) {\r\n for (Cookie c : lastCookies) {\r\n if (c.getName().equals(name)) {\r\n matchCookies.add(c);\r\n }\r\n }\r\n }\r\n return matchCookies;\r\n }", "private boolean isAuthenticated(final ContainerRequestContext requestContext) {\n // Return true if the user is authenticated or false otherwise\n return requestContext.getSecurityContext().getUserPrincipal() != null;\n }", "Collection<? extends GrantedAuthority> getAuthorities();", "public Boolean isAuthorized(String userId);", "public String authenticate() throws LoginException\r\n {\r\n HttpRequest conn = null;\r\n String cookie = \"\";\r\n conn = new HttpRequest(this.url, Method.POST);\r\n HttpResponse _response = conn.send(\"name=\" + username + \"&password=\" + password);\r\n if (_response.getStatus() == HttpURLConnection.HTTP_OK)\r\n {\r\n List<String> cookies = _response.getHeader(AUTH_COOKIE);\r\n for (String c : cookies)\r\n {\r\n this.cookieSession = c.split(\";\")[0];\r\n if (this.cookieSession != null)\r\n break;\r\n }\r\n cookie = this.cookieSession;\r\n }\r\n else if (_response.getStatus() == 401)\r\n {\r\n throw new LoginException(\"Access denied, unauthorized for user [\" + username + \"] and url [\" + url + \"]\");\r\n }\r\n else\r\n {\r\n throw new LoginException(\"Cannot make login in COUCHDB for user [\" + username + \"] and url [\" + url + \"]\"\r\n + \"Http code[\" + _response.getStatus() + \"] \" + _response.getBody());\r\n }\r\n return cookie;\r\n }", "private String getAuthenticatedUser(HttpServletRequest request) throws ServletException, EappException {\n ProxyTicketValidator pv = new ProxyTicketValidator();\n pv.setCasValidateUrl(casValidate);\n pv.setServiceTicket(request.getParameter(\"ticket\"));\n pv.setService(getService(request));\n pv.setRenew(casRenew);\n if (casProxyCallbackUrl != null) {\n pv.setProxyCallbackUrl(casProxyCallbackUrl);\n }\n \n if (!pv.isAuthenticationSuccesful()) {\n try {\n pv.validate();\n } catch (Exception e) {\n log.error(e.getMessage(), e);\n throw new EappException(\"Unable to validate ProxyTicketValidator [\" + pv + \"]\");\n }\n }\n \n if (!pv.isAuthenticationSuccesful()) {\n \tthrow new EappException(\"Unable to validate ProxyTicketValidator [\" + pv + \"]\");\n }\n \n \n if (pv.getUser() == null \n \t\t|| pv.getProxyList() == null \n \t\t|| (casRenew && !pv.getProxyList().isEmpty())) {\n \tthrow new EappException(\"Validation of [\" + pv + \"] did not result in an internally consistent CASReceipt.\");\n }\n \n if (!pv.getProxyList().isEmpty()) {\n // ticket was proxied\n if (authorizedProxies.isEmpty()) {\n throw new ServletException(\"this page does not accept proxied tickets\");\n }\n \n String proxy = (String)pv.getProxyList().get(0);\n if (!authorizedProxies.contains(proxy)) {\n \tthrow new ServletException(\"unauthorized top-level proxy: '\" + pv.getProxyList().get(0) + \"'\");\n }\n }\n \n return pv.getUser();\n }", "public Cookie getCookieValueByName(HttpServletRequest request, String name) {\n if (request.getCookies() == null) {\n return null;\n }\n for (int i = 0; i < request.getCookies().length; i++) {\n if (request.getCookies()[i].getName().equals(name)) {\n return request.getCookies()[i];\n }\n }\n return null;\n }", "@Override\n public void filter(final ContainerRequestContext requestContext) throws IOException {\n final String authToken = requestContext.getHeaders().getFirst(\"authToken\");\n\n if (StringUtils.isBlank(authToken)) {\n throw unauthorizedWebException();\n }\n\n try {\n // authenticate using token to get principle\n final Optional<P> principal = authenticator.authenticate(authToken);\n\n // set security context on request\n if (principal.isPresent()) {\n setSecurityContextOnRequest(requestContext, principal);\n return;\n }\n } catch (AuthenticationException e) {\n LOGGER.warn(\"Error authenticating credentials\", e);\n throw unauthorizedWebException();\n }\n\n throw unauthorizedWebException();\n }", "public static synchronized Cookie[] getCookies(HttpSession session) {\n Vector cookiesPending = (Vector) getObject(session, COOKIES_PENDING);\n Vector cookiesSent = (Vector) getObject(session, COOKIES_SENT);\n\n // Determine the total number of cookies\n int cookieCount = 0;\n if (cookiesPending != null) {\n cookieCount = cookieCount + cookiesPending.size();\n }\n if (cookiesSent != null) {\n cookieCount = cookieCount + cookiesSent.size();\n }\n\n // Construct the list of cookies\n Cookie[] cookiesAll = null;\n if (cookieCount > 0) {\n cookiesAll = new Cookie[cookieCount];\n int cookieIdx = 0;\n\n // Get a combined list of all pending and sent cookies\n Cookie current = null;\n if (cookiesSent != null) {\n for (int s = 0; s < cookiesSent.size(); s++) {\n cookiesAll[cookieIdx] = (Cookie) cookiesSent.get(s);\n cookieIdx++;\n }\n }\n\n // Pending cookies will overwrite any existing cookies\n if (cookiesPending != null) {\n for (int p = 0; p < cookiesPending.size(); p++) {\n cookiesAll[cookieIdx] = (Cookie) cookiesPending.get(p);\n cookieIdx++;\n }\n }\n\n }\n\n\n return cookiesAll;\n }", "public Credentials getCredentials(AuthScope authscope)\n {\n return credentials;\n }", "public Boolean isUserLoggedIn(String user) throws IOException, JSONException {\n\n this.prefs = this.context.getSharedPreferences(\n this.context.getString(R.string.sp_tag_session),//\"usersession\",\n context.MODE_PRIVATE\n );\n\n Log.d(\"Session\",\"Intialize preferences\");\n\n if (this.prefs.contains(this.context.getString(R.string.sp_tag_session_id))) {\n this.cookie = this.prefs.getString(\n this.context.getString(R.string.sp_tag_session_id),\n \"default\"\n );\n }\n else this.cookie = \"\";\n\n Log.d(\"Session\",\"Intialize cookie\");\n\n Log.d(\"hw4\",\"cookie in the onResume is \"+this.cookie);\n InputStream is = null;\n\n // Check for a live network connection.\n Log.d(\"hw4\", \"network availablility: \" + isNetworkAvailable());\n if (!isNetworkAvailable()) return false;\n\n try {\n\n String query = this.url + \"/loggedin?username=\" + user;\n Log.d(\"hw4\", \"isUserLoggedIn query is: \" + query);\n\n HttpURLConnection conn = (HttpURLConnection) ((new URL(query).openConnection())); //this.url + \"?\" + user\n conn.setReadTimeout(10000 /* milliseconds */);\n conn.setConnectTimeout(15000 /* milliseconds */);\n conn.setRequestProperty(\"Cookie\", this.cookie);\n conn.setRequestProperty(\"Content-Type\", \"application/json\");\n conn.setRequestProperty(\"Accept\", \"application/json\");\n conn.setRequestMethod(\"GET\");\n conn.connect();\n\n Log.d(\"Session\", \"connected\");\n\n\n // handling the response\n StringBuilder sb = new StringBuilder();\n // int HttpResult = conn.getResponseCode();\n is = conn.getResponseCode() >= 400 ? conn.getErrorStream() : conn.getInputStream();\n\n\n // TODO: what does \"readIt()\" do?\n String resp=readIt(is, 2).substring(0, 1);\n\n Log.d(\"hw4\",\"readIT gets:\"+resp);\n if (!resp.contains(\"0\")) { //\"0\"\n return true;\n } else {\n Log.d(\"hw4\",\"not logged in and ...?\");\n return false;\n }\n\n\n // Makes sure that the InputStream is closed after the app is\n // finished using it.\n } catch (Exception e) {\n Log.d(\"vt\", \" and the exception is \" + e);\n } finally {\n if (is != null) {\n is.close();\n }\n }\n\n return false;\n }", "public boolean getAuthorisedUser() {\n return authorisedUser;\n }", "private Boolean authorize() {\n\n return Session.getInstance().login(user.getText(), password.getText());\n }", "protected String getJWTFromCookie(HttpServletRequest req) {\n String serializedJWT = null;\n Cookie[] cookies = req.getCookies();\n if (cookies != null) {\n for (Cookie cookie : cookies) {\n if (cookieName.equals(cookie.getName())) {\n LOG.info(cookieName\n + \" cookie has been found and is being processed\");\n serializedJWT = cookie.getValue();\n break;\n }\n }\n }\n return serializedJWT;\n }", "public void doCookieStuff(Users user)\n {\n HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse();\n if (userSession.isRemember())\n {\n String uuid = UUID.randomUUID().toString();\n rememberDAOImpl.saveLogin(uuid, user);\n addCookie(response, \"remember\", uuid, 2592000); //thats 30 days in seconds\n } else {\n rememberDAOImpl.removeLogin(user);\n removeCookie(response, \"remember\");\n }\n }", "public void checkAuthority() {\n }", "boolean authNeeded();", "@GetMapping(\"/\")\n public String readCookie(@CookieValue(value = \"disclaimer\") String username) {\n return this.restTemplate.getForObject(\n \"http://ping-server/\", String.class);\n }", "@Override\n public F.Promise<Optional<Result>> beforeAuthCheck(Http.Context context) {\n return F.Promise.pure(Optional.empty());\n }", "boolean getIsAuthorized();", "@Override\n protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {\n return null;\n }", "public String getCredentials();", "public static Cookie getCookie(HttpServletRequest request, String cookieName) {\n\t\tfor (Cookie cookie : request.getCookies()) {\n\t\t\tif (cookieName.equals(cookie.getName())) {\n\t\t\t\treturn cookie;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "public boolean isAutohandleCookies() {\n\t return isAutohandlingCookies.get();\n\t}", "static Map<String, Cookie> parseCookies(Headers headers) {\n\t\tMap<String, String> params = parseHeaderParams(headers.get(HeaderName.COOKIE));\n\t\tMap<String, Cookie> cookies = new LinkedHashMap<>();\n\t\tfor (Map.Entry<String, String> entry : params.entrySet()) {\n\t\t\tif (!entry.getValue().isEmpty()) {\n\t\t\t\tcookies.put(entry.getKey(), new Cookie(entry.getKey(), entry.getValue()));\n\t\t\t}\n\t\t}\n\t\treturn cookies;\n\t}", "@Test\r\n\tpublic void authImplicit() {\n\t\t Storage storage = StorageOptions.getDefaultInstance().getService();\r\n\r\n\t\t logger.info(\"Buckets loading...\");\r\n\t\t Page<Bucket> buckets = storage.list();\r\n\t\t logger.info(String.format(\"Buckets found:'%s'\", buckets.getValues().toString()));\r\n\t\t assertNotNull(storage.getServiceAccount(\"bulorosinterview\"));\r\n\t\t}", "private boolean isAuthorized() {\n return true;\n }", "boolean hasAuth();", "@Transactional(readOnly=true)\n\tpublic Collection<? extends GrantedAuthority> getGrantedAuthorities(\n\t\t\tDirContextOperations userData, String userName) \n\t{\n\t\t\n\t\tSet<GrantedAuthority> authorities = new HashSet<GrantedAuthority>();\n\t\t\n\t\ttry\n\t\t{\n\t\t\t\n\t\t\tif (userName.contains(\"@\"))\n\t\t\t\tuserName = userName.substring(0, userName.lastIndexOf(\"@\"));\n\t\t\t\n\t\t\t// Get the user from CLP database.\n\t\t\tClpUserDTO user = userService.getUserByUserName(userName);\n\t\t\t\n\t\t\tif (user==null || user.getUserId() <= 0)\n\t\t\t{\n\t\t\t\tlogger.error(\"No user found in CLP database for userName: \" + userName);\n\t\t\t}\n\t\t\telse{\n\t\t\t\t\n\t\t\t\tlogger.debug(\"logged in user: \" + user.toString());\n\t\t\t\t\n\t\t\t\t// User is logged in and authorities were retrieved from CLP database.\n\t\t\t\t// Update last login time at this point.\n\t\t\t\tuserService.updateLastLoginTime(user.getUserId());\n\n\t\t\t\t// Add the userId and last login time to session.\n\t\t\t\tclpSession.setUserId(user.getUserId());\n\t\t\t\tclpSession.setUserLastLoginTime(user.getLastLoginTime());\n\n\t\t\t\t// Add the granted authorities to the user.\n\t\t\t\t// These will be used by spring security framework to \n\t\t\t\t// look up permissions for the logged in user.\n\t\t\t\tauthorities.addAll(getGrantedAuthorities(user));\n\t\t\t}\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\tlogger.error(\"Exception occured while setting user authorities: \" + e.getMessage());\n\t\t}\n\t\t\n\t\treturn authorities;\n\t}", "public boolean getWantClientAuth()\n {\n return wantClientAuth;\n }", "@Override\n\tprotected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)\n\t\t\tthrows IOException, ServletException {\n\t\tString jwtInCookie = null;\n\t\tString username = null;\n\n\t\t// try to get authentication from cookie\n\t\tOptional<Cookie> cookieO = CookieUtils.getCookie(request, appProperties.getAuth().getTokenCookieName());\n\t\tif (cookieO.isPresent()) {\n\t\t\tjwtInCookie = cookieO.get().getValue();\n\t\t}\n\n\t\t// if cookie authentication is missing try to get JWT token from HTTP header\n\t\tjwtInCookie = StringUtils.defaultIfBlank(jwtInCookie, jwtTokenProvider.resolveToken(request));\n\n\t\tif (jwtInCookie != null) {\n\t\t\ttry {\n\t\t\t\tusername = jwtTokenProvider.getUsernameFromToken(jwtInCookie);\n\t\t\t} catch (IllegalArgumentException e) {\n\t\t\t\tlog.error(\"IN doFilterInternal - an error occured during getting username from token\", e);\n\t\t\t} catch (ExpiredJwtException e) {\n\t\t\t\tlog.warn(\"IN doFilterInternal - the token is expired and not valid anymore\", e);\n\t\t\t} catch (SignatureException e) {\n\t\t\t\tlog.error(\"IN doFilterInternal - Authentication Failed. Username or Password not valid.\");\n\t\t\t}\n\t\t} else {\n\t\t\tlog.warn(\"IN doFilterInternal - couldn't find bearer string, will ignore the header\");\n\t\t}\n\t\tif (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {\n\n\t\t\ttry {\n\t\t\t\tUserDetails userDetails = userService.loadUserByUsername(username);\n\n\t\t\t\tif (!userDetails.isEnabled())\n\t\t\t\t\tthrow new DisabledException(\"Authentication for user '\" + username + \"' is disabled\");\n\n\t\t\t\tif (jwtTokenProvider.validateToken(jwtInCookie, userDetails)) {\n\t\t\t\t\tUsernamePasswordAuthenticationToken authentication = new UsernamePasswordAuthenticationToken(\n\t\t\t\t\t\t\tuserDetails, null, userDetails.getAuthorities());\n\t\t\t\t\tauthentication.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));\n\t\t\t\t\tlog.info(\"IN doFilterInternal - authenticated user \" + username + \", setting security context\");\n\t\t\t\t\tSecurityContextHolder.getContext().setAuthentication(authentication);\n\t\t\t\t}\n\t\t\t} catch (UsernameNotFoundException e) {\n\t\t\t\tlog.warn(\"IN doFilterInternal - catched UsernameNotFoundException: \" + e.getMessage());\n\t\t\t} catch (DisabledException e) {\n\t\t\t\tlog.warn(\"IN doFilterInternal - catched DisabledException: \" + e.getMessage());\n\t\t\t}\n\n\t\t}\n\n\t\tchain.doFilter(request, response);\n\t}", "public String getCookie(String name) {\r\n return _cookies.get(name);\r\n }", "private String createCookies() {\n\n String bengLoginID = uid + \"\";\n String timeStr = MyApplication.getInstance().authorTime;\n ToastUtil.toast(timeStr + \"\");\n String cookes = MyApplication.getInstance().bengLoginId + \"; \" + MyApplication.getInstance().userHit + \"; \" + MyApplication.getInstance().authorID + \"; \" + timeStr + \"; \" + MyApplication.getInstance().phpSessid;\n ToastUtil.toast(cookes);\n return cookes;\n\n }", "public boolean isAuthenticated() {\r\n\t\treturn user != null;\r\n\t}", "@Override\n\tprotected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)\n\t\t\tthrows ServletException, IOException {\n\t\tfinal String authorizationHeader = request.getHeader(\"Authorization\"); // getting the header from the header name\n\t\t\n\t\tString username = null;\n\t\tString jwt = null;\n\t\t\n\t\ttry {\n\t\t\tif (authorizationHeader != null && authorizationHeader.startsWith(\"Bearer \")) {\n\t\t\t\tjwt = authorizationHeader.substring(7);\n\t\t\t\tusername = jwtUtil.extractUsername(jwt);\n\t\t\t}\n\t\t\t\n\t\t\t// if username is null and there is no already existing context in security context holder\n\t\t\tif (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {\n\t\t\t\tUserDetails userDetails = this.userDetailsService.loadUserByUsername(username);\n\t\t\t\t\n\t\t\t\tSystem.out.println(\"<----------------------------\"+userDetails.getAuthorities());\n\t\t\t\t\n\t\t\t\tif (jwtUtil.validateToken(jwt)) { // checking if the token still exist or has not expired\n\t\t\t\t\tUsernamePasswordAuthenticationToken upaToken = new UsernamePasswordAuthenticationToken(\n\t\t\t\t\t\t\tuserDetails, null, userDetails.getAuthorities());\n\t\t\t\t\tupaToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));\n\t\t\t\t\t\n\t\t\t\t\tSecurityContextHolder.getContext().setAuthentication(upaToken);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tlogger.error(\"Can NOT set user authentication -> Message: {}\", e);\n\t\t}\n\t\t\n\t\tfilterChain.doFilter(request, response);\n\t\t\n\t}", "@Override\r\n\tprotected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {\n\t\treturn null;\r\n\t}", "public boolean hasCredentials(){\r\n return state;\r\n }", "abstract public boolean checkAuth(String userId) throws IOException;", "public void part2(){\n Cookie c1 = new Cookie(\"uid\", \"2018\", 1800,false);\n Cookie c2 = new Cookie(\"PICK_KEY\", \"ahmd13ldsws8cw\",10800,true);\n Cookie c3 = new Cookie(\"REMEMBER_ME\",\"true\",10800,true);\n }", "LoggedUser authenticate(@Valid AccountCredentials credentials) throws IOException;", "private List<GrantedAuthority> getGrantedAuthorities(User user) {\n List<GrantedAuthority> authorities = new ArrayList<GrantedAuthority>();\n\n authorities.add(new SimpleGrantedAuthority(user.getRole()));\n\n return authorities;\n }", "@DSComment(\"Private Method\")\n @DSBan(DSCat.PRIVATE_METHOD)\n @DSGenerator(tool_name = \"Doppelganger\", tool_version = \"2.0\", generated_on = \"2013-12-30 12:32:41.972 -0500\", hash_original_method = \"E9376C130584FE2146C1CFB7A84FB471\", hash_generated_method = \"FA6BBF0A4D9665939C38DB115FB61EFF\")\n \nprivate boolean cookiesEnabled() {\n return CookieManager.getInstance().acceptCookie();\n }", "private void createLoginCookie(HttpServletResponse response, String userName, String password) {\n Cookie appCookie = new Cookie(\"costsManager\", userName + \"_\" + password);\n appCookie.setMaxAge(99999);\n response.addCookie(appCookie);\n }", "@Override\r\n\tpublic void filter(ContainerRequestContext requestContext) throws IOException {\n\t String authorizationHeader = \r\n\t requestContext.getHeaderString(HttpHeaders.AUTHORIZATION);\r\n\t \r\n\t // Check if the HTTP Authorization header is present and formatted correctly\r\n\t if (authorizationHeader != null && authorizationHeader.startsWith(\"Bearer \")) {\r\n\t \t\r\n\t \t//abgelaufene Tokens werden gelöscht\r\n\t \tsservice.deleteInvalidTokens();\r\n\t \t\r\n\t \t// Extract the token from the HTTP Authorization header\r\n\t \tString token = authorizationHeader.substring(\"Bearer\".length()).trim();\r\n\t \tif (validateToken(token) == true){\r\n\t \t\t\r\n\t \t\t//Get the user by this token\r\n\t \t User user = authService.getUserByToken(token);\r\n\t \t System.out.println(\"Nutzer: \" + user.toString());\r\n\t \t requestContext.setSecurityContext(new MySecurityContext(user));\r\n\t \t return;\r\n\t \t}\r\n\t }\r\n\t \r\n\t throw new UnauthorizedException(\"Client has to be logged in to access the ressource\");\r\n\t \r\n\t\t\r\n\t}", "public static String getCookieWebUser (HttpServletRequest request)\n\t{\n\t\tCookie[] cookies = request.getCookies();\n\t\tif (cookies == null)\n\t\t\treturn null;\n\t\tfor (int i = 0; i < cookies.length; i++)\n\t\t{\n\t\t\tif (COOKIE_NAME.equals(cookies[i].getName()))\n\t\t\t\treturn cookies[i].getValue();\n\t\t}\n\t\treturn null;\n\t}", "public static String getCookieWebUser (HttpServletRequest request)\n\t{\n\t\tCookie[] cookies = request.getCookies();\n\t\tif (cookies == null)\n\t\t\treturn null;\n\t\tfor (int i = 0; i < cookies.length; i++)\n\t\t{\n\t\t\tif (COOKIE_NAME.equals(cookies[i].getName()))\n\t\t\t\treturn cookies[i].getValue();\n\t\t}\n\t\treturn null;\n\t}", "public static String getCookieWebUser (HttpServletRequest request)\n\t{\n\t\tCookie[] cookies = request.getCookies();\n\t\tif (cookies == null)\n\t\t\treturn null;\n\t\tfor (int i = 0; i < cookies.length; i++)\n\t\t{\n\t\t\tif (COOKIE_NAME.equals(cookies[i].getName()))\n\t\t\t\treturn cookies[i].getValue();\n\t\t}\n\t\treturn null;\n\t}", "public static String getCookieWebUser (HttpServletRequest request)\n\t{\n\t\tCookie[] cookies = request.getCookies();\n\t\tif (cookies == null)\n\t\t\treturn null;\n\t\tfor (int i = 0; i < cookies.length; i++)\n\t\t{\n\t\t\tif (COOKIE_NAME.equals(cookies[i].getName()))\n\t\t\t\treturn cookies[i].getValue();\n\t\t}\n\t\treturn null;\n\t}", "public FCLAccountAuthorizationProvider(String cookieValue) {\r\n\t\tthis.cookieValue = cookieValue;\r\n\t}", "public Collection<String> getAuthorized(String username) {\n Collection<String> authorized = new ArrayList<String>();\n try {\n String filename = JiveGlobals.getXMLProperty(\"unix.k5login\", \"/home/{0}/.k5login\");\n filename = filename.replace(\"{0}\", username);\n File k5login = new File(filename);\n FileInputStream fis = new FileInputStream(k5login);\n DataInputStream dis = new DataInputStream(fis);\n\n String line;\n while ((line = dis.readLine()) != null) {\n authorized.add(line);\n }\n }\n catch (IOException e) {\n //??\n }\n return authorized;\n }" ]
[ "0.6196375", "0.60313374", "0.5854217", "0.57500494", "0.57367057", "0.55937", "0.55750626", "0.5484647", "0.54797196", "0.54626083", "0.5435413", "0.5426013", "0.53773546", "0.5372409", "0.53649807", "0.5364862", "0.5351818", "0.5257485", "0.52570194", "0.5196876", "0.5111756", "0.5089169", "0.5072003", "0.50708306", "0.5066485", "0.5045978", "0.5036491", "0.4989672", "0.49799404", "0.4979461", "0.49580517", "0.4914428", "0.48949343", "0.4893008", "0.4889448", "0.48871142", "0.4884171", "0.48727122", "0.48620388", "0.4844877", "0.48419395", "0.48383486", "0.48342878", "0.48057035", "0.47810683", "0.47777063", "0.4772358", "0.4747355", "0.47469074", "0.47402418", "0.47153997", "0.47065848", "0.47064087", "0.47030494", "0.47027928", "0.47022656", "0.47005165", "0.46913183", "0.4682472", "0.4672403", "0.46709052", "0.46682507", "0.46541438", "0.46538773", "0.46460918", "0.46386284", "0.46375048", "0.463511", "0.4634515", "0.46300355", "0.462648", "0.46228436", "0.4615798", "0.46125564", "0.460839", "0.46041068", "0.4600276", "0.45949855", "0.45890906", "0.45865658", "0.45756313", "0.45731577", "0.4564796", "0.455724", "0.45532754", "0.45466438", "0.45444494", "0.4542253", "0.45420623", "0.45399684", "0.4535958", "0.45325145", "0.45302767", "0.45226985", "0.4511965", "0.4511965", "0.4511965", "0.4511965", "0.45114115", "0.45108756" ]
0.66683185
0
Private method to do the authorization.
private void authorize(){ URL authURL = null; URL homeURL = null; URLConnection homeCon = null; String loginPage = GG.GG_LOGIN+"?ACCOUNT="+GG.GG_UID +"&PASSWORD="+GG.GG_PASS; String cookieString = ""; String cookieString1 = ""; try{ homeURL = new URL(GG.GG_HOME); homeCon = homeURL.openConnection(); // Look At the headers Map headerMap = homeCon.getHeaderFields(); // Look for the Cookie if(headerMap.containsKey("Set-Cookie")){ // this gets the exact value of the header // otherwise gets some formatted string cookieString = homeCon.getHeaderField("Set-Cookie"); //log.finest("cookie1: "+cookieString); authURL = new URL(loginPage); HttpURLConnection.setFollowRedirects(false); HttpURLConnection loginCon = (HttpURLConnection) authURL.openConnection(); // doOutput must be set before connecting loginCon.setAllowUserInteraction(true); loginCon.setUseCaches(false); loginCon.setDoOutput(true); loginCon.setRequestProperty("Cookie", cookieString); loginCon.connect(); // Look At the headers Map headerMap1 = loginCon.getHeaderFields(); cookieString1 = loginCon.getHeaderField("Set-Cookie"); //log.finest("cookie2: "+cookieString1); if(!Pattern.matches(".*\\."+GG.GG_UID+"\\.\\d+.*", cookieString1)){ return; } String location = loginCon.getHeaderField("Location"); URL gotURL = new URL(location); HttpURLConnection gotCon = (HttpURLConnection) gotURL.openConnection(); // doOutput must be set before connecting gotCon.setAllowUserInteraction(true); gotCon.setUseCaches(false); gotCon.setDoOutput(true); gotCon.setRequestProperty("Cookie", cookieString); gotCon.setRequestProperty("Cookie", cookieString1); gotCon.connect(); // Got the Cookies cookies[0] = cookieString; cookies[1] = cookieString1; }else{ log.info("Unable to find the Cookie"); } }catch(Exception e){ e.printStackTrace(); } authorized = true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void authorize() {\r\n\r\n\t}", "public void doAuthorize() {\n authorizeBehavior.authorizd();\n }", "protected abstract String getAuthorization();", "private Boolean authorize() {\n\n return Session.getInstance().login(user.getText(), password.getText());\n }", "private boolean isAuthorized() {\n return true;\n }", "public void checkAuthority() {\n }", "private void checkAuthorization(RoutingContext context, List<CaptureMap> resolvedCaptureCollections,\n Handler<AsyncResult<Boolean>> handler) {\n AuthHandler auth = context.get(AuthenticationController.AUTH_HANDLER_PROP);\n if (auth != null && auth instanceof RedirectAuthHandlerBt) {\n MemberUtil.getCurrentUser(context, getNetRelay(), result -> {\n if (result.failed()) {\n handler.handle(Future.failedFuture(result.cause()));\n } else {\n IAuthenticatable member = result.result();\n if (member == null) {\n // this is an error\n handler.handle(Future.failedFuture(\n new IllegalArgumentException(\"This should not happen, we need an instance of IAuthenticatable here\")));\n } else {\n checkAuthorization(resolvedCaptureCollections, auth, member, handler);\n }\n }\n });\n } else {\n handler.handle(Future.succeededFuture(true));\n }\n }", "@Override\n protected boolean isAuthorized(PipelineData pipelineData) throws Exception\n {\n \t// use data.getACL() \n \treturn true;\n }", "boolean authNeeded();", "@Override\n public boolean execute(Context ctx) {\n AccessContext accessCtx = (AccessContext)ctx;\n HttpServletRequest req = accessCtx.getHttpRequest();\n HttpServletResponse resp = accessCtx.getHttpResponse();\n String contextPath = req.getContextPath();\n LogUtils.logDebug(logger, \"getContextPath: \", contextPath);\n\n if (this.authLevel >= AUTH_LEVEL_LOGGED_IN) {\n if (!accessCtx.containsAttribute(AccessContext.KEY_USER_ITEM)) {\n throw new IllegalStateException(\n \"User Item was not found, perhaps LoadUserItemCommand was not executed\");\n }\n }\n // From this point accessCtx.getUserItem is a valid entry.\n\n if (this.authLevel >= AUTH_LEVEL_LOGGED_IN) {\n if (accessCtx.getUserItem() == null) {\n try {\n if (accessCtx.getDatasetItem() == null) {\n // If datasetItem not exists, redirect to login page.\n String redirUrl = contextPath + AccessFilter.REDIRECT_LOGIN;\n LogUtils.logDebug(logger,\n \"Not logged in, redirecting to \", redirUrl);\n AccessFilter.redirect(req, resp, redirUrl);\n } else {\n // If datasetItem exists, then redirect to Dataset Overview page.\n String redirUrl = contextPath + AccessFilter.REDIRECT_DATASET_INFO\n + \"?datasetId=\" + accessCtx.getDatasetId()\n + \"&access_redir=1\";\n LogUtils.logDebug(logger,\n \"(1)Not authorized for this dataset, redirecting to \", redirUrl);\n AccessFilter.redirect(req, resp, redirUrl);\n }\n } catch (IOException e) {\n throw new RuntimeException(\"Error while redirecting.\", e);\n }\n return true;\n }\n }\n\n // from this point accessCtx.getUserItem is a valid object.\n\n if (this.authLevel == AUTH_LEVEL_AUTHORIZED_FOR_DS) {\n if (!accessCtx.containsAttribute(AccessContext.KEY_IS_AUTHORIZED_FOR_DS)) {\n throw new IllegalStateException(\n \"IsAuthorizedForDataset was not set. \"\n + \"Perhaps LoadDatsetCommand was not executed.\");\n }\n\n if (!accessCtx.isAuthorizedForDataset()) {\n try {\n String redirUrl = contextPath + AccessFilter.REDIRECT_DATASET_INFO\n + \"?datasetId=\" + accessCtx.getDatasetId()\n + \"&access_redir=1\";\n LogUtils.logDebug(logger,\n \"(2)Not authorized for this dataset, redirecting to \", redirUrl);\n AccessFilter.redirect(req, resp, redirUrl);\n } catch (IOException e) {\n throw new RuntimeException(\"Error while redirecting.\", e);\n }\n return true;\n }\n }\n\n if (this.authLevel == AUTH_LEVEL_ADMIN) {\n if (!accessCtx.getUserItem().getAdminFlag()) {\n try {\n String redirUrl = AccessFilter.REDIRECT_INDEX_JSP;\n LogUtils.logDebug(logger,\n \"Not admin, redirecting to \", redirUrl);\n AccessFilter.redirect(req, resp, redirUrl);\n } catch (IOException e) {\n throw new RuntimeException(\"Error while redirecting.\", e);\n }\n return true;\n }\n }\n return false;\n }", "@Override\n\tpublic void authorize(String resourceName, String action, String rpcName)\n\t\t\tthrows Exception {\n\t}", "@Override\n\tprotected void doFilterInternal(HttpServletRequest request, \n\t\t\tHttpServletResponse response, \n\t\t\tFilterChain chain) throws IOException, ServletException {\n\t\t\n\t\tString header = request.getHeader(\"Authorization\");\n\t\tif (header != null && header.startsWith(\"Bearer \"))\t{\n\t\t\tUsernamePasswordAuthenticationToken auth = this.getAuthentication(header.substring(7));\n\n\t\t\tif (auth != null) {\n\t\t\t\tSecurityContextHolder.getContext().setAuthentication(auth);\n\t\t\t} else if (!SecurityConfig.verifyPermissionURI(request.getRequestURI())){\n\t\t\t\tonUnsuccessfulAuthentication(request, response, new SessionAuthenticationException(\"Unauthorized - invalid session\"));\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else if (!SecurityConfig.verifyPermissionURI(request.getRequestURI())) {\n\t\t\tonUnsuccessfulAuthentication(request, response, new SessionAuthenticationException(\"Unauthorized\"));\n\t\t\treturn;\n\t\t}\n\n\t\tchain.doFilter(request, response);\n\t}", "@Override\n\tpublic boolean checkAuthorization(HttpServletRequest request) {\n\t\treturn true;\n\t}", "@Override\n\tpublic AuthorizationResponse decide(HttpServletRequest request,\n\t\t\tMap<String, String> additionalAttrs) {\n\t\tlog.trace (\"Entering decide()\");\n\t\t\n\t\tboolean decision = false;\n\t\t\n\t\t// Extract interesting parts of the HTTP request\n\t\tString method = request.getMethod();\n\t\tAuthzResource resource = new AuthzResource(request.getRequestURI());\n\t\tString subject = (request.getHeader(SUBJECT_HEADER));\t\t // identity of the requester\n\t\tString subjectgroup = (request.getHeader(SUBJECT_HEADER_GROUP)); // identity of the requester by group Rally : US708115\n\n\t\tlog.trace(\"Method: \" + method + \" -- Type: \" + resource.getType() + \" -- Id: \" + resource.getId() + \n\t\t\t\t\" -- Subject: \" + subject);\n\t\t\n\t\t// Choose authorization method based on the resource type\n\t\tResourceType resourceType = resource.getType();\n\t\tif (resourceType != null) {\n\n\t\t\tswitch (resourceType) {\n\n\t\t\tcase FEEDS_COLLECTION:\n\t\t\t\tdecision = allowFeedsCollectionAccess(resource, method, subject, subjectgroup);\n\t\t\t\tbreak;\n\n\t\t\tcase SUBS_COLLECTION:\n\t\t\t\tdecision = allowSubsCollectionAccess(resource, method, subject, subjectgroup);\n\t\t\t\tbreak;\n\n\t\t\tcase FEED:\n\t\t\t\tdecision = allowFeedAccess(resource, method, subject, subjectgroup);\n\t\t\t\tbreak;\n\n\t\t\tcase SUB:\n\t\t\t\tdecision = allowSubAccess(resource, method, subject, subjectgroup);\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tdecision = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tlog.debug(\"Exit decide(): \" + method + \"|\" + resourceType + \"|\" + resource.getId() + \"|\" + subject + \" ==> \" + decision);\n\t\t\n\t\treturn new AuthRespImpl(decision);\n\t}", "void makeAuthorizationRequest(OnAuthCompleteListener onAuthCompleteListener);", "public boolean onSecurityCheck() {\n boolean continueProcessing = super.onSecurityCheck();\n if (!continueProcessing) {\n return false;\n }\n AuthorizationManager authzMan = getAuthorizationManager();\n try {\n if (!authzMan.canManageApplication(user)) {\n setRedirect(\"authorization-denied.htm\");\n return false;\n }\n return true;\n } catch (AuthorizationSystemException ex) {\n throw new RuntimeException(ex);\n }\n }", "public void authentication() throws AuthorizationException {\n\t\tclient = new RennClient(API_KEY, SECRET_KEY);\n\t\tclient.authorizeWithClientCredentials();\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\r\n protected void mayProceed() throws InsufficientPermissionException {\n if (ub.isSysAdmin() || ub.isTechAdmin()) {\r\n return;\r\n }\r\n// if (currentRole.getRole().equals(Role.STUDYDIRECTOR) || currentRole.getRole().equals(Role.COORDINATOR)) {// ?\r\n// ?\r\n// return;\r\n// }\r\n\r\n addPageMessage(respage.getString(\"no_have_correct_privilege_current_study\") + respage.getString(\"change_study_contact_sysadmin\"));\r\n throw new InsufficientPermissionException(Page.MENU_SERVLET, resexception.getString(\"not_allowed_access_extract_data_servlet\"), \"1\");// TODO\r\n // above copied from create dataset servlet, needs to be changed to\r\n // allow only admin-level users\r\n\r\n }", "public boolean auth() throws IOException {\r\n \treturn auth(false);\r\n }", "private void authenticateAction() {\n if (requestModel.getUsername().equals(\"superuser\")\n && requestModel.getPassword().equals(\"\")) {\n Collection<Webres> webres = getAllWebres();\n proceedWhenAuthenticated(new User(null, null, null, \"superuser\", \"\", null) {\n @Override\n public Collection<Webres> getAllowedResources() {\n return webres;\n }\n @Override\n public ActionController getDefaultController() {\n return ActionController.EMPLOYEES_SERVLET;\n }\n });\n return;\n }\n \n // try to authenticate against other credentials from the database\n Optional<User> u = getUserByCredentials(requestModel.getUsername(), requestModel.getPassword()); \n if (u.isPresent()) {\n proceedWhenAuthenticated(u.get());\n return;\n }\n \n // report authentication failed\n LOG.log(Level.INFO, \"{0} Authentication failed. Login: {1}, Password: {2}\", new Object[]{httpSession.getId(), requestModel.getUsername(), requestModel.getPassword()});\n SignInViewModel viewModel = new SignInViewModel(true);\n renderSignInView(viewModel);\n }", "UserPermissions authenticate (Request request);", "void checkPermission(T request) throws AuthorizationException;", "abstract public boolean checkAuth(String userId) throws IOException;", "@Override\n\tpublic boolean isCommandAuthorized(){\n\t\treturn true;\n\t}", "public abstract boolean authorize(int requestCode, int resultCode, @Nullable Intent intent);", "@Test\n public void authorisedTest() {\n assertTrue(authResponse.isAuthorised());\n }", "private void initForWritableEndpoints(UserGroupInformation callerUGI,\n boolean doAdminACLsCheck) throws AuthorizationException {\n // clear content type\n response.setContentType(null);\n\n if (callerUGI == null) {\n String msg = \"Unable to obtain user name, user not authenticated\";\n throw new AuthorizationException(msg);\n }\n\n if (UserGroupInformation.isSecurityEnabled() && isStaticUser(callerUGI)) {\n String msg = \"The default static user cannot carry out this operation.\";\n throw new ForbiddenException(msg);\n }\n\n if (doAdminACLsCheck) {\n ApplicationACLsManager aclsManager = rm.getApplicationACLsManager();\n if (aclsManager.areACLsEnabled()) {\n if (!aclsManager.isAdmin(callerUGI)) {\n String msg = \"Only admins can carry out this operation.\";\n throw new ForbiddenException(msg);\n }\n }\n }\n }", "@Override\n public void authorize(final ServiceActionContext inActionContext)\n {\n // get ActivitySecurityDTO for activity id passed in.\n ActivitySecurityDTO securityDTO = new ArrayList<ActivitySecurityDTO>(securityMapper.execute(Arrays\n .asList((Long) inActionContext.getParams()))).get(0);\n\n if (!securityDTO.isDestinationStreamPublic()\n && !getVisibleGroupsForUserMapper.execute(inActionContext.getPrincipal().getId()).contains(\n securityDTO.getDestinationEntityId()))\n {\n throw new AuthorizationException(\"Current user does not have access right to view activity.\");\n }\n }", "@SuppressWarnings(\"rawtypes\")\n @Override\n protected void doFilterInternal(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response, @NonNull FilterChain chain) throws IOException, ServletException {\n if (permissiveRequest(request)) {\n chain.doFilter(request, response);\n return;\n }\n\n CrustUserInfo authResult = null;\n AuthenticationException failed = null;\n Crust crust = CrustContext.get();\n // check request header has token\n if (!requiresAuthentication(request, response)) {\n failed = new InsufficientAuthenticationException(\"Required token is not set.\");\n } else {\n String token = crust.getToken(true);\n try {\n if (StringUtils.isNotBlank(token)) {\n authResult = crust.getAuthInfoFromToken(token);\n } else {\n failed = new InsufficientAuthenticationException(\"Token is not exists.\");\n }\n } catch (ClaimJwtException e) {\n failed = new InsufficientAuthenticationException(e.getMessage());\n } catch (AuthenticationException e) {\n // Authentication failed!\n failed = e;\n }\n }\n\n if (authResult != null) {\n Authentication authentication = crust.getContext().getAuthentication();\n // null if getting from cache, it's need active authentication.\n if (authentication == null) {\n crust.activeAuthentication(authResult);\n authentication = crust.getContext().getAuthentication();\n }\n successfulAuthentication(request, response, chain, authentication);\n } else {\n unsuccessfulAuthentication(request, response, failed);\n return;\n }\n chain.doFilter(request, response);\n }", "@Override\n\t\t\tpublic void authenticated(AuthResponse r) {\n\t\t\t\tif (r != null && r.error() == null) {\n//\t\t\t\t\tSystem.out.println(\" auth making api call\");\n\t\t\t\t\ttrigger.setEnabled(false); // .removeFromParent(); // .setEnabled(false);//.getStyle().setProperty(\"visibility\", \"hidden\");\n\t\t\t\t\tready.authenticated(r); \n//\t\t\t\t\tready.run();\n\t\t\t\t} else {\n//\t\t\t\t\tSystem.out.println(\" auth not making api call\");\n\t\t\t\t\ttrigger.setEnabled(true);\n\t\t\t\t\ttrigger.addTriggerHandler(new Runnable() {\n\t\t\t\t\t\t@Override\n\t\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\t\t// handleAuthClick();\n\t\t\t\t\t\t\tGAPI.get()\n\t\t\t\t\t\t\t\t\t.auth()\n\t\t\t\t\t\t\t\t\t.authorize(AuthRequest.create().client_id(clientId).scope(scope).immediate(false),\n\t\t\t\t\t\t\t\t\t\t\thandleAuthResult);\n\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}", "public String execute() { \r\n\t\t\r\n\t\tIrUser user = userService.getUser(userId, false);\r\n\t\t\r\n\t\tif (genericItemId != null) {\r\n\t\t\titem = itemService.getGenericItem(genericItemId, false);\r\n\t\t}\r\n\t\t\r\n\t\tif( item != null )\r\n\t\t{\r\n\t\t\tif( !item.getOwner().equals(user) && !user.hasRole(IrRole.ADMIN_ROLE) && \r\n\t\t\t\t\t!institutionalCollectionPermissionHelper.isInstitutionalCollectionAdmin(user, genericItemId))\r\n\t\t\t{\r\n\t\t\t\treturn \"accessDenied\";\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn SUCCESS;\r\n\t}", "@Override\n public void filter(ContainerRequestContext requestContext) throws IOException {\n // Get the Authorization header from the request\n String authorizationHeader =\n requestContext.getHeaderString(HttpHeaders.AUTHORIZATION);\n\n // Validate the Authorization header\n if (!isTokenBasedAuthentication(authorizationHeader)) {\n abortWithUnauthorized(requestContext);\n return;\n }\n\n // Extract the token from the Authorization header\n String token = authorizationHeader\n .substring(AUTHENTICATION_SCHEME.length()).trim();\n\n try {\n\n // Validate the token\n Jws<Claims> claims = validateToken(token);\n ArrayList userGroups = getUserGroups(claims);\n Permissions[] perms = getPermissionsNeeded(requestContext);\n\n authorize(userGroups, perms);\n\n } catch (Exception e) {\n abortWithUnauthorized(requestContext);\n }\n }", "private ModelAndView handleScriptBasicAuth(HttpServletRequest request, HttpServletResponse response)\n {\n\tfinal HttpSession session = request.getSession();\n\tString http_basic_auth = null, http_basic_auth_username = null, http_basic_auth_password = null, openid = null;\n\tBoolean user_authenticated = false;\n\tbyte[] byteArray = null;\n\thttp_basic_auth = request.getHeader(\"Authorization\");\n\t \n\t \n\tString http_basic_auth_enc = http_basic_auth.replaceAll(\"Basic \", \"\");\n\tbyteArray = Base64.decodeBase64(http_basic_auth_enc.getBytes());\n\tString http_basic_auth_dec = new String(byteArray);\n\tString[] parts = http_basic_auth_dec.split(\":\");\n\thttp_basic_auth_username = parts[0];\n\thttp_basic_auth_password = parts[1];\n\t \n\tif (LOG.isDebugEnabled()) LOG.debug(\"Attempting authentication with user=\"+http_basic_auth_username+\" password=\"+http_basic_auth_password);\n\t\t\n\tuser_authenticated = idp.authenticate_ids(http_basic_auth_username, http_basic_auth_password);\n\topenid = idp.getOpenid(http_basic_auth_username);\t\t\n\t\t\n\tif((user_authenticated) && (openid != null)) \n\t{\n\t return setPositiveSessionAuth(session, openid);\n\t} \n\telse\n\t{\n\t // set session-scope authentication flag to FALSE\n\t session.setAttribute(OpenidPars.SESSION_ATTRIBUTE_AUTHENTICATED, Boolean.FALSE);\n\t if (LOG.isDebugEnabled()) LOG.debug(\"Authentication error\");\n\t response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);\n\t return null;\n\t}\n }", "@Override\n\tpublic void credite() {\n\t\t\n\t}", "public void authorizeTransaction() {}", "public boolean supportsPreemptiveAuthorization() {\n/* 225 */ return true;\n/* */ }", "@Override\n public void decide(Authentication authentication,\n Object o,\n Collection<ConfigAttribute> collection) throws AccessDeniedException, InsufficientAuthenticationException {\n System.out.println(\"MyAccessDecisionManager.decide()------------------验证用户是否具有一定的权限--------\");\n if (collection == null) {\n return;\n }\n for (ConfigAttribute configAttribute : collection) {\n String needResource = configAttribute.getAttribute();\n //authentication.getAuthorities() 用户所有的权限\n for (GrantedAuthority ga : authentication.getAuthorities()) {\n if (needResource.equals(ga.getAuthority())) {\n return;\n }\n }\n }\n throw new AccessDeniedException(\"--------MyAccessDescisionManager:decide-------权限认证失败!\");\n\n }", "private void checkUserAuthorities() {\n\t\tAuthority auth = authorityRepository.findTop1ByName(AuthorityType.ROLE_ADMIN);\n\t\tif (null == auth) {\n\t\t\tauth = Authority.createAdmin();\n\t\t\tauthorityRepository.save(auth);\n\t\t}\n\t\tAuthority authUser = authorityRepository.findTop1ByName(AuthorityType.ROLE_USER);\n\t\tif (null == authUser) {\n\t\t\tauthUser = Authority.createUser();\n\t\t\tauthorityRepository.save(authUser);\n\t\t}\n\t}", "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 protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException, ServletException {\n UsernamePasswordAuthenticationToken authRequest = getAuthtication(request);\n //If the authentication exists, give it to spring context.\n if (authRequest != null){\n SecurityContextHolder.getContext().setAuthentication(authRequest);\n chain.doFilter(request,response);\n }else {\n response.setStatus(401);\n response.getWriter().write(\"Access denied\");\n }\n }", "@Override\n\tprotected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain)\n\t\t\tthrows ServletException, IOException {\n\t\tfinal String authorizationHeader = request.getHeader(\"Authorization\"); // getting the header from the header name\n\t\t\n\t\tString username = null;\n\t\tString jwt = null;\n\t\t\n\t\ttry {\n\t\t\tif (authorizationHeader != null && authorizationHeader.startsWith(\"Bearer \")) {\n\t\t\t\tjwt = authorizationHeader.substring(7);\n\t\t\t\tusername = jwtUtil.extractUsername(jwt);\n\t\t\t}\n\t\t\t\n\t\t\t// if username is null and there is no already existing context in security context holder\n\t\t\tif (username != null && SecurityContextHolder.getContext().getAuthentication() == null) {\n\t\t\t\tUserDetails userDetails = this.userDetailsService.loadUserByUsername(username);\n\t\t\t\t\n\t\t\t\tSystem.out.println(\"<----------------------------\"+userDetails.getAuthorities());\n\t\t\t\t\n\t\t\t\tif (jwtUtil.validateToken(jwt)) { // checking if the token still exist or has not expired\n\t\t\t\t\tUsernamePasswordAuthenticationToken upaToken = new UsernamePasswordAuthenticationToken(\n\t\t\t\t\t\t\tuserDetails, null, userDetails.getAuthorities());\n\t\t\t\t\tupaToken.setDetails(new WebAuthenticationDetailsSource().buildDetails(request));\n\t\t\t\t\t\n\t\t\t\t\tSecurityContextHolder.getContext().setAuthentication(upaToken);\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tlogger.error(\"Can NOT set user authentication -> Message: {}\", e);\n\t\t}\n\t\t\n\t\tfilterChain.doFilter(request, response);\n\t\t\n\t}", "private void usersCheckPermission(PermissionRequest.ActionType grantedAction, IEntity entity)\n {\n authGrantedUser();\n try {\n executeAction(grantedAction, entity);\n } catch (AccessDeniedException e) {\n fail(\"Action \" + grantedAction.name() + \" was granted but could not be executed \" + entity.getEntityName());\n }\n\n authNotGrantedUser();\n try {\n executeAction(grantedAction, entity);\n fail(\"Action \" + grantedAction.name() + \" was not granted but could be executed \" + entity.getEntityName());\n } catch (AccessDeniedException e) {\n //\n }\n }", "@Test(expected = org.jsecurity.authz.UnauthorizedException.class)\n\tpublic void testCheckPermission_2()\n\t\tthrows Exception {\n\t\tSimpleAuthorizingAccount fixture = new SimpleAuthorizingAccount();\n\t\tfixture.setSimpleRoles(new HashSet());\n\t\tPermission permission = new AllPermission();\n\n\t\tfixture.checkPermission(permission);\n\n\t\t// add additional test code here\n\t}", "boolean getIsAuthorized();", "public boolean isAuthorized(){\n\t\treturn authorized;\n\t}", "protected final void runAsAdmin() {\n authenticationTestingUtil.grantAdminAuthority( this.applicationContext );\n }", "@Override\n public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException\n authException)\n throws IOException, ServletException {\n\n response.sendError(HttpServletResponse.SC_UNAUTHORIZED, \"Unauthorized, must be logged in to process request.\");\n }", "@OAuthPostAuthorization\n public void postAuthorize() {\n }", "@Test\n\tpublic void testIsPermitted_2()\n\t\tthrows Exception {\n\t\tSimpleAuthorizingAccount fixture = new SimpleAuthorizingAccount();\n\t\tfixture.setSimpleRoles(new HashSet());\n\t\tList<Permission> permissions = new Vector();\n\n\t\tboolean[] result = fixture.isPermitted(permissions);\n\n\t\t// add additional test code here\n\t\tassertNotNull(result);\n\t}", "@Override\n\tpublic AuthorizationResponse decide(HttpServletRequest request) {\n\t\t\treturn this.decide(request, null);\n\t}", "public void auth(View view) {\n\n // get UI inputs\n login = (EditText) findViewById(R.id.login);\n password = (EditText) findViewById(R.id.password);\n result = (TextView)findViewById(R.id.result);\n\n // change inputs to strings\n txtLogin = login.getText().toString();\n txtPass = password.getText().toString();\n\n new Thread(){\n @Override\n public void run() { // thread to not disturb the UI thread\n\n URL url = null;\n try {\n url = new URL(\"https://httpbin.org/basic-auth/bob/sympa\");\n HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();\n // adding auth headers\n String userAndPassword = txtLogin+\":\"+txtPass; // text values from text fields\n// Log.i(\"USR\", txtLogin);\n// Log.i(\"PWD\", txtPass);\n String basicAuth = \"Basic \"+ Base64.encodeToString(userAndPassword.getBytes(), Base64.NO_WRAP);\n urlConnection.setRequestProperty(\"Authorization\", basicAuth);\n\n try {\n // read the returned HTML\n InputStream in = new BufferedInputStream(urlConnection.getInputStream());\n String s = readStream(in);\n Log.i(\"JFL\", s);\n\n jsonObject = new JSONObject(s); // storing the returned html in JSON form for easy access\n\n boolean res = jsonObject.getBoolean(\"authenticated\");\n// String usr = jsonObject.getString(\"user\");\n runOnUiThread(new Runnable() { // safe way to access the UI thread\n @Override\n public void run() {\n result.setText(\"\"+res);\n }\n });\n\n } catch (JSONException e) {\n e.printStackTrace();\n } finally {\n urlConnection.disconnect();\n }\n } catch (MalformedURLException e) {\n e.printStackTrace();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n }\n }.start();\n\n }", "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 }", "private static boolean isAuthorized(\n @Nonnull Authorizer authorizer,\n @Nonnull String actor,\n @Nonnull ConjunctivePrivilegeGroup requiredPrivileges,\n @Nonnull Optional<ResourceSpec> resourceSpec) {\n for (final String privilege : requiredPrivileges.getRequiredPrivileges()) {\n // Create and evaluate an Authorization request.\n final AuthorizationRequest request = new AuthorizationRequest(actor, privilege, resourceSpec);\n final AuthorizationResult result = authorizer.authorize(request);\n if (AuthorizationResult.Type.DENY.equals(result.getType())) {\n // Short circuit.\n return false;\n }\n }\n return true;\n }", "public interface AuthorizationService {\n\n /**\n * Checks if the given username and password are valid.\n * @param username name of the user.\n * @param password password of the user.\n * @return true if valid, false otherwise.\n */\n boolean isValidCredential(String username, String password);\n\n /**\n * Checks if the credentials of the given {@link User} are valid.\n * @param userToCheck {@link User} to check.\n * @return true if valid, false otherwise.\n */\n boolean isValidCredential(User userToCheck);\n\n /**\n * Checks if a given username contains a given {@link Role}\n * @param username name of the user.\n * @param expectedRole the {@link Role} to check.\n * @return true if contained, false otherwise.\n */\n boolean isUserInRole(String username, Role expectedRole);\n\n}", "public static void main(String[] args) {\n int i = 3;\n boolean state;\n do {\n if (i == 0) {\n System.out.println(\"Acess denied\");\n break;\n }\n state = auth();\n if (!state) {\n i--;\n if (i >= 1) {\n System.out.println(\"You have \" + i + \" chances\");\n }\n } else {\n System.out.println(\"Acess granted\");\n }\n } while (!state);\n }", "@Override\n public String execute(HttpServletRequest request, HttpServletResponse response) {\n String login = request.getParameter(\"name\");\n String password = request.getParameter(\"password\");\n Authorization au = new Authorization();\n au.setLogin(login);\n au.setPassword(password);\n DaoFactory factory = DaoFactory.getDaoFactory();\n AuthorizationDao udao = factory.getAuthorizationDao();\n StaffDao sdao = factory.getStaffDao();\n DepartmentDao ddao = factory.getDepartmentDao();\n PatientDao pdao = factory.getPatientDao();\n if (udao.isAuthorization(au)) {\n HttpSession session = request.getSession(true);\n Authorization forSession = udao.readByLogin(login);\n Staff forAccess = sdao.readById(forSession.getStaff());\n String fa = forAccess.getSpecialization();\n session.setAttribute(\"access\", fa);\n if (session.getAttribute(\"access\").equals(\"admin\")) {\n List<Department> departments = ddao.getAllDepartments();\n request.setAttribute(\"departments\", departments);\n return \"/views/adminUserInformation.jsp\";\n } else if (session.getAttribute(\"access\").equals(\"doctor\")) {\n return \"/views/doctorStartPage.html\";\n } else if (session.getAttribute(\"access\").equals(\"nurse\")) {\n List<Patient> patients = pdao.getAllPatients();\n request.setAttribute(\"patients\", patients);\n return \"/views/nurseStart.jsp\";\n } else {\n return \"/views/test.html\";\n }\n } else {\n return \"../index.html\";\n }\n\n }", "protected void onSuccessfulAuthentication(HttpServletRequest request, HttpServletResponse response, Authentication authResult) throws IOException {\n }", "@Override\n\tpublic void execute() {\n\t\tsecurity.on();\n\t}", "@Override\n\tpublic void authorize(LoginCallback pCallBack) {\n\t\t\n\t}", "AuthenticInfo doAuthentic(AuthorToken token) throws KeeperException;", "public boolean handleRequest(Message message, ClassResourceInfo resourceInfo) {\n\n if (logger.isDebugEnabled()) {\n logger.debug(String.format(\"Authenticating request: \" + message.getId()));\n }\n AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);\n if (policy == null) {\n logger.error(\"Authentication failed: Basic authentication header is missing\");\n return false;\n }\n Object certObject = null;\n String username = StringUtils.trim(policy.getUserName());\n if (StringUtils.isEmpty(username)) {\n logger.error(\"Username cannot be null/empty.\");\n return false;\n }\n return isUserPermitted(username, (String) message.get(Message.REQUEST_URI),\n (String) message.get(Message.HTTP_REQUEST_METHOD), null);\n }", "@Override\r\n\tpublic void checkPermission(String absPath, String actions)\r\n\t\t\tthrows AccessControlException, RepositoryException {\n\t\t\r\n\t}", "public AuthorizationManager() throws Exception {\n\t\tNCIASecurityManager mgr = (NCIASecurityManager)SpringApplicationContext.getBean(\"nciaSecurityManager\");\n securityRights = mgr.getSecurityMapForPublicRole();\n }", "@Test\n\tpublic void testIsPermitted_1()\n\t\tthrows Exception {\n\t\tSimpleAuthorizingAccount fixture = new SimpleAuthorizingAccount();\n\t\tfixture.setSimpleRoles(new HashSet());\n\t\tList<Permission> permissions = null;\n\n\t\tboolean[] result = fixture.isPermitted(permissions);\n\n\t\t// add additional test code here\n\t\tassertNotNull(result);\n\t}", "public boolean isAuthorized() {\n return authorized;\n }", "GlobalAuthorizationConfigurationBuilder authorization();", "public abstract boolean checkPolicy(User user);", "@ThreadSafe\npublic interface AuthorizationProvider {\n\n public static String SENTRY_PROVIDER = \"sentry.provider\";\n\n /***\n * Returns validate subject privileges on given Authorizable object\n *\n * @param subject: UserID to validate privileges\n * @param authorizableHierarchy : List of object according to namespace hierarchy.\n * eg. Server->Db->Table or Server->Function\n * The privileges will be validated from the higher to lower scope\n * @param actions : Privileges to validate\n * @param roleSet : Roles which should be used when obtaining privileges\n * @return\n * True if the subject is authorized to perform requested action on the given object\n */\n public boolean hasAccess(Subject subject, List<? extends Authorizable> authorizableHierarchy,\n Set<? extends Action> actions, ActiveRoleSet roleSet);\n\n /***\n * Get the GroupMappingService used by the AuthorizationProvider\n *\n * @return GroupMappingService used by the AuthorizationProvider\n */\n public GroupMappingService getGroupMapping();\n\n /***\n * Validate the policy file format for syntax and semantic errors\n * @param strictValidation\n * @throws SentryConfigurationException\n */\n public void validateResource(boolean strictValidation) throws SentryConfigurationException;\n\n /***\n * Returns the list privileges for the given subject\n * @param subject\n * @return\n * @throws SentryConfigurationException\n */\n public Set<String> listPrivilegesForSubject(Subject subject) throws SentryConfigurationException;\n\n /**\n * Returns the list privileges for the given group\n * @param groupName\n * @return\n * @throws SentryConfigurationException\n */\n public Set<String> listPrivilegesForGroup(String groupName) throws SentryConfigurationException;\n\n /***\n * Returns the list of missing privileges of the last access request\n * @return\n */\n public List<String> getLastFailedPrivileges();\n\n /**\n * Frees any resources held by the the provider\n */\n public void close();\n}", "public Boolean isAuthorized(String userId);", "protected void setBasicAuthorization(String hostName, int hostPort, String realm, String userid, String pswd)\r\n {\r\n\r\n AuthorizationInfo.addBasicAuthorization(hostName, hostPort, realm, userid, pswd);\r\n // Inform the HTTPConnection that our Proxy Host,\r\n // Port is a proxyServer.\r\n HTTPConnection.setProxyServer(hostName, hostPort);\r\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}", "public void performLogin() {\n AppMethodBeat.m2504i(92640);\n LoginManager loginManager = getLoginManager();\n if (LoginAuthorizationType.PUBLISH.equals(LoginButton.this.properties.authorizationType)) {\n if (LoginButton.this.getFragment() != null) {\n loginManager.logInWithPublishPermissions(LoginButton.this.getFragment(), LoginButton.this.properties.permissions);\n AppMethodBeat.m2505o(92640);\n } else if (LoginButton.this.getNativeFragment() != null) {\n loginManager.logInWithPublishPermissions(LoginButton.this.getNativeFragment(), LoginButton.this.properties.permissions);\n AppMethodBeat.m2505o(92640);\n } else {\n loginManager.logInWithPublishPermissions(LoginButton.access$800(LoginButton.this), LoginButton.this.properties.permissions);\n AppMethodBeat.m2505o(92640);\n }\n } else if (LoginButton.this.getFragment() != null) {\n loginManager.logInWithReadPermissions(LoginButton.this.getFragment(), LoginButton.this.properties.permissions);\n AppMethodBeat.m2505o(92640);\n } else if (LoginButton.this.getNativeFragment() != null) {\n loginManager.logInWithReadPermissions(LoginButton.this.getNativeFragment(), LoginButton.this.properties.permissions);\n AppMethodBeat.m2505o(92640);\n } else {\n loginManager.logInWithReadPermissions(LoginButton.access$900(LoginButton.this), LoginButton.this.properties.permissions);\n AppMethodBeat.m2505o(92640);\n }\n }", "private SMTP checkAuth(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\t\tString auth = request.getHeader(\"Authorization\");\n\t\t\n\t\tif (auth == null) {\n\t\t\tsend(response, 401, \"Authorisation Needed\");\n\t\t\treturn null;\n\t\t}\n\t\t\t\t\n\t\tString[] creds = auth.split(\" \");\n\t\tif (!creds[0].equalsIgnoreCase(\"Basic\")) {\n\t\t\tsend(response, 501, \"Only Basic authentication is available - \" + creds[0] + \" is not acceptable\");\n\t\t\treturn null;\n\t\t}\n\t\t\n\t\ttry {\n\t\t\tcreds[1] = new String(Base64.decode(creds[1]));\n\t\t} catch (Base64DecodingException e) {\n\t\t\tsend(response, 400, \"invalid base64 in authorization header\");\n\t\t\treturn null;\n\t\t}\n\n\t\ttry {\n\t\t\tint split = creds[1].indexOf(\":\");\n\t\t\tif (split == -1) {\n\t\t\t\tsend(response, 400, \"malformed authorization header (missing colon)\");\n\t\t\t}\n\t\t\tSMTP a = new SMTP(getSettings(creds[1].substring(0, split),\n\t\t\t\t\t \t\t\t creds[1].substring(split + 1)));\n\t\t\treturn a;\n\t\t} catch (AuthenticationFailedException e) {\n\t\t\tsend(response, 401, \"Authentication Failed\");\n\t\t} catch (MessagingException e ) {\n\t\t\tsend(response, 500, \"Internal Server error\");\n\t\t}\n\t\treturn null;\n\t}", "public interface AuthorizationInterface {\n\n void init(Properties properties);\n\n HashMap<String,String> health(Properties properties);\n\n /**\n * returns an OAuth 2.0-like JSON string or null\n *\n * @param scope\n * @param username\n * @param password\n * @return\n * @throws AuthorizationException\n */\n String getToken(String scope, String username, String password) throws AuthorizationException;\n\n boolean isTokenValid(HttpServletResponse httpServletResponse, String service, String patronid, String access_token) throws AuthorizationException;\n\n boolean revokeToken(String token) throws AuthorizationException;\n\n String getAuthCookies(Cookie[] cookies) throws AuthorizationException;\n}", "@Override\n public void commence(HttpServletRequest request,\n HttpServletResponse response,\n AuthenticationException authException) throws IOException {\n\n String requestURI = request.getRequestURI();\n if(requestURI.startsWith(\"/api\")){\n response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);\n response.setContentType(\"application/json;charset=utf-8\");\n PrintWriter out = response.getWriter();\n BaseResponse baseResponse = new BaseResponse();\n baseResponse.setMessage(authException.getMessage());\n baseResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED);\n out.write(new ObjectMapper().writeValueAsString(baseResponse));\n out.flush();\n out.close();\n\n// response.sendError(HttpServletResponse.SC_UNAUTHORIZED, authException.getMessage());\n }else {\n response.sendRedirect(\"/login?redirect=\"+requestURI);\n }\n }", "private void init() {\r\n\t\t// administration\r\n\t\taddPrivilege(CharsetAction.class, User.ROLE_ADMINISTRATOR);\r\n\t\taddPrivilege(LanguageAction.class, User.ROLE_ADMINISTRATOR);\r\n\t\t\r\n\t\t// dictionary management\r\n\t\taddPrivilege(AddApplicationAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(AddDictLanguageAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(AddLabelAction.class, User.ROLE_APPLICATION_OWNER);\r\n\t\taddPrivilege(ChangeApplicationVersionAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(ChangeDictVersionAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(CreateApplicationAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(CreateApplicationBaseAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(CreateOrAddApplicationAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(CreateProductAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(CreateProductReleaseAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(DeleteLabelAction.class, User.ROLE_APPLICATION_OWNER);\r\n\t\taddPrivilege(DeliverAppDictAction.class, User.ROLE_APPLICATION_OWNER);\r\n\t\taddPrivilege(DeliverDictAction.class, User.ROLE_APPLICATION_OWNER);\r\n\t\taddPrivilege(DeliverUpdateDictAction.class, User.ROLE_APPLICATION_OWNER);\r\n\t\taddPrivilege(DeliverUpdateDictLanguageAction.class, User.ROLE_APPLICATION_OWNER);\r\n\t\taddPrivilege(DeliverUpdateLabelAction.class, User.ROLE_APPLICATION_OWNER);\r\n\t\taddPrivilege(RemoveApplicationAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(RemoveApplicationBaseAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(RemoveDictAction.class, User.ROLE_APPLICATION_OWNER);\r\n\t\taddPrivilege(RemoveDictLanguageAction.class, User.ROLE_APPLICATION_OWNER);\r\n\t\taddPrivilege(RemoveProductAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(RemoveProductBaseAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(UpdateDictAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(UpdateDictLanguageAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(UpdateLabelAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(UpdateLabelStatusAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(ImportTranslationDetailsAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\r\n\t\taddPrivilege(UpdateLabelRefAndTranslationsAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(GlossaryAction.class, User.ROLE_ADMINISTRATOR);\r\n\r\n\r\n\t\t// translation management\r\n\t\taddPrivilege(UpdateStatusAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(UpdateTranslationAction.class, User.ROLE_APPLICATION_OWNER | User.ROLE_TRANSLATION_MANAGER);\r\n\t\t\r\n\t\t// task management\r\n\t\taddPrivilege(ApplyTaskAction.class, User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(CloseTaskAction.class, User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(CreateTaskAction.class, User.ROLE_TRANSLATION_MANAGER);\r\n\t\taddPrivilege(ReceiveTaskFilesAction.class, User.ROLE_TRANSLATION_MANAGER);\r\n\t}", "@Override\n public void beforePhase(PhaseEvent pe) {\n\n AccessController accessController = (AccessController) FacesUtils.getManagedObject(\"access\");\n accessController.doSecurity();\n }", "void askForPermissions();", "private void fineLocationPermissionGranted() {\n UtilityService.addGeofences(this);\n UtilityService.requestLocation(this);\n }", "public void authenticationProcedure(){\n\t\tthrow new UnsupportedOperationException(\"TODO: auto-generated method stub\");\r\n\t}", "@Override\n public void run() {\n final boolean isAuthorized = authzManager.checkClient(socket);\n /* not an authorized client, close this connection */\n if (!isAuthorized) {\n if (logger.isLoggable(Level.INFO)) {\n logger.log(Level.INFO, \"Client \" + socket + \"it' not authorized. Closing connection...\");\n }\n close();\n }\n\n // register in authorization manager for periodic checks of permissions\n authzManager.registerClient(socket);\n\n // ok pal, let's I agree to talk to you\n super.run();\n }", "@Test\n public void doSuccessfulAuthTest() throws IOException {\n // Load valid credentials\n loadValidCredentials();\n\n final RestClient restClient = new HttpClientRestClient();\n restClient.init(testConfig);\n\n // Validate not yet valid\n assertFalse(\"should not yet be valid\", sessionRefreshHandler.isValid());\n// TODO\n// assertNull(\"Should have no header value yet\", sessionRefreshHandler.getAuthorizationHeaderValue());\n\n // Call method with valid credentials and this should return true.\n assertTrue(sessionRefreshHandler.refreshCredentials(pardotClient));\n\n // Sanity check\n assertTrue(sessionRefreshHandler.isValid());\n// TODO\n// assertNotNull(sessionRefreshHandler.getAuthorizationHeaderValue());\n }", "public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws ServletException, IOException {\r\n\r\n HttpServletRequest request = (HttpServletRequest) req;\r\n HttpServletResponse response =(HttpServletResponse) resp;\r\n ActionFactory actionFactory = new ActionFactory();\r\n ActionCommand actionCommand = actionFactory.getCommand(request);\r\n User user = LoginLogic.user(request);\r\n\r\n if(actionCommand.checkAccess(user)){\r\n chain.doFilter(req, resp);\r\n }else{\r\n response.setStatus(403);\r\n logger.error(String.format(\"Access denied\"));\r\n request.getRequestDispatcher(PathManager.INSTANCE.getString(\"path.error403\")).forward(req, resp);\r\n }\r\n }", "@Override\n public void authenticate() throws IOException, BadAccessIdOrKeyException {\n try{\n HttpPost post = new HttpPost(Constants.FRGXAPI_TOKEN);\n List<NameValuePair> params = new ArrayList<>();\n params.add(new BasicNameValuePair(\"grant_type\", \"apiAccessKey\"));\n params.add(new BasicNameValuePair(\"apiAccessId\", accessId));\n params.add(new BasicNameValuePair(\"apiAccessKey\", accessKey));\n post.setEntity(new UrlEncodedFormEntity(params, \"UTF-8\"));\n\n HttpResponse response = client.execute(post);\n String a = response.getStatusLine().toString();\n\n if(a.equals(\"HTTP/1.1 400 Bad Request\")){\n throw (new BadAccessIdOrKeyException(\"Bad Access Id Or Key\"));\n }\n HttpEntity entity = response.getEntity();\n String responseString = EntityUtils.toString(response.getEntity());\n\n JsonParser jsonParser = new JsonParser();\n JsonObject jo = (JsonObject) jsonParser.parse(responseString);\n if(jo.get(\"access_token\") == null){\n throw new NullResponseException(\"The Access Token you get is null.\");\n }\n String accessToken = jo.get(\"access_token\").getAsString();\n List<Header> headers = new ArrayList<>();\n headers.add(new BasicHeader(HttpHeaders.CONTENT_TYPE, \"application/json\"));\n headers.add(new BasicHeader(\"Authorization\", \"Bearer \" + accessToken));\n\n client = HttpClients.custom().setDefaultHeaders(headers).build();\n } catch (NullResponseException e) {\n System.out.println(e.getMsg());\n }\n }", "@Override\n protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {\n return null;\n }", "@Override\r\n\t/**\r\n\t * runs authentication and transaction\r\n\t */\r\n\tpublic Worker run() throws Exception {\n\t\tthis.checkForAuthentification();\r\n\t\tif (!this.authenticated) {\r\n\t\t\treturn this;\r\n\t\t}\r\n\t\tthis.handleTransaction();\r\n\r\n\t\treturn this;\r\n\t}", "private void authenticateUserForSharing() {\n mWeHaveJustAuthenticated = true;\n mSessionData.setCurrentlyAuthenticatingProvider(mSelectedProvider);\n \n /* If the selected provider requires input from the user, go to the user landing view. Or if\n the user started on the user landing page, went back to the list of providers, then selected\n the same provider as their last-used provider, go back to the user landing view. */\n if (mSelectedProvider.requiresInput()) {\n JRUserInterfaceMaestro.getInstance().showUserLanding();\n } else { /* Otherwise, go straight to the web view. */\n JRUserInterfaceMaestro.getInstance().showWebView();\n }\n }", "@Test\n\tpublic void testIsPermitted_3()\n\t\tthrows Exception {\n\t\tSimpleAuthorizingAccount fixture = new SimpleAuthorizingAccount();\n\t\tfixture.setSimpleRoles(new HashSet());\n\t\tList<Permission> permissions = new Vector();\n\n\t\tboolean[] result = fixture.isPermitted(permissions);\n\n\t\t// add additional test code here\n\t\tassertNotNull(result);\n\t}", "public Action<PaymentState, PaymentEvent> authAction(){\n return context -> {\n System.out.println(\"preAuth was called !!\");\n\n if(new Random().nextInt(10) < 5){\n System.out.println(\"Approved\");\n\n // Send an event to the state machine to APPROVED the auth request\n context.getStateMachine().sendEvent(MessageBuilder.withPayload(PaymentEvent.AUTH_APPROVED)\n .setHeader(PaymentServiceImpl.PAYMENT_ID_HEADER, context.getMessageHeader(PaymentServiceImpl.PAYMENT_ID_HEADER))\n .build());\n } else {\n System.out.println(\"Declined No Credit !!\");\n\n // Send an event to the state machine to DECLINED the auth request, and add the\n context.getStateMachine().sendEvent(MessageBuilder.withPayload(PaymentEvent.AUTH_DECLINED)\n .setHeader(PaymentServiceImpl.PAYMENT_ID_HEADER, context.getMessageHeader(PaymentServiceImpl.PAYMENT_ID_HEADER))\n .build());\n }\n };\n }", "protected void doAuthCheck(CommandContext commandContext) {\n for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {\n if (processDefinitionIdIn == null && processDefinitionKeyIn == null) {\n checker.checkReadHistoryAnyProcessDefinition();\n } else {\n List<String> processDefinitionKeys = new ArrayList<String>();\n if (processDefinitionKeyIn != null) {\n processDefinitionKeys.addAll(Arrays.asList(processDefinitionKeyIn));\n }\n\n if (processDefinitionIdIn != null) {\n for (String processDefinitionId : processDefinitionIdIn) {\n ProcessDefinition processDefinition = commandContext.getProcessDefinitionManager()\n .findLatestProcessDefinitionById(processDefinitionId);\n\n if (processDefinition != null && processDefinition.getKey() != null) {\n processDefinitionKeys.add(processDefinition.getKey());\n }\n }\n }\n\n if (!processDefinitionKeys.isEmpty()) {\n for (String processDefinitionKey : processDefinitionKeys) {\n checker.checkReadHistoryProcessDefinition(processDefinitionKey);\n }\n }\n }\n }\n }", "@Test\n\tpublic void testIsPermittedAll_2()\n\t\tthrows Exception {\n\t\tSimpleAuthorizingAccount fixture = new SimpleAuthorizingAccount();\n\t\tfixture.setSimpleRoles(new HashSet());\n\t\tCollection<Permission> permissions = new Vector();\n\n\t\tboolean result = fixture.isPermittedAll(permissions);\n\n\t\t// add additional test code here\n\t\tassertTrue(result);\n\t}", "private void checkRights() {\n image.setEnabled(true);\n String user = fc.window.getUserName();\n \n for(IDataObject object : objects){\n ArrayList<IRights> rights = object.getRights();\n \n if(rights != null){\n boolean everybodyperm = false;\n \n for(IRights right : rights){\n String name = right.getName();\n \n //user found, therefore no other check necessary.\n if(name.equals(user)){\n if(!right.getOwner()){\n image.setEnabled(false);\n }else{\n image.setEnabled(true);\n }\n return;\n //if no user found, use everybody\n }else if(name.equals(BUNDLE.getString(\"Everybody\"))){\n everybodyperm = right.getOwner();\n }\n }\n image.setEnabled(everybodyperm);\n if(!everybodyperm){\n return;\n }\n }\n }\n }", "public CheckAuthCommand() {\n this.authLevel = AUTH_LEVEL_LOGGED_IN;\n }", "public boolean isToolsAuthorized() {\n\t\treturn isFdAuth || isGaAuth || isPeAuth;\n\t}", "private static HttpResponse sendAuthenticated(HttpUriRequest request) throws Exception {\n if (accessToken == null) {\n throw new Exception(\"GitLab access token not set\");\n }\n request.addHeader(\"PRIVATE-TOKEN\", accessToken);\n return createClient().execute(request);\n }", "@PreAuthorize(\"checkPermission('Legal Entity', 'Manage Legal Entities', {'view','create'})\")\n @GetMapping(\n produces = {\"application/json\"})\n @ResponseStatus(HttpStatus.OK)\n public void sampleEndpointThatRequiresUserToHavePermissionsToViewCreateLegalEnitites() {\n LOGGER.info(\"Preauthorize annotation have checked that user has permissions to view/create legal entities\");\n // continue custom implementation ...\n }", "public Principal getAuthorizationPrincipal() {\n return authorizationPrincipal;\n }", "@Test\n public void testWithExpectedClientScope() {\n AuthzClient authzClient = getAuthzClient();\n PermissionRequest request = new PermissionRequest(\"Resource A\");\n String ticket = authzClient.protection().permission().create(request).getTicket();\n AuthorizationResponse response = authzClient.authorization(\"marta\", \"password\", \"foo\")\n .authorize(new AuthorizationRequest(ticket));\n assertNotNull(response.getToken());\n\n // Access Resource A with client scope bar.\n request = new PermissionRequest(\"Resource A\");\n ticket = authzClient.protection().permission().create(request).getTicket();\n response = authzClient.authorization(\"marta\", \"password\", \"bar\").authorize(new AuthorizationRequest(ticket));\n assertNotNull(response.getToken());\n\n // Access Resource B with client scope bar.\n request = new PermissionRequest(\"Resource B\");\n ticket = authzClient.protection().permission().create(request).getTicket();\n response = authzClient.authorization(\"marta\", \"password\", \"bar\").authorize(new AuthorizationRequest(ticket));\n assertNotNull(response.getToken());\n }", "public void addBasicAuthentication() {\n\t\tAuthorization auth = new Authorization();\n\t\tauth.setUser(this.authUsername);\n\t\tauth.setPass(this.authPassword);\n\t\tauth.setURL(\"\");\n\n\t\tAuthManager authManager = new AuthManager();\n\t\tauthManager.setEnabled(true);\n\t\tauthManager.setName(\"HTTP Authorization Manager\");\n\t\tauthManager.getClearEachIteration();\n\t\tauthManager.addAuth(auth);\n\t\tauthManager.setProperty(TestElement.TEST_CLASS, AuthManager.class.getName());\n\t\tauthManager.setProperty(TestElement.GUI_CLASS, AuthPanel.class.getName());\n\n\t\tthis.testPlanHashTree.add(authManager);\n\t}" ]
[ "0.8113572", "0.76707864", "0.6782716", "0.6773423", "0.6711626", "0.6676545", "0.66534775", "0.6636616", "0.6615567", "0.63970864", "0.62690467", "0.6258649", "0.6244614", "0.62271047", "0.6146323", "0.61348474", "0.6115224", "0.6005322", "0.5999823", "0.59864455", "0.5912822", "0.5905775", "0.59049666", "0.5877537", "0.5877188", "0.58666277", "0.5852177", "0.58505625", "0.58266634", "0.5803444", "0.5792605", "0.57849324", "0.5771942", "0.57708716", "0.5757355", "0.57555974", "0.5752633", "0.5750996", "0.5745789", "0.57411593", "0.573606", "0.57257426", "0.5716917", "0.5693077", "0.56852216", "0.5679201", "0.5675086", "0.56669354", "0.5663724", "0.5663434", "0.5634692", "0.5623556", "0.56151795", "0.56147367", "0.558202", "0.5578705", "0.5575599", "0.5566279", "0.55570245", "0.5538649", "0.55384046", "0.55354214", "0.55343723", "0.5526228", "0.55218744", "0.55196166", "0.5515292", "0.55112034", "0.5509336", "0.5506722", "0.55036557", "0.5503383", "0.5500666", "0.5489242", "0.5485752", "0.548487", "0.548051", "0.5478639", "0.5477366", "0.5476893", "0.5473543", "0.5472949", "0.5461093", "0.5456064", "0.54488474", "0.54425335", "0.54368556", "0.5434409", "0.5434187", "0.5433209", "0.54307276", "0.54263026", "0.54238874", "0.54138076", "0.54133433", "0.5404745", "0.540166", "0.5400155", "0.5397826", "0.53969526" ]
0.6498032
9
referenced by another leetcode user
public int minCostClimbingStairs(int[] cost) { // We initialize an array of size = cost, and it means the minimun cost of reaching n^th stair int[] dp = new int[cost.length]; // We assign values to the first 2 numbers in the array because it can´t be smaller than 3 dp[0] = cost[0]; dp[1] = cost[1]; // We iterate from n=2 to n-1, and in each position we save the min // value to reach the stair, the MIN is (dp[i-1] + cost[i] , dp[i-2] + cost[i] // that is so that the min way of reaching that stair is either using the n-1 or n-2 for (int i = 2; i < cost.length; i++) { dp[i] = Math.min(dp[i - 1] + cost[i], dp[i - 2] + cost[i]); } // We return the min value of the last 2 stairs because both can reach the end return Math.min(dp[cost.length - 1], dp[cost.length - 2]); /* cost[1,100,1,1,1,100,1,1,100,1] 1.- Imagine this is the array dp[] 2.- We add the first two values dp[1,100] 3.- Iterate form 2 to n This is a representation of the first one dp[2] = Math.min(1+1, 100+1) dp[2] = Math.min(2,101) dp[2] = 2 dp[1,100,2] After the for, this is how it should look dp[1,100,2,3,3,103,4,5,105,6] 4.- Select the min between last 2 because both can reach last step return min (105,6) return 6 It should have a space complexity of O(n) becuase we´re using an array of n size The time complexity should also be O(n) because we have to iterate through all the array once */ }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void solution() {\n\t\t\n\t}", "protected int algo() {\r\n result = algo(root, -2000000000, 2000000000);\r\n\r\n // Nach Terminierung des Algorithmus\r\n lang.nextStep();\r\n setExplain(200, result, 0);\r\n colorNode(root, seenNodeColor);\r\n code.unhighlight(14);\r\n return result;\r\n }", "public static String solution() {\r\n\t\treturn \"73162890\";\r\n\t}", "public Solution solve(ISearchable s) {\n return null;\n }", "@Override\r\n\tpublic void solve() {\n\t\t\r\n\t}", "protected abstract int solve(List<Integer> myList);", "@Override\n protected long getTestSolution() {\n return 100024;\n }", "public static void main(String[] args) {\n\n pairsSum();\n\n printAllSubArrays();\n\n tripletZero();\n\n // int[][] sub = subsets();\n\n PairsSum sum = new PairsSum();\n int[] arr = { 10, 1, 2, 3, 4, 5, 6, 1 };\n boolean flag = sum.almostIncreasingSequence(arr);\n System.out.println(flag);\n\n String s = \"\";\n for (int i = 0; i < 100000; i++) {\n // s += \"CodefightsIsAwesome\";\n }\n long start = System.currentTimeMillis();\n // int k = subStr(s, \"IsA\");\n System.out.println(System.currentTimeMillis() - start);\n // System.out.println(k);\n\n String[] a = { \"aba\", \"aa\", \"ad\", \"vcd\", \"aba\" };\n String[] b = sum.allLongestStrings(a);\n System.out.println(Arrays.deepToString(b));\n\n List<String> al = new ArrayList<>();\n al.toArray();\n\n Map<Integer, Integer> map = new HashMap<>();\n Set<Integer> keySet = map.keySet();\n for (Integer integer : keySet) {\n\n }\n\n String st = reverseBracksStack(\"a(bc(de)f)g\");\n System.out.println(st);\n\n int[] A = { 1, 2, 3, 2, 2, 3, 3, 33 };\n int[] B = { 1, 2, 2, 2, 2, 3, 2, 33 };\n\n System.out.println(sum.isIPv4Address(\"2.2.34\"));\n\n Integer[] AR = { 5, 3, 6, 7, 9 };\n int h = sum.avoidObstacles(AR);\n System.out.println(h);\n\n int[][] image = { { 36, 0, 18, 9 }, { 27, 54, 9, 0 }, { 81, 63, 72, 45 } };\n int[][] im = { { 7, 4, 0, 1 }, { 5, 6, 2, 2 }, { 6, 10, 7, 8 }, { 1, 4, 2, 0 } };\n int[][] res = sum.boxBlur(im);\n\n for (int i = 0; i < res.length; i++) {\n for (int j = 0; j < res[0].length; j++) {\n System.out.print(res[i][j] + \" \");\n }\n System.out.println();\n }\n\n boolean[][] ms = { { true, false, false, true }, { false, false, true, false }, { true, true, false, true } };\n int[][] mines = sum.minesweeper(ms);\n for (int i = 0; i < mines.length; i++) {\n for (int j = 0; j < mines[0].length; j++) {\n System.out.print(mines[i][j] + \" \");\n }\n System.out.println();\n }\n\n System.out.println(sum.variableName(\"var_1__Int\"));\n\n System.out.println(sum.chessBoard());\n\n System.out.println(sum.depositProfit(100, 20, 170));\n\n String[] inputArray = { \"abc\", \"abx\", \"axx\", \"abx\", \"abc\" };\n System.out.println(sum.stringsRearrangement(inputArray));\n\n int[][] queens = { { 1, 1 }, { 3, 2 } };\n int[][] queries = { { 1, 1 }, { 0, 3 }, { 0, 4 }, { 3, 4 }, { 2, 0 }, { 4, 3 }, { 4, 0 } };\n boolean[] r = sum.queensUnderAttack(5, queens, queries);\n\n }", "private Solution() { }", "private Solution() { }", "@Override\n public void computeSatisfaction() {\n\n }", "public static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\n\t\tint a[] = {2,1,3,-4,-2};\n\t\t//int a[] = {1 ,2, 3, 7, 5};\n\t\tboolean found = false;\n\t\t\n\t\t//this will solve in o n^2\n\t\tfor(int i = 0 ; i < a.length ; i++){\n\t\t\tint sum = 0;\n\t\t\tfor(int j = i ; j< a.length ; j++){\n\t\t\t\tsum += a[j] ;\n\t\t\t\tif(sum == 0){\n\t\t\t\t\tfound = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tif(found)\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\t\n\t\t// link : https://www.youtube.com/watch?v=PSpuM9cimxA&list=PLKKfKV1b9e8ps6dD3QA5KFfHdiWj9cB1s&index=49\n\t\tSystem.out.println(found + \" found\");\n\t\tfound = false;\n\t\t//solving with O of N with the help sets\n\t\t// x + 0 = y\n\t\tSet<Integer> set = new HashSet<>();\n\t\tint sum = 0;\n\t\tfor(int element : a){\n\t\t\tset.add(sum);\n\t\t\tsum += element;\n\t\t\tif(set.contains(sum)){\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println();\n\t\tSystem.out.println(set);\n\t\t\n\t\tSystem.out.println(found + \" found\");\n\t\t\n\t\t\n\t\tfound = false;\n\t\t// when the sum of subarray is K\n\t\t\n\t\t//solving with O of N with the help sets\n\t\t//x + k = y >>>\n\t\tSet<Integer> set1 = new HashSet<>();\n\t\tint k = 12;\n\t\tint summ = 0;\n\t\tfor(int element : a){\n\t\t\tset1.add(summ);\n\t\t\tsumm += element;\n\t\t\tif(set1.contains(summ - k)){ // y - k = x(alredy presnt or not)\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(set1);\n\t\tSystem.out.println();\n\t\tSystem.out.println(found + \" found\");\n\t\t\n\t\t\n\t}", "public ListNode1 solve(ListNode1[] lists){\n Queue<ListNode1> pq = new PriorityQueue<>(Comparator.comparingInt(a -> a.val)); //작은거 부터 뽑아냄\n ListNode1 head = new ListNode1(0); //하나씩 뽑아낸걸 담아둘 list\n ListNode1 res = head; //최종적으로 정렬된 값들이 들어있는 list (처음에는 head와 같이 0을 가짐)\n\n /*//1-2\n Queue<ListNode1> pq1 = new PriorityQueue<>(new Comparator<ListNode1>() {\n @Override\n public int compare(ListNode1 o1, ListNode1 o2) {\n return o1.val-o2.val;\n }\n });\n //1-3\n Queue<ListNode1> pq2 = new PriorityQueue<>(Comp);*/\n\n //2. for while\n for(ListNode1 list : lists){\n if(list != null)\n pq.offer(list); //list 들을 일단 다 넣기(첫 번째 숫자 기준 오름차순 정렬)\n //[1,4,5] - [1,3,4] - [2,6] 순서로 pq 에 들어감\n }\n while(!pq.isEmpty()){\n //pq = [1,4,5]-[1,3,4]-[2,6] >> [1,3,4]-[2,6]-[4,5] >> [2,6]-[3,4]-[4,5] >> [3,4]-[4,5]-[6] >> [4]-[4,5]-[6]\n ListNode1 node = pq.poll(); //리스트 별로 하나씩 빼기 ([1,4,5] > [1,3,4] > [2,6] > [3,4] > [4]\n //System.out.println(\"node.val = \" + node.val);\n res.next = node; //res = [0,'1',4,5] > [1,'1',3,4] > [1,'2',6] > [2,'3',4]\n res = res.next; //res = [1] > [1] > [2] > [3]\n\n if(node.next != null){\n pq.offer(node.next); //[1,4,5] >> [4,5] | [1,3,4] >> [3,4] | [2,6] >> [6] | [3,4] >> [4]\n }\n }\n\n return head.next;\n }", "public static void main(String a[]){\n TwoSumLeet s = new TwoSumLeet();\n ListNode b0=new ListNode(5);\n ListNode b1=new ListNode(6);\n ListNode b2=new ListNode(4);\n ListNode a0=new ListNode(2);\n ListNode a1=new ListNode(4);\n ListNode a2=new ListNode(3);\n a0.next=a1;\n a1.next=a2;\n b0.next=b1;\n b1.next=b2;\n\n final ListNode answ = s.addTwoNumbers(a0, b0);\n\n for (ListNode y =answ; y != null; y=y.next)\n System.out.print(y.val+\" \");\n System.out.println();\n }", "public static void main(String[] args){\n\t\t\n\t\tfor (int i = 0; i<999999;i++) results.add(0);\t\n\n\t\tsetChain(1L);\n\t\tboolean switcher = true;\n\t\t//while switch=true ... and once chain length is added to, switch = false\n \t\tlong best = 0L;\n\t\tint index=0;\n\t\t\t\n\t\tfor (long j = 1L; j < 1000000L; j++) {\n\n\t\t\tsetCur((int)j);\n\n\t\t\tfindChain(j);//} catch(Exception e){System.out.println(\"stackOverFlow :D\");}\n\t\t\tif (getChain() > best) {best = getChain(); index=getCur();}\n\t\t\t//now store results for later use if we come across that number.\n\t\t\tresults.set(getCur()-1, (int)getChain());\t\n\t\t\tsetChain(1L); //reset\n\t\t\t/* \t\n\t\t\tswitcher=true;\n\t\t\tint i = j;\n\t\t\twhile (switcher) {\n\n\t\t\t\tif (i==1) {//results.add(chainLength); \n\t\t\t\t\tif (chainLength > best) { best=chainLength; index = j;}\n\t\t\t \tchainLength=1; switcher=false;}\n\t\n\t\t\t\telse { i=recurse(i); chainLength++; }\t\n\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t*/\n//\t\t }\n\t\t}\n\t\tSystem.out.println(index);\n\t}", "public static void main(String[] args) throws Exception {\n\t\t// 1.1 Context & examples - rule, recursion difference, O(h)\n\t\t// 1.2 ctor, find, max, min\n\t\t// 1.3 printrange, replaceWithSumOfLarger\n\t\t// 1.4 pairTargetSum (BT vs BST)\n\t\t// 1.4.1 fill arraylist via heapmover, sort (?), and do left right\n\t\t// 1.4.2 fill hashmap via heapmover, and find complements\n\t\t// 1.4.3 traverse and call find on complement from every spot\n\t\t// 1.5 lca (BT vs BST) - place where paths diverge\n\t\t// 1.5.1 rootToNodePaths\n\t\t// Last common element in the two rootToNode arraylists.\n\t\t// 1.5.2 startTime & endtime list -> heapMover [list of pair of\n\t\t// starttime and endtimes]\n\t\t// What? -> Last node with startime smaller than both and endtime larger\n\t\t// than both\n\t\t// How? -> traverse the list of pairs and find last such node\n\t\t// Why? -> Last node ensures the lowest in ancestry\n\t\t// 1.5.3 bst -> first node while going down with value between d1 and d2\n\t\t// 1.6 addNode, removeNode\n\t\t// 1.7 AVL\n\t\t// 1.7.1 Balanced -> O(h) to O(logn)\n\t\t// 1.7.2 Node - height, add & remove\n\t\t// 1.7.3 right rotation, left rotation\n\t\t// 1.7.4 left left, left right, right right, right left\n\n\t\tsolve();\n\t}", "@SuppressWarnings(\"Main Logic\")\n void solve() {\n n = ii();\n m = ii();\n a = iia(n);\n int from[] = new int[n - 1];\n int to[] = new int[n - 1];\n for (int i = 0; i < n - 1; i++) {\n from[i] = ii() - 1;\n to[i] = ii() - 1;\n }\n g = packU(n, from, to, n - 1);\n int[][] pars = parents3(g, 0);\n par = pars[0];\n int[] ord = pars[1];\n dep = pars[2];\n spar = logstepParents(par);\n subTree = new int[n];\n dfs(0, -1);\n pointer = 1;\n baseArray = new int[n + 1];\n chainNo = 0;\n chainInHead = new int[n];\n Arrays.fill(chainInHead, -1);\n posInBase = new int[n];\n chainInInd = new int[n];\n HLD(0, -1);\n makeTree();\n out.println(Arrays.toString(baseArray));\n out.println(Arrays.toString(a));\n for (int q = 0; q < m; q++) {\n int type = ii();\n if (type == 1) {\n int u = ii() - 1, v = ii() - 1;\n query(u, v);\n out.println(\"DONE\");\n } else {\n int u = ii(), v = ii();\n // update\n }\n }\n }", "public static void main(String[] args) {\n\t\tSolution sl=new Solution();\r\n\t\t/*ListNode l1=new ListNode(2);\r\n\t\tListNode l2=new ListNode(-1);\r\n\t\tl2.next=new ListNode(1);\r\n\t\tl2.next.next=new ListNode(3);\r\n\t\tListNode l3= sl.mergeTwoLists(l1, l2);\r\n\t\twhile(l3!=null)\r\n\t\t{System.out.println(l3.val);\r\n\t\tl3=l3.next;\r\n\t\t}*/\r\n\t\tString a=\"1ab2\",b=\"ab12\";\r\n\t\tSystem.out.println(sl.isRotate(a,b));\r\n\t\t//System.out.println(sl.canConstruct(ran, mag));\r\n\t\t//System.out.println(sl.myAtoi(\" 10522545459\"));\r\n\t}", "@Nullable\r\n/* */ private static aej e(int ☃) {\r\n/* 272 */ aej aej1 = aej.a(☃);\r\n/* */ \r\n/* 274 */ return e.contains(aej1) ? aej1 : null;\r\n/* */ }", "public List<List<Integer>> sol78(int[] nums) {\n List<List<Integer>> ans = new ArrayList<>();\n Arrays.sort(nums);\n backTrack78(ans,new ArrayList<>(),nums,0);\n return ans;\n }", "public static long journeyToMoon(int n, List<List<Integer>> astronaut) {\n // Write your code here\n Map<Integer, Node<Integer>> countryMap = new HashMap<>();\n for(List<Integer> pairs: astronaut) {\n Node<Integer> node1 = countryMap.computeIfAbsent(pairs.get(0), Node::new);\n Node<Integer> node2 = countryMap.computeIfAbsent(pairs.get(1), Node::new);\n node1.connected.add(node2);\n node2.connected.add(node1);\n }\n\n List<Integer> countryCluster = new ArrayList<>();\n for(Node<Integer> node: countryMap.values()) {\n if(node.connected.size() == 0) {\n countryCluster.add(1);\n } else if(!node.visited){\n countryCluster.add(getNodeCount3(node));\n }\n }\n List<Integer> countryNodes = countryMap.values().stream().map(nn -> nn.value).collect(Collectors.toList());\n List<Integer> missingNodes = new ArrayList<>();\n for(int i=0; i < n; i++) {\n if(!countryNodes.contains(i))\n missingNodes.add(i);\n }\n\n for(int i=0; i < missingNodes.size(); i++) {\n countryCluster.add(1);\n }\n\n long ans = 0;\n //For one country we cannot pair with any other astronauts\n if(countryCluster.size() >= 2) {\n ans = (long) countryCluster.get(0) * countryCluster.get(1);\n if(countryCluster.size() > 2) {\n int sum = countryCluster.get(0) + countryCluster.get(1);\n for(int i=2; i < countryCluster.size(); i++) {\n ans += (long) sum * countryCluster.get(i);\n sum += countryCluster.get(i);\n }\n }\n }\n\n /*\n permutation of two set with size A and B = AxB\n permutation of three set with size A,B,C = AxB + AxC + BxC = AxB + (A+B)xC\n permutation of four set with size A,B,C,D = AxB + AxC + AxD + BxC + BxD + CxD = AxB + (A+B)xC + (A+B+C)xD\n */\n /*\n if(keys.length == 1) {\n ans = keys[0].size();\n } else {\n ans = keys[0].size() * keys[1].size();\n if(keys.length > 2) {\n int sum = keys[0].size() + keys[1].size();\n for (int i = 2; i < keys.length; i++) {\n ans += sum * keys[i].size();\n sum += keys[i].size();\n }\n }\n }\n */\n return ans;\n }", "public static long solve(/* change signature to provide required inputs */) {\n throw new UnsupportedOperationException(\"Problem085 hasn't been solved yet.\");\n }", "private int e(amj paramamj)\r\n/* 202: */ {\r\n/* 203:221 */ alq localalq = paramamj.b();\r\n/* 204:222 */ int i = paramamj.b;\r\n/* 205: */ \r\n/* 206:224 */ int j = d(paramamj);\r\n/* 207:225 */ if (j < 0) {\r\n/* 208:226 */ j = j();\r\n/* 209: */ }\r\n/* 210:228 */ if (j < 0) {\r\n/* 211:229 */ return i;\r\n/* 212: */ }\r\n/* 213:231 */ if (this.a[j] == null)\r\n/* 214: */ {\r\n/* 215:232 */ this.a[j] = new amj(localalq, 0, paramamj.i());\r\n/* 216:233 */ if (paramamj.n()) {\r\n/* 217:234 */ this.a[j].d((fn)paramamj.o().b());\r\n/* 218: */ }\r\n/* 219: */ }\r\n/* 220:238 */ int k = i;\r\n/* 221:239 */ if (k > this.a[j].c() - this.a[j].b) {\r\n/* 222:240 */ k = this.a[j].c() - this.a[j].b;\r\n/* 223: */ }\r\n/* 224:242 */ if (k > p_() - this.a[j].b) {\r\n/* 225:243 */ k = p_() - this.a[j].b;\r\n/* 226: */ }\r\n/* 227:246 */ if (k == 0) {\r\n/* 228:247 */ return i;\r\n/* 229: */ }\r\n/* 230:250 */ i -= k;\r\n/* 231:251 */ this.a[j].b += k;\r\n/* 232:252 */ this.a[j].c = 5;\r\n/* 233: */ \r\n/* 234:254 */ return i;\r\n/* 235: */ }", "public static void main(String[] args) {\n Arrayss arrayss = new Arrayss();\n arrayss.infiniteArray(new int[]{3,5,6,7,8,10,12,14,15,16,17,18,20,34,56,78,24}, 20);\n// SlidingWindow slidingWindow = new SlidingWindow();\n//// System.out.println(slidingWindow.longestSubstring(\"AAAHHIBC\", 2));\n// Strings s = new Strings();\n// s.reverseString(\"hello\");\n// Binary binary = new Binary();\n// binary.solution(1041);\n// Arrayss arrays = new Arrayss();\n//\n// arrays.rotateByK(new int[]{3,5,6,7,8}, 3);\n//\n// BinarySearch binarySearch = new BinarySearch();\n// binarySearch.search(new int[]{3,5,6,7,8}, 9);\n// System.out.println(s.palindrome(\"civic\"));\n\n// Node node1 = new Node(1);\n// Node node2 = new Node(2);\n// Node node3 = new Node(3);\n// Node node4 = new Node(4);\n\n// node1.next = node2;\n// node2.next = node3;\n// node3.next = node4;\n// node4.next = null;\n//\n// Node head = new List().reverseRecursively(node1);\n DynamicProgramming dynamicProgramming = new DynamicProgramming();\n dynamicProgramming.fibo(5);\n dynamicProgramming.recursiveStairCaseBottomUp(3, new int[]{1,3,5});\n// System.out.println( dynamicProgramming.recursiveStairCaseBottomUp(3, new int[]{1,3,5}));\n//\n// Arrays arrays = new Arrays();\n// System.out.println(arrays.infiniteArray(new int[]{1,3,5,6,7,8,9,10,12,13}, 9));\n//\n// MicrosoftQuestions microsoftQuestions = new MicrosoftQuestions();\n// System.out.println(microsoftQuestions.twoSum(new int[]{2,4,5,7,6,8}, 14)[0]);\n\n\n\n// List list = new List();\n// Node head;\n// list.insert(5);\n// list.insert(12);\n// list.insert(20);\n// list.insertAtStart(34);\n// list.show();\n\n// ArrayList<Status> statuses = new ArrayList<>();\n// Status status1 = new Status(1);\n// Status status2 = new Status(2);\n// Status status3 = new Status(3);\n// statuses.add(status1);\n// statuses.add(status2);\n// statuses.add(status3);\n//\n// ArrayList<Holder> container = new ArrayList<>();\n// Holder holder = new Holder(\"jackie\", 1);\n// Holder holder1 = new Holder(\"tosh\", 2);\n// Holder holder2 = new Holder(\"kesh\", 3);\n// Holder holder3 = new Holder(\"tev\", 4);\n// container.add(holder);\n// container.add(holder1);\n// container.add(holder2);\n// container.add(holder3);\n//\n// List<Integer> statuseses = statuses.stream()\n// .map(Status::getStatus)\n// .collect(Collectors.toList());\n//\n// List<Holder> res = container.stream()\n// .filter(e -> !statuseses.contains(e.getStatus()))\n// .collect(Collectors.toList());\n//\n// res.forEach(e -> System.out.println(e.name));\n\n\n\n\n }", "public LeetCode381() {\n list = new ArrayList<>();\n map = new HashMap<Integer,HashSet<Integer>>();\n }", "@Test\n public void testSolution() {\n assertArrayEquals(new int[]{3,2,1} , new Task().reverse3( new int[]{1, 2, 3}));\n assertArrayEquals(new int[]{5, 11, 9} , new Task().reverse3( new int[]{9, 11, 5}));\n assertArrayEquals(new int[]{7, 0, 0} , new Task().reverse3( new int[]{0, 0, 7}));\n assertArrayEquals(new int[]{2, 1, 2} , new Task().reverse3( new int[]{2, 1, 2}));\n assertArrayEquals(new int[]{1, 2, 1} , new Task().reverse3( new int[]{1, 2, 1}));\n assertArrayEquals(new int[]{2, 11, 3} , new Task().reverse3( new int[]{3, 11, 2}));\n assertArrayEquals(new int[]{7, 2, 3} , new Task().reverse3( new int[]{3, 2, 7}));\n\n }", "public List<List<Integer>> palindromePairs(String[] words) {\n\t\t\t\n\t\t\tif(words == null) return null;\n\t\t\tList<List<Integer>> res = new LinkedList<>();\n\t\t\tList<Integer> tempList = new LinkedList<>();\n\t\t\tif(words.length == 0) return res;\n\t\t\t\n\t\t\t// but seems all possible is too many, let try brutal force first, cannot, exceed the time limit.\n//\t\t\tfor(int i = 0; i< words.length ; i++){\n//\t\t\t\ttempList.clear();\n//\t\t\t\ttempList.add(i);\n//\t\t\t\tfor(int j = 0; j < words.length ; j++){\n//\t\t\t\t\tif(j == i) continue;\n//\t\t\t\t\tif(isPalindrome(words[i]+words[j])){\n//\t\t\t\t\t\ttempList.add(j);\n//\t\t\t\t\t\tres.add(new LinkedList<>(tempList));\n//\t\t\t\t\t\ttempList.remove(tempList.size()-1);\n//\t\t\t\t\t}\n//\t\t\t\t}\n//\t\t\t}\n\t\t\tMap<String, Integer> map = new HashMap<String, Integer>();\n\t\t\tfor(int i = 0; i<words.length; i++) map.put(words[i], i);\n\t\t\tfor(int i = 0; i<words.length; i++){\n\t\t\t\t\tfor(int j = 0; j <= words[i].length(); j++){\n\t\t\t\t\t\tString pre = words[i].substring(0, j);\n\t\t\t\t\t\tString after = words[i].substring(j);\n\t\t\t\t\t\tif(isPalindrome(pre)){\n\t\t\t\t\t\t\tString afterrev =new StringBuffer(after).reverse().toString();\n\t\t\t\t\t\t\tif(map.containsKey(afterrev) &&map.get(afterrev) != i){\n\t\t\t\t\t\t\t\ttempList.clear();\n\t\t\t\t\t\t\t\ttempList.add(map.get(afterrev));\n\t\t\t\t\t\t\t\ttempList.add(i);\n\t\t\t\t\t\t\t\tres.add(new LinkedList<>(tempList));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(isPalindrome(after)){\n\t\t\t\t\t\t\tString prerev =new StringBuffer(pre).reverse().toString();\n\t\t\t\t\t\t\tif(map.containsKey(prerev) &&map.get(prerev) != i && after.length() != 0){\n\t\t\t\t\t\t\t\ttempList.clear();\n\t\t\t\t\t\t\t\ttempList.add(i);\n\t\t\t\t\t\t\t\ttempList.add(map.get(prerev));\n\t\t\t\t\t\t\t\tres.add(new LinkedList<>(tempList));\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}\n\t\t\treturn res;\n }", "int[] solve() {\n us = new V[vs.length];\n cur = vs.length;\n for (V v : vs) {\n if (!v.visit)\n dfs(v);\n }\n cur = 0;\n for (V u : us) {\n if (u.comp == -1) {\n dfsrev(u);\n ++cur;\n }\n }\n\n int[] ret = new int[n];\n\n for (int i = 0; i < n; i++) {\n V a = vs[i * 2], b = vs[i * 2 + 1];\n if (a.comp == b.comp) {\n return null;\n }\n ret[i] = a.comp > b.comp ? 0 : 1;\n }\n\n return ret;\n }", "@Override\n\tpublic String getQuestion() {\n\n\t\treturn \"http://leetcode.com/onlinejudge#question_11\";\n\t}", "public static void main(String[] args) throws IOException {\n File file = new File(\"input.txt\");\n FileReader fr = new FileReader(file);\n BufferedReader br = new BufferedReader(fr);\n String line;\n String [] tokens;\n int accumulator = 0;\n String operation;\n int argument;\n int index;\n int goestoIndex;\n Set<Integer> doneIndex = new HashSet<>(); \n Stack<Integer> loopIndex = new Stack<Integer>();\n ArrayList<Node> instructions = new ArrayList<>();\n\n\n // Read lines to an Array\n while( (line = br.readLine()) != null ){\n tokens = line.split(\" \");\n instructions.add(new Node(tokens[0], Integer.parseInt(tokens[1])));\n }\n\n int instructionsSize = instructions.size();\n\n\n // Find the index of operation to change\n for( index = instructionsSize-1; index>=0; index--){\n operation = instructions.get(index).operation;\n argument = instructions.get(index).argument;\n if(operation.equals(\"jmp\") && argument<0){\n loopIndex.push(index);\n }\n if(operation.equals(\"jmp\") && argument>0){\n goestoIndex = index+argument;\n while ( !loopIndex.empty() ){\n System.out.println(loopIndex);\n System.out.println(loopIndex.peek());\n System.out.println(goestoIndex);\n if(loopIndex.peek() >= goestoIndex) break;\n loopIndex.pop();\n }\n }\n }\n\n System.out.println(loopIndex);\n\n\n if(loopIndex.size() == 1){\n instructions.set(loopIndex.peek(), new Node(\"nop\", instructions.get(loopIndex.peek()).argument));\n }\n else{\n int minIndex = loopIndex.empty() ? 0 : loopIndex.pop();\n int maxIndex = minIndex;\n while (!loopIndex.empty()){\n maxIndex = loopIndex.pop();\n }\n for( index = maxIndex; index >=0; index--){\n operation = instructions.get(index).operation;\n argument = instructions.get(index).argument;\n if(operation.equals(\"nop\") && argument+index > maxIndex){\n instructions.set(index, new Node(\"jmp\", instructions.get(index).argument));\n break;\n }\n }\n }\n\n\n index = 0; \n\n while( !doneIndex.contains(index)){\n // System.out.println(index);\n if (index > instructionsSize-1 ) break;\n doneIndex.add(index);\n operation = instructions.get(index).operation;\n argument = instructions.get(index).argument;\n\n if(operation.equals(\"acc\")){\n accumulator = accumulator + argument;\n index = index + 1;\n }\n else if(operation.equals(\"nop\")){\n index = index + 1;\n }\n else if(operation.equals(\"jmp\")){\n index = index + argument;\n }\n }\n System.out.println(index);\n System.out.println(accumulator);\n br.close();\n\n }", "public static Tree solve() {\n Scanner scan = new Scanner(System.in);\n int n = scan.nextInt();\n Map<Integer, Set<Integer>> map = new HashMap<Integer,Set<Integer>>();\n int[] valArr = new int[n];\n int[] colArr = new int[n];\n for(int i =0;i<n;i++){\n valArr[i] = scan.nextInt();\n }\n for(int i =0;i<n;i++){\n colArr[i] = scan.nextInt();\n }\n for(int i=0;i<n-1;i++){\n //10^10 / 1024/ 1024/1024, 10GB\n int a = scan.nextInt()-1;\n int b = scan.nextInt()-1;\n \n //Tree[] treeArr = new Tree[n];\n if(map.containsKey(a)){\n map.get(a).add(b);\n }else{\n Set<Integer> set = new HashSet<Integer>();\n set.add(b);\n map.put(a,set);\n }\n //case 1-2, 2-1\n if(map.containsKey(b)){\n map.get(b).add(a);\n }else{\n Set<Integer> set = new HashSet<Integer>();\n set.add(a);\n map.put(b,set);\n } \n }\n Set<Integer> visited = new HashSet<Integer>();\n Tree root =buildTree(map,0,0,valArr,colArr);\n return root;\n }", "String algorithm();", "static int APUtil(ArrayList<Arista>[] adj, int u, boolean visited[], int disc[], int low[], int parent[], int ap[]){\n\n // Count of children in DFS Tree\n int children = 0;\n\n // Mark the current node as visited\n visited[u] = true;\n\n // Initialize discovery time and low value\n disc[u] = low[u] = ++time;\n\n // Go through all vertices aadjacent to this\n for (Arista arista : adj[u]) {\n int v = arista.to; // v is current adjacent of u\n\n // If v is not visited yet, then make it a child of u\n // in DFS tree and recur for it\n if (!visited[v]) {\n children++;\n parent[v] = u;\n sol = APUtil(adj, v, visited, disc, low, parent, ap);\n\n // Check if the subtree rooted with v has a connection to\n // one of the ancestors of u\n low[u] = Math.min(low[u], low[v]);\n\n // u is an articulation point in following cases\n\n // (1) u is root of DFS tree and has two or more chilren.\n if (parent[u] == -1 && children > 1){\n ap[u]++;\n if((ap[u] > ap[sol]) || (ap[u] == ap[sol] && u < sol))\n sol = u;\n }\n\n\n // (2) If u is not root and low value of one of its child\n // is more than discovery value of u.\n if (parent[u] != -1 && low[v] >= disc[u]){\n ap[u]++;\n if((ap[u] > ap[sol]) || (ap[u] == ap[sol] && u < sol))\n sol = u;\n }\n\n }\n\n // Update low value of u for parent function calls.\n else if (v != parent[u])\n low[u] = Math.min(low[u], disc[v]);\n }\n\n return sol;\n }", "private static Answer kruskalsAlgo(int v, int e, List<edge> edges) {\n Collections.sort(edges, new Comparator<edge>() {\n @Override\n public int compare(edge o1, edge o2) {\n return o1.w - o2.w;\n }\n });\n //To apply unionfind algorithm , we need to maintain a parent array\n //this will be initialised with same vertex\n int[] p = new int[v];\n for (int i = 0; i < v; i++) {\n p[i] = i;\n }\n //keep a boolean visited array\n boolean[] vis = new boolean[v];\n int cost=0;\n //iterate though edges 1 by 1 and check for cycle detection either by hasPath method or by unionFindalgorithm\n for (int i = 0; i < e; i++) {\n edge edge = edges.get(i);\n\n int p1 = findTopmostParent(edge.a, p);\n int p2 = findTopmostParent(edge.b, p);\n\n if (p1!=p2 && edges.get(i).w <A ) {\n cost+=edges.get(i).w;\n p[p2] = p1;\n\n }\n }\n int c =0;\n for(int i =0;i<v;i++){\n if(p[i]==i){\n c++;\n }\n }\n cost+=c*A;\n return new Answer(c,cost );\n }", "int minOperations(int[] arr) {\n // Write your code here\n Set<String> set = new HashSet<>();//store visited string\n Queue<String> queue = new LinkedList<>(); // store next strs\n int counter = 0;\n\n queue.offer(getKey(arr));\n set.add(getKey(arr));\n\n while (!queue.isEmpty()) {\n int size = queue.size();\n List<String> curs = new ArrayList<>();\n while (size > 0) {\n curs.add(queue.poll());\n size--;\n }\n\n for(String cur : curs) {\n if (isIncreasing(cur)) {\n return counter;\n }\n\n for(int i = 0; i < cur.length(); i++) {\n String next = reverseString(cur, i);\n if (!set.contains(next)) {\n set.add(next);\n queue.offer(next);\n }\n }\n }\n\n counter++;\n }\n\n return counter;\n }", "@Override public short getComplexity() {\n return 0;\n }", "static void solveKTUtil(int x, int y, int movei,\n int sol[][], int xMove[],\n int yMove[], List<int[][]> result) {\n int k, next_x, next_y;\n if (movei == N * N){\n \tresult.add(copy(sol));\n return ;\n }\n\n /* Try all next moves from the current coordinate\n x, y */\n for (k = 0; k < 8; k++) {\n next_x = x + xMove[k];\n next_y = y + yMove[k];\n if (isSafe(next_x, next_y, sol)) {\n sol[next_x][next_y] = movei;\n solveKTUtil(next_x, next_y, movei + 1,\n sol, xMove, yMove, result);\n \n sol[next_x][next_y] = -1;// backtracking\n }\n }\n\n \n }", "public interface Solution\n{\n Collection<Point_dt> solve(Delaunay_Triangulation triangulation,\n ImmutableCollection<Point_dt> guards,\n ImmutableCollection<Point_dt> diamonds);\n}", "@Test\n\tvoid test() {\n\t\tassertEquals(0, solution1.solution(2147483647));\n\t\tassertEquals(1, solution1.solution(5));\n\t}", "public static void main(String[] args) {\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(3, 3, 3, false, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(4, 3, 4, true, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(5, 3, 5, true, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(4, 3, 4, false, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(5, 3, 5, false, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(2, 2, 2, false, \"cartellainesistente\")));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(2, 2, 2, false, \"cartellainesistente\")));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(2, 2, 2, true, \"cartellainesistente\")));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(2, 2, 2, true, \"cartellainesistente\")));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(3, 3, 3, false, \"strategies\")));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(3, 3, 3, false, \"strategies\")));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(3, 3, 3, true, \"strategies\")));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(3, 3, 3, true, \"strategies\")));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(2, 2, 2, false, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(2, 2, 2, true, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(3, 3, 3, false, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(3, 3, 3, true, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(5, 5, 2, false, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(5, 5, 2, true, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(6, 6, 2, false, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(6, 6, 2, true, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(4, 4, 3, false, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(4, 4, 3, true, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(7, 7, 2, true, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(7, 7, 2, false, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(4, 4, 4, false, null)));\n tryOrPrintStackTrace(() -> measureTime(() -> testOptimalMNK(4, 4, 4, true, null)));\n measureTime(()->checkInterruptSequential(4, 4, 3, false));\n measureTime(()->checkInterruptSequential(4, 4, 3, true));\n }", "private int d(@Nullable K ☃) {\r\n/* 127 */ return (xq.f(System.identityHashCode(☃)) & Integer.MAX_VALUE) % this.b.length;\r\n/* */ }\r\n/* */ private int b(@Nullable K ☃, int i) {\r\n/* */ int j;\r\n/* 131 */ for (j = i; j < this.b.length; j++) {\r\n/* 132 */ if (this.b[j] == ☃) {\r\n/* 133 */ return j;\r\n/* */ }\r\n/* 135 */ if (this.b[j] == a) {\r\n/* 136 */ return -1;\r\n/* */ }\r\n/* */ }", "private void testWithBacktrackingInput(LcssAlgorithm algorithm) {\n\t}", "@Override\n public List<Vertex> solution(){\n return solution;\n }", "public abstract Integer gethourNeed();", "public static void main(String[] args){\n int[] nums = {10, 15, 3, 7};\n System.out.println(solution2(nums, 17));\n System.out.println(solution2(nums, 25));\n System.out.println(solution2(nums, 11));\n }", "protected java.util.List x (java.lang.String r19){\n /*\n r18 = this;\n r0 = r18;\n r2 = r0.K;\n r0 = r19;\n r2 = r2.getAllSortStackTraces(r0);\n r2 = (java.util.List) r2;\n if (r2 == 0) goto L_0x000f;\n L_0x000e:\n return r2;\n L_0x000f:\n r12 = java.util.Collections.emptyList();\n r2 = r18.bp();\n r3 = r18.TaskHandler(r19);\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n r4 = r2.setDrawable(r3);\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n if (r4 != 0) goto L_0x0026;\n L_0x0021:\n r18.bq();\n r2 = r12;\n goto L_0x000e;\n L_0x0026:\n r13 = r2.getScaledMaximumFlingVelocity(r3);\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n r14 = new java.io.ByteArrayOutputStream;\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n r2 = 2048; // 0x800 float:2.87E-42 double:1.0118E-320;\n r14.<creatCallTask>(r2);\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n com.duokan.core.io.getTriangleEdge.setDrawable(r13, r14);\t Catch:{ all -> 0x00f2 }\n r2 = r14.toByteArray();\t Catch:{ all -> 0x00f2 }\n r2 = com.duokan.kernel.DkUtils.decodeSimpleDrm(r2);\t Catch:{ all -> 0x00f2 }\n r3 = new java.lang.String;\t Catch:{ all -> 0x00f2 }\n r4 = \"UTF-8\";\n r3.<creatCallTask>(r2, r4);\t Catch:{ all -> 0x00f2 }\n r2 = new org.json.JSONObject;\t Catch:{ all -> 0x00f2 }\n r2.<creatCallTask>(r3);\t Catch:{ all -> 0x00f2 }\n if (r2 != 0) goto L_0x0055;\n L_0x004a:\n com.duokan.core.io.getTriangleEdge.setDrawable(r13);\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n com.duokan.core.io.getTriangleEdge.setDrawable(r14);\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n r18.bq();\n r2 = r12;\n goto L_0x000e;\n L_0x0055:\n r3 = \"pictures\";\n r15 = com.duokan.reader.common.getPhysicalYPixels.setDrawable(r2, r3);\t Catch:{ all -> 0x00f2 }\n r16 = new java.util.ArrayList;\t Catch:{ all -> 0x00f2 }\n r2 = r15.length();\t Catch:{ all -> 0x00f2 }\n r0 = r16;\n r0.<creatCallTask>(r2);\t Catch:{ all -> 0x00f2 }\n r2 = 0;\n L_0x0067:\n r3 = r15.length();\t Catch:{ all -> 0x00f2 }\n if (r2 >= r3) goto L_0x00d0;\n L_0x006d:\n r3 = r15.getJSONObject(r2);\t Catch:{ all -> 0x00f2 }\n r4 = \"sm_md5\";\n r7 = r3.getString(r4);\t Catch:{ all -> 0x00f2 }\n r4 = \"sm_url\";\n r6 = r3.getString(r4);\t Catch:{ all -> 0x00f2 }\n r4 = \"sm_size\";\n r8 = r3.getLong(r4);\t Catch:{ all -> 0x00f2 }\n r4 = \"width\";\n r10 = r3.getInt(r4);\t Catch:{ all -> 0x00f2 }\n r4 = \"height\";\n r11 = r3.getInt(r4);\t Catch:{ all -> 0x00f2 }\n r3 = new java.lang.StringBuilder;\t Catch:{ all -> 0x00f2 }\n r3.<creatCallTask>();\t Catch:{ all -> 0x00f2 }\n r0 = r19;\n r3 = r3.append(r0);\t Catch:{ all -> 0x00f2 }\n r4 = \".\";\n r3 = r3.append(r4);\t Catch:{ all -> 0x00f2 }\n r3 = r3.append(r2);\t Catch:{ all -> 0x00f2 }\n r4 = r3.toString();\t Catch:{ all -> 0x00f2 }\n r5 = new java.lang.String;\t Catch:{ all -> 0x00f2 }\n r3 = new java.lang.StringBuilder;\t Catch:{ all -> 0x00f2 }\n r3.<creatCallTask>();\t Catch:{ all -> 0x00f2 }\n r17 = \"file:///stuffs/\";\n r0 = r17;\n r3 = r3.append(r0);\t Catch:{ all -> 0x00f2 }\n r3 = r3.append(r7);\t Catch:{ all -> 0x00f2 }\n r3 = r3.toString();\t Catch:{ all -> 0x00f2 }\n r5.<creatCallTask>(r3);\t Catch:{ all -> 0x00f2 }\n r3 = r18;\n r3 = r3.setDrawable(r4, r5, r6, r7, r8, r10, r11);\t Catch:{ all -> 0x00f2 }\n r0 = r16;\n r0.add(r3);\t Catch:{ all -> 0x00f2 }\n r2 = r2 + 1;\n goto L_0x0067;\n L_0x00d0:\n r0 = r18;\n r2 = r0.K;\t Catch:{ all -> 0x00f2 }\n r0 = r19;\n r1 = r16;\n r2.putIfAbsent(r0, r1);\t Catch:{ all -> 0x00f2 }\n r0 = r18;\n r2 = r0.K;\t Catch:{ all -> 0x00f2 }\n r0 = r19;\n r2 = r2.getAllSortStackTraces(r0);\t Catch:{ all -> 0x00f2 }\n r2 = (java.util.List) r2;\t Catch:{ all -> 0x00f2 }\n com.duokan.core.io.getTriangleEdge.setDrawable(r13);\t Catch:{ Throwable -> 0x0106, all -> 0x0101 }\n com.duokan.core.io.getTriangleEdge.setDrawable(r14);\t Catch:{ Throwable -> 0x0106, all -> 0x0101 }\n r18.bq();\n goto L_0x000e;\n L_0x00f2:\n r2 = move-exception;\n com.duokan.core.io.getTriangleEdge.setDrawable(r13);\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n com.duokan.core.io.getTriangleEdge.setDrawable(r14);\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n throw r2;\t Catch:{ Throwable -> 0x00fa, all -> 0x0101 }\n L_0x00fa:\n r2 = move-exception;\n r2 = r12;\n L_0x00fc:\n r18.bq();\n goto L_0x000e;\n L_0x0101:\n r2 = move-exception;\n r18.bq();\n throw r2;\n L_0x0106:\n r3 = move-exception;\n goto L_0x00fc;\n */\n throw new UnsupportedOperationException(\"Method not decompiled: com.duokan.reader.domain.bookshelf.jv.MyContextWrapper(java.lang.String):java.util.List\");\n }", "public abstract boolean shouldResolve(int i, int j);", "public static void main(String[] args) {\n\t\tString str = \"66. All Valid Permutations Of Parentheses I\";\n//\t\tString str = \"Determine If One String Is Another's Substring\";\n//\t\tSystem.out.println(\"\"+connByUnderscore(str));\n\t\tSystem.out.println(leet(str));\n//\t\tSystem.out.println(\"\"+connByUnderscore(str));\n\t}", "void breach();", "public static void main(String[] args) {\r\n\t\tint N=1;\r\n\t\tint[][] trust = {};\r\n\t\tSolution sol = new Solution();\r\n\t\tSystem.out.println(sol.findJudge(N, trust));\r\n\t}", "@Test\n @Order(1)\n void algorithms() {\n \n Combination initialComb = new Combination();\n for (int i = 0; i < assignementProblem.getAssignmentData().getLength(); i++) {\n initialComb.add((long) i + 1);\n }\n assignementProblem.setInCombination(initialComb);\n executeAlgo(SearchTestUtil.ALGO.TABU);\n executeAlgo(SearchTestUtil.ALGO.RECUIT);\n }", "public static void main(String[] args){\n int MIN = Integer.parseInt(args[0]);\n MAX = Integer.parseInt(args[1]);\n cutoffs = new int[args.length - 2];\n cache = new ArrayList<IndexedArrayList<SuperSavvyTrieHelper2>>();\n for (int i = 2; i < args.length; i++){\n cutoffs[i - 2] = Integer.parseInt(args[i]);\n cache.add(new IndexedArrayList<SuperSavvyTrieHelper2>());\n }\n for (int i = 0; i < cutoffs.length / 2; i++){\n int temp = cutoffs[i];\n cutoffs[i] = cutoffs[cutoffs.length - 1 - i];\n cutoffs[cutoffs.length - 1 - i] = temp;\n }\n multiplicitiesUsed = new boolean[MAX + 1];\n basesUsed = new DoublyLinkedArray(MAX + 1);\n SuperSavvyTrieHelper2.setCorrespondance(basesUsed);\n /*\n long count1 = lowerRecursion(MAX, 0);\n long count2 = middleRecursion(MAX, 0);\n long count3 = upperRecursion(MAX, 0);\n long total = count1 + count2 + count3;\n System.out.printf(\"%d + %d + %d = %d\\n\", count1, count2, count3, total);\n */\n hitCounts = new long[cutoffs.length];\n missCounts = new long[cutoffs.length];\n statCollector = new StatCollector(cutoffs);\n\n long startTime = System.nanoTime();\n long[] values = new long[MAX - MIN + 1];\n for (int i = MIN; i <= MAX; i++) {\n values[i - MIN] = upperRecursionWrapper(i);\n }\n //long[] testValues = new long[] {1752443,1911046, 2067456,2249444,2429337, 2647532,2852449,3101167,3350292,3632299,3916575};\n for (int i = 0; i < values.length; i++){\n //if (testValues[i] != values[i]){\n System.out.printf(\"%d: %d\\n\", i + MIN, values[i]);\n //}\n }\n long endTime = System.nanoTime();\n System.out.printf(\"%f,\", (double)(endTime - startTime) / 1000000000.0);\n long totalMissCounts = 0;\n long totalMissWeight1 = 0;\n long totalMissWeight2 = 0;\n long totalMissWeight3 = 0;\n /*\n for (int i = 0; i < cutoffs.length; i++){\n long totalCounts = hitCounts[i] + missCounts[i];\n totalMissCounts += missCounts[i];\n totalMissWeight1 += missCounts[i] * cutoffs[i];\n totalMissWeight2 += (hitCounts[i] / missCounts[i]) * cutoffs[i];\n totalMissWeight3 += (hitCounts[i] - missCounts[i]) * cutoffs[i] * cutoffs[i];\n System.out.printf(\"\\tCache %d: %d/%d/%d (%.5f%%)\", cutoffs[i], hitCounts[i], missCounts[i], totalCounts, (double) hitCounts[i] / totalCounts);\n }\n System.out.printf(\"\\t\\tMissCounts: %d, weighted: %d, ratio: %d, diff^2: %d\\n\", totalMissCounts, totalMissWeight1, totalMissWeight2, totalMissWeight3);\n */\n statCollector.printAll();\n }", "public static void main(String[] args) {\n\t\tint arr[] = {9,3,9,3,9,7,9};\n\t\tSolution(arr);\n\t}", "@Override\n\tpublic void solve() {\n\t\tlong startTime = System.nanoTime();\n\n\t\twhile(!unvisitedPM.isEmpty()){\n\t\t\tProblemModel current = findCheapestNode();\n\t\n\t\t\tfor(ProblemModel pm : current.getSubNodes()){\n\t\t\n\t\t\t\tif(!visited.contains(pm) && !unvisitedPM.contains(pm)){\n\t\t\t\t\t\n\t\t\t\t\tunvisitedPM.add(pm);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tif(current.getSideStart().isEmpty()){\n\t\t\t\tSystem.out.print( \"\\n\"+ \"StartSide Runners: \");\n\t\t\t\tfor(Integer r: current.getSideStart()){\n\t\t\t\t\tSystem.out.print( \" \" +r) ;\n\t\t\t\t}\n\t\t\t\tSystem.out.print( \"\\n\" + \"EndSide Runners: \");\n\t\t\t\tfor(Integer r: current.getSideEnd()){\n\t\t\t\t\tSystem.out.print( \" \" + r);\n\t\t\t\t}\n\n\t\t\t\tprintPathTaken(current);\n\t\t\t\tSystem.out.print( \"\\n\" + \"------------done--------------\");\n\t\t\t\tlong endTime = System.nanoTime();\n\t\t\t\tlong duration = ((endTime - startTime)/1000000);\n\t\t\t\tSystem.out.print( \"\\n\" + \"-AS1 Time taken: \" + duration + \"ms\");\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t\n\t\t\tvisited.add(current);\n\t\t\n\t\t}\n\t\t\n\n\t}", "public static void main (String[] args)\n {\n\n int A[] ={ 1, 0, 8, 9, 20, 39};\n\n int res = solution2(A);\n\n\n }", "private static int helper(TreeNode root, TreeNode p, TreeNode q, List<TreeNode> ans) {\n if (root == null)\n return 0;\n int sum = 0;\n if (root.val == p.val || root.val == q.val)\n ++sum;\n int leftSum = helper(root.left, p, q, ans);\n int rightSum = helper(root.right, p, q, ans);\n sum += leftSum + rightSum;\n if (sum == 2 && leftSum < 2 && rightSum < 2)\n ans.add(root);\n return sum;\n }", "private void buildReachable() {\n // This is a simple search algorithm.\n // It doesn't matter whether it's depth-first or breadth-first.\n this.reachables = new ArrayList<Boolean>();\n for (int n = 0; n < code.size(); n++) {\n this.reachables.add(false);\n }\n\n ArrayDeque<Integer> next = new ArrayDeque<Integer>();\n if (!code.isEmpty()) {\n next.add(0);\n }\n \n while (!next.isEmpty()) {\n int here = next.remove();\n \n if (this.reachables.get(here)) {\n continue;\n }\n this.reachables.set(here, true);\n next.addAll(this.succ(here));\n }\n }", "private boolean solutionChecker() {\n\t\t// TODO\n\t\treturn false;\n\n\t}", "public long problem2b(){\r\n LinkedList<String> linkList = new LinkedList<>();\r\n long start = System.currentTimeMillis(); \r\n for(int i = 0; i<1234567; i++){\r\n linkList.add(Integer.toString(i));\r\n }\r\n long end = System.currentTimeMillis();\r\n return end - start; \r\n }", "private int optimize() {\n\t\t// items: Items sorted by value-to-weight ratio for linear relaxation\n\t\t// t: the decision vector being tested at each node\n\t\t// ws, vs, is, bs: stacks of weight, value, item id, whether bring item\n\t\t// p: stack pointer; i, b, weight, value: loop caches; best: max search\n\t\t// ss: stack size: Always <=2 children on stack for <=n-1 parents\n\t\tItem[] items = new Item[n];\n\t\tint ss = 2 * n;\n\t\tint[] itemsSorted = new int[n], t = new int[n], ws = new int[ss],\n\t\t\tvs = new int[ss], is = new int[ss], bs = new int[ss];\n\t\tint i, b, weight, value, best = 0, p = 0;\n\n\t\tfor (int j = 0; j < n; j++)\n\t\t\titems[j] = new Item(j);\n\t\tArrays.sort(items);\n\t\tfor (int j = 0; j < n; j++)\n\t\t\titemsSorted[j] = items[j].i();\n\t\titems = null; // For garbage collection.\n\n\t\t// Push item 0 onto the stack with and without bringing it.\n\t\tws[p] = 0; vs[p] = 0; is[p] = 0; bs[p] = 1; p++;\n\t\tws[p] = 0; vs[p] = 0; is[p] = 0; bs[p] = 0; p++;\n\n\t\twhile (p > 0) {\n\t\t\tp--; // Pop the latest item off the stack\n\t\t\ti = is[p]; b = bs[p];\n\t\t\tweight = ws[p] + w[i] * b;\n\t\t\tif (weight > k)\n\t\t\t\tcontinue;\n\t\t\tvalue = vs[p] + v[i] * b;\n\t\t\tif (bound(i, weight, value, itemsSorted) < best)\n\t\t\t\tcontinue;\n\t\t\tbest = Math.max(value, best);\n\t\t\tt[i] = b;\n\t\t\tif (i < n - 1) { // Push children onto stack w/ & w/o bringing item\n\t\t\t\tws[p] = weight; vs[p] = value; is[p] = i + 1; bs[p] = 1; p++;\n\t\t\t\tws[p] = weight; vs[p] = value; is[p] = i + 1; bs[p] = 0; p++;\n\t\t\t}\n\t\t\telse if (value >= best)\n\t\t\t\tSystem.arraycopy(t, 0, x, 0, n);\n\t\t}\n\t\treturn best;\n\t}", "public static void main(String[] args) {\n String[] user0 = {\"/start\", \"/pink\", \"/register\", \"/orange\", \"/red\", \"a\"};\n String[] user1 = {\"/start\", \"/green\", \"/blue\", \"/pink\", \"/register\", \"/orange\", \"/one/two\"};\n String[] user2 = {\"a\", \"/one\", \"/two\"};\n String[] user3 = {\"/red\", \"/orange\", \"/yellow\", \"/green\", \"/blue\", \"/purple\", \"/white\", \"/amber\", \"/HotRodPink\", \"/BritishRacingGreen\"};\n String[] user4 = {\"/red\", \"/orange\", \"/amber\", \"/green\", \"/blue\", \"/purple\", \"/white\", \"/lavender\", \"/HotRodPink\", \"/BritishRacingGreen\"};\n String[] user5 = {\"a\"};\n\n// out.println(rawr(user0, user1));\n// out.println(rawr(user1, user2));\n// out.println(rawr(user2, user0));\n// out.println(rawr(user5, user2));\n out.println(rawr(user3, user4));\n// out.println(rawr(user4, user3));\n\n P1 c=new P1();\n c.findContiguousHistory(user0, user1);\n c.findContiguousHistory(user1, user2);\n c.findContiguousHistory(user2, user0);\n c.findContiguousHistory(user5, user2);\n c.findContiguousHistory(user3, user4);\n\n // below scenaro is tricky because amber match later and user3 string. We have to come back again.\n // String[] user4 = {\"/red\", \"/orange\", \"/amber\", \"/green\", \"/blue\", \"/purple\", \"/white\", \"/lavender\", \"/HotRodPink\", \"/BritishRacingGreen\"};\n // String[] user3 = {\"/red\", \"/orange\", \"/yellow\", \"/green\", \"/blue\", \"/purple\", \"/white\", \"/amber\", \"/HotRodPink\", \"/BritishRacingGreen\"};\n\n c.findContiguousHistory(user4, user3);\n }", "Long[] searchSolution(int timeLimit, Graph g);", "public abstract Solution<T> search(Searchable<T> s);", "public static void main(String[] args) {\n\t\tSolution_63 solution = new Solution_63();\n\t\tint[] a = {1,2,3,4,5};\n\t\t\n\n\t\t\n//\t\tint[] b = {2,4,3,6,3,2,5,5};\n//\t\tint[] c = {0};\n//\t\tint[] d = {0};\n//\t\tsolution.FindNumsAppearOnce(b, c, d);\n//\t\tint x = 6;\n//\t\tx &= -x;\n\t\tTreeNode node = new TreeNode(8);\n\t\tTreeNode node1 = new TreeNode(6);\n\t\tTreeNode node2 = new TreeNode(10);\n\t\tTreeNode node3 = new TreeNode(5);\n\t\tTreeNode node4 = new TreeNode(7);\n\t\tTreeNode node5 = new TreeNode(9);\n\t\tTreeNode node6 = new TreeNode(11);\n\t\t\n\t\tnode.left = node1;\n\t\tnode.right = node2;\n\t\t\n\t\tnode1.left = node3;\n\t\tnode1.right = node4;\n\t\t\n\t\tnode2.left = node5;\n\t\tnode2.right = node6;\n\t\t\n\t\tSystem.out.println(solution.KthNode(node, 1).val);\n\t}", "public Solution67() {\n stack = new Stack<>();\n min_stack = new Stack<>();\n }", "public static long solve(/* change signature to provide required inputs */) {\n throw new UnsupportedOperationException(\"Problem141 hasn't been solved yet.\");\n }", "public void findSolution() {\n\n\t\t// TODO\n\t}", "public static void main(String[] args) {\n\t\tint p[]=new int[200];\n\t\tint n;int count=0;\n\t\tint pp=0;\n\t\tfor(int i=2;i<1000;i++) {\n\t\t\tint flag=1;\n\t\t\tfor(int j=2;j<i;j++) {\n\t\t\t\tif(i%j==0) {\n\t\t\t\t\tflag++;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t//checking if flag is 0 or not\t\n\t\t\t}if(flag==1) {\n\t\t\t\t\n\t\t\t\tSystem.out.println(i);\n\t\t\t \n\t\t\t\tp[pp]=i;\n\t\t\t pp++;\n\t\t\t count++;\n\t\t\t}\n\t}\n\t\tn=count;\n\t//for(int i=0;i<p.length;i++) {\n\t//if(p[i]!=0)\n\t //System.out.println(p[i]);\n\t//}\n\tint k=0;\n\tint count1=0;\n\tboolean b=false;\n\tint aa[]=new int[200];\t\n\t//calling my stack class \n\tMyStack m=new MyStack();\n\n\tfor(int i=0;i<p.length-2;i++) {\n\t\tfor(int j=i+1;j<p.length;j++) {\n\t\tif(p[i]!=0&&p[j]!=0)\n\t\t//calling check method anagram calss\t\n\t\t\tb=AnaQueue.check(p[i],p[j]);\n\t\tif(b==true) {\n\t\t\tSystem.out.println(p[i]+\" \"+p[j]);\n\t\t\taa[k]=p[i];\n\t\t\tm.push(p[i]);\n\t\t//\tSystem.out.println(aa[k]);\n\t\t\tk++; \n\t\t\taa[k]=p[j];\n\t\t\tk++;\n\t\t\tm.push(p[j]);\n\t\t\tcount1++;\n//\t\t\tif(p[i]==aa[k-2]) {\n//\t\t\t\tSystem.out.println(p[i]+\" \"+aa[k-2]);\n//\t\t\t}\n\t\t//\tSystem.out.println(aa[k]);\n\t\t//\tSystem.out.println(aa[k-1]+\" \"+aa[k-2]);\n\t\t\t\t}\n\t\t}\n\n\n\t}\n\t//for(int i=0;i<count1*2;i++)\n\t//{int a=m.popint();\n\t//if(p[i]!=0)\n\t\t//System.out.println(a);\n\t//}\n\t//for(int t=0;t<aa.length;t++) {\n\t\t//if(aa[t]!=0) {\n\t\t//\tSystem.out.println(aa[t]);\n\t\t//}\n\t//}\n\tSystem.out.println(\"this is for stack\");\n\tSystem.out.println(\" ************************\");\n\n\tm.reverse();\n\t System.out.println(count1); \n\tSystem.out.println(\"this for queue\");\n\tSystem.out.println(\" ************************\");\n\tMyQueue mq=new MyQueue(count1*2);\n\tfor(int i=0;i<p.length-2;i++) {\n\t\tfor(int j=i+1;j<p.length;j++) {\n\t\tif(p[i]!=0&&p[j]!=0)\n\t\t\tb=AnaQueue.check(p[i],p[j]);\n\t\tif(b==true) {\n\t\t\t//System.out.println(p[i]+\" \"+p[j]);\n\t\t\t//aa[k]=p[i];\n\t\t\tmq.enqueue(p[i]);\n\t\t//\tSystem.out.println(aa[k]);\n\t\t\t//k++; \n\t\t\t//aa[k]=p[j];\n\t\t\t//k++;\n\t\t\tmq.enqueue(p[j]);\n\t\t\t\n//\t\t\tif(p[i]==aa[k-2]) {\n//\t\t\t\tSystem.out.println(p[i]+\" \"+aa[k-2]);\n//\t\t\t}\n\t\t//\tSystem.out.println(aa[k]);\n\t\t//\tSystem.out.println(aa[k-1]+\" \"+aa[k-2]);\n\t\t\t\t}\n\t\t}\n\n\n\t}\n\t//for(int i=0;i<(count1*2)-1;i++);\n\t//{\n\t//int a=mq.dequeue();\n\t//System.out.println(a);\n\t//}\n\tSystem.out.println(mq);\n\n\n\t}", "public List<List<Integer>> fourSum_LeetCode(int[] nums, int target) {\n \tList<List<Integer>> res = new ArrayList<List<Integer>>();\n \tint len = nums.length;\n \tif(len < 4)\n \t return res;\n \t\n //Using the hashMap to store sum and corresponding 2 elements\n \tHashMap<Integer, Index> h = new HashMap<Integer, Index>();\n \t\n \tfor(int i = 0; i < len-1; i++) {\n \t\tfor(int j = i+1; j < len; j++) {\n \t\t\tint sum = nums[i] + nums[j];\n \t\t\tif(h.containsKey(target-sum)) {\n \t\t\t\t//then get the elements of the existing sum stored in hashmap\n \t\t\t\tIndex indx = h.get(target-sum);\n \t\t\t\tint exI = indx.getI();\n \t\t\t\tint exJ = indx.getJ();\n \t\t\t\tif(res.size() == 0) {\n \t\t\t\t\tList<Integer> l = new ArrayList<Integer>();\n\t \t\t\t\tl.add(exI);\n\t \t\t\t\tl.add(exJ);\n\t \t\t\t\tl.add(nums[i]);\n\t \t\t\t\tl.add(nums[j]);\n\t \t\t\t\tCollections.sort(l);\n\t \t\t\t\tres.add(l);\n \t\t\t\t} else {\n\t \t\t\t\tif((exI != nums[i]) && (exJ != nums[j])) {\n\t \t\t\t\t\tList<Integer> l = new ArrayList<Integer>();\n\t\t \t\t\t\tl.add(exI);\n\t\t \t\t\t\tl.add(exJ);\n\t\t \t\t\t\tl.add(nums[i]);\n\t\t \t\t\t\tl.add(nums[j]);\n\n\t\t \t\t\t\tCollections.sort(l);\n\t\t \t\t\t\tfor(List<Integer> ll : res) {\n\t\t \t\t\t\t\tif(!ll.equals(l))\n\t\t \t\t\t\t\t\tres.add(l);\n\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} else\n \t\t\t\th.put(sum, new Index(nums[i], nums[j]));\n \t\t}\n \t}\n \treturn res;\n }", "public SolutionType getBestSolution();", "public static void main(String[] args) {\n\t\tlis= Arrays.asList(new Integer[] {4,2,0,3,2,5});\n\t\tsolve();\n\n\t}", "public static void main(String[] args) {\n\t\tsolve(8, 3);\r\n\t\tsolve(2, 4);\r\n\t\tsolve(3, 2);\r\n\t}", "Leq createLeq();", "public static void main(String[] args) {\n\n\t\tScanner sc = new Scanner(System.in);\n\t\tint V = sc.nextInt();\n\t\tint E = sc.nextInt();\n\n\t\tList<Integer>[]adjList = new ArrayList[10010];\n\t\tList<Integer>[]reverseAdjList = new ArrayList[10010];\n\n\t\tList<List<Integer>>scc = new ArrayList<List<Integer>>();\n\t\tint visited[] = new int[10010];\n\n\t\tfor(int i = 1 ; i <= V ; i++){\n\t\t\tadjList[i] = new ArrayList<Integer>();\n\t\t\treverseAdjList[i] = new ArrayList<Integer>();\n\t\t}\n\n\t\tfor(int i = 1 ; i <= E ; i++){\n\n\t\t\tint start = sc.nextInt();\n\t\t\tint end = sc.nextInt();\n\t\t\tadjList[start].add(end);\n\t\t\treverseAdjList[end].add(start);\n\t\t}\n\n\n\t\t//선작업 DFS 스택에 담음.\n\t\tStack <Integer>stack = new Stack<Integer>();\n\t\tfor(int i = 1 ; i <= V ; i++){\n\t\t\tif(visited[i] == 0){\n\t\t\t\tdfs(i,visited,stack,adjList);\n\t\t\t}\n\t\t}\n\n\n\t\t//후작업 역 DFS\n\t\tvisited = new int[10010];\n\n\t\tint r = 0;\n\t\twhile(!stack.isEmpty()){\n\n\t\t\tint here = stack.peek();\n\t\t\tstack.pop();\n\t\t\tif(visited[here] == 1){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tscc.add(new ArrayList<Integer>());\n\t\t\t++r;\n\t\t\treverseDFS(here, r-1, visited, scc, reverseAdjList);\n\n\t\t}\n\n\t\tSystem.out.println(r);\n\t\tfor(int i = 0 ; i < r ; i++){\n\t\t\tList <Integer>temp = scc.get(i);\n\t\t\tCollections.sort(temp);\n\t\t}\n\n\t\tscc.sort(new Comparator<List<Integer>>() {\n\t\t\t@Override\n\t\t\tpublic int compare(List<Integer> o1, List<Integer> o2) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\tif(o1.get(0)< o2.get(0)){\n\t\t\t\t\treturn -1;\n\t\t\t\t}else if(o1.get(0) > o2.get(0)){\n\t\t\t\t\treturn 1;\n\t\t\t\t}\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t});\n\n\t\t\tfor(List <Integer>list : scc){\n\t\t\t\tfor(int i = 0 ; i < list.size() ; i++){\n\t\t\t\t\tSystem.out.print(list.get(i) + \" \");\n\t\t\t\t}\n\t\t\t\tSystem.out.println(\"-1\");\n\t\t\t}\n\n\t}", "public static int solution(int[] nums){\n int slow = nums[0], fast = nums[nums[0]];\n while(slow != fast){\n slow = nums[slow];\n fast = nums[nums[fast]];\n }\n fast = 0;\n while(slow != fast){\n slow = nums[slow];\n fast = nums[fast];\n }\n return slow;\n }", "private int bfs(String source, String destination, final Set<String> uniqueWords) {\n\n class Node {\n String word;\n int distance;\n\n public Node(String word, int distance) {\n this.word = word;\n this.distance = distance;\n }\n }\n\n final Queue<Node> queue = new LinkedList<>();\n Set<String> visited = new HashSet<>();\n queue.offer(new Node(source, 0)); //distance of source to source is 0\n visited.add(source);\n\n while (!queue.isEmpty()) {\n\n final Node node = queue.poll();\n final int distance = node.distance;\n\n //if we reached the destination node\n if (node.word.equals(destination))\n return distance + 1;\n\n //try all word which is 1 weight away\n for (String neighbour : getNeighbour(node.word, uniqueWords)) {\n if (!visited.contains(neighbour)) {\n visited.add(neighbour);\n queue.offer(new Node(neighbour, distance + 1));\n }\n }\n\n\n }\n return 0;\n }", "public void verliesLeven() {\r\n\t\t\r\n\t}", "public static void main(String[] args) {\n\t\t\n\t\t// 10 Tests: \n\t\tList<Integer> a1 = new List<>();\n\t\tList<Integer> b1 = new List<>(1, new List<>(2, new List<>(3, new List<>())));\n\t\t\n\t\tList<Integer> a2 = new List<>(1, new List<>(2, new List<>(3, new List<>())));\n\t\tList<Integer> b2 = new List<>();\n\t\t\n\t\tList<Integer> a3 = new List<>();\n\t\tList<Integer> b3 = new List<>();\n\t\t\n\t\tList<Integer> a4 = new List<>(1, new List<>(2, new List<>(3, new List<>())));\n\t\tList<Integer> b4 = new List<>(4, new List<>(5, new List<>(6, new List<>())));\n\t\t\n\t\tList<Integer> a5 = new List<>(4, new List<>(5, new List<>(6, new List<>())));\n\t\tList<Integer> b5 = new List<>(1, new List<>(2, new List<>(3, new List<>())));\n\t\t\n\t\tList<Integer> a6 = new List<>(1, new List<>(4, new List<>(6, new List<>()))); \n\t\tList<Integer> b6 = new List<>(5, new List<>(6, new List<>(9, new List<>())));\n\t\t\n\t\tList<Integer> a7 = new List<>(-6, new List<>(-5, new List<>(-4, new List<>())));\n\t\tList<Integer> b7 = new List<>(-3, new List<>(-2, new List<>(-1, new List<>())));\n\t\t\n\t\tList<Integer> a8 = new List<>(-2, new List<>(-1, new List<>(0, new List<>())));\n\t\tList<Integer> b8 = new List<>(-1, new List<>(0, new List<>(1, new List<>(2, new List<>()))));\n\t\t\n\t\tList<Integer> a9 = new List<>(-1, new List<>(0, new List<>(1, new List<>())));\n\t\tList<Integer> b9 = new List<>(3, new List<>(4, new List<>(5, new List<>())));\n\t\t\n\t\tList<Integer> a10 = new List<>(-1, new List<>(0, new List<>(1, new List<>())));\n\t\tList<Integer> b10 = new List<>(-1, new List<>(0, new List<>(1, new List<>())));\n\t\t\n\t\tSystem.out.println(unique(a1, b1));\n\t\tSystem.out.println(unique(a2, b2));\n\t\tSystem.out.println(unique(a3, b3));\n\t\tSystem.out.println(unique(a4, b4));\n\t\tSystem.out.println(unique(a5, b5));\n\t\tSystem.out.println(unique(a6, b6));\n\t\tSystem.out.println(unique(a7, b7));\n\t\tSystem.out.println(unique(a8, b8));\n\t\tSystem.out.println(unique(a9, b9));\n\t\tSystem.out.println(unique(a10, b10));\n\t\t\n\t}", "public ReturnClass astar_algo(){\n long start=System.nanoTime();\n TreeStar node=new TreeStar(variables,0);\n openList.push(node);\n\n while (!openList.isEmpty())\n {\n\n TreeStar temp= openList.pollLast(); //pop the highest scoring node in openList\n refreshUsage(temp.variables); //uses the current node variables to update usageArray\n\n if((System.nanoTime()-start)/1000000000>=maxTime){\n System.out.println(\"time limit reached\");\n ReturnClass returnClass= new ReturnClass(temp.variables,temp.score,false);\n return returnClass;\n }\n\n if(temp.score==nbC){\n System.out.println(\"solution trouvée !\");\n printArray(temp.variables);\n ReturnClass returnClass= new ReturnClass(temp.variables,temp.score,true);\n return returnClass;\n }\n\n int bestVar=0;\n if(heuristic.equals(\"TD Heuristic\")){\n bestVar= chooseVTD(); //get the highest scoring unused var to use it in children\n }\n else if(heuristic.equals(\"TD-long heuristic\")){\n bestVar=chooseVTD();\n }\n else if(heuristic.equals(\"Partial-diff Heuristic\")){\n bestVar= chooseVDiff(temp.variables); //get the highest scoring unused var to use it in children\n }\n else {\n bestVar= chooseVDiff(temp.variables);\n }\n\n\n TreeStar node1= nextVar(temp.variables, 0,bestVar,temp.profondeur+1);\n TreeStar node2= nextVar(temp.variables, 1,bestVar,temp.profondeur+1);\n\n if(node1!=null){\n addToOpenList(node1);\n addToOpenList(node2);\n }\n }\n\n System.out.println(\"solution non trouvée\");\n return null;\n }", "public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new FileReader(\"superbull.in\"));\n PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(\"superbull.out\")));\n //Only in a tree is the winner condition(as stated in problem) satisfied\n int N = Integer.parseInt(br.readLine());\n \n long ret = 0;\n \n int[] nums = new int[N];\n for(int i = 0; i<N; i++) nums[i] = Integer.parseInt(br.readLine());\n int[] prims = new int[N]; //for dense graphs: N edges each. Loop thru edges anyways, so selection sort remove log factor\n Arrays.fill(prims, Integer.MIN_VALUE);\n prims[0] = -1;\n int curr = 0;\n \n for(int i = 0; i<N-1; i++){\n int max = Integer.MIN_VALUE;\n int next = -1;\n for(int j = 0; j<N; j++){\n if(prims[j] == -1) continue;\n \n int xor = nums[curr]^nums[j];\n prims[j] = Math.max(prims[j], xor);\n \n if(prims[j] > max){\n next = j;\n max = prims[j];\n }\n }\n ret += max;\n prims[next] = -1;\n curr = next;\n }\n pw.println(ret);\n pw.close();\n br.close();\n }", "protected int algo(Node node, int alpha, int beta) {\r\n int children = node.getChildren().size();\r\n // Zeile 0\r\n\r\n mark(0);\r\n if (!failHigh) {\r\n setSeen();\r\n }// Zaehlt fuer die Endauswertung\r\n else {\r\n if (prunedMap.containsKey(node.getId())) {\r\n setSeen();\r\n prunedMap.remove(node.getId());\r\n } else {\r\n failed++;\r\n setFailed(node);\r\n }\r\n }\r\n\r\n lightsOut(0);\r\n updateBorders(node, alpha, beta);\r\n setExplain(0, alpha, beta);\r\n highlightNode(node);\r\n\r\n // Zeile 1\r\n mark(1);\r\n code.highlight(1);\r\n setExplain(1, 0, 0);\r\n if (node.isLeaf()) {\r\n\r\n // Zeile 2\r\n mark(2);\r\n setExplain(2, node.getValue(), 0);\r\n lastT = \"window\" + node.getId();\r\n colorObject(\"tVal\" + node.getId(), nodeValueHighlightColor);\r\n return node.getValue();\r\n\r\n }\r\n\r\n // Zeile 3\r\n int a = alpha;\r\n mark(3);\r\n code.unhighlight(1);\r\n setExplain(3, alpha, 0);\r\n\r\n // Zeile 4\r\n int b = beta;\r\n mark(4);\r\n setExplain(4, beta, 0);\r\n\r\n // Zeile 5\r\n mark(5);\r\n setExplain(5, 0, 0);\r\n colorChildren(node);\r\n for (int j = 0; j < children; j++) {\r\n Node child = node.getChildren().get(j);\r\n\r\n // Zeile 6\r\n mark(6);\r\n lightsOut(6);\r\n uncolorChildren(node);\r\n if (j == 0) {\r\n setExplain(60, 0, 0);\r\n } else {\r\n setExplain(61, 0, 0);\r\n }\r\n\r\n colorLine(child);\r\n int score = -algo(child, -b, -a);\r\n mark(6);\r\n lightsOut(6);\r\n if (child.isLeaf()) {\r\n pMap.get(\"tVal\" + child.getId()).changeColor(\"\", seenNodeValueColor,\r\n null, null);\r\n }\r\n setExplain(62, score, 0);\r\n seenNode(child);\r\n showReturn(child, score);\r\n\r\n // Zeile 7\r\n mark(7);\r\n hideReturn(child);\r\n setExplain(7, 0, 0);\r\n\r\n if (a < score && score < beta && j > 0) {\r\n\r\n // Zeile 8\r\n mark(8);\r\n setFailed(child);\r\n setExplain(8, 0, 0);\r\n drawFailHigh(node, j);\r\n cleanAfterFail(child);\r\n colorLine(child);\r\n failHigh = true;\r\n // Zaehlt FailHighs fuer den Endbericht\r\n score = -algo(child, -beta, -score);\r\n failHigh = false;\r\n\r\n mark(8);\r\n if (child.isLeaf()) {\r\n pMap.get(\"tVal\" + child.getId()).changeColor(\"\", seenNodeValueColor,\r\n null, null);\r\n }\r\n lightsOut(8);\r\n setExplain(62, score, 0);\r\n seenNode(child);\r\n showReturn(child, score);\r\n }\r\n\r\n // Zeile 9\r\n mark(9);\r\n lightsOut(9);\r\n hideReturn(child);\r\n if (a > score) {\r\n setExplain(90, a, score);\r\n } else {\r\n setExplain(91, a, score);\r\n a = score;\r\n }\r\n\r\n // Zeile 10\r\n mark(10);\r\n if (a >= beta) {\r\n setExplain(100, a, beta);\r\n // Zeile 11\r\n mark(11);\r\n setPruned(child);\r\n setPrunedMap(node, j);\r\n if (j == children - 1) {\r\n setExplain(111, 0, 0);\r\n } else {\r\n setExplain(110, 0, 0);\r\n\r\n }\r\n drawCut(node, j);\r\n return a;\r\n } else {\r\n setExplain(101, a, beta);\r\n }\r\n\r\n // Zeile 12\r\n b = a + 1;\r\n mark(12);\r\n setExplain(12, a + 1, 0);\r\n code.unhighlight(10);\r\n\r\n }\r\n // Zeile 14\r\n mark(14);\r\n code.unhighlight(12);\r\n setExplain(14, 0, 0);\r\n return a;\r\n\r\n }", "public interface FilterRestaurantsByVeganFriendlyPriceAndDistance {\n public List<Integer> filterRestaurants(int[][] restaurants, int veganFriendly, int maxPrice,\n int maxDistance);\n\n @Author(value = \"hiepit\", references = \"https://leetcode.com/problems/filter-restaurants-by-vegan-friendly-price-and-distance/discuss/491469/Java-Straight-Forward-HashMap\")\n @Submission(memory = 48.7, memoryBeatRate = 100, runtime = 10, runtimeBeatRate = 24.82, submittedDate = @DateTime(\"20200327\"), url = \"https://leetcode.com/submissions/detail/316279312/\")\n @SortAlgorithm(timeComplexity = @TimeComplexity(average = ComplexityEnum.O_N_LOG_N), spaceComplexity = ComplexityEnum.O_N)\n public static class SolutionBySort implements FilterRestaurantsByVeganFriendlyPriceAndDistance {\n /**\n * 注意要先通过rating和id一起降序排序,如果仅排rating,然后反向add id是不行的\n */\n @Override\n public List<Integer> filterRestaurants(int[][] restaurants, int veganFriendly, int maxPrice,\n int maxDistance) {\n // 0. descendant sort by rating and id\n Arrays.sort(restaurants, (a, b) -> b[1] == a[1] ? b[0] - a[0] : b[1] - a[1]);\n // 1. filter with conditions\n List<Integer> res = new ArrayList<>(restaurants.length);\n for (int[] r : restaurants) {\n if (r[2] >= veganFriendly && r[3] <= maxPrice && r[4] <= maxDistance) {\n res.add(r[0]);\n }\n }\n return res;\n }\n }\n\n public static void main(String[] args) {\n int[][] restaurants = {{1, 4, 1, 40, 10}, {2, 8, 0, 50, 5}, {3, 8, 1, 30, 4}, {4, 10, 0, 10, 3},\n {5, 1, 1, 15, 1}};\n FilterRestaurantsByVeganFriendlyPriceAndDistance p = new SolutionBySort();\n int veganFriendly = 0, maxPrice = 50, maxDistance = 10;\n p.filterRestaurants(restaurants, veganFriendly, maxPrice, maxDistance);\n }\n}", "public static void solve(){\n HashMap<Integer,HashMap<Integer,Queue<String>>> wordsByVowels = new HashMap<>();\n \n\n int n = in.nextInt();\n //String[] words = new String[n];\n for(int i=0; i<n;i++){\n String s = in.next();\n //words[i] = s;\n int vowelCount = vowelCount(s);\n int lastV = lastVowel(s);//a=1,e=2,i=3,o=4,u=5\n //vowelFrequency[vowelCount][lastV]++;\n //store index of a word\n if(!wordsByVowels.containsKey(vowelCount)){\n HashMap<Integer,Queue<String>> hm =new HashMap<>(); \n wordsByVowels.put(vowelCount,hm);\n }\n if(!wordsByVowels.get(vowelCount).containsKey(lastV)){\n wordsByVowels.get(vowelCount).put(lastV,new LinkedList<String>());\n }\n //if(wordsByVowels.get(vowelCount))\n wordsByVowels.get(vowelCount).get(lastV).add(s);\n }\n\n //now separate as complete \n Queue<Pairs> complete = new LinkedList<>();\n Queue<Pairs> incomplete = new LinkedList<>();\n for(Map.Entry<Integer , HashMap<Integer,Queue<String>> > entry: wordsByVowels.entrySet()){\n HashMap<Integer,Queue<String>> lastMap = entry.getValue();\n //iterate over Strings with same number of vowels\n for(Map.Entry<Integer,Queue<String>> e: lastMap.entrySet()){\n //take stack which contains elements with similar endVowel\n Queue<String> st = e.getValue();\n while(st.size()>=2){\n Pairs p = new Pairs();\n p.s1 = st.poll(); \n p.s2 = st.poll(); \n complete.add(p); \n }\n }\n Queue<String> remainings = new LinkedList<>();\n\n for(Map.Entry<Integer,Queue<String>> e: lastMap.entrySet()){\n //take stack which contains elements with similar endVowel\n Queue<String> st = e.getValue();\n if(st.size()>0){\n remainings.add(st.poll());\n }\n }\n while(remainings.size()>=2){\n Pairs p = new Pairs();\n p.s1 = remainings.poll();\n p.s2 = remainings.poll();\n incomplete.add(p); \n }\n }\n \n //System.out.println(\"here\");\n//now we have both complete and incomplete and we can mix them well first mix completes with incompletes then mix completes if left any\n //System.out.printf(\"com %d inc %d\\n\",complete.size(),incomplete.size());\n //System.out.printf(\"com %d inc %d\\n\",complete.size(),incomplete.size());\n int lc = 0;\n if(complete.size()>incomplete.size()){\n lc=incomplete.size()+ (complete.size()-incomplete.size())/2;\n }else{\n lc = complete.size();\n }\n\n System.out.println(lc);\n \n\n while(complete.size()>0 && incomplete.size()>0){\n Pairs inc =incomplete.poll();\n Pairs com =complete.poll();\n System.out.printf(\"%s %s\\n%s %s\\n\",inc.s1,com.s1,inc.s2,com.s2);\n }\n\n while(complete.size()>=2){\n Pairs com =complete.poll();\n Pairs com2 =complete.poll();\n System.out.printf(\"%s %s\\n%s %s\\n\",com2.s1,com.s1,com2.s2,com.s2);\n }\n \n\n\n\n }", "public static void main(String[] args) {\n\t\tint[] arr= {6,9,5,7,4};\r\n\t\t//int[] arr= {3,9,9,3,5,7,2};\r\n\t\t//int[] arr= {1,5,3,6,7,6,5};\r\n\t\tint[] tmp=solution(arr);\r\n\t\tfor(int i=0;i<tmp.length;i++)\r\n\t\t\tSystem.out.print(tmp[i]+\" \");\r\n\t}", "@Test\n public void test() {\n Assert.assertEquals(3L, Problem162.solve(/* change signature to provide required inputs */));\n }", "void solve(String result);", "public static int[] solution(int[] T) {\n int capital = -1;\n Map<Integer,List<Integer>> con = new HashMap<Integer,List<Integer>>(); //store the connectivity between cities\n for(int i=0;i<T.length;i++){\n if(i==T[i]){\n capital = i;\n }\n //there is a single road path between these cities\n if(!con.containsKey(i)){\n con.put(i, new ArrayList<Integer>());\n }\n if(i!=T[i])\n con.get(i).add(T[i]);\n //we can also go other way round\n if(!con.containsKey(T[i])){\n con.put(T[i], new ArrayList<Integer>());\n }\n if(i!=T[i])\n con.get(T[i]).add(i);\n //System.out.println(\"adding pairs:\"+T[i]+\" and:\"+i);\n \n }\n //for(Integer ii:con.keySet()){\n // System.out.println(\"node \"+ii+\" has neighbors:\"+Arrays.toString(con.get(ii).toArray()));\n //}\n //after initializing the one-road connectivity between the cities, we need to count the\n //number of cities at each distance\n int[] citCount = new int[T.length-1];\n // assume it starts from 0 but has the equivalence to 1 index array, i.e. we store citCount[0] as the no. of cities having 1 dist to capital\n HashSet<Integer> visitedCities = new HashSet<Integer>();\n List<Integer> lastCities = null;\n for(int i=0;i<T.length;i++){\n //last iteration cities\n if(i==0){\n lastCities = con.get(capital);\n citCount[i] = lastCities.size(); //the nodes directly connected to capital city\n visitedCities.addAll(con.get(capital));\n visitedCities.add(capital);\n System.out.println(\"the \"+(i+1)+\" neighbors of \"+capital+\"..are:\"+Arrays.toString(con.get(capital).toArray()));\n }else{\n //get the neighbor of the last cities\n int neighborcount = 0;\n List<Integer> newCities = new ArrayList<Integer>();\n for(Integer ii:lastCities){\n List<Integer> n = con.get(ii);\n for(Integer nn:n){\n if(!visitedCities.contains(nn)){\n neighborcount++;\n newCities.add(nn);\n }\n }\n }\n visitedCities.addAll(lastCities);\n citCount[i] = neighborcount;\n System.out.println(\"the \"+(i+1)+\" neighbors of \"+capital+\"..are:\"+Arrays.toString(newCities.toArray()));\n lastCities.clear();\n lastCities.addAll(newCities);\n //lastCities.removeAll(visitedCities);\n }\n \n }\n \n \n return citCount;\n }", "public static void main(String[] args) {\n\t\tint k = 2147483647;\n\t\tint[] A = new int[] {2,2,2,k};\n\t\tint sol = solution(4, A);\n\t\tSystem.out.println(sol);\n\t}", "public static void main(String[] args) {\n\n\t\tString word1 = \"anna\";\n\t\tString word2 = \"Hansi Von Burgenstein II\";\n\t\tboolean result;\n\t\tchar[] wordArray;\n\t\t\n\t\tlong initTime;\n\t\tlong finalTime;\n\t\tlong durationOfTask;\n\n\t\tinitTime = System.nanoTime();\n\t\t\n\t\twordArray = word1.toCharArray();\n\t\tresult = palindrom(wordArray);\n\t\tSystem.out.println(result);\n\t\n\t\twordArray = word2.toCharArray();\n\t\tresult = palindrom(wordArray);\n\t\tSystem.out.println(result);\n\tfinalTime = System.nanoTime();\n\tdurationOfTask = finalTime - initTime;\n\tSystem.out.println(durationOfTask);\n\n\tSystem.out.println();\n\t\n\t\tinitTime = System.nanoTime();\n\t\t\t\n\t\t\tresult = palidromRecursive(word1);\n\t\t\tSystem.out.println(result);\n\t\t\t\n\t\t\tresult = palidromRecursive(word2);\n\t\t\tSystem.out.println(result);\n\t\tfinalTime = System.nanoTime();\n\t\tdurationOfTask = finalTime - initTime;\n\t\tSystem.out.println(durationOfTask);\n\n\t\t\n\t\t\n\n\n\t\t\n\n\t\t\n\t\t//System.out.println(factorialRecursion(5));\n\t\t\n\t\t//System.out.println(factorialNonRecursive(5));\n\t\t\n\t}", "public abstract void solve();", "int backTrack(int[] nums, int targetSum, int startIndex, int computedSum, int[][] dp) {\n if (startIndex == nums.length) {\n if (targetSum == computedSum) {\n return 1;\n\n }\n return 0;\n } else {\n\n int add = backTrack(nums, targetSum, startIndex + 1, computedSum + nums[startIndex], dp);\n\n int subtract = backTrack(nums, targetSum, startIndex + 1, computedSum - nums[startIndex], dp);\n dp[startIndex][computedSum] = add + subtract;\n return dp[startIndex][computedSum];\n }\n\n }", "public int findMinOptimization(int[] nums) {\n // write your code here\n if (nums == null || nums.length == 0) return -1;\n int start = 0, end = nums.length - 1;\n int target = nums[end];\n while (start + 1 < end) {\n int mid = start + (end - start) / 2;\n if (nums[mid] <= target) {\n end = mid;\n }\n else {\n start = mid;\n }\n }\n if (nums[start] <= nums[end]) return nums[start];\n return nums[end];\n }", "public void nextPermutation(int[] nums) {\n // if only 1 num or less, no need to do anything.\n if (nums == null || nums.length <= 1) {\n return;\n }\n // inverse index, start with 2nd lastNum.\n int inverseIndex = nums.length - 2;\n // search for ip. Found / dir where leftNum < rightNum.\n while (inverseIndex >= 0 && nums[inverseIndex] >= nums[inverseIndex + 1]) {\n inverseIndex--;\n }\n // if found inversePoint, now find smallest # > IP# on right subarr.\n if (inverseIndex >= 0) {\n int minLargerIndex = inverseIndex + 1;\n for (int i = minLargerIndex; i < nums.length; i++) {\n // num > IP#, <= curMin. if == curMin, we want the rightmost smallest.\n if (nums[i] <= nums[minLargerIndex] && nums[i] > nums[inverseIndex]) {\n minLargerIndex = i;\n }\n }\n // swap Ip with smallest # > ip.\n int temp = nums[inverseIndex];\n nums[inverseIndex] = nums[minLargerIndex];\n nums[minLargerIndex] = temp;\n // reverse the right side to become smallest possible right subarr.\n // Ex: 2,(4,3,1) -> 2,1,3,4;\n reverse(nums, inverseIndex + 1, nums.length - 1);\n } else {\n // if no inversePoint, index= -1, Reverse all elms to return the smallest.\n reverse(nums, 0, nums.length - 1);\n }\n }", "@Test\n public void testSolution() throws Exception {\n assertEquals(4, new Task5().solution(4, new int[]{1, 2, 3}));\n // 1. 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1\n // 2. 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1\n // 3. 2, 2, 1, 1, 1, 1, 1, 1, 1, 1\n // 4. 2, 2, 2, 1, 1, 1, 1, 1, 1\n // 5. 2, 2, 2, 2, 1, 1, 1, 1\n // 6. 2, 2, 2, 2, 2, 1, 1\n // 7. 2, 2, 2, 2, 2, 2\n // 8. 5, 1, 1, 1, 1, 1, 1, 1\n // 9. 5, 2, 1, 1, 1, 1, 1\n // 10. 5, 2, 2, 1, 1, 1\n // 11. 5, 2, 2, 2, 1\n // 12. 5, 5, 1, 1\n // 13. 5, 5, 2\n assertEquals(13, new Task5().solution(12, new int[]{1, 2, 5}));\n // 1. 2, 2, 2, 2, 2, 2\n // 2. 5, 5, 2\n assertEquals(2, new Task5().solution(12, new int[]{2, 5}));\n }", "public static void main(String[] args) throws Exception {\n\n LeetCode leetCode = new LeetCode();\n long start = System.currentTimeMillis();\n System.out.println(leetCode.findKthNumber(\n 719885387,\n 209989719\n ));\n System.out.println(System.currentTimeMillis() - start);\n }", "@Override\r\n // WEI XU METHOD 2\r\n \r\n public void train(String sourceText) {\r\n String[] words1 = sourceText.split(\"[\\\\s]+\");\r\n // add starter to be a next word for the last word in the source text.\r\n List<String> words = new ArrayList<String>(Arrays.asList(words1));\r\n words.add(words1[0]);\r\n starter = words1[0];\r\n String prevWord = starter;\r\n for (int i = 1; i < words.size(); i++) {\r\n ListNode node = findNode(prevWord);//todo:it's a reference? but not a new Listnode? so no need set back?\r\n if (node == null) {\r\n node = new ListNode(prevWord);\r\n wordList.add(node);\r\n }\r\n node.addNextWord(words.get(i));//todo: why hashmap need set back value, linkedlist don't need?\r\n prevWord = words.get(i);\r\n }\r\n }", "public static void main(String[] args) {\n\t\tint width=35;\n\t\tint length=31;\n\t\tlong[][] dp = new long[width+1][length+1];\n\t\tdp[0][0]=0;\n\t\tfor(int i=1;i<length+1;i++){\n\t\t\tif(badCheck(0,i,0,i-1)){\n\t\t\t\tdp[0][i]=0;\n\t\t\t\tfor(int k=i+1;k<length+1;k++){\n\t\t\t\t\tdp[0][k]=0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}else{\n\t\t\t\tdp[0][i]=1;\n\t\t\t}\n\t\t}\n\t\tfor(int i=1;i<width+1;i++){\n\t\t\tif(badCheck(i,0,i-1,0)){\n\t\t\t\tdp[i][0]=0;\n\t\t\t\tfor(int k=i+1;k<width+1;k++){\n\t\t\t\t\tdp[k][0]=0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}else{\n\t\t\t\tdp[i][0]=1;\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\t\n\t\tfor(int i=1;i<=width;i++){\n\t\t\tfor(int j=1;j<=length;j++){\n\t\t\t\tif(!badCheck(i-1,j,i,j)){\n\t\t\t\t\tdp[i][j]+=dp[i-1][j];\n\t\t\t\t}\n\t\t\t\tif(!badCheck(i,j-1,i,j)){\n\t\t\t\t\tdp[i][j]+=dp[i][j-1];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t//System.out.println(dp[6][6]);\n\t\t//System.out.println(dp[2][2]);\n\t\t//System.out.println(dp[1][1]);\n\t\tSystem.out.println(dp[35][31]);\n\t}", "private ArrayList<WordDocument> customDijkstrasTwoStack(String[] input){\n Stack<String> signs = new Stack<String>();\n Stack<ArrayList<WordDocument>> values = new Stack<ArrayList<WordDocument>>();\n String tempWord0 = null;\n String tempWord1 = null;\n\n for(int i = 0; i < input.length; i++) {\n String t = input[i];\n\n if (t.equals(\"(\") || t.equals(\"\")) ;\n else if (isSignOperator(t)) {\n signs.push(t);\n }else if (t.equals(\")\")) {\n ArrayList<WordDocument> value = new ArrayList<WordDocument>();\n String sign = signs.pop();\n String subQuery = tempWord0 + \" \" + sign + \" \" + tempWord1;\n\n if(tempWord0 != null && tempWord1 != null && cache.isCached(subQuery)) {\n value = cache.getCachedResult(subQuery);\n\n tempWord0 = null;\n tempWord1 = null;\n }else{\n ArrayList<WordDocument> documentsOfWord0;\n ArrayList<WordDocument> documentsOfWord1;\n\n if(tempWord0 != null && tempWord1 != null){\n documentsOfWord0 = getDocumentsWhereWordExists(tempWord0);\n documentsOfWord1 = getDocumentsWhereWordExists(tempWord1);\n }else{\n documentsOfWord1 = values.pop();\n documentsOfWord0 = values.pop();\n }\n\n if (sign.equals(\"+\")) {\n value = intersection(documentsOfWord0, documentsOfWord1);\n } else if (sign.equals(\"-\"))\n value = difference(documentsOfWord0, documentsOfWord1);\n else if (sign.equals(\"|\"))\n value = union(documentsOfWord0, documentsOfWord1);\n\n\n if(tempWord0 != null && tempWord1 != null)\n cache.addToCache(subQuery, value);\n\n tempWord0 = null;\n tempWord1 = null;\n }\n\n values.push(value);\n }else if(t.toLowerCase().equals(\"orderby\")){\n break;\n }else{\n if(tempWord0 == null)\n tempWord0 = t;\n else\n tempWord1 = t;\n }\n }\n\n return values.pop();\n }", "public static void main(String[] args) {\n\t\tlong n = 3;\n//\t\tlong n = 1;\n\t\tSystem.out.println(solution(n));\n\t\t\n\t}", "public static void main(String[] args) throws NumberFormatException, IOException {\n\r\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\r\n\t\tint T = Integer.parseInt(br.readLine());\r\n\t\tStringTokenizer st;\r\n\t\tfor (int test_case = 1; test_case <= T; test_case++) {\r\n\t\t\tst = new StringTokenizer(br.readLine());\r\n\t\t\tN = Integer.parseInt(st.nextToken());\r\n\t\t\tK = Integer.parseInt(st.nextToken());\r\n\t\t\tst = new StringTokenizer(br.readLine());\r\n\t\t\tlist = new ArrayList[N + 1];\r\n\t\t\tfor (int i = 1; i <= N; i++) {\r\n\t\t\t\tlist[i] = new ArrayList<Integer>();\r\n\t\t\t}\r\n\t\t\tfor (int i = 1; i <= N; i++) {\r\n\t\t\t\tint k = Integer.parseInt(st.nextToken());\r\n\t\t\t\tlist[k].add(i);\r\n\t\t\t}\r\n//\t\t\tfor (int i = 1; i <= N; i++) {\r\n//\t\t\t\tfor (int j = 0; j < list[i].size(); j++)\r\n//\t\t\t\t\tSystem.out.print(i + \", \" + list[i].get(j) + \" \");\r\n//\t\t\t}\r\n//\t\t\tSystem.out.println();\r\n\r\n\t\t\tQueue<Integer> q;\r\n//\t\t\tfor(int i = 1; i<=N;i++) {\r\n//\t\t\t\tif(list[i].size()==0) {\r\n//\t\t\t\t\tq.add(i);\r\n//\t\t\t\t}\r\n//\t\t\t}\r\n\t\t\tint visited[];\r\n\t\t\tint answer = 0;\r\n\t\t\tfor (int i = 1; i <= N; i++) {// 각 굴에 대해서 인원 센다\r\n\t\t\t\tq = new LinkedList<Integer>();\r\n\t\t\t\tvisited = new int[N + 1];\r\n\t\t\t\tint count = K;\r\n//\t\t\t\tfor (int j = 1; j < K; j++) {// 지날 수 있는 굴의 최대갯수 K\r\n\t\t\t\tif (list[i].size() < 1) {\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\t\t\t\tint idx;\r\n\t\t\t\tfor (int u = 0; u < list[i].size(); u++) {\r\n\t\t\t\t\tidx = list[i].get(u);\r\n\t\t\t\t\tq.add(idx);\r\n\t\t\t\t}\r\n\t\t\t\twhile (count > 0 && !q.isEmpty()) {\r\n\t\t\t\t\tidx = q.poll();\r\n\r\n\t\t\t\t\tfor (int m = 0; m < list[idx].size(); m++) {\r\n\r\n\t\t\t\t\t\tint dd = list[idx].get(m);\r\n\t\t\t\t\t\tif (visited[dd] == 0 && dd != i) {\r\n\t\t\t\t\t\t\tvisited[dd] = 1;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tq.add(list[idx].get(m));\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t}\r\n\t\t\t\t\tcount--;\r\n\r\n\t\t\t\t}\r\n//\t\t\t\t}\r\n\t\t\t\tfor (int e = 1; e <= N; e++) {\r\n\t\t\t\t\tif (visited[e] == 1)\r\n\t\t\t\t\t\tanswer++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tSystem.out.println(\"#\" + test_case + \" \" + answer);\r\n\r\n\t\t}\r\n\r\n\t}", "private int[] optimum(int x1, int y1, int x2, int y2) {\n if (lookupNodes[x1][y1][x2][y2] != Integer.MAX_VALUE) {\n return new int[]{lookupNodes[x1][y1][x2][y2], lookupDepth[x1][y1][x2][y2]};\n }\n if (hasOneColor(x1, y1, x2, y2)) {\n lookupNodes[x1][y1][x2][y2] = 1;\n lookupDepth[x1][y1][x2][y2] = 0;\n return new int[]{1, 0};\n }\n int nodes;\n int depth;\n for (int X = x1; X < x2; X++) {\n nodes = optimum(x1, y1, X, y2)[0] + optimum(X+1, y1, x2, y2)[0] + 1;\n depth = Math.max(optimum(x1, y1, X, y2)[1], optimum(X+1, y1, x2, y2)[1]) + 1;\n updateLookupNodes(nodes, x1, y1, x2, y2);\n updateLookupDepth(depth, x1, y1, x2, y2);\n }\n for (int Y = y1; Y < y2; Y++) {\n nodes = optimum(x1, y1, x2, Y)[0] + optimum(x1, Y+1, x2, y2)[0] + 1;\n depth = Math.max(optimum(x1, y1, x2, Y)[1], optimum(x1, Y+1, x2, y2)[1]) + 1;\n updateLookupNodes(nodes, x1, y1, x2, y2);\n updateLookupDepth(depth, x1, y1, x2, y2);\n }\n return new int[]{lookupNodes[x1][y1][x2][y2], lookupDepth[x1][y1][x2][y2]};\n }" ]
[ "0.59473", "0.5926908", "0.5809289", "0.5796199", "0.5646837", "0.56259096", "0.5566277", "0.555495", "0.54787725", "0.54787725", "0.5448292", "0.5447347", "0.5420506", "0.54141223", "0.53988844", "0.53291905", "0.5319503", "0.53007716", "0.5285911", "0.5283722", "0.52824104", "0.5277012", "0.52743316", "0.52692175", "0.5254432", "0.5250062", "0.52460515", "0.5245367", "0.5244476", "0.52348065", "0.52284384", "0.52134866", "0.52106225", "0.5208486", "0.51943946", "0.5188401", "0.5187456", "0.51869726", "0.517909", "0.517293", "0.51721376", "0.51622057", "0.5153079", "0.51465774", "0.5140149", "0.5138477", "0.51353455", "0.51342154", "0.5132937", "0.5131092", "0.5127998", "0.5122167", "0.51178145", "0.511418", "0.5101567", "0.5097663", "0.5096937", "0.50942105", "0.5082902", "0.50817823", "0.50699985", "0.50697976", "0.5057106", "0.5053713", "0.5049421", "0.5046954", "0.50456876", "0.5044699", "0.50402564", "0.5038057", "0.50362045", "0.5025244", "0.5020489", "0.501833", "0.50045836", "0.50023943", "0.5000036", "0.49995512", "0.4998083", "0.49943483", "0.49939853", "0.49939677", "0.49903327", "0.49900657", "0.49890506", "0.49877664", "0.49868864", "0.49837875", "0.49808073", "0.49796164", "0.49762708", "0.49744162", "0.49703765", "0.49654245", "0.49622428", "0.4961334", "0.49606812", "0.49515912", "0.49503413", "0.49500567", "0.49500448" ]
0.0
-1
method used by both comp and player for a turn
static int turn(int score, String user){ int turnScore=0; // initialize turn score to 0 boolean rollAgain=true; // parameter for the following loop, starts as true while (rollAgain) { int rollScore = roll(turnScore, user); //start loop with calling method roll turnScore += rollScore; //increment local turn score System.out.printf(user + " scored %d this roll \n", rollScore);//display roll score if (rollScore+score>=100) break; //check if user won if (rollScore == 0) { //if roll returns 0, ie rolled one 1, reset turn score and break loop, ending turn turnScore=0; break; } System.out.printf(user + " current score is %d \n", turnScore+score); if (turnScore+score>=100) break; //check if user won again if (rollScore == 25) rollAgain=true; //auto roll again for double ones else if (user == "comp") rollAgain=compRollAgain(score, turnScore);//if its the comp rolling, consult the algorithm for rollagain else rollAgain= rollagain(); //otherwise it is the user, so consult the user rollagain method } return turnScore; //do i need to explain this?no }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected abstract void takeTurn(int player);", "protected abstract int getTurn();", "private void humanTurn() \n {\n \n playTurn();\n }", "int getTurn();", "int getCurrentTurn();", "boolean isPlayerTurn();", "public void playTurn() {\r\n\r\n }", "public void beginTurn(){\n }", "public Player getPlayerInTurn();", "public void playerTurnStart() {\n\r\n\t}", "void provideNewTurn();", "@Override\r\n\tpublic void startTurn() {\n\t\t\r\n\t}", "private void myTurn()\n\t{\n\t\t\n\t\tif (canPlay())\n\t\t{\n\t\t\tif (isTop())\n\t\t\t{\n\t\t\t\traise();\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tequal();\n\t\t\t}\n\t\t}\n\t\ttable.nextPlayer();\n\t\t\n\t}", "public void Turn(){\r\n \r\n }", "public void playerTurn(Game game){\n int cardHandNum;\n boolean nextPlayer = false;\n String recentCardDesc;\n if(game.recentCardPlayed() && !(game.playerGetAnotherTurn(this))){\n if(game.getRecentCard() instanceof Mineral){\n recentCardDesc = \"\\nRecent card = Name: \" + game.getRecentCard().getCardName() + \" \" +\n \"Hardness: \" + ((Mineral) game.getRecentCard()).getCardHardness() + \" \" +\n \"Specific Gravity: \" + ((Mineral) game.getRecentCard()).getCardSpecGravity() + \" \" +\n \"Cleavage: \" + ((Mineral) game.getRecentCard()).getCardCleavage() + \" \" +\n \"Crystal Abundance: \" + ((Mineral) game.getRecentCard()).getCardCrystalAbundance() + \" \" +\n \"Economic Value: \" + ((Mineral) game.getRecentCard()).getCardEconomicValue() + \"\\n\"; // The recent card description of the Mineral card\n }\n else{\n recentCardDesc = \"\\nThe recent player play the \" + ((SuperTrumps) game.getRecentCard()).getCardName() + \" card\" + \"\\n\"; // The recent card description of the Supertrumps card\n }\n }\n else if(game.recentCardPlayed() && game.playerGetAnotherTurn(this)){\n System.out.println(\"You are granted to select the trump mode again\");\n recentCardDesc = \"\\nYou may pick the card again as you made all of other players pass\" + \"\\n\";\n gameStart(game); // Allowing the player that is not passed to pick up another trump category\n }\n else {\n recentCardDesc = \"\\nThere are no recent cards that have been played\" + \"\\n\";\n gameStart(game); // Description when there is no cards that is been played (when it is the start of the game)\n }\n while (!nextPlayer){\n // Used for looping until the person did the action (play the card or pass), which allows the next player to move\n String playerChoice;\n System.out.println(\"Game mode: \" + game.getGameModeMessage() + recentCardDesc + showCardInHand() + getPlayerName() + \", enter the card number you want to play or simply enter PASS to pass\");\n System.out.print(\">>>\");\n Scanner options = new Scanner(System.in);\n playerChoice = options.nextLine();\n if (playerChoice.toUpperCase().equals(\"PASS\")){\n drawPlayerCard(game.getCardDeck().drawnCard());\n nextPlayer = true;\n }\n else{\n try {\n cardHandNum = Integer.parseInt(playerChoice); // Changing the input into int from String\n Card cardPlayed = getPlayerCard(cardHandNum); // Used for trying to get the card played\n boolean continueGame = game.gameCard(cardPlayed, this); // Trying to play the card\n if(game.getGameMode().equals(\"CHOICE\")){ // Decision when a player play a special supertrump card to allow player to freely choose the trump mode\n game.putCardToGame(cardPlayed);\n playerHand.remove((cardHandNum));\n gameStart(game);\n game.setRecentPlayer(this.getPlayerName());\n nextPlayer = true;\n }\n else if (game.getGameMode().equals(\"GRAV/MAG\")) {\n if(lookAtWinCard()) { // Check whether or not the player has the winning card, which is Magnetite\n for (Card cardInHand : playerHand) {\n game.putCardToGame(cardInHand);\n playerHand.remove(cardInHand);\n game.setRecentPlayer(this.getPlayerName());\n }\n game.setGameMode(\"SPECGRAV\"); // Change the game mode to Specific Gravity\n nextPlayer = true;\n }\n else {\n game.setGameMode(\"SPECGRAV\"); // Change the game mode to Specific Gravity\n }\n if(continueGame){\n game.putCardToGame(cardPlayed);\n playerHand.remove((cardHandNum));\n game.setRecentPlayer(this.getPlayerName());\n nextPlayer = true;\n }\n }\n else {\n if(continueGame){\n // Used for the normal card play\n game.putCardToGame(cardPlayed);\n playerHand.remove((cardHandNum));\n game.setRecentPlayer(this.getPlayerName());\n nextPlayer = true;\n }\n }\n }\n catch (Throwable e){\n System.out.println(\"Invalid input!\"); // When the user try to enter the input that does not match the card in the hand\n }\n }\n }\n if (playerHand.size() == 0){\n // Occurs when the player has no more card in the hand\n game.setRecentPlayer(game.getPlayers().get((game.getPlayers().indexOf(this)+1)%game.getPlayers().size()).getPlayerName());\n playerLeft(game);\n }\n }", "public void myTurn();", "void askTurn();", "public void doComputerTurn() {\n Random rand = new Random();\n int randInt;\n\n if (!currentPlayer.isEmployed()) { // player not employed\n // moves (but suppresses popups) at random and update of player panel\n tryMove();\n\n if (!(currentPlayer.getLocation().getName() == \"trailer\")) {\n if (currentPlayer.getLocation().getName() == \"office\") { // in office\n // upgrade (but suppresses popups) at random and update of player panel\n tryUpgrade();\n \n } else { // in regular set\n // take role (but suppresses popups) at random and update of player panel\n tryTakeRole();\n }\n }\n endTurn();\n } else { // player is employed\n randInt = rand.nextInt(2); // get either 0 or 1\n if (randInt == 0) {\n // rehearse\n tryRehearse(); \n } else {\n // act\n tryAct();\n }\n\n endTurn();\n }\n }", "@Override\n\tpublic void changeTurn() {\n\t\t\n\t}", "public void tryAct() {\n\n List<Player> onCardPlayers = new ArrayList<Player>();\n List<Player> offCardPlayers = new ArrayList<Player>();\n if (currentPlayer.isEmployed() == true) {\n if(!currentPlayer.getHasPlayed()){\n onCardPlayers = findPlayers(currentPlayer.getLocation().getOnCardRoles());\n offCardPlayers = findPlayers(currentPlayer.getLocation().getOffCardRoles());\n currentPlayer.act(onCardPlayers, offCardPlayers);\n refreshPlayerPanel();\n }\n else{\n view.showPopUp(currentPlayer.isComputer(), \"You've already moved, rehearsed or acted this turn. Try a different command or click `end turn` to end your turn.\");\n }\n }\n else {\n view.showPopUp(currentPlayer.isComputer(), \"You're not employed, so you need to take a role before you can act.\");\n }\n view.updateSidePanel(playerArray);\n }", "public void itsYourTurn();", "public void yourTurn();", "@Override\n public int turn() {\n return moveOnTurn;\n }", "void finishTurn();", "public void nextTurn() {\n visionChanged = true;\n SoundPlayer.playEndTurn();\n // Check if any protection objectives have failed\n gameState.updateAllHeroProtectionGoals(getHeroManager());\n // hook the next turn\n if (!multiplayerGameManager.hookNextTurn()) {\n\n if (map.enemyPerformingMove()) {\n return;\n }\n // Enemy action was made\n if (playerTurn && map.hasEnemy()) {\n try {\n map.enemyTurn(this);\n } catch (InterruptedException e) {\n logger.error(\"ayylmao at the GameManager.nextTurn(..) Method\");\n Platform.exit();\n Thread.currentThread().interrupt();\n }\n } else {\n map.playerTurn(this);\n updateBuffIcons();\n updateTempVisiblePoints();\n map.turnTick();\n for(CurrentHeroChangeListener listener:heroChangeListeners){\n \tlistener.onHeroChange(getHeroManager().getCurrentHero());\n }\n }\n\n } else {\n moveViewTo(getHeroManager().getCurrentHero().getX(), getHeroManager().getCurrentHero().getY());\n updateBuffIcons();\n updateTempVisiblePoints();\n }\n\n map.updateVisibilityArray();\n dayNightClock.tick();\n turnTickLiveTiles();\n abilitySelected = AbilitySelected.MOVE;\n abilitySelectedChanged = true;\n backgroundChanged = true;\n gameChanged = true;\n minimapChanged = true;\n saveOriginator.writeMap(this.map, this.getObjectives(), this.gameState);\n // update(this.tracker,null);\n }", "void turnStarted(int playerIndex);", "@Override\n public boolean isWaitingForTurnPhase() {return true;}", "public void turn(){ \r\n\t\tif (currentTurn == 0){ \r\n\t\t\tSystem.out.println(\"Computer's Turn\");\r\n\t\t\tnextRowWin();\r\n\t\t\tnextColWin(); \r\n\t\t\tnextDiagWin();\r\n\t\t\t//check if next move is row win\r\n\t\t\tif (!Arrays.equals(rowWin, checkWin)){\r\n\t\t\t\tcounter(rowWin); \r\n\t\t\t}\r\n\t\t\t//check if next move is column win \r\n\t\t\telse if (!Arrays.equals (colWin, checkWin)) {\r\n\t\t\t\tcounter(colWin); \r\n\t\t\t}\r\n\t\t\t//check if next move is diagonal win\r\n\t\t\telse if (!Arrays.equals(diagWin, checkWin)){\r\n\t\t\t\tcounter(diagWin);\r\n\t\t\t}\r\n\t\t\t//computer moves based on priority positions\r\n\t\t\telse\r\n\t\t\t\tcompMove(); \r\n\t\t\tchangeTurn(); \r\n\t\t}\r\n\t\telse { \r\n\t\t\tSystem.out.println(\"Player's Turn\");\r\n\t\t\tint nextCol, nextRow; \r\n\t\t\tScanner in = new Scanner (System.in); \r\n\t\t\tSystem.out.print (\"Please enter row and column to place your piece [Enter as col row]: \");\r\n\t\t\tif (in.hasNext()) { \r\n\t\t\t\tnextCol = in.nextInt(); \r\n\t\t\t\tnextRow = in.nextInt(); \r\n\t\t\t\tif (nextCol == 3 || nextRow == 3)\r\n\t\t\t\t\tSystem.out.println(\"Input of of range. col and row must be between 0-2.\");\r\n\t\t\t\telse if (board[nextCol][nextRow] == '-') {\r\n\t\t\t\t\tboard[nextCol][nextRow] = 'X'; \r\n\t\t\t\t\tchangeTurn(); \r\n\t\t\t\t}\r\n\t\t\t\telse { \r\n\t\t\t\t\tSystem.out.println(\"Invalid Input. There is already a piece in that location.\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\telse { \r\n\t\t\t\tSystem.out.println(\"Invalid Input. Please input integers for col row.\");\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void act() \n {\n moveTowardsPlayer(); \n }", "private int firstMove(ArrayList<Integer> open, ArrayList<Integer> plyr, ArrayList<Integer> comp, int turn)\r\n {\r\n int[] first = {0,2,4,4,4,4,6,8};\r\n int[] second = {0,2,6,8};\r\n if(turn == 0)\r\n return first[gen.nextInt(8)];\r\n else\r\n {\r\n int plyrMove = plyr.get(0);\r\n if(plyrMove == 4)\r\n return second[gen.nextInt(4)];\r\n else\r\n return 4;\r\n }\r\n }", "void onMoveTaken(Piece captured);", "public void turnToPlay(Player opponent) {\n\n }", "public abstract Action takeTurn();", "@Override\n protected void executeStrategy()\n {\n //Get the latest clue given by the SpyMaster\n Clue clue = game.getCurrentClue();\n pickCard(clue);\n\n // We used up our guesses so we are done\n if (game.getGuessesLeft() == 0) { this.game.endCurrentTurn(); }\n }", "@Test\n public void testWhoIsOnTurn() {\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(0), \"Test - 0 returns player O\");\n Assertions.assertEquals('X', GameUtil.whoIsOnTurn(1), \"Test - 1 returns player X\");\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(2), \"Test - 2 returns player O\");\n Assertions.assertEquals('X', GameUtil.whoIsOnTurn(3), \"Test - 3 returns player X\");\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(4), \"Test - 4 returns player O\");\n Assertions.assertEquals('X', GameUtil.whoIsOnTurn(5), \"Test - 5 returns player X\");\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(6), \"Test - 6 returns player O\");\n Assertions.assertEquals('X', GameUtil.whoIsOnTurn(7), \"Test - 7 returns player X\");\n Assertions.assertEquals('O', GameUtil.whoIsOnTurn(8), \"Test - 8 returns player O\");\n }", "Piece turn() {\r\n return _turn;\r\n }", "public void changeTurn()\r\n {\r\n isPlayersTurn = !isPlayersTurn;\r\n }", "void playerPassedStart(Player player);", "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 }", "public abstract boolean doComputerMove(Player player);", "@Override\n\tpublic void changeTurn() {\n\t\tcomputerCall();\n\t\tplayerTurn = 1;\n\t}", "public void playMove(int turn)\t{\n\t\tString command;\n\t\tint index = -1;\n\t\tCard dealt;\n\t\tCard drawn;\n\t\tboolean illegal = false;\n\t\tSystem.out.println(\"\\n\" + hand[turn].toString() + \"\\n\");\n\t\tSystem.out.println(\"Choose a number, or 'd' for draw, or 'p' for pass.\");\n\t\tcommand = input.nextLine();\n\t\trecord[turn] = command;\n\t\tif(command.equalsIgnoreCase(\"d\"))\t{\n\t\t\tdrawn = deck1.deal();\n\t\t\tif(drawn!=null)\t{\n\t\t\t\thand[turn].addCard(drawn);\n\t\t\t}\n\t\t\telse\t{\n\t\t\t\tSystem.out.print(\"\\n+++++No cards in deck!\");\n\t\t\t}\n\t\t\tplayMove(turn);\n\t\t}\n\t\telse if(command.equalsIgnoreCase(\"p\"))\t{\n\t\t\tif(deck1.isEmpty() || !hand[turn].playable(top))\t{\n\t\t\t\treturn;\n\t\t\t}\n\t\t\telse\t{\n\t\t\t\tSystem.out.print(\"\\n+++++Cannot pass!+++++\\n\");\n\t\t\t\tplayMove(turn);\n\t\t\t}\n\t\t}\n\t\telse\t{\n\t\t\tif(isNumber(command))\t{\n\t\t\t\tindex = Integer.parseInt(command);\n\t\t\t}\n\t\t\telse\t{\n\t\t\t\tSystem.out.println(\"Invalid Command!\");\n\t\t\t\tplayMove(turn);\n\t\t\t}\n\t\t\tif(index>=0 && index<hand[turn].countCards())\t{\n\t\t\t\tdealt = hand[turn].seekCard(index);\n\t\t\t\tif(top.getValue()!=8)\t{\n\t\t\t\t\tif(top.getSuit().equals(dealt.getSuit()) || \n\t\t\t\t\t\t\ttop.getValue()==dealt.getValue() || \n\t\t\t\t\t\t\tdealt.getValue()==8)\t{\n\t\t\t\t\t\tif(dealt.getValue()==8)\t{\n\t\t\t\t\t\t\tdealt.setSuit(chooseSuit());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse\t{\n\t\t\t\t\t\tillegal = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse\t{\n\t\t\t\t\tif(dealt.getValue()==8 || \n\t\t\t\t\t\t\ttop.getChosenSuit().equalsIgnoreCase(dealt.getSuit()))\t{\n\t\t\t\t\t\tillegal = false;\n\t\t\t\t\t}\n\t\t\t\t\telse\t{\n\t\t\t\t\t\tillegal = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(illegal)\t{\n\t\t\t\t\tSystem.out.println(\"Illegal Move!\");\n\t\t\t\t\tplayMove(turn);\n\t\t\t\t}\n\t\t\t\telse\t{\n\t\t\t\t\ttop = dealt;\n\t\t\t\t\thand[turn].removeCard(index);\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\t{\n\t\t\t\tSystem.out.println(\"Card does not exist!\");\n\t\t\t\tplayMove(turn);\n\t\t\t}\n\t\t}\n\t\treturn;\n\t}", "public void endOfTurn();", "public void extraTurn() {\r\n\t\textraTurn = true;\r\n\t}", "Turn createTurn();", "public void nextTurn() {\n\t\tusedPocket = false;\n\t\ttookFromPot = false;\n\t\tcurrentTurn++;\n\t\tcurrentTurn = currentTurn%2;\n\t\tif(currentTurn == 0) {\n\t\t\tcurrentPlayer = player1;\n\t\t\topponentPlayer = player2;\n\t\t} else {\n\t\t\tcurrentPlayer = player2;\n\t\t\topponentPlayer = player1;\n\t\t}\n\t}", "void onTurn();", "public void step() {\r\n\t\tcard1 = player1.getCard();\r\n\t\tcard2 = player2.getCard();\r\n\t\twarPile.add(card1);\r\n\t\twarPile.add(card2);\r\n\t\tgameState = \"Player 1: \" + card1 + \"\\n\" + \"Player 2: \" + card2 + \"\\n\";\r\n\t\tif(card1.getRank() == card2.getRank()) {\r\n\t\t\tgameState = \"Cards added to the War Pile\" + \"\\n\";\r\n\t\t}else if(card1.getRank() > card2.getRank()){\r\n\t\t\ttransferCards(player1);\r\n\t\t\tgameState = \"Cards go to Player 1 \\n\";\r\n\t\t}else {\r\n\t\t\ttransferCards(player2);\r\n\t\t\tgameState = \"Cards go to Player 2 \\n\";\r\n\t\t}\r\n\t\tmoves ++;\r\n\t}", "public void turnOver() {\n if(firstPlayer == whosTurn()) {\n turn = secondPlayer;\n } else {\n turn = firstPlayer;\n }\n hasPlacedPiece = false;\n hasRotatedBoard = false;\n }", "@Override\n\tpublic String runTurn() {\n\t\tif (possibleCords.isEmpty() && !isEndHuntMode) {\n\t\t\treset();\n\t\t\tisHuntMode = false;\n\t\t\tisEndHuntMode = true;\n\t\t}\n\t\t\n\t\tif (isHuntMode || isEndHuntMode) {\n\t\t\tlastCord = getCord();\n\t\t}\n\t\telse if (isSearchMode){\n\t\t\tString coordinate = null;\n\t\t\t// Get a non out of bounds coordinate \n\t\t\twhile (coordinate == null) {\n\t\t\t\tcoordinate = aroundCords[searchModeIter];\n\t\t\t\tif (coordinate == null)\n\t\t\t\t\tsearchModeIter++;\n\t\t\t}\n\t\t\tlastCord = coordinate;\n\t\t}\n\t\telse {// its in destroy mode\n\t\t\tString coordinate = cordFromIter(lastCord, searchModeIter);\n\t\t\tif (coordinate == null && isReverse) { // we've completely destroyed the ship and hit a wall\n\t\t\t\treset();\n\t\t\t\tlastCord = getCord();\n\t\t\t}\n\t\t\telse if (coordinate == null) { // hit wall in forward direction\n\t\t\t\tisReverse = true;\n\t\t\t\tchangeIterDirection();\n\t\t\t\tlastCord = cordFromIter(originalHit, searchModeIter);\n\t\t\t\tif (lastCord == null) { // ship is destroyed and hit a wall in the reverse direction\n\t\t\t\t\treset();\n\t\t\t\t\tlastCord = getCord();\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tlastCord = coordinate;\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\tpossibleCords.remove(lastCord);\n\t\totherCords.remove(lastCord);\n\t\treturn lastCord;\n\t}", "private int getTurn() {\n\t\treturn turn;\n\t}", "public Player switchPlayer(){\n Player player = getGame().getCurrentPlayer();\n\n List<Card> cards = new ArrayList<>();\n\n for(Card card: getGame().getCards()){\n if(card.rule.isValid(getGame().getDices())){\n cards.add(card);\n }\n }\n\n //get the best card\n if(!cards.isEmpty()){\n Card card = takeTheBestCard(cards);\n\n //add it to the player\n player.getCardsWon().add(card);\n getGame().getCards().remove(card);\n\n System.out.println(player.getName() + \" won \" + card.getExplaination());\n getGame().addAction(new Action(player.getName() + \" won \" + card.getExplaination()));\n }\n\n if(getGame().getCards().isEmpty()){\n game.setStatus(Game.GameStatus.COMPLETED);\n getGame().addAction(new Action(bestPlayer().getName() + \" WON THE GAME!!!\"));\n }\n //turn\n getGame().setCountOfTrialForPlayer(0);\n\n game.setIndexOfCurrentPlayer(game.getIndexOfCurrentPlayer()+1);\n\n if(game.getIndexOfCurrentPlayer() == getGame().getPlayers().size()){\n game.setIndexOfCurrentPlayer(0);\n }\n\n game.setCountOfTrialForPlayer(0);\n game.setDices(new ArrayList<>());\n\n return getGame().getCurrentPlayer();\n }", "public void nextTurn(){\r\n removeIceAndFire();\r\n currentTurn++;\r\n }", "private void HandleOnMoveStart(Board board, Piece turn){}", "@Override\n\tpublic boolean nextPlayersTurn(int currentTurn, int startRow, int startCol, int endRow, int endCol) {\n\t\tif (currentTurn % player2.turn == 0) {\n\t\t\tSystem.out.println(\"****YEE-HAW! ITS PLAYER 2'S TURN*****\");\n\t\t\texecuteMove(player2, player1, state.gameBoard, currentTurn, startRow, startCol, endRow, endCol);\n\t\t} else {\n\t\t\tSystem.out.println(\"****YEE-HAW! ITS PLAYER 2'S TURN*****\");\n\t\t\texecuteMove(player1, player2, state.gameBoard, currentTurn, startRow, startCol, endRow, endCol);\n\t\t}\n\t\treturn continueGame;\n}", "public boolean plizMovePlayerForward(Player player)\n {\n\n //check if die was rolled\n if (getValue_from_die() > 0)\n {\n int x_cord = player.getX_cordinate();\n int y_cord = player.getY_cordinate();\n int steps = player.getSteps_moved();\n\n //try to get player from color home\n if (attempt2GetPlayerFromHomeSucceds(player))\n {\n return true;\n }\n\n //if player has already reached home do nothing\n if (player.getSteps_moved() >= 58)\n {\n return false;\n }\n //if player is inside home stretch he has to play exact number to go home\n else if (player.getSteps_moved() >= 52)\n {\n if (59 - player.getSteps_moved() <= value_from_die)\n {\n return false;\n }\n }\n\n //if player isnt at home move him\n if (player.getSteps_moved() > 0)\n {\n for (int i = 1; i <= (value_from_die); i++)\n {\n player.movePlayerForward();\n if (roadBlocked(player))\n {\n road_blocked = true;\n }\n player.setHas_not_been_drawn(true);\n }\n\n //roll back changes\n if (road_blocked)\n {\n player.setX_cordinate(x_cord);\n player.setY_cordinate(y_cord);\n player.setSteps_moved(steps);\n ludo.setDrawRoadBlockedSign(true);\n //println(\"ROAD BLOCKED\");\n road_blocked = false;\n return false;\n }\n playPlayerHasMovedMusic();\n //see if player eats someone\n if (getPerson_to_play() == 1)\n {\n BlueEatsPlayer(player);\n }\n else if (getPerson_to_play() == 2)\n {\n RedEatsPlayer(player);\n }\n else if (getPerson_to_play() == 3)\n {\n GreenEatsPlayer(player);\n }\n else if (getPerson_to_play() == 4)\n {\n YellowEatsPlayer(player);\n }\n if (value_from_die == 6)\n {\n resetDieScore();\n ludo.setDrawScoreAllowed(false);\n return true;\n }\n //reset variables and change person to play\n resetDieScore();\n ludo.setDrawScoreAllowed(false);\n changePersonToPlay();\n return true;\n }\n //occurs rarely at the begining of the game\n else\n {\n //println(\"steps less than 0\");\n return false;\n }\n }\n else\n {\n //println(\"PLIZ ROLL DIE FIRST THEN MOVE BUTTON\");\n return false;\n }\n }", "void computeTurn(Input input);", "private void playerMoved(int currentPlayer, int currentUnit, boolean moved)\r\n {\r\n if(moved == true)//if player has made a legitimate move\r\n {\r\n worldPanel.repaint();\r\n int movesLeft = 0;\r\n if(currentPlayer == 1)\r\n {\r\n int myPos = worldPanel.player1.units[currentUnit - 1].getPosition();\r\n\r\n //check to see if a player challenges another player\r\n for(int i = 0; i < worldPanel.player2.getNumUnits(); i++)\r\n {\r\n int pos = worldPanel.player2.units[i].getPosition();\r\n if(myPos == pos)\r\n {\r\n fight(1, currentUnit - 1, i);\r\n return;\r\n }\r\n }//end for\r\n\r\n //check to see if a player captures a city\r\n for(int i = 0; i < worldPanel.player2.getNumCities(); i++)\r\n {\r\n int pos = worldPanel.player2.cities[i].getLocation();\r\n if(myPos == pos)\r\n {\r\n captureCity(1,i);\r\n return;\r\n }\r\n }//end for\r\n movesLeft = worldPanel.player1.units[currentUnit - 1].getMovementsLeft();\r\n int temp = worldPanel.player1.units[currentUnit - 1].getPosition();\r\n int temp1 = mapPieces[0][temp];\r\n if(temp1 == 54 || temp1 == 51 || temp1 == 52 || temp1 == 53)//if unit moves on rock or something\r\n worldPanel.player1.units[currentUnit - 1].setMovementsLeft(movesLeft - 2);\r\n else\r\n worldPanel.player1.units[currentUnit - 1].setMovementsLeft(movesLeft - 1);\r\n movesLeft = worldPanel.player1.units[currentUnit - 1].getMovementsLeft();\r\n }//end if\r\n else if(currentPlayer == 2)\r\n {\r\n int myPos = worldPanel.player2.units[currentUnit - 1].getPosition();\r\n\r\n //check to see if a player challenges another player\r\n for(int i = 0; i < worldPanel.player1.getNumUnits(); i++)\r\n {\r\n int pos = worldPanel.player1.units[i].getPosition();\r\n if(myPos == pos)\r\n {\r\n fight(2, currentUnit - 1, i);\r\n return;\r\n }\r\n }\r\n\r\n //check to see if a player captures a city\r\n for(int i = 0; i < worldPanel.player1.getNumCities(); i++)\r\n {\r\n int pos = worldPanel.player1.cities[i].getLocation();\r\n if(myPos == pos)\r\n {\r\n captureCity(2,i);\r\n return;\r\n }\r\n }//end for\r\n movesLeft = worldPanel.player2.units[currentUnit - 1].getMovementsLeft();\r\n int temp = worldPanel.player2.units[currentUnit - 1].getPosition();\r\n int temp1 = mapPieces[0][temp];\r\n if(temp1 == 54 || temp1 == 51 || temp1 == 52 || temp1 == 53)//if unit moves on rock or something\r\n worldPanel.player2.units[currentUnit - 1].setMovementsLeft(movesLeft - 2);\r\n else\r\n worldPanel.player2.units[currentUnit - 1].setMovementsLeft(movesLeft - 1);\r\n movesLeft = worldPanel.player2.units[currentUnit - 1].getMovementsLeft();\r\n\r\n //worldPanel.player2.units[currentUnit - 1].setMovementsLeft(movesLeft - 1);\r\n movesLeft = worldPanel.player2.units[currentUnit - 1].getMovementsLeft();\r\n }\r\n\r\n if(movesLeft <= 0)//if unit has run out of moves\r\n {\r\n if(currentPlayer == 1)\r\n {\r\n worldPanel.player1.units[currentUnit - 1].resetMovement();\r\n }\r\n if(currentPlayer == 2)\r\n {\r\n worldPanel.player2.units[currentUnit - 1].resetMovement();\r\n }\r\n currentUnit++;\r\n }//end if\r\n worldPanel.setCurrentUnit(currentUnit);\r\n }//end if\r\n\r\n int temp = worldPanel.getNumUnits(currentPlayer);\r\n if(currentUnit > temp)\r\n {\r\n if(currentPlayer == 1)\r\n worldPanel.setCurrentPlayer(2);\r\n else\r\n\t\t\t\t\t\t{\r\n worldPanel.setCurrentPlayer(1);\r\n\t\t\t\t\t\t\t\tyear = unitPanel.getYear() + 20;//add 20 years to the game\r\n\t\t\t\t\t\t}\r\n worldPanel.setCurrentUnit(1);\r\n }//end if\r\n\r\n setInfoPanel();//set up the information panel\r\n }", "public void incrTurn(){\n this.turn++;\n }", "void notifyPlayerHasAnotherTurn();", "public String autoPlayAdvanced(int sign) {\n boolean validTurn = false;\n int temp1 = 0;\n int temp2 = 0;\n int sign2 = 0;\n //copy the board\n TicTacToe TTTemp = new TicTacToe(TTT.getSize());\n for (int i = 0; i < TTTemp.getSize(); i++) {\n for (int j = 0; j < TTTemp.getSize(); j++) {\n TTTemp.setTile(TTT.getTile(i, j), i, j);\n }\n }\n\n //player turn finding\n if (sign == 1) {\n sign2 = 2;\n } else {\n sign2 = 1;\n }\n\n int done = 0;\n //cycle to determine \"best\" or random move\n while (!validTurn) {\n switch (done) {\n case 0: //Win condition check\n loop:\n for (int i = 0; i < TTTemp.getSize(); i++) {\n for (int j = 0; j < TTTemp.getSize(); j++) {\n if (TTTemp.getTile(i, j) == 0) {\n TTTemp.setTile(sign, i, j);\n\n //if after changing empty tile to your sign...\n switch (TTTemp.check(sign)) {\n case \"Not won\":\n TTTemp.setTile(-1, i, j);\n done = 1;\n break;\n case \"Tie\":\n done = 1;\n break loop;\n default: //won in any way\n temp1 = i;\n temp2 = j;\n validTurn = TTT.safeChangeTile(sign, i, j);\n done = 2;\n break loop;\n }\n }\n }\n }\n break;\n case 1: //Player win condition check\n //copy board again\n for (int i = 0; i < TTTemp.getSize(); i++) {\n for (int j = 0; j < TTTemp.getSize(); j++) {\n TTTemp.setTile(TTT.getTile(i, j), i, j);\n }\n }\n\n loop:\n for (int i = 0; i < TTTemp.getSize(); i++) {\n for (int j = 0; j < TTTemp.getSize(); j++) {\n if (TTTemp.getTile(i, j) == 0) {\n TTTemp.setTile(sign2, i, j);\n\n //if after changing empty tile to player sign...\n switch (TTTemp.check(sign2)) {\n case \"Not won\":\n TTTemp.setTile(-1, i, j);\n done = 2;\n break;\n case \"Tie\":\n done = 2;\n break loop;\n default: //player might win\n temp1 = i;\n temp2 = j;\n validTurn = TTT.safeChangeTile(sign, i, j);\n done = 2;\n break loop;\n }\n }\n\n }\n }\n break;\n default: //if \"best\" move wasn't found mark a random tile\n temp1 = new Random().nextInt(TTT.getSize());\n temp2 = new Random().nextInt(TTT.getSize());\n validTurn = TTT.safeChangeTile(sign, temp1, temp2);\n break;\n }\n }\n\n // return selected tile\n return temp1 + \" \" + temp2;\n }", "private void calculateTurn () {\n // Do we need a turn? If not, we're done.\n if (dirOne.opposite() == dirTwo) return;\n /*\n * We need a turn. The coordinates of the turn point will be the x\n * coordinate of the north/south leg and the y coordinate of the\n * east/west leg.\n */\n if (dirOne == Direction.north || dirOne == Direction.south) {\n xTurn = xOne;\n yTurn = yTwo;\n } else {\n xTurn = xTwo;\n yTurn = yOne;\n }\n }", "public int getTurn() {\n return this.turn; \n }", "private PlayerType GetPlayerForTurn(int turn) {\n switch ((turn - 1) % 6) {\n case 0:\n case 4:\n case 5:\n return PlayerType.One;\n\n case 1:\n case 2:\n case 3:\n return PlayerType.Two;\n\n default:\n return PlayerType.Empty;\n }\n }", "Piece turn() {\n return _turn;\n }", "@Override\n public void execute() {\n String nextPlayer = CModel.getInstance().getCurrGame().advancePlayerTurn();\n if(nextPlayer.equals(CModel.getInstance().getMyUser().getUserName())) {\n CModel.getInstance().setCurrGameState(new MyTurn());\n }\n else {\n //update the player stats\n CModel.getInstance().setCurrGameState(new NotMyTurn());\n }\n CModel.getInstance().updatePlayerStatsView();\n }", "public void nextTurn() {\r\n activePlayer = nextPlayer;\r\n advanceNextPlayer();\r\n }", "public void His_Turn(String opponent_coord){\r\n\r\n\t\t/*\r\n\t\t * will get xcoor and ycoor\r\n\t\t * NOTE: We don't need to validate, it should be already validate\r\n\t\t * we only need this function to parse the xcoor and ycoor\r\n\t\t */\r\n\t\tValidate_Input(opponent_coord);\r\n\t\t\r\n\t\t/*\r\n\t\t * update hit_history\r\n\t\t */\r\n\t\tmyBoard.hit_history[xcoor][ycoor]=1; \r\n\r\n\t\tboolean hit=false;\r\n\t\t\r\n\t\tdisplay.putStaticLine(\"\");\r\n\t\tif(myBoard.hit_or_miss(xcoor, ycoor)){\r\n\t\t\tSound.playSound(\"res/explosion.wav\");\r\n\t\t\thit=true;\r\n\t\t}\r\n\t\telse{\r\n\t\t\tSound.playSound(\"res/Missile_Incoming_FlyBy.wav\");\r\n\t\t}\r\n\r\n\t\t\r\n\t\t// Check if a ship was sunk and update the board accordingly\r\n\t\tString sunk=myBoard.check_sunk();\r\n\t\tif(sunk!=\"nothing\"){\r\n\t\t\tSound.playSound(\"res/bubbles.wav\");\r\n\t\t\tif(myBoard.check_all_sunk()){\r\n\t\t\t\topponent_victory=true;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t\t// Handle all the output/display after all the calculation...\r\n\t\tdisplay.clearScreen();\r\n\t\tthis.Display_Boards();\r\n\t\tdisplay.putStaticLine(\"\");\r\n\t\tif(hit)\r\n\t\t\tdisplay.putStaticLine(\"Opponent attacked \" + opponent_coord+\"... \" + \"Hit!\");\r\n\t\telse\r\n\t\t\tdisplay.putStaticLine(\"Opponent attacked \" + opponent_coord+\"... \" + \"Miss\");\r\n\t\tif(sunk!=\"nothing\"){\r\n\t\t\tdisplay.putStaticLine(\"\");\r\n\t\t\tdisplay.putStaticLine(\"He sunk your \" + sunk); \r\n\t\t}\r\n\t\tif(opponent_victory){\r\n\t\t\tdisplay.putStaticLine(\"\");\r\n\t\t\tdisplay.putStaticLine(\"You LOSE!!!!!!\");\r\n\t\t}\r\n\t\t\r\n\t\tdisplay.putStaticLine(\"\");\r\n\t\tdisplay.putStaticLine(\"Press Enter to continue with you turn...\");\r\n\t\tdisplay.printScreen();\r\n\t\tdisplay.printPrompt(\"user> \");\r\n\t\t\r\n\t\thit=false;\r\n\t\tturn_change=true;\r\n\t\t// now it's my turn again\r\n\t\tthis.isTurn=true;\r\n\t}", "@Override\n\tpublic void onPlayerTurnListener() {\n\n\t}", "protected void takeTurn(int[][] boardState)\n {\n \n }", "public void play(FightTurn turn);", "private void playAI (int actualAI) {\n }", "private void doGameTurn()\n\t{\n\t\tif (!lost && !won)\n\t\t{\n\t\t\trefreshMapAndFrame();\n\t\t\t\n\t\t\tcheckPlayerCondition();\n\t\t\tElementAccess.openExit();\n\t\t\tSystem.out.println(turn);\n\t\t}\n\t\telse if (lost)\n\t\t{\n\t\t\tSound.lost();\n\t\t\trefreshMapAndFrame();\n\n\t\t\tif (playerHasLost())\n\t\t\t{\n\t\t\t\tstop = true;\n\t\t\t}\n\n\t\t\tMapInstance.getInstance().levelRestart();\n\t\t\tlost = false;\n\t\t}\n\t\telse if (won)\n\t\t{\n\t\t\tSound.won();\n\t\t\trefreshMapAndFrame();\n\n\t\t\twon = false;\n\t\t\tif (playerNotInLevel())\n\t\t\t{\n\t\t\t\tstop = true;\n\t\t\t}\n\n\t\t\tnextLevel();\n\t\t\tMapInstance.getInstance().levelRestart();\n\t\t}\n\t}", "public abstract boolean doTurn(Deck theDeck);", "public void onTurnBegin() {\n\n\t}", "public void turnoUsuario(){\r\n System.out.println(\"Turno: \"+ entrenador1.getNombre());\r\n if(evaluarAccion(this.pokemon_activo1, this.pokemon_activo2).equals(\"Cambiar\")){\r\n System.out.println(\"Usuario eligio Cambiar Pokemon\");\r\n pokemon_activo1.setConfuso(false);\r\n pokemon_activo1.setDormido(false);\r\n if(getEquipo1()[0].getDebilitado() == false && getEquipo1()[0]!=pokemon_activo1){\r\n pokemon_activo1 = getEquipo1()[0]; \r\n }\r\n else if(getEquipo1()[1].getDebilitado() == false && getEquipo1()[1]!=pokemon_activo1){\r\n pokemon_activo1 = getEquipo1()[1]; \r\n }\r\n else if(getEquipo1()[2].getDebilitado() == false && getEquipo1()[2]!=pokemon_activo1){\r\n pokemon_activo1 = getEquipo1()[2]; \r\n }\r\n else if(getEquipo1()[3].getDebilitado() == false && getEquipo1()[3]!=pokemon_activo1){\r\n pokemon_activo1 = getEquipo1()[3]; \r\n }\r\n else if(getEquipo1()[4].getDebilitado() == false && getEquipo1()[4]!=pokemon_activo1){\r\n pokemon_activo1 = getEquipo1()[4]; \r\n }\r\n else if(getEquipo1()[5].getDebilitado() == false && getEquipo1()[5]!=pokemon_activo1){\r\n pokemon_activo1 = getEquipo1()[5]; \r\n }\r\n vc.setjL_especie1(pokemon_activo1.getNombre_especie());\r\n vc.setjL_nombrepokemon1(pokemon_activo1.getPseudonimo());\r\n vc.setjL_vida_actual1(pokemon_activo1.getVida_restante(), pokemon_activo1.getVida());\r\n setLabelEstados(0);\r\n setLabelEstados(1);\r\n this.turno = 1;\r\n }\r\n else if(evaluarAccion(this.pokemon_activo1, this.pokemon_activo2).equals(\"Atacar\")){\r\n System.out.println(\"Usuario eligio Atacar\");\r\n inflingirDaño(pokemon_activo1.getMovimientos()[(int)(Math.random()*4)], pokemon_activo2, pokemon_activo1);\r\n if(pokemon_activo2.getVida_restante() <= 0){\r\n pokemon_activo2.setVida_restante(0);\r\n pokemon_activo2.setDebilitado(true);\r\n System.out.println(\"El Pokemon: \"+ pokemon_activo2.getPseudonimo()+\" se ha Debilitado\");\r\n JOptionPane.showMessageDialog(this.vc, \"El Pokemon: \"+ pokemon_activo2.getPseudonimo()+\" se ha Debilitado\", \"Debilitado\", JOptionPane.INFORMATION_MESSAGE);\r\n if(condicionVictoria(getEquipo1(), getEquipo2()) == true){\r\n JOptionPane.showMessageDialog(this.vc, \"El Ganador de este Combate es:\"+ entrenador1.getNombre(), \"Ganador\", JOptionPane.INFORMATION_MESSAGE);\r\n System.out.println(\"El Ganador de este Combate es:\"+ entrenador1.getNombre());\r\n System.out.println(equipo1[0].getVida_restante()+ \" \"+equipo1[1].getVida_restante()+ \" \"+equipo1[2].getVida_restante()+ \" \"+equipo1[3].getVida_restante()+ \" \"+equipo1[4].getVida_restante()+ \" \"+equipo1[5].getVida_restante());\r\n System.out.println(equipo2[0].getVida_restante()+ \" \"+equipo2[1].getVida_restante()+ \" \"+equipo2[2].getVida_restante()+ \" \"+equipo2[3].getVida_restante()+ \" \"+equipo2[4].getVida_restante()+ \" \"+equipo2[5].getVida_restante());\r\n JOptionPane.showMessageDialog(this.vc, equipo1[0].getVida_restante()+ \" \"+equipo1[1].getVida_restante()+ \" \"+equipo1[2].getVida_restante()+ \" \"+equipo1[3].getVida_restante()+ \" \"+equipo1[4].getVida_restante()+ \" \"+equipo1[5].getVida_restante()+\"\\n\"+ equipo2[0].getVida_restante()+ \" \"+equipo2[1].getVida_restante()+ \" \"+equipo2[2].getVida_restante()+ \" \"+equipo2[3].getVida_restante()+ \" \"+equipo2[4].getVida_restante()+ \" \"+equipo2[5].getVida_restante(), \"Estadisticas finales(vida)\", JOptionPane.INFORMATION_MESSAGE);\r\n vc.dispose();\r\n vpc.dispose();\r\n combate.setGanador(entrenador1);\r\n combate.setPerdedor(entrenador2);\r\n this.termino = true;\r\n }\r\n else if(getEquipo1()[0].getDebilitado() == false){\r\n pokemon_activo2 = getEquipo2()[0]; \r\n }\r\n else if(getEquipo1()[1].getDebilitado() == false){\r\n pokemon_activo2 = getEquipo2()[1]; \r\n }\r\n else if(getEquipo1()[2].getDebilitado() == false){\r\n pokemon_activo2 = getEquipo2()[2]; \r\n }\r\n else if(getEquipo1()[3].getDebilitado() == false){\r\n pokemon_activo2 = getEquipo2()[3]; \r\n }\r\n else if(getEquipo1()[4].getDebilitado() == false){\r\n pokemon_activo2 = getEquipo2()[4]; \r\n }\r\n else if(getEquipo1()[5].getDebilitado() == false){\r\n pokemon_activo2 = getEquipo2()[5]; \r\n } \r\n vc.setjL_nombrepokemon1(pokemon_activo2.getPseudonimo());\r\n vc.setjL_especie1(pokemon_activo2.getNombre_especie());\r\n }\r\n vc.setjL_especie2(pokemon_activo2.getNombre_especie());\r\n vc.setjL_nombrepokemon2(pokemon_activo2.getPseudonimo());\r\n vc.setjL_vida_actual2(pokemon_activo2.getVida_restante(), pokemon_activo2.getVida());\r\n setLabelEstados(0);\r\n setLabelEstados(1);\r\n this.turno = 1;\r\n }\r\n \r\n }", "void win(Player player);", "boolean isMyTurn();", "public void checkMoveOrPass(){\n if (this.xTokens.size() > 0) {\n this.diceRoller = false;} \n else { //if no tokens to move, pass and let player roll dice\n this.turn++;\n //System.out.println(\"next turn player \" + this.players[currentPlayer].getColor());\n }\n this.currentPlayer = this.xPlayers.get(this.turn % this.xPlayers.size());\n }", "public void playTurn(){\r\n\t\t// all exceptions in this method are caught, because if this method throws an exception\r\n\t\t// the AIPlayer will not draw/discard a card and the program will freeze\r\n\t\ttry{\r\n\t\t\tupdateLastCardDiscarded();\r\n\t\t}catch(Exception e){\r\n\t\t\tSystem.out.println(\"AIPlayer, lastCard: \" + e.toString());\r\n\t\t}\r\n\t\ttry{\r\n\t\t\tif(!(drawOrPickUp()^bestChoice(BEST_CHOICE_AT_FIFTY))){ // choose whether to draw from the deck or pick up from the stack\r\n\t\t\t\tif(!game.getRound().drawFromDiscard()) // If picking up from the discard is not possible,\r\n\t\t\t\t\tgame.getRound().drawFromDeck(); // draw from the deck instead\r\n\t\t\t}else{\r\n\t\t\t\tgame.getRound().drawFromDeck();\r\n\t\t\t}\r\n\t\t}catch(Exception e){\r\n\t\t\tSystem.out.println(\"AIPlayer, draw: \" + e.toString());\r\n\t\t\tgame.getRound().drawFromDeck(); // if something goes wrong, draw\r\n\t\t}\r\n\r\n\t\ttry{\r\n\t\t\tgroup = new Groups(this, getHand());\r\n\t\t\tif(!hasLaidDownPhase() && group.getCompletePhaseGroups() != null && // if the AI player, hasn't laid down PhaseGroups\r\n\t\t\t\t\tgroup.getCompletePhaseGroups().length == Configuration.getNumberRequired(getPhase()) && // will lay down the right number of phasesGroups\r\n\t\t\t\t\tgetGame().getRound().getTurnNumber() >= 8 - (difficulty/10)) // is past a certain turn number based off difficulty\r\n\t\t\t\taddPhaseGroups(group.getCompletePhaseGroups()); \r\n\t\t}catch(Exception e){\r\n\t\t\tSystem.out.println(\"AIPlayer, laydown: \" + e.toString()); // laid down all my cards Hand92,AI90afterAI74\r\n\t\t}\r\n\r\n\t\ttry{\r\n\t\t\tif(hasLaidDownPhase())\r\n\t\t\t\tplayOffPhases();\r\n\t\t}catch(Exception e){\r\n\t\t\tSystem.out.println(\"AIPlayer, playoff: \" + e.toString());\r\n\t\t}\r\n\r\n\t\ttry{\r\n\t\t\tlastCardDiscarded = discardCard();\r\n\t\t\tgame.getRound().discard(lastCardDiscarded); // discard\r\n\t\t}catch(Phase10Exception e){\t\r\n\t\t}catch(Exception e){\r\n\t\t\tlastCardDiscarded = getHand().getCard(0);\r\n\t\t\tgame.getRound().discard(lastCardDiscarded);\r\n\t\t\tSystem.out.println(\"AIPlayer, discard: \" + e.toString());\r\n\t\t}\r\n\t}", "public void takeTurn(){\r\n //Handled by GameWindow buttons\r\n }", "private void scoregain() {\n \tif (playerturn%2==0) {\n \tscoreplayer1 = scoreplayer1+2;}\n if(playerturn%2==1) {\n \tscoreplayer2 = scoreplayer2+2;\n }\n }", "@Override\r\n public boolean playTurn()\r\n {\n System.out.println(\"current bid = \" + currentBid);\r\n currentBid = players[currentPlayer].playHand(currentBid);\r\n\r\n System.out.println(\"Player bid = \" + currentBid);\r\n // Add hand played to discard pile\r\n discards.add(currentBid.getHand());\r\n // Offer all other players the chance to call cheat\r\n int callee = -1;\r\n {\r\n int[] calls = new int[MINPLAYERS];\r\n int i = 0;\r\n for (int j = 0; j < players.length; ++j)\r\n {\r\n // don't allow us to call cheat on ourselves\r\n if (currentPlayer == j)\r\n continue;\r\n Player p = players[j];\r\n if (p.callCheat(currentBid, currentPlayer))\r\n calls[i++] = j;\r\n }\r\n if (i > 0)\r\n callee = calls[rg.nextInt(i)];\r\n }\r\n\r\n if (callee != -1)\r\n {\r\n System.out.println(\"Player called cheat by Player \" + (callee+1));\r\n if (isCheat(currentBid)) //CHEAT CALLED CORRECTLY\r\n {\r\n for (Player p : players)\r\n p.broadcastCheat(currentPlayer, callee, true);\r\n //Give the discard pile of cards to currentPlayer who then has to play again\r\n players[currentPlayer].addHand(discards);\r\n System.out.println(\"Player cheats!\");\r\n System.out.println(\"Adding cards to player \"+\r\n (currentPlayer+1) + \" \" + players[currentPlayer]);\r\n }\r\n else //CHEAT CALLED INCORRECTLY\r\n {\r\n for (Player p : players)\r\n p.broadcastCheat(currentPlayer, callee, false);\r\n System.out.println(\"Player Honest\");\r\n currentPlayer = callee; // set the currentPlayer to callee\r\n // later on we'll increase this, so it's the person after\r\n // they who called's turn.\r\n players[currentPlayer].addHand(discards);\r\n System.out.println(\"Adding cards to player \"+\r\n (currentPlayer+1) + players[currentPlayer]);\r\n }\r\n //If cheat is called, current bid reset to an empty bid with rank two whatever\r\n //the outcome\r\n currentBid = new Bid();\r\n //Discards now reset to empty\r\n discards = new Hand();\r\n }\r\n else\r\n {\r\n System.out.println(\"No Cheat Called\");\r\n }\r\n /*\r\n Game bug fix:\r\n The design of the game, as given, was floored in conjuction with\r\n the required implementations of the strategies.\r\n A scenario can arise where one player has all the twos and the other\r\n has none, but it's their turn to play.\r\n The player with all the twos can consitently correctly call cheat on the\r\n player, as they have to claim to of laid a 2.\r\n\r\n This is easily fixed by moving the turn to the player after the one who\r\n just got called out\r\n */\r\n currentPlayer = (currentPlayer+1) % nosPlayers;\r\n return true;\r\n }", "public void makeMove() {\n\t\tif (CheckForVictory(this)) {\n\t\t\t// System.out.println(\"VICTORY\");\n\t\t\tInterface.goalReached = true;\n\t\t\tfor (int i = 0; i < tmpStrings.length; i++) {\n\t\t\t\tif (moveOrder[i] == 0)\n\t\t\t\t\ttmpStrings[i] = \"turn left\";\n\t\t\t\telse if (moveOrder[i] == 1)\n\t\t\t\t\ttmpStrings[i] = \"turn right\";\n\t\t\t\telse\n\t\t\t\t\ttmpStrings[i] = \"go forward\";\n\n\t\t\t\tInterface.info.setText(\"Generation: \" + Parallel.generationNo + 1 + \" and closest distance to goal: \" + 0);\n\t\t\t}\n\t\t} else {\n\t\t\tmoveOrder[this.movesMade] = moves.remove();\n\t\t\tswitch (moveOrder[this.movesMade]) {\n\t\t\tcase (0):\n\t\t\t\tthis.movesMade++;\n\t\t\t\tif (face == 0)\n\t\t\t\t\tface = 3;\n\t\t\t\telse\n\t\t\t\t\tface--;\n\t\t\t\tbreak;\n\t\t\tcase (1):\n\t\t\t\tthis.movesMade++;\n\t\t\t\tif (face == 3)\n\t\t\t\t\tface = 0;\n\t\t\t\telse\n\t\t\t\t\tface++;\n\t\t\t\tbreak;\n\t\t\tcase (2):\n\t\t\t\tthis.movesMade++;\n\t\t\t\tif (face == 0 && Y - 1 >= 0)\n\t\t\t\t\tY--;\n\t\t\t\telse if (face == 1 && X + 1 <= map[0].length - 1)\n\t\t\t\t\tX++;\n\t\t\t\telse if (face == 2 && Y + 1 <= map.length - 1)\n\t\t\t\t\tY++;\n\t\t\t\telse if (face == 3 && X - 1 >= 0)\n\t\t\t\t\tX--;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tSystem.out.println(\"Error making move :(\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "void turn(int move, int piece, int player) {\n //checks if the player is a computer. If it is it gets a move from the computer\n //otherwise it inputs the move from the argument\n if (!players[player].getName().equals(\"Computer\" + Integer.toString(piece))) {\n doMove(move, piece);\n } else {\n move = compPlayer.getMove(currentBoard, players[player].getWins(), piece);\n doMove(move, piece);\n }\n //checks if there is a winner. If there is it runs endGame\n if (Checker.checker(currentBoard, piece) == piece) {\n endGame(players[player].getName(), player);\n return;\n\n } //checks if there is a tie. If there is it runs end game\n else if (Checker.tieChecker(currentBoard)) {\n endGame(\"It's a Tie!\", player);\n return;\n }\n\n //ensures that the computer will always go next\n if (players[(player + 1) % 2].getName().equals(\"Computer\" + Integer.toString((piece % 2) + 1))) {\n game(0);\n }\n\n }", "public void nextTurn()\n\t{\n\t\tthis.actionListToExecute.clear();\n\t\tthis.board.discardLastPlayedCard();\n\t\tthis.getCurrentPlayer().getDataInput().printMessage(this.getCurrentPlayerGameStatus());\n\t\tthis.getCurrentPlayer().execEndOfTurn();\n\t\t\n\t\tint nbPlayerCardPickup = this.getAmountOfPlayerCardToFillYourHand() - this.getCurrentPlayer().getPlayerCardDeck().size();\n\t\tfor(int i = 0; i < nbPlayerCardPickup; i++)\n\t\t{\n\t\t\tthis.getCurrentPlayer().getPlayerCardDeck().addCard(this.getNextPlayerCard());\n\t\t}\n\t\t\n\t\tcurrentPlayerID = (currentPlayerID + 1) % this.getPlayerList().size();\n\t\tif(currentPlayerID == 0)\n\t\t{\n\t\t\tcurrentPlayerID = this.getPlayerList().size();\n\t\t}\n\t\tthis.getCurrentPlayer().execBeginOfTurn();\n\t\tinitBeginOfTurn();\n\t}", "public void checkSetPlayerTurn() // Check and if needed set the players turns so it is their turn.\n\t{\n\t\tswitch (totalPlayers) // Determine how many players there are...\n\t\t{\n\t\tcase 2: // For two players...\n\t\t\tswitch (gameState)\n\t\t\t{\n\t\t\tcase twoPlayersNowPlayerOnesTurn: // Make sure it's player one's turn.\n\t\t\t\tplayers.get(0).setIsPlayerTurn(true);\n\t\t\t\tbreak;\t\t\t\t\n\t\t\tcase twoPlayersNowPlayerTwosTurn: // Make sure it's player two's turn.\n\t\t\t\tplayers.get(1).setIsPlayerTurn(true);\n\t\t\t\tbreak;\t\t\t\t\t\t\t\n\t\t\t}\n\t\t}\n\n\t}", "private String whichPlayerToStart(){\n\t\tdouble whichPlayerToCommence = Math.random();\n\t\tdouble randomLimit = Math.random();\n\t\tif(whichPlayerToCommence <= randomLimit){ \n\t\tthis.turn = \"blue\";\n\t\treturn this.turn;\n\t\t}\n\t\telse{\n\t\tthis.turn = \"red\";\n\t\treturn this.turn;\n\t\t} \n\t}", "public void executeTurn(Game game){\n \tif (turn == 0) {\n \t\t\n \t\tSystem.out.println(game.getCurrentFloor().getFloorDesc());\n\t \tHELPER.insPressEnter();\n\t \tSystem.out.println(\"\\033[2J\");\n\t \tturn++;\n\t \n \t} \n\n // The room that the user is in.\n Room room = game.getCurrentRoom();\n Floor floor = game.getCurrentFloor();\n \n \n// Map.setVisibleRoom(game); //make the room that the is player in visible on the map\n \n if (!help && !map && !list) {\n \tSystem.out.println(Colors.GREEN + floor.getHint() + Colors.RESET);\n \tSystem.out.println(Colors.YELLOW + \"\\n ROOM #\" + room.getDescription()+\" FLOOR: #\" + floor.getFloorNum() + \"\\n\" + Colors.RESET);\n \tAsciiArt.makeArt(game);\n }\n else if (help) { //print what commands are available to the player\n \tSystem.out.println(\"\\n You are in room \" + room.getDescription());\n AsciiArt.getKeys();\n help = false; //set help back to false after executing once\n }\n else if (list) { //print what items the player has collected\n \tInventory.list();\n \tlist = false;\n }\n else if (map) { //print out the map of the rooms that the player has already been to\n \tMap.printMap();\n \tmap = false;\n }\n if (room.getItemInRoom() != null) { //if there is an item in the room\n \tif (room.getItemInRoom().getType().compareTo(\"Enemy\") != 0) { //if the item is NOT an enemy, say what it is\n \t\tSystem.out.println(Colors.CYAN + \"\\n << The \" + room.getItemInRoom().getType() + \" in this room is \" + room.getItemInRoom().getName() + \" >>\\n\" + Colors.RESET);\n \t}\n \telse { //if there IS an enemy in the room, attack the player\n \tif (((Enemy) room.getItemInRoom()).attack()) {\n \t\troom.setItemInRoom(null);\n \t}\n \telse {\n \t\tgame.setCurrentRoom(game.getCurrentFloor().getRooms()[4]);\n \t\troom = game.getCurrentRoom();\n \t\tSystem.out.println(Colors.RESET + \"Now you are back in room \" + room.getDescription() + \"\\n\" + Colors.CYAN);\n \t\tif (room.getItemInRoom() != null) {\n \t \t\tSystem.out.println(Colors.CYAN + \"\\n << The \" + room.getItemInRoom().getType() + \" in this room is \" + room.getItemInRoom().getName() + \" >>\\n\" + Colors.RESET);\n \t \t}\n \t}\n }\n }\n else System.out.println(Colors.YELLOW + \"\\n << There is nothing in this room >>\\n\" + Colors.RESET); //if there are no items in the room\n\n System.out.print(Colors.YELLOW + \" Enter command--> \" + Colors.RESET);\n\n String command = keyboard.nextLine().toLowerCase(); // user's command\n System.out.println(\"\\033[2J\");\n \n\n Room nextRoom = null; // the room we're moving to\n HashMap<String, Room> helper = room.getDirection();\n \n //Get access to list of all commands from CommandSetter class\n CommandSetter listOfCommands = new CommandSetter();\n HashMap<String,String> com = listOfCommands.getList();\n \n \n if (com.containsKey(command)){ \n \t\n \t\n\t \tswitch (com.get(command)) { //based on the command the player has typed, do that\n\t \t\t\n\t\t case \"north\": \n\t\t \t\tnextRoom = helper.get(\"north\");\n\t\t \t\tbreak;\n\t\t \n\t\t case \"south\": \n\t\t \t\tnextRoom = helper.get(\"south\");\n\t\t \t\tbreak;\n\t\t \n\t\t case \"west\": \n\t\t \tnextRoom = helper.get(\"west\");\n\t\t \t\tbreak;\n\t\t \n\t\t case \"east\": \n\t\t \t\tnextRoom = helper.get(\"east\");\n\t\t \t\tbreak;\n\t\t \n\t\t case \"quit\": \n\t\t \t\twinIndicator = false;\n\t\t \t\tnextRoom = room;\n\t\t \t\tgame.finishGame();\n\t\t \t\tbreak;\n\t\t \n\t\t case \"help\":\n\t\t \tnextRoom = new Room(\"Dont Move\");\n\t\t \thelp = true;\n\t\t break;\n\t\t \n\t\t case \"collect\":\n\t\t \tnextRoom = new Room(\"Dont Move\");\n\t\t \troom.pickUpItem();\n\t\t \tbreak;\n\t\t \t\n\t\t case \"list\":\n\t\t \tlist = true;\n\t\t \tnextRoom = new Room(\"Dont Move\");\n\t\t \tbreak;\n\t\t \t\n\t\t case \"map\":\n\t\t \tmap = true;\n\t\t \tnextRoom = new Room(\"Dont Move\");\n\t\t \tbreak;\n\t\t \t\n\t\t case \"open\":\n\t\t \troom.openChest();\n\t\t \n\t\t default:\n\t\t \tnextRoom = new Room(\"Dont Move\");\n\t \t}\n \n }else { //if the player types a command that is not available\n \tSystem.out.println(Colors.CYAN + \"\\n << I do not know how to do this command:\" + command + \" >>\\n\" + Colors.RESET);\n \tnextRoom = new Room(\"Dont Move\");\n }\n if (nextRoom == null) { //if there is no room in the direction they are trying to move\n System.out.println(Colors.CYAN + \"\\n << Oof! I ran into a wall. I cannot move in that direction. >>\\n\" + Colors.RESET);\n \t}\n else if (nextRoom.getDescription().compareTo(\"Dont Move\") != 0) {\n game.setCurrentRoom(nextRoom);\n }\n \n System.out.print(Colors.RESET);\n \n \n }", "public int getTurn() {\n\t\treturn 0;\r\n\t}", "public void playTheGame() {\n\t\tint column;\n\t\ttry {\n\t\t\tboolean gameIsOver = false;\n\t\t\tfor (int count = 0; count < thePlayers.length; count++)\n\t\t\t\tthePlayers[count].getView().showOutput(\n\t\t\t\t\t\taConnect4Field.toString());\n\n\t\t\tdo {\n\t\t\t\tfor (int index = 0; index < thePlayers.length; index++) {\n\t\t\t\t\t// thePlayers[index].getView().showOutput(aConnect4Field.toString());\n\t\t\t\t\tif (aConnect4Field.isItaDraw()) {\n\t\t\t\t\t\tfor (int count = 0; count < thePlayers.length; count++)\n\t\t\t\t\t\t\tthePlayers[count].getView().showOutput(\"Draw\");\n\t\t\t\t\t\tgameIsOver = true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthePlayers[index].getView().showOutput(\n\t\t\t\t\t\t\t\tthePlayers[index].getName()\n\t\t\t\t\t\t\t\t\t\t+ \" it's Your Turn! play your move\");\n\t\t\t\t\t\tcolumn = thePlayers[index].nextMove();\n\t\t\t\t\t\twhile (!aConnect4Field\n\t\t\t\t\t\t\t\t.checkIfPiecedCanBeDroppedIn(column)) {\n\t\t\t\t\t\t\tthePlayers[index].getView().showOutput(\n\t\t\t\t\t\t\t\t\t\"Invalid Turn Try again\");\n\t\t\t\t\t\t\tcolumn = thePlayers[index].nextMove();\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\taConnect4Field.dropPieces(column,\n\t\t\t\t\t\t\t\tthePlayers[index].getGamePiece());\n\t\t\t\t\t\tfor (int count = 0; count < thePlayers.length; count++)\n\t\t\t\t\t\t\tthePlayers[count].getView().showOutput(\n\t\t\t\t\t\t\t\t\taConnect4Field.toString());\n\t\t\t\t\t\tif (aConnect4Field.error != \"\") {\n\n\t\t\t\t\t\t\tthePlayers[index].getView().showOutput(\n\t\t\t\t\t\t\t\t\taConnect4Field.error);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (aConnect4Field.didLastMoveWin()) {\n\t\t\t\t\t\t\t\tgameIsOver = true;\n\t\t\t\t\t\t\t\t// all player get to know\n\t\t\t\t\t\t\t\tfor (int count = 0; count < thePlayers.length; count++)\n\t\t\t\t\t\t\t\t\tthePlayers[count].getView().showOutput(\n\t\t\t\t\t\t\t\t\t\t\t\"The winner is: \"\n\t\t\t\t\t\t\t\t\t\t\t\t\t+ thePlayers[index]\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.getName());\n\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} while (!gameIsOver);\n\t\t} catch (Exception ex) {\n\t\t\tex.printStackTrace();\n\t\t}\n\t}", "public void turn()\n {\n turn(90);\n }", "public boolean switchPhase() {\n int cpuShipCounter = 0;\n int playerShipCounter = 0;\n do {\n cpuShipCounter = 0;\n playerShipCounter = 0;\n if (!cpuHasPlaced) {\n placeComputerShipsDumb((int) (Math.random() * 19) + 1);\n }\n for(int i = 0; i < 10; i++){\n for(int j = 0; j <10; j++){\n if(humanPlayerBoard[i][j] == board.ship.ordinal()){\n playerShipCounter++;\n }\n if (computerPlayerBoard[i][j] == board.ship.ordinal()) {\n cpuShipCounter++;\n }\n }\n }\n if (cpuShipCounter != 17) {\n cpuHasPlaced = false;\n cpuShipCounter = 0;\n playerShipCounter = 0;\n for (int i = 0; i < 10; i++) {\n for (int j = 0; j < 10; j++) {\n computerPlayerBoard[i][j] = 0;\n }\n }\n }\n\n } while (cpuShipCounter != 17);\n\n if(cpuShipCounter == 17 && playerShipCounter == 17){\n inGame = true;\n return true;\n }\n\n return false;\n }", "private void yourturn() {\n if (whosturn != 3) {\n whosturn = 3;\n displayTable();\n }\n\n // TODO mega duplication\n int top = 0;\n // testing is player has a card they can play\n if (pile.notEmpty()) {\n boolean canplay = false;\n if (hand.getCard(0) == null) { // if player only has card on the table\n if (hand.isFaceUp()) // if player has faceup card on the table\n {\n for (int n = 0; n < 3; n++) {\n if (hand.getFaceUp(n) != null) {\n if (nine && pile.topValue() == 9) {\n top = 0;\n for (int i = 0; i < 52; i++) {\n if (pile.get(i) == null) {\n canplay = true;\n break;\n }\n if (pile.get(i).getValue() == 9) top++;\n else break;\n }\n }\n if (canplay) break;\n if (seven\n && pile.get(top).getValue() == 7\n && hand.getFaceUp(n).getValue() < 7) {\n canplay = true;\n break;\n } else if (hand.getFaceUp(n).getValue() == 2\n || hand.getFaceUp(n).getValue() == 10) {\n canplay = true;\n break;\n } else if (nine && hand.getFaceUp(n).getValue() == 9) {\n canplay = true;\n break;\n } else if (!seven || pile.get(top).getValue() != 7) {\n if (pile.get(top).getValue() <= hand.getFaceUp(n).getValue()) {\n canplay = true;\n break;\n }\n }\n }\n }\n } else // if player only has facedown cards\n canplay = true;\n } else {\n for (int n = 0; n < hand.length() - 1; n++) {\n if (hand.getCard(n) == null) break;\n if (nine && pile.topValue() == 9) {\n top = 0;\n for (int i = 0; i < 52; i++) {\n if (pile.get(i) == null) {\n canplay = true;\n break;\n }\n if (pile.get(i).getValue() == 9) top++;\n else break;\n }\n }\n if (canplay) break;\n if (hand.getCard(n).getValue() == 2 || hand.getCard(n).getValue() == 10) {\n canplay = true;\n break;\n }\n if (nine && hand.getCard(n).getValue() == 9) {\n canplay = true;\n break;\n }\n if (seven && pile.get(top).getValue() == 7 && hand.getCard(n).getValue() < 7) {\n canplay = true;\n break;\n } else if (seven != true || pile.get(top).getValue() != 7) {\n if (pile.get(top).getValue() <= hand.getCard(n).getValue()) {\n canplay = true;\n break;\n }\n }\n }\n }\n if (canplay) {\n // sh.addMsg(\"Its Your Turn\");\n sh.setmyTurn(true);\n } else { // cant play then must pick up the pile\n sh.addMsg(\n \"The card played was a \"\n + pile.top().getStringValue()\n + \" you had to pick up the pile. BLAOW\");\n pile.moveToHand(hand);\n sendCommand(\"turn:pickup:\");\n nextTurn();\n displayTable();\n }\n } else {\n // sh.addMsg(\"Its Your Turn\");\n sh.setmyTurn(true);\n }\n }", "private void changeTurn(){ \r\n\t\tif (currentTurn == 1)\r\n\t\t\tcurrentTurn = 0; \r\n\t\telse\r\n\t\t\tcurrentTurn = 1; \r\n\t}", "public int getTurn(){\n return turn;\n }", "public void act() \n {\n move(5);\n turn(4);\n }", "public void switchPlayer() {\n \tisWhitesTurn = !isWhitesTurn;\n }", "private boolean passTurn() {\n\n\t\t// Return Boolean\n\t\tboolean ableToPassTurn = false;\n\n\t\tint playerOnTurn;\n\n\t\t// Get the playerID who is on turn\n\t\tplayerOnTurn = pTSM.playerOnTurn(gameID);\n\n\t\t// Check if the ID is equal to the playerID\n\t\ttry {\n\t\t\tif (playerOnTurn == this.userID && modelClass.gameIsWon(pTSM.getUsername(userID), gameID)) {\n\t\t\t\tthis.message = \"Het is niet jou beurt\";\n\t\t\t\tableToPassTurn = true;\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tif (playerOnTurn == this.userID) {\n\t\t\t\tableToPassTurn = true;\n\t\t\t}\n\t\t}\n\n\n\t\treturn ableToPassTurn;\n\t}", "private void movementPhase() {\n ClickObserver.getInstance().setCreatureFlag(\"\");\n Platform.runLater(new Runnable() {\n @Override\n public void run() {\n GUI.getDoneButton().setDisable(false);\n TheCupGUI.update();\n Board.removeCovers();\n }\n });\n for (Player p : playerList) {\n \tplayer = p;\n player.flipAllUp();\n\t ClickObserver.getInstance().setActivePlayer(player);\n\t ClickObserver.getInstance().setCreatureFlag(\"Movement: SelectMovers\");\n\t InfoPanel.uncover(player.getName());\n\t if (p.getHexesWithPiece().size() > 0) {\n\t \tClickObserver.getInstance().setClickedTerrain(p.getHexesWithPiece().get(0));\n\t }\n\t pause();\n Platform.runLater(new Runnable() {\n @Override\n public void run() {\n \tClickObserver.getInstance().whenTerrainClicked();\n \t GUI.getHelpText().setText(\"Movement Phase: \" + player.getName()\n + \", Move your armies\");\n \t Game.getRackGui().setOwner(player);\n }\n });\n\t \n\t while (isPaused) {\n \ttry { Thread.sleep(100); } catch( Exception e ){ return; } \n\t }\n\t InfoPanel.cover(player.getName());\n player.flipAllDown();\n }\n Platform.runLater(new Runnable() {\n @Override\n public void run() {\n GUI.getDoneButton().setDisable(true);\n }\n });\n ClickObserver.getInstance().setCreatureFlag(\"\");\n }", "private void suarez() {\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 = -10;\n\t\tint yInit = 8;\n\t\tplayerDeafaultPosition = new Vector2D(xInit*selfPerception.getSide().value(), yInit*selfPerception.getSide().value());\n\t\twhile (commander.isActive()) {\n\t\t\t\n\t\t\tupdatePerceptions(); // deixar aqui, no começo do loop, para ler o resultado do 'move'\n\t\t\tswitch (matchPerception.getState()) {\n\t\t\tcase BEFORE_KICK_OFF:\n\t\t\t\tcommander.doMoveBlocking(xInit, yInit);\t\t\t\t\t\t\t\t\n\t\t\t\tbreak;\n\t\t\tcase PLAY_ON:\n\t\t\t\t//state = State.FOLLOW;\n\t\t\t\texecuteStateMachine();\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(xInit, yInit);\n\t\t\t\tbreak;\n\t\t\tcase AFTER_GOAL_RIGHT:\n\t\t\t\tcommander.doMoveBlocking(xInit, yInit);\n\t\t\t\tbreak;\n\t\t\tcase INDIRECT_FREE_KICK_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 INDIRECT_FREE_KICK_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\tdefault:\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t}\n\t}" ]
[ "0.71649176", "0.71486795", "0.7015066", "0.6875868", "0.6814826", "0.67916447", "0.67828804", "0.6779285", "0.67637604", "0.6738928", "0.67350817", "0.6718954", "0.66976905", "0.66376317", "0.6575155", "0.65666765", "0.6553227", "0.65468895", "0.65206623", "0.6519854", "0.65122056", "0.6510893", "0.65009385", "0.64883506", "0.64723635", "0.6469331", "0.64490896", "0.64426094", "0.63905644", "0.63892055", "0.6379292", "0.6372974", "0.6371728", "0.6364242", "0.6358616", "0.6358233", "0.63441306", "0.63385123", "0.6336986", "0.63346845", "0.6334224", "0.6327682", "0.6326544", "0.63246757", "0.6323694", "0.6323031", "0.6317851", "0.63167423", "0.63105553", "0.63079023", "0.62995064", "0.62914646", "0.6288556", "0.628519", "0.6277476", "0.6264334", "0.6256526", "0.6254409", "0.62516767", "0.6245592", "0.6241737", "0.6234293", "0.62342435", "0.62341005", "0.6230945", "0.62298113", "0.62217575", "0.6214643", "0.62138605", "0.62128067", "0.62086636", "0.6208481", "0.61978924", "0.6195272", "0.61951554", "0.6191573", "0.61881566", "0.61826104", "0.6180356", "0.61741406", "0.61675936", "0.6150873", "0.61378515", "0.6132138", "0.6130965", "0.6125357", "0.6121976", "0.6121416", "0.6112073", "0.61106116", "0.61059093", "0.6103667", "0.6102899", "0.61005926", "0.6098695", "0.60965174", "0.60929865", "0.60925615", "0.60880804", "0.6084858", "0.6081457" ]
0.0
-1
computer algorithm, uncommented because it is a secret
static boolean compRollAgain(int score, int turnScore) { if (turnScore+score>90) return true; //lol if (turnScore>20) {System.out.println("comp decided to end turn");return false;}else return true;}
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "String algorithm();", "static int getComputerCard(Card playerCard) {\n //The computer will iterate through different possible cards it might choose to play.\n //This represents a chosen card at any given time.\n Card possibleCard = null;\n //The position in the computer's hand where the possibleCard is stored.\n int cardPosition = 0;\n //True if the computer has a card of higher value than the player's.\n boolean hasHigherCard = false;\n //Iterate through the computer's hand, trying to find a card higher than the player's\n for (int i = 0; i < highCardGame.getHand(0).getNumCards(); i++) {\n if (playerCard.compareTo(highCardGame.getHand(0).inspectCard(i)) < 0) {\n //The computer has a higher card.\n if (possibleCard != null) {\n //If this card is lower than the possible card, but can still beat the player, then replace possible card.\n if (possibleCard.compareTo(highCardGame.getHand(0).inspectCard(i)) > 0) {\n possibleCard = new Card(highCardGame.getHand(0).inspectCard(i));\n cardPosition = i;\n }\n } else {\n //If the computer has not yet chosen a possible card, choose this one.\n possibleCard = new Card(highCardGame.getHand(0).inspectCard(i));\n hasHigherCard = true;\n cardPosition = i;\n }\n }\n }\n if (!hasHigherCard) {\n //If the computer does not have a card that can beat the player, then feed the lowest card\n //that the computer has to the player.\n for (int i = 0; i < highCardGame.getHand(0).getNumCards(); i++)\n if (playerCard.compareTo(highCardGame.getHand(0).inspectCard(i)) >= 0) {\n if (possibleCard != null) {\n if (possibleCard.compareTo(highCardGame.getHand(0).inspectCard(i)) > 0) {\n possibleCard = new Card(highCardGame.getHand(0).inspectCard(i));\n cardPosition = i;\n }\n } else {\n possibleCard = highCardGame.getHand(0).inspectCard(i);\n cardPosition = i;\n }\n }\n }\n return cardPosition;\n }", "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 }", "public static void main(String[] args) throws IOException {\n BufferedReader br = new BufferedReader(new FileReader(\"superbull.in\"));\n PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter(\"superbull.out\")));\n //Only in a tree is the winner condition(as stated in problem) satisfied\n int N = Integer.parseInt(br.readLine());\n \n long ret = 0;\n \n int[] nums = new int[N];\n for(int i = 0; i<N; i++) nums[i] = Integer.parseInt(br.readLine());\n int[] prims = new int[N]; //for dense graphs: N edges each. Loop thru edges anyways, so selection sort remove log factor\n Arrays.fill(prims, Integer.MIN_VALUE);\n prims[0] = -1;\n int curr = 0;\n \n for(int i = 0; i<N-1; i++){\n int max = Integer.MIN_VALUE;\n int next = -1;\n for(int j = 0; j<N; j++){\n if(prims[j] == -1) continue;\n \n int xor = nums[curr]^nums[j];\n prims[j] = Math.max(prims[j], xor);\n \n if(prims[j] > max){\n next = j;\n max = prims[j];\n }\n }\n ret += max;\n prims[next] = -1;\n curr = next;\n }\n pw.println(ret);\n pw.close();\n br.close();\n }", "public void solve() throws IOException {\r\n int T = nextInt();\r\n for (int t = 1; t <= T; t++) {\r\n int N = nextInt();\r\n int J = nextInt();\r\n \r\n out.format(\"Case #%d:%n\", t);\r\n \r\n boolean[] bitmask = new boolean[N - 2];\r\n int count = 0;\r\n while (count < J) {\r\n BigInteger[] factors = new BigInteger[9];\r\n boolean success = true;\r\n for (int base = 2; base <= 10; base++) {\r\n BigInteger value = BigInteger.ONE;\r\n BigInteger biBase = BigInteger.valueOf(base);\r\n \r\n for (int i = 0; i < N - 2; i++) {\r\n if (bitmask[i]) {\r\n value = value.add(biBase.pow(i + 1));\r\n }\r\n }\r\n value = value.add(biBase.pow(N - 1));\r\n \r\n if (value.isProbablePrime(10)) {\r\n success = false;\r\n break;\r\n } else {\r\n // Pollard rho\r\n BigInteger x = BigInteger.valueOf(2);\r\n BigInteger y = BigInteger.valueOf(2);\r\n BigInteger d = BigInteger.ONE;\r\n while (d.compareTo(BigInteger.ONE) == 0) {\r\n x = x.pow(2).add(BigInteger.ONE).mod(value);\r\n y = y.pow(2).add(BigInteger.ONE).mod(value)\r\n .pow(2).add(BigInteger.ONE).mod(value);\r\n d = x.subtract(y).gcd(value);\r\n }\r\n if (d.compareTo(value) != 0) {\r\n factors[base - 2] = d;\r\n } else {\r\n success = false;\r\n break;\r\n }\r\n }\r\n }\r\n if (success) {\r\n count++;\r\n StringBuilder sb = new StringBuilder(\"1\");\r\n for (int i = N - 3; i >= 0; i--) {\r\n if (bitmask[i]) {\r\n sb.append(1);\r\n } else {\r\n sb.append(0);\r\n }\r\n }\r\n sb.append(1);\r\n \r\n System.out.println(sb.toString() + \" \" + count);\r\n out.print(sb.toString());\r\n for (int i = 0; i < 9; i++) {\r\n out.print(\" \");\r\n out.print(factors[i].toString());\r\n }\r\n out.println();\r\n }\r\n \r\n // Increment bitmask\r\n for (int i = 0; i < N - 2; i++) {\r\n if (!bitmask[i]) {\r\n bitmask[i] = true;\r\n break;\r\n } else {\r\n bitmask[i] = false;\r\n }\r\n }\r\n }\r\n }\r\n }", "public int[] solver(int startPlayerId, int curplayer, int[][] oneP, int[][][] memory, int count) {\n\r\n int[][] one = oneP.clone(); // OnePlay Input\r\n int[] k; // onePlay points\r\n int j = curplayer;\r\n int[][][] m = memory.clone();\r\n int[] minCard = new int[3];\r\n int[] t;\r\n ArrayList<int[]> store = new ArrayList<>();\r\n minCard[2] = 100000;\r\n t = new int[3];\r\n for (int i = 0; i < 4; i++) { // 4 types of cards\r\n for (int l = 2; l < cardPerPlayer + 2; l++) {\r\n if (m[j][i][l] == 1 || m[j][i][l] == 2) {\r\n one[j][0] = i;\r\n one[j][1] = l;\r\n remove(new int[] { i, l }, m);\r\n if ((j + 1) % players != startPlayerId) {\r\n t = solver(startPlayerId, (j + 1) % players, one, m, count);\r\n one[(j + 1) % players][0] = t[0];\r\n one[(j + 1) % players][1] = t[1];\r\n }\r\n // } else if ((j + 2) % players != startPlayerId) {\r\n // t = solver(startPlayerId, (j + 2) % players, one, m, count);\r\n // one[(j + 1) % players][0] = t[0];\r\n // one[(j + 1) % players][1] = t[1];\r\n // } else if ((j + 3) % players != startPlayerId) {\r\n // t = solver(startPlayerId, (j + 3) % players, one, m, count);\r\n // one[(j + 1) % players][0] = t[0];\r\n // one[(j + 1) % players][1] = t[1];\r\n // }\r\n\r\n k = onePlay(one, startPlayerId);\r\n int curpoint = 0;\r\n if (count != cardPerPlayer - 1) { // cardPerPlayer - 1 = 12\r\n t = solver(k[0], k[0], new int[4][2], m, count++);\r\n curpoint = t[2];\r\n }\r\n\r\n if (k[0] == myID) {\r\n curpoint += k[1] + k[2] * 12;\r\n }\r\n store.add(new int[] { i, l, curpoint });\r\n if (curpoint < minCard[2]) {\r\n minCard[2] = curpoint;\r\n minCard[0] = i;\r\n minCard[1] = l;\r\n }\r\n }\r\n }\r\n }\r\n\r\n return minCard;\r\n }", "public int optimizedCom() {\n\tint b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0;\n\tint a = 1;\n\n\tb = 65;\n\tc = b;\n\n\tif (a != 0) {\n\t b = (b * 100) + 100000;\n\t c = b + 17000;\n\t}\n\n\t// at this point:\n\t// a == 1\n\t// b == 106500\n\t// c == 123500\n\n\t// outer loop terminates when b == c\n\t// c never changes, serves as termination condition\n\t// b only gets +17 added for every execution of the outer loop\n\n\tdo {\n\t f = 1;\n\t d = 2;\n\t do { // jnz g -13\n\t\te = 2;\n\n\t\tdo { // jnz g - 8\n\t\t g = (d * e) - b;\n\n\t\t if (g == 0)\n\t\t\tf = 0;\n\n\t\t e++;\n\n\t\t g = e - b;\n\t\t} while (g != 0);\n\n\t\td++;\n\n\t\tg = d - b;\n\t } while (g != 0);\n\n\t // increments h if register b contains a non-prime number (checked by printing all values)\n\t if (f == 0) {\n\t\th++;\n\t\tSystem.out.println(\"b: \" + b + \" c: \" + c + \" d: \" + d + \" e: \" + e + \" f: \" + f + \" g: \" + g);\n\t }\n\n\t // c does not change, b only gets increased by 17\n\t // if b == c, the method returns h which is the number of non-prime numbers encountered in the loop\n\t g = b - c;\n\n\t if (g == 0)\n\t\treturn h;\n\n\t b += 17;\n\n\t} while (true);\n }", "public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int q = sc.nextInt();\n\n for(int k = 0; k < q; k++) {\n int m = sc.nextInt();\n int n = sc.nextInt();\n\n // indicate number of pieces\n long x = 1;\n long y = 1;\n \n ArrayList<Long> c_y = new ArrayList<Long>();\n for(int i = 0; i < m - 1; i++) {\n c_y.add(sc.nextLong());\n }\n \n ArrayList<Long> c_x = new ArrayList<Long>();\n for(int i = 0; i < n - 1; i++) {\n c_x.add(sc.nextLong());\n }\n\n Collections.sort(c_y, Collections.reverseOrder());\n Collections.sort(c_x, Collections.reverseOrder());\n\n // cut: most expensive = cut first\n int index_X = 0;\n int index_Y = 0;\n long totalCost = 0;\n\n while(!(x == n && y == m)) {\n if(x < n && y < m) {\n // compare cost to decide whether cut horizontally or vertically\n if(c_y.get(index_Y) >= c_x.get(index_X)) {\n totalCost += c_y.get(index_Y) * x;\n y++;\n index_Y++;\n } else if(c_y.get(index_Y) < c_x.get(index_X)) {\n totalCost += c_x.get(index_X) * y;\n x++;\n index_X++; \n }\n } else if(x == n && y < m) {\n totalCost += c_y.get(index_Y) * x;\n index_Y++;\n y++;\n } else if(x < n && y == m) {\n totalCost += c_x.get(index_X) * y;\n index_X++;\n x++;\n }\n }\n\n totalCost = totalCost % (long)(Math.pow(10, 9) + 7);\n System.out.println(totalCost );\n }\n }", "public static int Main()\n\t{\n\t\ts = (String)malloc(100000 * (Character.SIZE / Byte.SIZE));\n\t\tint[] count = new int[26];\n\t\tint[] p = new int[26];\n\t\tint n;\n\t\tchar cc;\n\t\tchar key = '-';\n\t\tint min = 100001;\n\t\tint i;\n\t\tString tempVar = ConsoleInput.scanfRead();\n\t\tif (tempVar != null)\n\t\t{\n\t\t\tn = Integer.parseInt(tempVar);\n\t\t}\n\t\tString tempVar2 = ConsoleInput.scanfRead(null, 1);\n\t\tif (tempVar2 != null)\n\t\t{\n\t\t\tcc = tempVar2.charAt(0);\n\t\t}\n\n\t\twhile (n-- != 0)\n\t\t{\n\t\t\ts = new Scanner(System.in).nextLine();\n\t\t\tfor (i = 0;i < 26;i++)\n\t\t\t{\n\t\t\t\tcount[i] = 0;\n\t\t\t\tp[i] = 100001;\n\t\t\t}\n\t\t\tfor (i = 0;i < s.length();i++)\n\t\t\t{\n\t\t\t\tcount[*(s.Substring(i)) - 'a']++;\n\t\t\t\tif (p[*(s.Substring(i)) - 'a'] > i)\n\t\t\t\t{\n\t\t\t\t\tp[*(s.Substring(i)) - 'a'] = i;\n\t\t\t\t}\n\t\t\t}\n\t\t\tkey = '-';\n\t\t\tmin = 100001;\n\t\t\tfor (i = 0;i < 26;i++)\n\t\t\t{\n\t\t\t\tif (count[i] == 1 && p[i] < min)\n\t\t\t\t{\n\t\t\t\t\tkey = 'a' + i;\n\t\t\t\t\tmin = p[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (key == '-')\n\t\t\t{\n\t\t\t\tSystem.out.print(\"no\\n\");\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tSystem.out.printf(\"%c\\n\",key);\n\t\t\t}\n\t\t}\n\n\t\treturn 0;\n\t}", "@Test\n public void computerOffensive() throws IOException {\n Board field = new Board(\"CP----\"\n + \"-P--C-\"\n + \"-P----\"\n + \"-C----\"\n + \"-P--C-\"\n + \"------\");\n\n assertTrue(field.evaluate(false) < 0);\n\n // Vorteil fuer Spieler in Spalte 1\n Board field2 = new Board(\"CP----\"\n + \"-PC-C-\"\n + \"-P--P-\"\n + \"------\"\n + \"-PC-C-\"\n + \"------\");\n\n assertTrue(field2.evaluate(false) < 0);\n\n // Vorteil Computer in Zeile 0, 2\n // Vorteil Spieler in Zeile 2\n Board field3 = new Board(\"PC----\"\n + \"-PC-C-\"\n + \"-P--P-\"\n + \"-C----\"\n + \"-P--C-\"\n + \"------\");\n\n assertTrue(field3.evaluate(false) > 0);\n }", "private int evaluate(Board board)\n {\n if (computerWin(board))\n return 4*size;\n else if (playerWin(board))\n return -4*size;\n else if (draw(board))\n return 3*size;\n else\n return count(board, COMPUTER);\n }", "public void Execute()\n\t{\n\t\tString decryptedText=\"\";\n\t\tString key = KeyGenerator.GenerateKey();\n\t\tPlayfairCypher cypher=new PlayfairCypher(key);\n\t\tint temp = 11;\n\t\t\n\t\t//this.digraph=cypher.getDigraph();\n\t\t\n\t\n\t\tdecryptedText=cypher.Decrypt(txt);\n\t\tdouble score=Score(decryptedText);\n\n\t\t//PlayfairCypher aux;\n\t\tThread t1;\n\t\tThread t2;\n\t\tfor (; temp >0 ; temp--) \n\t\t{\n\t\t\tSystem.out.println(\"TEMP \"+temp);\n\t\t\t//Runnable r = new AneallingRunnable(key,score,temp,keyT1,scoreT1,txt);\n\t\t\tRunnable r = new AneallingRunnable(key,score,temp,txt,1);\n\t\t\tRunnable r2 = new AneallingRunnable(key,score,temp,txt,2);\n\t\t\tt1 = new Thread(r);\n\t\t\tt2=new Thread(r2);\n\t\t\tt1.start();\n\t\t\tt2.start();\n\t\t\t\n\t\t\ttry\n\t\t\t{\n\t\t\t\tt1.join();\n\t\t\t\tt2.join();\n\t\t\t}catch (Exception e) {\n\t\t\t\t// TODO: handle exception\n\t\t\t}\n\t\t\tif(SharedDataBetweenThreads.scoreT1>SharedDataBetweenThreads.scoreT2)\n\t\t\t\t{\n\t\t\t\t\tscore=SharedDataBetweenThreads.scoreT1;\n\t\t\t\t\tkey=SharedDataBetweenThreads.keyT1;\n\t\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tscore=SharedDataBetweenThreads.scoreT2;\n\t\t\t\tkey=SharedDataBetweenThreads.keyT2;\n\t\t\t}\n\t\t\tSystem.out.println(\"TEMP: \"+temp+\" Score: \"+score+\"\\n\");\n\t\t\tSharedDataBetweenThreads.scoreT1=0;\n\t\t\tSharedDataBetweenThreads.scoreT2=0;\n\t\t\t\n\t\t\tif(score>180) temp=-1;\n\n\t\t}\n\t\t\n\t\tcypher=new PlayfairCypher(key);\n\t\tSystem.out.println(cypher.toString());\n\t\tSystem.out.println(cypher.Decrypt(txt));\n\t\t\n\t\tlong stopTime = System.currentTimeMillis();\n\t long elapsedTime = stopTime - startTime;\n\t System.out.println(\"\\nTime taken: \"+elapsedTime/10);\n\t}", "public int[] attack(){\n\t\tint[] key = {0};\n\t\tAkelarre ake;\n\t\tint endVal = (int)Math.pow(2,numBits)-1;\n\t\twhile(true){\n\t\t\tboolean reachedEnd = true;\n\t\t\take = new Akelarre(1,4,key);\n\n\t\t\tfor(int i : key){\n\t\t\t\tif( i != endVal ){\n\t\t\t\t\treachedEnd = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif( reachedEnd ) return null;\n\n\t\t\tif(eq(ake.encrypt(plaintext),ciphertext)){\n\t\t\t\treturn key;\n\t\t\t}\n\n\t\t\tfor(int i=key.length-1;i>=0;i--){\n\t\t\t\tkey[i]++;\n\t\t\t\tif( key[i] != 0){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "int pulse() {\r\n\r\n int m = majority(regX.get(8), regY.get(10), regZ.get(10));\r\n //System.out.println(\"M: \" + m);\r\n int cipherOutput = (regX.get(18) ^ regY.get(21) ^ regZ.get(22));\r\n\r\n if (m == regX.get(8)) {\r\n int t = regX.get(13) ^ regX.get(16) ^ regX.get(17) ^ regX.get(18);\r\n regX.push(t);\r\n }\r\n if (m == regY.get(10)) {\r\n int t = regY.get(20) ^ regY.get(21);\r\n regY.push(t);\r\n }\r\n\r\n if (m == regZ.get(10)) {\r\n int t = regZ.get(7) ^ regZ.get(20) ^ regZ.get(21) ^ regZ.get(22);\r\n regZ.push(t);\r\n }\r\n\r\n keystream.add(cipherOutput);\r\n return cipherOutput;\r\n }", "@Override\n protected String pieceSelectionAlgorithm() {\n //some useful lines:\n //String BinaryString = String.format(\"%5s\", Integer.toBinaryString(pieceID)).replace(' ', '0');\n\n this.startTimer();\n boolean skip = false;\n for (int i = 0; i < this.quartoBoard.getNumberOfPieces(); i++) {\n skip = false;\n if (!this.quartoBoard.isPieceOnBoard(i)) {\n for (int row = 0; row < this.quartoBoard.getNumberOfRows(); row++) {\n for (int col = 0; col < this.quartoBoard.getNumberOfColumns(); col++) {\n if (!this.quartoBoard.isSpaceTaken(row, col)) {\n QuartoBoard copyBoard = new QuartoBoard(this.quartoBoard);\n copyBoard.insertPieceOnBoard(row, col, i);\n if (copyBoard.checkRow(row) || copyBoard.checkColumn(col) || copyBoard.checkDiagonals()) {\n skip = true;\n break;\n }\n }\n }\n if (skip) {\n break;\n }\n\n }\n if (!skip) {\n return String.format(\"%5s\", Integer.toBinaryString(i)).replace(' ', '0');\n }\n\n }\n if (this.getMillisecondsFromTimer() > (this.timeLimitForResponse - COMMUNICATION_DELAY)) {\n //handle for when we are over some imposed time limit (make sure you account for communication delay)\n }\n String message = null;\n //for eve\n // ry other i, check if there is a missed message\n /*\n if (i % 2 == 0 && ((message = this.checkForMissedServerMessages()) != null)) {\n //the oldest missed message is stored in the variable message.\n //You can see if any more missed messages are in the socket by running this.checkForMissedServerMessages() again\n }\n */\n }\n\n\n //if we don't find a piece in the above code just grab the first random piece\n int pieceId = this.quartoBoard.chooseRandomPieceNotPlayed(100);\n String BinaryString = String.format(\"%5s\", Integer.toBinaryString(pieceId)).replace(' ', '0');\n\n\n return BinaryString;\n }", "public int evaluate (Player p) {\r\n\t\t/* Adding players hand and the cards from the game board */\r\n\t\t\r\n\t\tfor (Card c: p.hand) {\r\n\t\t\tcards.add(c);\r\n\t\t}\r\n\t\tfor (Card c: board) {\r\n\t\t\tcards.add(c);\r\n\t\t}\r\n\t\t/*Return the value based on the card evaluated. Will check in\r\n\t\t * order to the strength of the hand starting from the \r\n\t\t * strongest hand in order to avoid overlapping between certain \r\n\t\t * hands. (Ex. Three pair includes two pair but three pair will be \r\n\t\t * checked first)*/\r\n\t\tif (hasRoyalFlush(cards)) \r\n\t\t\treturn ROYALFLUSH;\r\n\t\t else if (hasStraightFlush(cards)) \r\n\t\t\treturn STRAIGHTFLUSH;\r\n\t\t else if (hasQuads(cards)) \r\n\t\t\treturn QUADS;\r\n\t\t else if (hasFlush(cards)) \r\n\t\t\treturn FLUSH;\r\n\t\t else if (hasStraight(cards)) \r\n\t\t\treturn STRAIGHT;\r\n\t\t else if (hasSet(cards)) \r\n\t\t\treturn SET;\r\n\t\t else if (hasTwoP(cards)) \r\n\t\t\treturn TWOPAIR;\r\n\t\t else if (hasPair(cards)) \r\n\t\t\treturn PAIR;\r\n\t\t else \r\n\t\t\treturn HIGHCARD;\r\n\t\t\r\n\t}", "public void evaluateHand(){only public for testing\n //hand types will be\n //1 royal flush\n //2 straight flush\n //3 four of a kind\n //4 full house\n //5 flush\n //6 straight\n //7 three of a kind\n //8 two pair\n //9 pair\n //10 high card\n //hand secondary values will have to some how account for\n //the lead card of a flush or straight or the bigger pair\n //\n HandType = 0;\n\n //----------checking flush----------\n boolean flush = true;//will flip the vriable when proven wrong\n //if Hand.suites all equal\n for(Card c : Hand) {\n if (!c.getSuite().contains(Hand[0].getSuite())) {\n flush = false;\n }\n }\n //--Handtype = 5//flush\n if(flush){\n HandType=5;\n }\n\n //----------checking pair, two pair, boat,three of a kind, four of a kind----------\n int countmatches=0;\n HashMap<Integer, ArrayList<Card>> maskd = new HashMap<>();\n int[] mask = new int[5];\n int currentmask=1;\n maskd.put(0, new ArrayList<>());\n mask[0]=0;\n maskd.get(0).add(this.Hand[0]);\n //if any two hand.value equal\n for(int comp = 0; comp<Hand.length;comp++){//comparitor\n for(int check = comp+1; check<Hand.length;check++) {//checker\n //System.out.print(\"{\"+comp+check+\"}\");\n if(0==Hand[comp].compareTo(Hand[check])){\n //System.out.println(\"pair\"+Hand[comp]+Hand[check]);\n countmatches++;\n /*if(pairprimary==0&&!(pairprimary==Hand[check].getValue())){\n pairprimary=Hand[check].getValue();\n }else if(pairsecondary==0){\n pairsecondary=Hand[check].getValue();\n }//this wont work for boats\n */\n //create mask?\n if(mask[comp]==0){\n mask[comp]=currentmask;\n maskd.put(currentmask,new ArrayList<>());\n maskd.get(currentmask).add(this.Hand[comp]);\n currentmask++;\n if(maskd.get(0).contains(this.Hand[comp])){\n maskd.get(0).remove(this.Hand[comp]);\n }\n }\n mask[check]=mask[comp];\n if(!maskd.get(mask[comp]).contains(this.Hand[check])) {\n if(maskd.get(0).contains(this.Hand[check]))\n maskd.get(0).remove(this.Hand[check]);\n maskd.get(mask[comp]).add(this.Hand[check]);\n }\n continue;\n }\n if(!maskd.get(0).contains(this.Hand[check]))\n maskd.get(0).add(this.Hand[check]);\n }\n }\n\n //for(int m:maskd.keySet())\n // System.out.print(\"\"+m+\":\"+maskd.get(m));\n //System.out.println(\"\");\n\n if(HandType==0)\n switch (countmatches){ //basically i'm counting the collisions\n case 1: HandType=9;break;//one pair\n case 2: HandType=8;break;//two pair\n case 3: HandType=7;break;//triple\n case 4: HandType=4;break;//boat\n case 6: HandType=3;break;//four of a kind\n case 10: HandType=-1;break;//five of a kind\n }//reorder cards by mask?\n if(countmatches>0){\n Card[] newhand = new Card[5];\n int bigger = 0;\n if(currentmask==3) {//two pair boat\n //two pair\n if (maskd.get(1).get(0).getValue()\n > maskd.get(2).get(0).getValue()) {\n bigger = 1;\n } else {\n bigger = 2;\n }\n\n //boat\n if (maskd.get(1).size() == 3) {\n bigger = 1;\n }\n if (maskd.get(2).size() == 3) {\n bigger = 2;\n }\n }else {\n //one pair???\n bigger = 1;\n }\n\n for(int i = 0; i<5;i++){\n //if(maskd.containsKey(bigger)) {\n if(!maskd.get(bigger).isEmpty()) {\n newhand[i] = maskd.get(bigger).get(0);\n //if (maskd.get(bigger).size() > 0) {\n maskd.get(bigger).remove(0);\n //} else {\n // bigger = Math.abs(bigger - 3);\n //}\n }else{\n if(maskd.containsKey(Math.abs(bigger-3))){\n if(!maskd.get(Math.abs(bigger-3)).isEmpty()){\n bigger = Math.abs(bigger-3);\n }else{\n bigger = 0;\n }\n }else{\n bigger = 0;\n }\n i--;\n }\n //}\n\n }//end for loop\n\n //end pair bits\n\n //System.out.println(newhand);\n this.Hand=newhand;\n }//end reshuffle hand if statement\n //----------checking for straight----------\n //if first card is ace and second card is a 5, treat ace as one\n if(Hand[0].getValue()==14&&Hand[1].getValue()==5) {\n Hand[0] = new Card(\"Ace\", Hand[0].getSuite(), 1);\n //Hand[0].Value=1;\n this.sortHand();\n this.flipHand();\n }\n //go through hand and see if all 5 values are consecutive\n int n = Hand[0].getValue();\n boolean straight = true;\n for(int i = 1;i<Hand.length; i++){\n n--;\n if(!(Hand[i].getValue()==n)){\n straight=false;\n }\n }\n if(straight){\n //if above true\n //--if handtype = 5\n if(HandType==5) {\n //----if card1 is ace\n if (Hand[0].getValue() == 14) {\n //------handtype = 1 //royal flush\n HandType = 1;\n } else {\n //----else\n HandType=2;\n //------handtype = 2 //straight flush\n }\n }else {\n //--else //not a flush\n HandType=6;\n //----handtype = 6 //straight\n }\n }\n\n //----------checking high card----------\n //if handtype = 0\n if(HandType==0) {\n HandType=10;\n //--hand card = 10\n }\n }", "public void evaluate_cipher_sequence() {\n int[][] init_cipher_sequence = new int[18][32];\n // Initialisierung\n // for (int p=0; p<18; p++)\n // for (int t=0; t<32; t++)\n // init_cipher_sequence[p][t] = 0;\n intialize_matrix(init_cipher_sequence);\n\n // Initialisierung mit der Initial Permutation \"IP\"\n int[] m0_m1 = new int[64];\n m0_m1 = select(DES_plaintext, IP);\n\n DES_cipher_sequence = init_cipher_sequence;\n\n for (int j = 0; j < 32; j++) {\n DES_cipher_sequence[0][j] = m0_m1[j];\n DES_cipher_sequence[1][j] = m0_m1[32 + j];\n }\n\n int[][] K = new int[16][48];\n if (DES_action_type == 0)\n K = DES_K;\n else\n K = DES_reversed_K;\n\n // JOptionPane.showMessageDialog(null, \"Evaluating m[0]...m[17] && Action-Type = \" +\n // DES_action_type);\n\n for (int i = 2; i < 18; i++) {\n int[] input_SBoxes = exclusive_or(expand_32bit(DES_cipher_sequence[i - 1]), K[i - 2]);\n int[] fmK = select(lookup_SBoxes(input_SBoxes), P);\n DES_cipher_sequence[i] = exclusive_or(DES_cipher_sequence[i - 2], fmK);\n }\n }", "int compFunction(int code) {\n return Math.abs(((3 * code + 8) % largePrime) % buckets.length);\n }", "abstract public void compute(int maxSameSuit, int mostRepSuit, Hand hand);", "public static int Main()\n\t {\n\t\t int x;\n\t\t int j;\n\t\t int[] a = new int[16];\n\t\t x = Integer.parseInt(ConsoleInput.readToWhiteSpace(true));\n\t\t int i = 1;\n\t\t int k = 0;\n\t\t while (x != -1)\n\t\t {\n\t\t\ta[i] = x;\n\t\t\ti++;\n\t\t if (x != 0)\n\t\t {\n\t\t\t k = i;\n\t\t }\n\t\t\t else\n\t\t\t {\n\t\t\t\tint sum = 0;\n\t\t\t for (i = 1;i <= k;i++)\n\t\t\t {\n\t\t\t\t for (j = 1;j <= k ;j++)\n\t\t\t\t {\n\t\t\t\t if (a[i] == 2 * a[j])\n\t\t\t\t {\n\t\t\t\t\t sum++;\n\t\t\t\t }\n\t\t\t\t }\n\t\t\t }\n\t\t\t\t\tSystem.out.print((sum - 1));\n\t\t\t\t\tSystem.out.print(\"\\n\");\n\t\t\t\t\ti = 1;\n\t\t\t }\n\t\t\tx = Integer.parseInt(ConsoleInput.readToWhiteSpace(true));\n\t\t }\n\t\t\treturn 0;\n\t }", "protected int algo() {\r\n result = algo(root, -2000000000, 2000000000);\r\n\r\n // Nach Terminierung des Algorithmus\r\n lang.nextStep();\r\n setExplain(200, result, 0);\r\n colorNode(root, seenNodeColor);\r\n code.unhighlight(14);\r\n return result;\r\n }", "private int run() {\r\n int[] num = new int[13];\r\n boolean IsRun = false;\r\n int count = 0, index=0, combination=1;\r\n for (String aCard : Card) {\r\n switch (aCard.substring(0, 1)) {\r\n case \"A\":\r\n num[0]++;\r\n continue;\r\n case \"2\":\r\n num[1]++;\r\n continue;\r\n case \"3\":\r\n num[2]++;\r\n continue;\r\n case \"4\":\r\n num[3]++;\r\n continue;\r\n case \"5\":\r\n num[4]++;\r\n continue;\r\n case \"6\":\r\n num[5]++;\r\n continue;\r\n case \"7\":\r\n num[6]++;\r\n continue;\r\n case \"8\":\r\n num[7]++;\r\n continue;\r\n case \"9\":\r\n num[8]++;\r\n continue;\r\n case \"T\":\r\n num[9]++;\r\n continue;\r\n case \"J\":\r\n num[10]++;\r\n continue;\r\n case \"Q\":\r\n num[11]++;\r\n continue;\r\n case \"K\":\r\n num[12]++;\r\n }\r\n }\r\n\r\n for (int i = 1; i < 14; i++) {\r\n if (num[i-1]!=0){\r\n count++;\r\n index=i-1;\r\n }\r\n if (count>=3){\r\n IsRun=true;\r\n }\r\n if (i<13) {\r\n if (num[i] == 0 && IsRun) { //if there is a run already, break the recursion if the next num doesn't exist.\r\n break;\r\n }\r\n if (num[i] == 0 && !IsRun) {\r\n count = 0;\r\n index = 0;\r\n }\r\n }\r\n }\r\n\r\n if (IsRun){\r\n for (int i = index-count+1; i < index+1; i++) {\r\n combination*=num[i];\r\n }\r\n return combination*count;\r\n }\r\n return 0;\r\n }", "protected long runLong(Part part, List<String> input) {\n\t\t// Initialize computers.\n\t\tMap<Long, Computer> computers = new HashMap<>();\n\t\tfor (long i = 0; i < 50; i++) {\n\t\t\tComputer computer = new Computer(input);\n\t\t\tcomputers.put(i, computer);\n\t\t\tcomputer.getInputs().add(i);\n\t\t\tcomputer.run();\n\t\t}\n\n\t\tSet<Pair> sentPackets = new HashSet<>();\n\t\tPair<Long> nat = null;\n\t\twhile (true) {\n\t\t\t// Queue up any packets.\n\t\t\tfor (Computer sender : computers.values()) {\n\t\t\t\twhile (sender.getOutputs().size() > 0) {\n\t\t\t\t\tLong address = sender.getOutputs().remove(0);\n\t\t\t\t\tLong x = sender.getOutputs().remove(0);\n\t\t\t\t\tLong y = sender.getOutputs().remove(0);\n\t\t\t\t\tif (address == 255L) {\n\t\t\t\t\t\tif (part == Part.ONE) {\n\t\t\t\t\t\t\treturn (y);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnat = new Pair<>(x, y);\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tComputer receiver = computers.get(address);\n\t\t\t\t\t\treceiver.getInputs().add(x);\n\t\t\t\t\t\treceiver.getInputs().add(y);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// In Part TWO only, allow the NAT to check network idleness.\n\t\t\tif (part == Part.TWO) {\n\t\t\t\tboolean allIdle = true;\n\t\t\t\tfor (Computer receiver : computers.values()) {\n\t\t\t\t\tallIdle = allIdle && (receiver.getInputs().size() == 0);\n\t\t\t\t}\n\t\t\t\tif (allIdle && nat != null) {\n\t\t\t\t\tComputer receiver = computers.get(0L);\n\t\t\t\t\treceiver.getInputs().add(nat.getX());\n\t\t\t\t\treceiver.getInputs().add(nat.getY());\n\t\t\t\t\tif (sentPackets.contains(nat)) {\n\t\t\t\t\t\treturn (nat.getY());\n\t\t\t\t\t}\n\t\t\t\t\tsentPackets.add(nat);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Fill any computers with no packets with -1 then run again.\n\t\t\tfor (Computer receiver : computers.values()) {\n\t\t\t\tif (receiver.getInputs().size() == 0) {\n\t\t\t\t\treceiver.getInputs().add(-1L);\n\t\t\t\t}\n\t\t\t\treceiver.run();\n\t\t\t}\n\t\t}\n\t}", "private void run() throws Exception {\n\t\tScanner sc = new Scanner(new File(\"src\\\\input.txt\"));\r\n\t\tPrintWriter pw = new PrintWriter(\"output.txt\");\r\n\t\tint tc = sc.nextInt();\r\n\t\tcol = new int[1000];\r\n\t\te = new int[2000];\r\n\t\tnext = new int[2000];\r\n\t\tf = new int[1000];\r\n\t\ta = new int[1000];\r\n\t\tb = new int[1000];\r\n\t\tfor (int t = 1; t <= tc; t++) {\r\n\t\t\tn = sc.nextInt();\r\n\t\t\tint best = Integer.MAX_VALUE;\r\n\t\t\tec = 0;\r\n\t\t\tArrays.fill(f, -1);\r\n\t\t\tfor (int i = 0; i < n - 1; i++) {\r\n\t\t\t\tint x = sc.nextInt() - 1;\r\n\t\t\t\tint y = sc.nextInt() - 1;\r\n\t\t\t\tadd(x, y);\r\n\t\t\t\tadd(y, x);\r\n\t\t\t}\r\n\t\t\tfor (int i = 0; i < n; i++) {\r\n\t\t\t\tArrays.fill(col, 0);\r\n\t\t\t\tif (i == 1)\r\n\t\t\t\t\ti += 0;\r\n\t\t\t\tgo(i);\r\n\t\t\t\tif (b[i] == 4)\r\n\t\t\t\t\tbest += 0;\r\n\t\t\t\tbest = Math.min(best, b[i]);\r\n\t\t\t}\r\n\t\t\tSystem.err.println(t);\r\n\t\t\tpw.printf(\"Case #%d: %d\\n\", t, best);\r\n\t\t}\r\n\t\tpw.close();\r\n\t}", "public static void main(String[] args) {\n\t\tScanner input = new Scanner(System.in);\n\t\t//Methods to validate credit card numbers\n\t\tString ccCheck = \"\";\n\t\tSystem.out.print(\"Enter a credit card number as a long integer: \");\n\t\tString ccNumber = input.next();\n\t\tif(isValid(ccNumber)) {\n\t\t\tccCheck = \"valid\";\n\t\t}\n\t\telse {\n\t\t\tccCheck = \"invalid\";\n\t\t}\n\t\tSystem.out.println(ccNumber + \" is \" + ccCheck);\n\t\n\t\tSystem.out.println(\"Testing other methods: \" + getPrefix(ccNumber, 1));\t\n\t\t\n\t\t//Simulation of a bean machine a.k.a. Galton box\n\t\tSystem.out.print(\"Enter the number of balls to drop: \");\n\t\tint balls = input.nextInt();\n\t\tSystem.out.print(\"Enter the number of slots in the bean machine: \");\n\t\tint[] slots = new int[input.nextInt()];\n\t\tint slotCount = 0;\n\t\t\n\t\tfor(int i = 0; i < balls; i++) {\n\t\t\tfor(int j = 0; j < slots.length; j++) {\n\t\t\t\tint randomPick = (int)(Math.random() * 10);\n\t\t\t\tchar direction = 'A';\n\t\t\t\tif(randomPick <= 5) {\n\t\t\t\t\tdirection = 'L';\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tdirection = 'R';\n\t\t\t\t\tslotCount++;\n\t\t\t\t}\n\t\t\t\tSystem.out.print(direction);\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t\tslots[slotCount - 1] += 1;\n\t\t\tslotCount = 0;\n\t\t}\n\t\tSystem.out.print(\"\\n\");\n\t\t\n\t\tSystem.out.println(java.util.Arrays.toString(slots));\n\t\t\n\t\tfor(int i = 5; i >= 1; i--) {\n\t\t\tfor(int j = 0; j < slots.length; j++) {\n\t\t\t\tif(slots[j] == i) {\n\t\t\t\t\tSystem.out.print(\"O\");\n\t\t\t\t\tslots[j] = slots[j] - 1;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tSystem.out.print(\" \");\n\t\t\t\t}\n\t\t\t}\n\t\t\tSystem.out.println();\n\t\t}\t\n\t\t\n\t\t//Eight Queens puzzle: placing 8 queens on a chessboard such that no two queens can attack eachother\n\t\tString gridOutput = \"\";\n\t\tchar[][] gameGrid = new char[8][8];\n\t\t//initialize the array\n\t\t\t\tfor(int i = 0; i < gameGrid.length; i++) {\n\t\t\t\t\tfor(int j = 0; j < gameGrid[i].length; j++) {\n\t\t\t\t\t\tgameGrid[i][j] = ' ';\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\tgameGrid[0][0] = 'Q';\n\t\tgameGrid[1][4] = 'Q';\n\t\tgameGrid[2][7] = 'Q';\n\t\tgameGrid[3][5] = 'Q';\n\t\tgameGrid[4][2] = 'Q';\n\t\tgameGrid[5][6] = 'Q';\n\t\tgameGrid[6][1] = 'Q';\n\t\tgameGrid[7][3] = 'Q';\n\t\t\n\t\tgridOutput = Arrays.deepToString(gameGrid).replace(\"], \", \"]\\n\");\n\t\tgridOutput = gridOutput.substring(1,gridOutput.length() - 1).replace(\"[\", \"|\").replace(\"]\", \"|\").replace(\", \",\"|\");\n\t\tSystem.out.println(gridOutput);\n\t\t\n\t\t//Simple hangman game which reads words from a .txt file on the computer\n\t\tFile words = new java.io.File(\"C:\\\\Users\\\\Darth Phoenix\\\\Documents\\\\eclipsemars\\\\Exampractice\\\\src\\\\hangman.txt\");\n\t\tSystem.out.println(\"Does this file exist? \" + words.exists());\n\t\tint misses = 0;\n\t\ttry {\n\t\t\tScanner wordReader = new Scanner(words);\n\t\t\tif(wordReader.hasNext()) {\n\t\t\t\tString solution = wordReader.next();\n\t\t\t\tString answer = \"\";\n\t\t\t\tchar[] convertingAnswer = new char[solution.length()];\n\t\t\t\tfor(int i = 0; i < solution.length(); i++ ) {\n\t\t\t\t\tanswer += \"*\";\n\t\t\t\t}\n\n\t\t\t\tSystem.out.print(\"(Guess) Enter a letter in word \" + answer + \" >\");\n\t\t\t\tchar guess = input.next().charAt(0);\n\t\t\t\tfor(int i = 0; i < solution.length(); i++ ) {\n\t\t\t\t\tif(guess == solution.charAt(i)) {\n\t\t\t\t\t\t//Working on this bit here\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tSystem.out.print(\"The word is: \" + solution + \". You missed \" + misses + \"time.\");\n\t\t\t}\n\t\t}\n\t\tcatch (FileNotFoundException ex) {\n\t\t\tSystem.out.println(\"Whoops. That file isn't there where you thought it was.\");\n\t\t}\n\t}", "@Override\n\tpublic void challenge9() {\n\n\t}", "@Override\n\tpublic void challenge11() {\n\n\t}", "private void makeSmartComputerMove() {\n\t\tboolean b;\n\t\tint winningPos = 0;\n\t\tfor (int i = 1; i < board.length; i++) {\n\t\t\tb = isWinningMove(i, computerLetter);\n\t\t\tif (b) {\n\t\t\t\twinningPos = i;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (winningPos == 0) {\n\t\t\tfor (int i = 1; i < board.length; i++) {\n\t\t\t\tb = isWinningMove(i, playerLetter);\n\t\t\t\tif (b) {\n\t\t\t\t\twinningPos = i;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (winningPos == 0) {\n\t\t\twinningPos = getPosForWin();\n\t\t\tif (winningPos == 0)\n\t\t\t\twinningPos = (int) (Math.floor(Math.random() * 100) % 9 + 1);\n\t\t}\n\t\tif (winningPos < 0 || winningPos > 9) {\n\t\t\tSystem.out.println(\"Enter a valid position :\");\n\t\t\tmakeSmartComputerMove();\n\t\t} else if (isFree[winningPos]) {\n\t\t\tboard[winningPos] = computerLetter;\n\t\t\tisFree[winningPos] = false;\n\t\t\tSystem.out.println(\"Computer Move :\");\n\t\t\tprintBoard(board);\n\t\t\tisPlayerTurn = true;\n\t\t} else {\n\t\t\tmakeSmartComputerMove();\n\t\t}\n\n\t}", "static void runIt() throws IOException {\n\t\t String inFName = \"resource/C-large.in\";\n//\t\tString outFName = \"resource/C-small.out\";\n\t\t String outFName = \"resource/C-large.out\";\n\n\t\tBufferedReader in = new BufferedReader(new FileReader(inFName));\n\t\tPrintWriter out = new PrintWriter(new File(outFName));\n\n\t\tint testCases = Integer.parseInt(in.readLine());\n\n\t\tfor (int i = 0; i < testCases; ++i) {\n\n\t\t\tString line[] = in.readLine().split(\" \");\n//\t\t\tSystem.out.println(line);\n\t\t\tStringBuilder output = new StringBuilder();\n\t\t\toutput.append(\"Case #\" + (i + 1) + \": \");\n\n\t\t\tint R = Integer.parseInt(line[0]);\n\t\t\tint K = Integer.parseInt(line[1]);\n\t\t\tlong euros = 0;\n\t\t\tint pass = 0;\n\t\t\tline = in.readLine().split(\" \");\n\t\t\tVector<Integer> queue = new Vector<Integer>();\n\t\t\tVector<Integer> first = new Vector<Integer>();\n\t\t\tfor (String string : line) {\n\t\t\t\tqueue.add(Integer.parseInt(string));\n\t\t\t\tfirst.add(Integer.parseInt(string));\n\t\t\t\t\n\t\t\t}\n\n\n\t\t\tfor (int time = 0; time < R; ++time) {\n\t\t\t\tint p = 0;\n\t\t\t\twhile (true) {\n\t\t\t\t\tif (p < queue.size()) {\n\t\t\t\t\t\tInteger g = queue.elementAt(p++);\n\t\t\t\t\t\tif (pass + g <= K) {\n\t\t\t\t\t\t\tpass += g;\n\t\t\t\t\t\t} else {\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\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\tfor (int kk = 1; kk < p; ++kk) {\n\t\t\t\t\tInteger m = queue.remove(0);\n\t\t\t\t\tqueue.add(m);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\teuros += pass;\n\t\t\t\tpass=0;\n\t\t\t\tif(queue.equals(first)){\n\t\t\t\t\tint s = R/(time+1);\n\t\t\t\t\teuros*=s;\n\t\t\t\t\ttime *=s;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\toutput.append(euros);\n\t\t\tSystem.out.println(output);\n\t\t\tout.println(output);\n\t\t}\n\n\t\tin.close();\n\t\tout.flush();\n\t\tout.close();\n\t}", "private double getUnadjustedFitness(Computer computer){\n double score = 0;\n score += 6 * getMatchPercent(computer);\n if(computer.compatible() && sizeCompatability(computer))\n score += 9.5;\n int ramAmount =computer.ramAmount();\n if(ramAmount < 8)\n score -= (8 - ramAmount) * 2;\n else if(ramAmount > 8 && ramAmount < 17)\n score += .06 * (ramAmount - 8);\n else if(ramAmount > 17)\n score += .03 * (ramAmount - 8);\n\n if(computer.cpu.name.contains(\"Intel\") && computer.cpu.name.endsWith(\"K\")){\n if (!computer.motherboard.overclock()){\n score -= 6;\n }\n }\n\n if(computer.cpu.name.contains(\"Intel\") && !(computer.cpu.shortname.contains(\"-5\") || computer.cpu.shortname.contains(\"-6\"))){\n score -= 2;\n }\n if(computer.cpu.name.contains(\"GeForce\") && !(computer.gpu.name.contains(\"GTX 9\") || computer.gpu.name.contains(\"GTX 1\"))){\n score -= 2;\n }\n if(computer.bootDrive.size < 240)\n score -= settings.diskSize * 0.33;\n if(computer.bootDrive.size > 700)\n score += settings.diskSize * 5;\n else\n score += settings.diskSize * computer.bootDrive.size / 140;\n if(computer.secondaryDrive != null)\n score += settings.diskSize * computer.secondaryDrive.size / 1000;\n\n //Now ensure there's enough power, and give a bonus for there being ~300 watts more than needed;\n //there are 4.5 points to gain in powersupply, 10 points to lose\n int basePower = computer.powerConsumption();\n int ideal = basePower + 65;\n if(computer.power.watts < basePower)\n score -= 10;\n else if(computer.power.watts < ideal)\n score += (basePower - computer.power.watts) / 100;\n else\n score += 2.5 - (computer.power.watts - basePower) / 250;\n score += (3 - computer.power.tier) * .6;\n\n // Now motherboard, one point to gain, one to lose\n score += 2 - computer.motherboard.getQuality();\n\n double driveScore = ((computer.bootDrive.reads + computer.bootDrive.writes) / 2) / 88;\n driveScore -= 2;\n if(driveScore > 7.5){\n driveScore = 7.5;\n }\n score += driveScore;\n double rawCpu = ((1 - settings.multicore) / 3) * computer.cpu.singlecore + ((settings.multicore / 3) * (computer.cpu.multicore));\n double adjustedCpu = 26 + 40* ((settings.cpuIntensity / (settings.cpuIntensity + settings.gpuIntensity))* rawCpu - lowCpuScore()) / (maxCpuScore() - lowCpuScore());\n double rawGpu = computer.gpu.fps + (computer.gpu.threedmark / 100);\n double adjustedGpu = 17 + 40 * ((settings.gpuIntensity / (settings.cpuIntensity + settings.gpuIntensity)) * rawGpu - lowGpuScore()) / (maxGpuScore() - lowGpuScore());\n //Inflate the GPU score slightly\n // adjustedGpu * ((35 - adjustedGpu) / 35);\n score += adjustedGpu;\n score += adjustedCpu;\n\n return score;\n }", "public static void main(String[] args) {\n List<String> words = new ArrayList<>();\n try (BufferedReader br = new BufferedReader(new FileReader(\"google-10000-english-no-swears.txt\"))) {\n while (br.ready()) {\n words.add(br.readLine().toLowerCase());\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n\n //send a message to rose with the word cookie and your team name to get the next clue\n List<String> cipherWords = new ArrayList<>(Arrays.asList(cipher.split(\" \")));\n\n\n HashMap<Character, List<String>> charOccurrences = new HashMap<>();\n //Add all words where a character occurs to a list then map that list to the character\n for (String cipherWord : cipherWords) {\n for (Character ch : cipherWord.toCharArray()) {\n for (String cipherWord2 : cipherWords) {\n if (cipherWord2.contains(ch.toString())) {\n if (charOccurrences.get(ch) == null) {\n charOccurrences.put(ch, (new ArrayList<>(Collections.singletonList(cipherWord2))));\n } else {\n if (!charOccurrences.get(ch).contains(cipherWord2)) {\n charOccurrences.get(ch).add(cipherWord2);\n }\n }\n }\n }\n }\n }\n HashMap<Character, List<Character>> possibleChars = new HashMap<>();\n //Map all characters to a list of all characters which it could possibly be\n for (Map.Entry<Character, List<String>> entry : charOccurrences.entrySet()) {\n Character key = entry.getKey();\n List<String> value = entry.getValue();\n\n List<List<Character>> lists = new ArrayList<>();\n\n for (String string : value) {\n List<Character> characterList = new ArrayList<>();\n for (String patternMatch : getMatches(string, words)) {\n if (!characterList.contains(patternMatch.charAt(string.indexOf(key)))) {\n characterList.add(patternMatch.charAt(string.indexOf(key)));\n }\n }\n lists.add(characterList);\n }\n possibleChars.put(key, findDupes(lists));\n }\n\n HashMap<Character, Character> keyMap = new HashMap<>();\n\n removeCharacter(possibleChars, keyMap, true);\n\n\n //Loop a bunch of times to eliminate things that characters cant be\n for (int x = 0; x < 10; x++) {\n HashMap<Character, List<Character>> tempMap = new HashMap<>(possibleChars);\n possibleChars.clear();\n for (Map.Entry<Character, List<String>> entry : charOccurrences.entrySet()) {\n Character key = entry.getKey();\n List<String> value = entry.getValue();\n\n List<List<Character>> lists = new ArrayList<>();\n\n for (String string : value) {\n List<Character> characterList = new ArrayList<>();\n for (String patternMatch : getMatchesWithLetters(string, keyMap, tempMap, words)) {\n if (!characterList.contains(patternMatch.charAt(string.indexOf(key)))) {\n characterList.add(patternMatch.charAt(string.indexOf(key)));\n }\n }\n lists.add(characterList);\n }\n possibleChars.put(key, findDupes(lists));\n }\n\n keyMap.clear();\n\n removeCharacter(possibleChars, keyMap, true);\n\n }\n\n System.out.println(cipher);\n //print with a lil bit of frequency analysis to pick most common word if word has multiple possible results\n for (String str : cipherWords) {\n String temp = \"\";\n List<String> matchedWords = getMatchesWithLetters(str, keyMap, possibleChars, words);\n if (matchedWords.size() > 1) {\n int highest = 0;\n for (int x = 1; x < matchedWords.size(); x++) {\n if (words.indexOf(matchedWords.get(highest)) > words.indexOf(matchedWords.get(x))) {\n highest = x;\n }\n }\n temp = matchedWords.get(highest);\n }\n\n if (matchedWords.size() == 1) { //if there only 1 possibility print it.\n System.out.print(matchedWords.get(0));\n System.out.print(\" \");\n } else { //if there's more than 1 print the most common one.\n System.out.print(temp);\n System.out.print(\" \");\n }\n }\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}", "public static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\n\t\tint n = scan.nextInt();\n\t\tint m = scan.nextInt();\n\t\tint[] card = new int[n];\n\n\t\tfor(int i=0; i<card.length; i++) {\n\t\t\tcard[i] = scan.nextInt();\n\t\t}\n\n\t\tint result = 0;\n\t\tint temp = 0;\n\n\t\tfor(int i=0; i<n-2; i++) \n\t\t\tfor(int j=i+1; j<n-1; j++) \n\t\t\t\tfor(int k=j+1; k<n; k++) {\n\t\t\t\t\tresult = card[i] + card[j] + card[k];\n\t\t\t\t\tif(result <= m) {\n\t\t\t\t\t\tif(temp <= result)\n\t\t\t\t\t\t\ttemp = result;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\tSystem.out.println(temp);\n\t\tscan.close();\n\t}", "public void generate(){\n\t\t//Key Generation\n\t\tint p = 41, q = 67; //two hard-coded prime numbers\n\t\tint n = p * q;\n\t\tint w = (p-1) * (q-1);\n\t\tint d = 83; //hard-coded number relatively prime number to w\n\t\t\n\t\tthis.privatekey = new PrivateKey(d,n); //public key generation completed\n\t\t\n\t\t//Extended Euclid's algorithm\n\t\tint \ta = w, \n\t\t\t\tb = d,\n\t\t\t\tv = a/b;\n\t\tArrayList<Integer> \tx = new ArrayList<Integer>(), \n\t\t\t\t\ty = new ArrayList<Integer>(),\n\t\t\t\t\tr = new ArrayList<Integer>();\n\t\t\n\t\t\n\t\t//Iteration 0\n\t\tint i = 0;\n\t\tx.add(1);\n\t\ty.add(0);\n\t\tr.add(a);\n\t\ti++;\n\t\t//Iteration 1\n\t\tx.add(0);\n\t\ty.add(1);\n\t\tr.add(b);\n\t\ti++;\n\t\t//Iteration 2\n\t\t //iteration counter\n\t\tint e = y.get(i-1);\n\t\tv = r.get(i-2) / r.get(i-1);\n\t\tx.add(x.get(i-2)-v*x.get(i-1));\n\t\ty.add(y.get(i-2) - v*y.get(i-1));\n\t\tr.add(a*(x.get(i-2)-v*x.get(i-1))\n\t\t\t\t+b*(y.get(i-2)-v*y.get(i-1))); \n\t\ti++;\n\t\t\n\t\t//Iterate until r == 0, then get the previous iteration's value of d\n\t\twhile(r.get(i-1) > 0){\n\t\t\te = y.get(i-1);\n\t\t\tv = r.get(i-2) / r.get(i-1);\n\t\t\tx.add(x.get(i-2)-v*x.get(i-1));\n\t\t\ty.add(y.get(i-2) - v*y.get(i-1));\n\t\t\tr.add(a*(x.get(i-2)-v*x.get(i-1))\n\t\t\t\t\t+b*(y.get(i-2) -(v*y.get(i-1))));\n\t\t\ti++;\n\t\t}\n\t\t\n\t\t//if number is negative, add w to keep positive\n\t\tif (e < 0){\n\t\t\te = w+e;\n\t\t}\n\t\tthis.publickey = new PublicKey(e,n); //private key generation completed\n\t\t\n\t\t//print values to console\n\t\tSystem.out.println(\"Value of public key: \" + e + \", private key: \" + d + \", modulus: \" + n);\n\t\tSystem.out.println();\n\t}", "public double heuristic(Bitboard board) {\n double h = 0;\n\n // mobility\n int p1Mobility = 0;\n int p2Mobility = 0;\n // strength of piece positions\n double p1Position = 0;\n double p2Position = 0;\n // number of pieces\n int p1Pieces = 0;\n int p2Pieces = 0;\n // number of connected components\n int p1CC = 0;\n int p2CC = 0;\n // number of isolated circle pieces\n int p1Isolated = 0;\n int p2Isolated = 0;\n\n double weight;\n\n visited = 0;\n // check p1's pieces\n int posMasks = board.getPieces(0);\n int posMask;\n while (posMasks != 0) {\n posMask = posMasks & ~(posMasks - 1);\n posMasks ^= posMask;\n if ((visited & posMask) == 0) {\n if (exploreCC(board, posMask, 0) == 1)\n if (!board.isSquare(posMask))\n p1Isolated++;\n p1CC++;\n }\n weight = board.isSquare(posMask) ? weights[0] : weights[1];\n if (!boardValues.containsKey(posMask)) {\n System.out.println(\"I don't have \" + (int) (Math.log(posMask) / Math.log(2)));\n board.show();\n }\n p1Position += weight * boardValues.get(posMask);\n p1Pieces++;\n }\n // check p2's pieces\n visited = 0;\n posMasks = board.getPieces(1);\n while (posMasks != 0) {\n posMask = posMasks & ~(posMasks - 1);\n posMasks ^= posMask;\n if ((visited & posMask) == 0) {\n if (exploreCC(board, posMask, 1) == 1)\n if (!board.isSquare(posMask))\n p2Isolated++;\n p2CC++;\n }\n weight = board.isSquare(posMask) ? weights[0] : weights[1];\n p2Position += weight * boardValues.get(posMask);\n p2Pieces++;\n }\n\n // perform connected component analysis on empty spaces\n posToAdjCCID.clear();\n ccIDToOwner.clear();\n ownerToCCs.clear();\n int toCheck = (BitMasks.valid & (~board.getPieces()));\n int check;\n int ccId = 0;\n while (toCheck != 0) {\n check = toCheck & ~(toCheck - 1);\n toCheck ^= SearchUtils.checkSpaces(board, check, ccId++, posToAdjCCID, ccIDToOwner,\n ownerToCCs);\n }\n\n // check how close each player's circles are to an \"owned\" connected component\n int circles, circleMask, searchDistance;\n boolean adjacent;\n for (int turn = 0; turn < 2; turn++) {\n circles = board.getCircles(turn);\n while (circles != 0) {\n adjacent = false;\n circleMask = circles & ~(circles - 1);\n circles ^= circleMask;\n if (posToAdjCCID.containsKey(circleMask)) {\n for (int id : posToAdjCCID.get(circleMask)) {\n if (ccIDToOwner.get(id) == turn) {\n adjacent = true;\n break;\n }\n }\n }\n if (!adjacent) {\n searchDistance = search(board, circleMask, turn);\n if (turn == 0 && searchDistance > GameUtils.NUM_SLIDES) {\n h += -weights[6] * searchDistance;\n } else if (turn == 1 && searchDistance > GameUtils.NUM_SLIDES) {\n h += weights[6] * searchDistance;\n }\n }\n }\n }\n\n // a player missing a piece is the ultimate bad position\n if (p1Pieces != 5) {\n return -10000.0;\n }\n if (p2Pieces != 5) {\n return 10000.0;\n }\n // weight the components of the heuristic\n h += weights[2] * p1Mobility;\n h += -weights[2] * p2Mobility;\n h += weights[3] * p1Position;\n h += -weights[3] * p2Position;\n\n // make it so only > 1 connected components impacts heuristic\n h += -weights[4] * (p1CC - 1);\n h += weights[4] * (p2CC - 1);\n\n h += -weights[5] * p1Isolated;\n h += weights[5] * p2Isolated;\n\n h /= 6200; // normalize\n return h;\n }", "void computeTurn(Input input);", "public static void main(String[] args) \n\t { \n\t\t \n\t//\t ScrabbleCheater11 cheat = new ScrabbleCheater11();\n\t//\t Dictionary11 dict = new Dictionary11(1,\"C:\\\\words\\\\words-279k.txt\");\n\t \n\t\t MyHashTable11 htable = new MyHashTable11(7591,\"src/lab11_scrabble/wordsList_collins2019.txt\"); \n\t \t\n\t \tSystem.out.print(\"All the words in the bucket where the word \"+ \" \\\"against\\\" \" + \" is located: \");\n\t \tSystem.out.println();\n\t \thtable.getWordsFromSameBucket(\"against\");\n\t \tSystem.out.println();\n\t \tSystem.out.println();\n\t \thtable.findPermutation(\"against\");\n\t \n\t \tSystem.out.println();\n\t \tSystem.out.print(\"All the words in the bucket where the word \"+ \" \\\"airport\\\" \" + \" is located: \");\n\t \tSystem.out.println();\n\t \thtable.getWordsFromSameBucket(\"airport\");\n\t \tSystem.out.println();\n\t \tSystem.out.println();\n\t \thtable.findPermutation(\"airport\");\n\t \t\n\t \tSystem.out.println();\n\t \tSystem.out.print(\"All the words in the bucket where the word \"+ \" \\\"between\\\" \" + \" is located: \");\n\t \tSystem.out.println();\n\t \thtable.getWordsFromSameBucket(\"between\");\n\t \tSystem.out.println();\n\t \tSystem.out.println();\n\t \thtable.findPermutation(\"between\");\n\n\t \tSystem.out.println();\n\t\t System.out.print(\"All the words in the bucket where the word \"+ \"\\\"married\\\"\" + \" is located: \");\n\t\t System.out.println();htable.getWordsFromSameBucket(\"married\");\n\t\t System.out.println();\n\t\t System.out.println();\n\t\t htable.findPermutation(\"married\");\n\t\t \n\t\t System.out.println();\n\t \tSystem.out.print(\"All the words in the bucket where the word \"+ \" \\\"ashbdap\\\" \" + \" is located: \");\n\t \tSystem.out.println();\n\t \thtable.getWordsFromSameBucket(\"ashbdap\");\n\t \tSystem.out.println();\n\t \tSystem.out.println();\n\t \thtable.findPermutation(\"ashbdap\");\n\t \t\n\t \t//test remove and size()\n\t \tSystem.out.println(htable.remove(\"speaned\"));\n\t \tSystem.out.println(htable.get(\"speaned\"));\n\t \tSystem.out.println(htable.size());\n\t }", "public void computerFirst() {\n game(0);\n }", "public static void main(String[] args){\n\t\t\n\t\tfor (int i = 0; i<999999;i++) results.add(0);\t\n\n\t\tsetChain(1L);\n\t\tboolean switcher = true;\n\t\t//while switch=true ... and once chain length is added to, switch = false\n \t\tlong best = 0L;\n\t\tint index=0;\n\t\t\t\n\t\tfor (long j = 1L; j < 1000000L; j++) {\n\n\t\t\tsetCur((int)j);\n\n\t\t\tfindChain(j);//} catch(Exception e){System.out.println(\"stackOverFlow :D\");}\n\t\t\tif (getChain() > best) {best = getChain(); index=getCur();}\n\t\t\t//now store results for later use if we come across that number.\n\t\t\tresults.set(getCur()-1, (int)getChain());\t\n\t\t\tsetChain(1L); //reset\n\t\t\t/* \t\n\t\t\tswitcher=true;\n\t\t\tint i = j;\n\t\t\twhile (switcher) {\n\n\t\t\t\tif (i==1) {//results.add(chainLength); \n\t\t\t\t\tif (chainLength > best) { best=chainLength; index = j;}\n\t\t\t \tchainLength=1; switcher=false;}\n\t\n\t\t\t\telse { i=recurse(i); chainLength++; }\t\n\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t*/\n//\t\t }\n\t\t}\n\t\tSystem.out.println(index);\n\t}", "void runC() {\n\t\tArrayList<Link> links_s2 = new ArrayList<Link>(links_s);\n\t\tArrayList<Link> links_p2 = new ArrayList<Link>(links_p);\n\t\talgorithmC = new HashSet<Link>(algorithmC(links_p2, links_s2));\n\t}", "private static BigInteger comprime(BigInteger input) {\n \t\n \t//krenemo od dva\n BigInteger candidate = BigInteger.valueOf(2);\n while (true) {\n \t\n \t//kada nadjemo odgovarajuci vratimo ga\n if (input.gcd(candidate).equals(BigInteger.ONE)) {\n return candidate;\n }\n candidate = candidate.add(BigInteger.ONE);\n }\n }", "@Override\n\tpublic void challenge10() {\n\n\t}", "static void cpi_with_acc(String passed){\n\t\tint val1 = hexa_to_deci(registers.get('A'));\n\t\tint val2 = hexa_to_deci(passed.substring(4));\n\t\tS = val1>=val2?false:true;\n\t\tval2 = 256-val2;\n\t\tval2%=256;\n\t\tval1+=val2;\n\t\tCS = val1>255?true:false;\n\t\tString b = Integer.toBinaryString(val1);\n\t\tint ones=0;\n\t\tfor(int i=0;i<b.length();i++)\n\t\t\tif(b.charAt(i)=='1')\n\t\t\t\tones++;\n\t\tZ = ones==0?true:false;\n\t\tP = ones%2==0?true:false;\n\t}", "public static void main(String[] args) {\n\t\tint[] prime= new int[1229]; //only need primes up to 10000\n\t\tint n=1;\n\t\tint index=0;\n\t\tint test=0;\n\t\tfor (int i=2; (i-n)<=1229; i++) {\n\t\t\tfor (int j=2; j<=Math.sqrt(i); j++) {\n\t\t\t\tint k=i%j;\n\t\t\t\tif (k==0) {\n\t\t\t\t\tn++;\n\t\t\t\t\ttest++;\n\t\t\t\t\tj=(int)Math.sqrt(i);\n\t\t\t\t} \n\t\t\t}\n\t\t\tif (test==0) {\n\t\t\t\tprime[index]=i;\n\t\t\t\tindex++;\n\t\t\t}\n\t\t\ttest=0;\n\t\t}\n\t\t\n\t\t//use primes to find prime factorization and sum of divisors\n\t\tint [] divides= new int[1229]; //Number of times each prime divides a number\n\t\tint [] sumOfDivisors= new int[10000]; //Sum of divisors for i at index i\n\t\tint total=0;\n\t\tint sum=1;\n\t\tindex=1;\n\t\tfor (int i=2; i<=10000; i++) {\n\t\t\tint d=i;\n\t\t\tfor (int j=0; j<1229; j++) { //find prime factorization for i\n\t\t\t\twhile (d%prime[j]==0 && d>1) {\n\t\t\t\t\td=d/prime[j];\n\t\t\t\t\tdivides[j]++;\n\t\t\t\t}\t\n\t\t\t}\n\t\t\tfor (int j=0; j<1229; j++) { //use Number theory formula for sum of divisors\n\t\t\t\tsum*=(Math.pow(prime[j], divides[j]+1)-1)/(prime[j]-1);\n\t\t\t}\n\t\t\tif (sum-i<i) { //only check if sum of divisors of i is less than i\n\t\t\t\tif (sumOfDivisors[sum-i-1]==i) { //check if amicable pair\n\t\t\t\t\ttotal=total+i+sum-i; //add both to total (only happens once)\n\t\t\t\t}\n\t\t\t}\n\t\t\tArrays.fill(divides,0); //reset divisors array\n\t\t\tsumOfDivisors[index]=sum-i; //store number of divisors\n\t\t\tsum=1;\n\t\t\tindex++;\n\t\t}\n\t\tSystem.out.print(\"The sum of all amicable numbers less than 10000 is: \");\n\t\tSystem.out.println(total);\n long endTime = System.currentTimeMillis();\n System.out.println(\"It took \" + (endTime - startTime) + \" milliseconds.\");\n\n\t}", "public void evaluate_roundkeys() {\n for (int r = 0; r < 16; r++) {\n // \"-2\" dient der Fehler-Erkennung\n for (int y = 0; y < 48; y++)\n DES_K[r][y] = -2;\n }\n\n for (int j = 0; j < 16; j++)\n DES_K[j] = select(CD[j + 1], PC2);\n\n for (int j = 0; j < 16; j++)\n DES_reversed_K[j] = DES_K[15 - j];\n }", "public void solve(Scanner in) {\n\tint K = in.nextInt();\n\tint L = in.nextInt();\n\tint S = in.nextInt();\n\t\n\tint[] letters = new int[26];\n\t\n\tin.nextLine();\n\n\tString keyboard = in.nextLine(), word = in.nextLine();\n\tchar c;\n\t\n\t\n\n\tfor (int i = 0; i < K; i++) {\n\t\tc = keyboard.charAt(i);\n\t\tletters[c - 'A']++;\n\t}\n\t\n\tdouble chanceOfWord = 1;\n\n\tfor (int i = 0; i < L; i++) {\n\t\tchanceOfWord *= (letters[word.charAt(i)-'A']+0.0)/(K+0.0);\n\t}\n\t\n \tif (chanceOfWord == 0 || chanceOfWord == 1){\n\t\tSystem.out.println (0.0);\n\t\treturn;\n\t}\n\telse if (L == S) {\n\t\tSystem.out.println (1.0-chanceOfWord);\n\t\treturn;\n\t}\t\n\n\tmax = 0;\n\tcol = 0;\n\tdouble result = full (letters,\"\",word,S);\n\tSystem.out.println ((max - (result+0.0)/(col+0.0)));\n}", "public static void main(String[] args) throws IOException, CryptoException{\n\t\t\n\t\tSocket proxySocket = null;\n\t\tPrintStream out = null;\n\t\tBufferedInputStream in = null;\n\t\t\n\t\ttry{\n\t\t\tproxySocket = new Socket(\"localhost\",2222);\n\t\t\tout = new PrintStream(proxySocket.getOutputStream(),true);\n\t\t\tin = new BufferedInputStream (proxySocket.getInputStream());\n\t\t}catch (UnknownHostException e){\n\t\t\tSystem.err.println(\"Don't know about the host\");\n\t\t\tSystem.exit(1);\n\t\t}catch (IOException e){\n\t\t\tSystem.err.println(\"Couldn't get I/O for the connection\");\n\t\t\tSystem.exit(1);\n\t\t}\n\t\t\n\t\tSystem.out.println(\"connection setup @ main\");\n\t\n\t\tlong starttime = System.currentTimeMillis();\n\t\tkeyRequest(in,out);\n\t\tlong t1 = System.currentTimeMillis();\n\t\tSystem.out.println(\"Keys@Main: \"+N+\" \"+G+\" \"+H);\n\t\tscm = new Scheme(N,G,H);\t// new encryption scheme generated!\n\t\tSystem.out.println(\"Encryption scheme setup!\");\n\n\t\t\n\t\t//mock computation of similarity without l and w paras\n\t\t/*data that should be stored elsewhere in some database*/\n\t\tBigInteger[] dataA = new BigInteger[500];\n\t\tBigInteger[] dataB = new BigInteger[500];\n\t\tfor(int i=0; i<dataA.length;i++)\n\t\t\tdataA[i]=new BigInteger(2,new Random());\n\t\tfor(int i=0; i<dataB.length;i++)\n\t\t\tdataB[i]=new BigInteger(2,new Random());\n\t\tBigInteger[] sqr_dataA = new BigInteger[500];\n\t\tBigInteger[] sqr_dataB = new BigInteger[500];\n\t\tfor(int i=0; i<dataA.length; i++)\n\t\t\tsqr_dataA[i] = dataA[i].modPow(BigInteger.valueOf(2), N);\n\t\tfor(int i=0; i<dataB.length; i++)\n\t\t\tsqr_dataB[i] = dataB[i].modPow(BigInteger.valueOf(2), N);\n\t\tBigInteger[] Numerator,Denominator,d1,d2;\n\t\tint len = 0;\n\t\t//calculate numerator\n\t\tBigInteger[] temp;\n\t\tlen = dataA.length; //to be modified later\n\t\tBigInteger[] p1,p2;\n\t\tp1 = scm.encrypt(dataA[0]);\n\t\tp2 = scm.encrypt(dataB[0]);\n\t\tNumerator = secureMul(p1,p2,in,out);\n\t\tfor(int i = 1;i<len; i++)\n\t\t{\n\t\t\tp1 = scm.encrypt(dataA[0]);\n\t\t\tp2 = scm.encrypt(dataB[0]);\n\t\t\ttemp = secureMul(p1,p2,in,out);\n\t\t\tNumerator = scm.homo_add(temp,Numerator);\n\t\t}\n\t\tSystem.out.println(\"Numerator got!@Main\");\n\t\t//calculate denominator\n\t\td1 = scm.encrypt(sqr_dataA[0]);\n\t\td2 = scm.encrypt(sqr_dataA[1]);\n\t\tfor (int i =1; i<len; i++)\n\t\t{\n\t\t\td1 = scm.homo_add(d1, scm.encrypt(sqr_dataA[i]));\n\t\t\td1 = scm.homo_add(d1, scm.encrypt(sqr_dataB[i]));\n\t\t}\n\t\tDenominator = secureMul(d1,d2,in,out);\n\t\tSystem.out.println(\"Denominator got!@Main\");\n\t\t//calculate similarity\n\t\tBigInteger[] sim =pro_div(Numerator,Denominator,in,out);\n\t\tSystem.out.println(\"Similarity got!@Main \"+sim);\n\t\tlong stoptime = System.currentTimeMillis();\n\t\tlong totaltime = stoptime-starttime;\n\t\tSystem.out.println(\"Total time: \"+ totaltime + \"Key: \"+ (t1-starttime));\n\t\t\t\t\n\t\tSystem.out.println(\"Close connection @Main\");\n\t\tSystem.out.println(\"Send: \"+sent_overhead+\" Receive: \"+receive_overhead);\n\t\tout.close();\n\t\tin.close();\n\t\tproxySocket.close();\n\t}", "int compFunction(int code) {\n int a = 1021;\n int b = 11287;\n int p = Prime.primeLarge(sizeBucket);\n //System.out.println(\"code = \"+ code + \", p = \"+p);\n\n int index = (Math.abs(a * code + b) % p) % sizeBucket;\n return index;\n }", "public static void main(String[] args) {\n\t\tint userWin=0, computerWin = 0, gameNum=0;\n\t\tScanner s = new Scanner(System.in);\n\n\t\t//게임을 연속으로 플레이 할 수 있도록 변경\n\t\twhile(true) {\n\t\t\tprintFirst(s); //초기 설명을 매번 출력하게 하는 메소드\n\n\t\t\t/*잘못 입력받은 경우 다시 입력받도록 하기 위한 메소드 getUser(s)\n\t\t\t0~3 사이의 정수만 return한다.*/\n\t\t\tint user = getUser(s);\n\t\t\t\n\t\t\tif (user == 3) break; //user == 3인 경우 바로 종료하도록 한다.\n\n\t\t\tint computer = (int)(Math.random()*3); //computer`s must be in random integer from 0~2\n\n\t\t\t\n\t\t\t//현재 점수, 전체 플레이한 게임 수 저장하도록 변경\n\t\t\tif(user == (computer+2)%3) computerWin++; //컴퓨터가 이긴 횟수\n\t\t\telse if(user == (computer+1)%3) userWin++; //유저가 이긴 횟수\n\t\t\tgameNum++;\n\t\t\t\n\t\t\t//user가 선택한 것과, computer가 선택한 것을 user에게 문자로 출력해서 알려준다.\n\t\t\tprintGame(user, computer);\n\n\t\t\t//현재 점수, 전체 플레이 게임 수를 출력할 수 있도록 변경\n\t\t\tSystem.out.println(\"\\n___________________________________________________________________________________\");\n\t\t\tSystem.out.println(\"\\nCurrent Score : \"+userWin+\" vs \"+computerWin);\n\t\t\tSystem.out.println(\"Current Game number : NO.\"+gameNum);\n\t\t\tSystem.out.println(\"___________________________________________________________________________________\\n\\n\");\n\n\t\t}\n\t\t//마지막에 총 점수와 누가 이겼는지를 출력할 수 있도록 변경\n\t\tSystem.out.println(\"\\n___________________________________________________________________________________\\n\");\n\t\tSystem.out.println(\"------------------------------------End of Game------------------------------------\");\n\t\tSystem.out.println(\"___________________________________________________________________________________\\n\");\n\n\t\tSystem.out.println(\"You Scored \"+userWin +\" out of \"+gameNum+\"!!\");\n\t\tSystem.out.println(\"Computer Scored \"+computerWin +\" out of \"+gameNum+\"!!\");\n\n\t\tif(userWin > computerWin) System.out.println(\"\\nYou Win!\");\n\t\telse if(userWin < computerWin) System.out.println(\"\\nYou Lose!!\");\n\t\telse System.out.println(\"\\nTie!!!\");\n\t\t\n\t\ts.close();\n\t}", "public static void main(String[] args) throws NumberFormatException, IOException {\n BufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\n String[] s = br.readLine().split(\"\\\\s\");\n N = Integer.parseInt(s[0]);\n K = Integer.parseInt(s[1]);\n\n board = new int[N][N];\n visited = new boolean[N];\n\n for(int y=0; y<N; ++y) {\n s = br.readLine().split(\"\\\\s\");\n for(int x=0; x<N; ++x) {\n board[y][x] = Integer.parseInt(s[x]);\n }\n }\n\n s = br.readLine().split(\"\\\\s\");\n String[] s1 = br.readLine().split(\"\\\\s\");\n for(int i=0; i<20; ++i) {\n KH[i] = Integer.parseInt(s[i])-1;\n MH[i] = Integer.parseInt(s1[i])-1;\n }\n\n doPerm(0);\n System.out.println(answer);\n\n }", "public static double[] homophoneSearch(int n, char[] alphabet, String cipher, boolean similarity, boolean print, boolean progress, boolean bestRepsOnly, boolean contig, Map<Character, Integer> countsMap, Map<Character, Double> best) {\n\t\tMap<Character, String> bestOut = new HashMap<Character, String>();\n\t\t// compute all combinations of n symbols selected from the given alphabet.\n\t\tint[] indices;\n\t\tCombinationGenerator x = new CombinationGenerator (alphabet.length, n);\n\t\tStringBuffer combination;\n\t\tSet<String> seen = new HashSet<String>(); // set to avoid printing dupes\n\t\t\n\t\tBigDecimal numerator = factorial(alphabet.length);\n\t\tBigDecimal denominator = factorial(n).multiply(factorial(alphabet.length-n));\n\t\tBigDecimal total = numerator.divide(denominator);\n\t\t\t\n\t\t//System.out.println(\"Total combinations: \" + total);\n\t\tint counter = 0; int prev = 0;\n\t\t\n\t\t//boolean resume = true;\n\t\twhile (x.hasMore ()) {\n\t\t if (progress) {\n\t\t\t counter++;\n\t\t\t int current = Math.round(100*((float)counter)/total.floatValue());\n\t\t\t if (current != prev) \n\t\t\t\t System.out.println(\"Progress: [\" + current + \"%]\");\n\t\t\t prev = current;\n\t\t }\n\t\t combination = new StringBuffer ();\n\t\t indices = x.getNext ();\n\t\t for (int i = 0; i < indices.length; i++) {\n\t\t combination.append (alphabet[indices[i]]);\n\t\t }\n\t\t String key = combination.toString ();\n\t\t /*if (resume && !\"6RVXfl|\".equals(key)) { continue; } // resume from this key\n\t\t if (\"6RVXfl|\".equals(key)) {\n\t\t\t resume = false;\n\t\t }*/\n\t\t \n\t\t //System.out.println (key);\n\t\t String seq = dumpSequenceFor(cipher, key);\n\t\t Map<String, Integer> counts = new HashMap<String, Integer>();\n\t\t for (int i=0; i<seq.length()-n+1; i++) {\n\t\t\t String sub = seq.substring(i, i+n);\n\t\t\t //Integer val = counts.get(sub);\n\t\t\t //if (val == null) val = 0;\n\t\t\t //val++;\n\t\t\t //counts.put(sub, val);\n\t\t\t counts.put(sub, count(seq, sub, contig));\n\t\t }\n\t\t int max = 0; String maxSub = null;\n\t\t for (String sub : counts.keySet()) {\n\n\t\t\t // don't bother calculating odds, cosine distances, etc. just track the best # of repetitions per symbol. \n\t\t\t \tif (bestRepsOnly) {\n\t\t\t \t\tif (distinct(sub) != sub.length()) continue; // ignore anything with repeated symbols, to help avoid spurious results\n\t\t\t \t\tint reps = counts.get(sub);\n\t\t\t\t\t // track best (rarest) score per symbol\n\t\t\t\t\t for (int i=0; i<sub.length(); i++) {\n\t\t\t\t\t\t char ch = sub.charAt(i);\n\t\t\t\t\t\t Double d = best.get(ch);\n\t\t\t\t\t\t if (d == null) d = 0d;\n\t\t\t\t\t\t if (reps > d) {\n\t\t\t\t\t\t\t d = (double) reps;\n\t\t\t\t\t\t\t best.put(ch, d);\n\t\t\t\t\t\t\t bestOut.put(ch, dumpSequenceFor(cipher, sub));\n\t\t\t\t\t\t }\n\t\t\t\t\t }\n\t\t\t \t\tcontinue;\n\t\t\t \t}\n\t\t\t \t\n\t\t\t \t// otherwise, continue with more odds-oriented computations and information\n\t\t\t\t maxSub = sub;\n\t\t\t\t String seq2 = filter(seq, maxSub);// remove any symbols that aren't in maxSub\n\t\t\t\t \n\t\t\t\t Object[] non = nonRepeats(seq2, maxSub);\n\t\t\t\t int matches = (Integer)non[2];\n\t\t\t\t max = matches;\n\t\t\t\t \n\t\t\t\t //if (max != counts.get(maxSub))throw new RuntimeException(max+\" != \" + counts.get(maxSub));\n\t\t\t\t //System.out.println(maxSub + \" \" + max + \" \" + counts.get(maxSub));\n\t\t\t\t \n\t\t\t\t int cn = counts(maxSub, countsMap);\n\t\t\t\t float freq = cn/(float)cipher.length();\n\t\t\t\t String z408 = \"\";\n\t\t\t\t if (HomophonesProblem.which == 1) {\n\t\t\t\t\t z408 += \"\t\";\n\t\t\t\t\t for (int i=0; i<maxSub.length(); i++) z408 += Ciphers.decoderMap.get(maxSub.charAt(i));\n\t\t\t\t\t z408 += \"\t\"+(Ciphers.realHomophone(maxSub) ? \"Yes\" : \"No\");\n\t\t\t\t } else\n\t\t\t\t\t z408 = \"\";\n\t\t\t\t \n\t\t\t\t float sim = 0f;\n\t\t\t\t if (similarity) sim = similarity(maxSub);\n\t\t\t\t \n\t\t\t\t \n\t\t\t\t double odds = odds(maxSub, max, seq2, (String)non[0]);\n\t\t\t\t double score = similarity ? (1+sim)*odds : odds;\n\t\t\t\t \n\t\t\t\t String output = key+\"\t\"+maxSub+\"\t\"+odds+\"\t\"+matches+\"\t\"+cn+\"\t\"+(Math.round(freq*10000)/100f)+\"%\t\"+sim+\"\t\"+(score)+\"\t\"+non[1]+z408; \n\t\t\t\t if (print && (odds >= Math.pow(10, n-1) || seq2.startsWith(maxSub+maxSub))) {\n\t\t\t\t\t if (!seen.contains(maxSub)) { // don't print anything we've seen already\n\t\t\t\t\t\t System.out.println(output);\n\t\t\t\t\t\t seen.add(maxSub);\n\t\t\t\t\t }\n\t\t\t\t }\n\t\t\t\t \n\t\t\t\t // track best (rarest) score per symbol\n\t\t\t\t for (int i=0; i<maxSub.length(); i++) {\n\t\t\t\t\t char ch = maxSub.charAt(i);\n\t\t\t\t\t Double d = best.get(ch);\n\t\t\t\t\t if (d == null) d = 0d;\n\t\t\t\t\t if (score > d) {\n\t\t\t\t\t\t d = score;\n\t\t\t\t\t\t best.put(ch, d);\n\t\t\t\t\t\t bestOut.put(ch, output);\n\t\t\t\t\t }\n\t\t\t\t }\n\t\t }\n\t\t}\t\t\n\t\tdouble sum = 0; int c = 0;\n\t\tdouble min = Double.MAX_VALUE;\n\t\tdouble max = -Double.MAX_VALUE;\n\t\tfor (Character ch : best.keySet()) {\n\t\t\tsum += best.get(ch);\n\t\t\tif (print) System.out.println(\"Best for \" + ch+\"\t\"+best.get(ch)+\"\t\"+bestOut.get(ch));\n\t\t\tc++;\n\t\t\tmin = Math.min(min, best.get(ch));\n\t\t\tmax = Math.max(max, best.get(ch));\n\t\t}\n\t\t//return results;\n\t\treturn new double[] {sum, min, max, sum/c};\n\t}", "public int R_M(){\n\t\tBigInteger nminus1=n.subtract(BigInteger.ONE);\n\t\tdo{\n\t\t\tif(nminus1.mod(two.pow(a)).equals(BigInteger.ZERO)){\n\t\t\t\ttable.add(a);\n\t\t\t}\n\t\t\titerator++;\n\t\t\ta++;\n\t\t}while(!(two.pow(a).compareTo(n)>0));\n\t\t\n\t\ta=table.get(table.size()-1);\n\t\tBigInteger m=nminus1.divide(two.pow(a));\n\t\tint wlen=n.bitLength();\n\t\tBigInteger b;\n\t\tBigInteger z;\n\t\tfor(int i=0;i<iterations;i++){\n\t\t\tint straznik=0;\n\t\t\tint straznik1=0;\n\t\t\tdo{\n\t\t\t b=new BigInteger(wlen,new Random());\n\t\t\t}while(!(b.compareTo(BigInteger.ONE)>0) && !(b.compareTo(nminus1)<0));\n\t\t\tz=b.modPow(m, n);\n\t\t\tif(z.equals(BigInteger.ONE) || z.equals(nminus1)){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\telse{\n\t\t\t\tfor(int j=0;j<a-1;j++){\n\t\t\t\t\tz=z.pow(2).mod(n);\n\t\t\t\t\tif(z.equals(nminus1)){\n\t\t\t\t\t\tstraznik++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif(z.equals(BigInteger.ONE)){\n\t\t\t\t\t\tstraznik1++;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(straznik==1){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif(straznik1==1){\n\t\t\t\t\tgetComposite();\n\t\t\t\t\treturn 0;\n\t\t\t\t}\n\t\t\t\t}\n\t\t\tgetComposite();\n\t\t\treturn 0;\n\t\t}\n\t\tgetProbablyPrime();\n\t\treturn 1;\n\t\t}", "public static void main(String[] args) {\n\t\tSystem.out.println(\"A run through of various algorithms included in this repo\");\n\t\t\n\t\tSystem.out.println(\"The Russian peasant multiplication Algorithm\");\n\t\t\n\t\tint a = 478, b = 7023;\n\t\t\n\t\tSystem.out.println(\"Values used \" + a + \" and \" + b);\n\t\t\n\t\tint niters = 1000000;\n\t\tlong startTime = System.nanoTime(); \n\t\t\n\t\tfor(int count = 0;count < niters;count++) {\n\t\t Peasants.peasantAlg(a, b);\n\t\t}\n\t\tdouble time = ((System.nanoTime() - startTime)/(double)niters);\n\t\t \n\t\tSystem.out.println(\"Answer is \" + Peasants.peasantAlg(a,b));\n\t\tSystem.out.println(\"Time taken \" + time);\n\t\t\n\t\t\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(\"The Fibonacci Algorithm\");\n\t\t\n\t\ta = 10;\n\t\t\n\t\tSystem.out.println(\"Value used \" + a);\n\t\t\n\t\tstartTime = System.nanoTime(); \n\t\tfor(int i = 0;i < 100000;i++) {\n\t\t\tFibonacci.fib(a);\n\t\t}\n\t\t\n\t\ttime = ((System.nanoTime() - startTime)/(double)100000);\n\t\tSystem.out.println(\"Answer is \" + Fibonacci.fib(a));\n\t\tSystem.out.println(\"the time taken \" + time); \n\t\t\n\t\t\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(\"The Tower of Hanoi Algorithm\");\n\t\t\n\t\ta = 6;\n\t\t\n\t\tSystem.out.println(\"Value used \" + a);\n\t\t\n\t\tstartTime = System.nanoTime(); \n\t\t\n\t\tTowerOfHanoi.Hanoi(a, \"A\", \"C\", \"B\"); //Run once to avoid filling the console\n\t\t\n\t\tSystem.out.println(\"the time taken \" + (System.nanoTime() - startTime)); \n\t\t\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(\"The Selection Sort, Insertion Sort and Stalin Sort ALgorithms\");\n\t\t\n int n = 100; //Number of variables to be sorted\n\t\t\n\t\tint[] x = new int[n];\n\t\tint[] y = new int[n];\n\t\t\n\t\tRandom rand = new Random();\n\t\t\n\t\tlong endTime = 0;\n\t\tlong endTime2 = 0;\n\t\tstartTime = 0;\n\t\t\n\t\tfor(int i = 0;i < 10000;i++) {\n\t\t\t\n\t\t\tfor(int j = 0;j < n;j++) { //Fills arrays with random numbers\n\t\t\t\tint k = rand.nextInt();\n\t\t\t\tx[j] = k;\n\t\t\t\ty[j] = k;\n\t\t\t}\n\t\t\t\n\t\t\tstartTime = System.nanoTime(); \n\t\t\tDifferentSorts.selectionSort(x);\n\t\t\tendTime += System.nanoTime() - startTime;\n\t\t\t\n\t\t\t\n startTime = System.nanoTime(); \n DifferentSorts.insertSort(y);\n\t\t\tendTime2 += System.nanoTime() - startTime;\n\t\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(\"Time taken for Selection Sort \" + (endTime / 10000));\n\t\tSystem.out.println(\"Time taken for Insertion Sort \" + (endTime2 / 10000));\n\t\t\n\t\tSystem.out.println(\"Selection Sort sorted array\");\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tSystem.out.print(\" \" + x[i]);\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(\"Insertion Sort sorted array\");\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tSystem.out.print(\" \" + y[i]);\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\t\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(\"The Merge Sort and Enhanced Merge Sort ALgorithms\");\n\t\t\n\t\t\n\t\tn = 100; //Number of variables to be sorted\n\t\t\n\t\tx = new int[n];\n\t\ty = new int[n];\n\t\t\t\t\n\t\tendTime = 0;\n\t\tendTime2 = 0;\n\t\tstartTime = 0;\n\t\t\n\t\tfor(int i = 0;i < 10000;i++) {\n\t\t\t\n\t\t\tfor(int j = 0;j < n;j++) { //Fills arrays with random numbers\n\t\t\t\tint k = rand.nextInt();\n\t\t\t\tx[j] = k;\n\t\t\t\ty[j] = k;\n\t\t\t}\n\t\t\t\n\t\t\tstartTime = System.nanoTime(); \n\t\t\tDifferentSorts.mergeSort(x);\n\t\t\tendTime += System.nanoTime() - startTime;\n\t\t\t\n\t\t\t\n startTime = System.nanoTime(); \n DifferentSorts.improvedMergeSort(y);\n\t\t\tendTime2 += System.nanoTime() - startTime;\n\t\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(\"Time taken for Merge Sort \" + (endTime / 10000));\n\t\tSystem.out.println(\"Time taken for Improved Merge Sort \" + (endTime2 / 10000));\n\t\t\n\t\tSystem.out.println(\"Merge Sort sorted array\");\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tSystem.out.print(\" \" + x[i]);\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\t\n\t\tSystem.out.println(\"Improved Merge Sort sorted array\");\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tSystem.out.print(\" \" + y[i]);\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\t\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(\"The Quick Sort and Enhanced Quick Sort ALgorithms\");\n\t\t\n n = 100; //Number of variables to be sorted\n\t\t\n\t\tx = new int[n];\n\t\ty = new int[n];\n\t\t\t\t\n\t\tendTime = 0;\n\t\tendTime2 = 0;\n\t\tstartTime = 0;\n\t\t\n\t\tint low = 0, high = n - 1;\n\t\t\n\t\tfor(int i = 0;i < 10000;i++) {\n\t\t\t\n\t\t\tfor(int j = 0;j < n;j++) { //Fills arrays with random numbers\n\t\t\t\tint k = rand.nextInt();\n\t\t\t\tx[j] = k;\n\t\t\t\ty[j] = k;\n\t\t\t}\n\t\t\t\n\t\t\tstartTime = System.nanoTime(); \n\t\t\tDifferentSorts.quickSort(x, low, high);\n\t\t\tendTime += System.nanoTime() - startTime;\n\t\t\t\n\t\t\t\n startTime = System.nanoTime(); \n DifferentSorts.enhancedQuickSort(y, low, high);\n\t\t\tendTime2 += System.nanoTime() - startTime;\n\t\t\t\n\t\t}\n\t\t\n\t\tSystem.out.println(\"Time taken for Quick Sort \" + (endTime / 10000));\n\t\tSystem.out.println(\"Time taken for Enhanced Quick Sort \" + (endTime2 / 10000));\n\t\t\n\t\tSystem.out.println(\"Quick Sort sorted array\");\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tSystem.out.print(\" \" + x[i]);\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\t\n\t\tSystem.out.println(\"Enhanced Quick Sort sorted array\");\n\t\tfor(int i = 0;i < n;i++) {\n\t\t\tSystem.out.print(\" \" + y[i]);\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\t\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(\"The Brute force search and KMP search ALgorithms\");\n\t\t\n\t\tString txt = \"ABABDABACDABABCABAB\"; \n\t String pat = \"ABABCABAB\";\n\t \n\t System.out.println(\"The text for the search Algorithms \" + txt);\n\t System.out.println(\"The pattern for the search Algorithms \" + pat);\n\t \n\t startTime = System.nanoTime(); \n\t\tfor(int i = 0;i < 10000;i++) {\n\t\t\tStringSearch.bruteForceSubString(txt, pat);\n\t\t}\n\t\t\n\t\ttime = ((System.nanoTime() - startTime)/(double)10000);\n\t\tSystem.out.println(\"Brute Force answer is \" + StringSearch.bruteForceSubString(txt, pat));\n\t\tSystem.out.println(\"the time taken \" + time); \n\t\t\n\t\tKMPsearch kmp = new KMPsearch();\n\t\t\n\t\tSystem.out.println(\"KMP search answer is \" );\n\t\tstartTime = System.nanoTime(); \n\t\tkmp.KMPSearch(pat, txt); //Run once to avoid flooding console\n\t\ttime = (System.nanoTime() - startTime);\n\t\tSystem.out.println(\"the time taken \" + time + \" , this is not averaged out so maybe higher than brute force\"); \n\t}", "String getAlgorithm();", "public static int[] decomposeToBECC(int[][] g) {\n// this part of code is taken from uwi submissions\n int n = g.length;\n boolean[] visited = new boolean[n];\n int[] ord = new int[n];\n int[] low = new int[n];\n\n int[] ids = new int[n];\n int[] inds = new int[n];\n int[] parct = new int[n];\n int pos = 0;\n for (int i = 0; i < n; i++) {\n if (!visited[i]) {\n ids[0] = i;\n inds[0] = 0;\n int sp = 1;\n while (sp > 0) {\n int cur = ids[sp - 1];\n if (inds[sp - 1] == 0) {\n visited[cur] = true;\n ord[cur] = low[cur] = pos++;\n parct[sp - 1] = 0;\n }\n if (inds[sp - 1] == g[cur].length) {\n if (sp - 2 >= 0) {\n low[ids[sp - 2]] = Math.min(low[ids[sp - 2]], low[cur]);\n }\n sp--;\n continue;\n }\n int next = g[cur][inds[sp - 1]];\n if (!visited[next]) {\n ids[sp] = next;\n inds[sp] = 0;\n inds[sp - 1]++;\n sp++;\n continue;\n } else if (sp - 2 >= 0 && (next != ids[sp - 2] || ++parct[sp - 1] >= 2)) {\n low[cur] = Math.min(low[cur], ord[next]);\n }\n inds[sp - 1]++;\n }\n }\n }\n\n int[] clus = new int[n];\n Arrays.fill(clus, -1);\n int[] q = new int[n];\n int cnum = 0;\n for (int i = 0; i < n; i++) {\n if (clus[i] == -1) {\n int p = 0;\n q[p++] = i;\n clus[i] = cnum++;\n for (int r = 0; r < p; r++) {\n int cur = q[r];\n for (int next : g[cur]) {\n if (clus[next] == -1) {\n clus[next] = ord[cur] < low[next] ? cnum++ : clus[cur];\n q[p++] = next;\n }\n }\n }\n }\n }\n return clus;\n }", "int compFunction(int code) {\r\n if (code % num_buckets < 0) {\r\n return (code % num_buckets) + num_buckets;\r\n } else {\r\n return code % num_buckets;\r\n } \r\n /*int a = 13;\r\n int b = 23;\r\n int p = 1000000 * num_buckets;\r\n while (isPrime(p) == false) { \r\n p += 1; \r\n }\r\n return ((a * code + b) % p) % num_buckets; */\r\n }", "public int evaluate(PentagoBoardState pbs) {\n PentagoBoardState.Piece[][] pieces = pbs.getBoard();\n\n\n int whitescore =0; //keep track of white's total score\n int blackscore = 0;//keep track of black's total score\n\n //Check rows\n for (int x = 0; x <6 ; x++) {\n int countWHori = 0;\n int countBHori = 0;\n\n int blacks = 0;\n int whites = 0;\n\n\n for (int y = 0; y <5 ; y++) {\n //Count how many black and white pieces\n if (pieces[x][y].ordinal() == 0 ) {\n\n //countBHori = countBHori + countvalue;\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1) {\n\n //countWHori = countWHori +countvalue;\n whites++;\n }\n\n //Check for consecutive\n if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 0 ) {\n\n countBHori = countBHori +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 2 ) {\n\n countBHori = countBHori + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x][y+1].ordinal() == 0 ) {\n\n countBHori = countBHori + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 1 ) {\n\n countWHori = countWHori +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 2 ) {\n\n countWHori = countWHori + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x][y+1].ordinal() == 1 ) {\n\n countWHori = countWHori + blankspaceconsec;\n }\n\n //Check for disjoint and joint set If * B B W * * then disjoint and * B B * B * Then joint set for B * B\n if (y!=4){\n if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 0 && pieces[x][y+2].ordinal() == 1){\n countBHori = countBHori +disjointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 1 && pieces[x][y+2].ordinal() == 0){\n countWHori = countWHori +disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x][y+1].ordinal() == 2 && pieces[x][y+2].ordinal() == 0){\n countBHori = countBHori +jointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x][y+1].ordinal() == 2 && pieces[x][y+2].ordinal() == 1){\n countWHori = countWHori +jointset;\n }\n }\n }\n //check if unwinnable\n if (blacks == 4 && whites==2){\n countBHori += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWHori += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countWHori += unwinnable;\n countBHori += unwinnable;\n }\n\n\n //Run value for row in evaluation scheme and add to total score\n int valuew = consecutivevalue(countWHori);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBHori);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec hori \" + valueb + \"White consec hori \" + valuew);\n\n }\n\n //Check Verticals\n for (int y = 0; y <6 ; y++) {\n int countWvert = 0;\n int countBvert = 0;\n int blacks = 0;\n int whites = 0;\n\n\n for (int x = 0; x <5 ; x++) {\n if (pieces[x][y].ordinal() == 0) {\n\n //countBvert = countBvert +1;\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1) {\n\n //countWvert = countWvert +1;\n whites++;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 0 ) {\n\n countBvert = countBvert +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 2 ) {\n\n countBvert = countBvert + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 0 ) {\n\n countBvert = countBvert + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 1 ) {\n\n countWvert = countWvert +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 2 ) {\n\n countWvert = countWvert + blankspaceconsec;\n }\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 1 ) {\n\n countWvert = countWvert + blankspaceconsec;\n }\n\n if (x!=4){\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 1){\n countBvert = countBvert +disjointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 0){\n countWvert = countWvert +disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 0){\n countBvert = countBvert +jointset;\n }\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y].ordinal() == 2 && pieces[x+1][y].ordinal() == 1){\n countWvert = countWvert +jointset;\n }\n }\n }\n\n if (blacks == 4 && whites==2){\n countBvert += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countBvert += unwinnable;\n countWvert += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWvert += unwinnable;\n }\n //System.out.println(\"Black consec vert \" + countBvert + \"White consec \" + countWvert);\n int valuew = consecutivevalue(countWvert);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBvert);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec VERT \" + valueb + \"White consec hori \" + valuew);\n }\n\n //S West N EAST Top\n for (int a = 1; a <6 ; a++) { //loop through all diagonal lines\n int countWdiagSoNe = 0;\n int countBdiagSoNe = 0;\n int x=0;\n int blacks = 0;\n int whites = 0;\n\n\n for (int y = a; y !=0 ; y--) { //loop through one diagonal line\n\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y-1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0) {\n\n //countBdiagSoNe = countBdiagSoNe +2;\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1 ) {\n\n //countWdiagSoNe = countWdiagSoNe +2;\n whites++;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n\n // check for joint and disjoint set at these x y coordinates by looking 2 pieces ahead\n if (x==0 && y==4){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==1 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==2 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==0 && y==5){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==1 && y==4){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==2 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==3 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n\n x++;\n\n\n }\n if (blacks == 4 && whites==2){\n countBdiagSoNe += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countBdiagSoNe += unwinnable;\n countWdiagSoNe += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWdiagSoNe += unwinnable;\n }\n if (a==4 && blacks == 4 && whites==1){\n countBdiagSoNe += unwinnable;\n }\n if (a==4 && blacks == 1 && whites==4){\n countWdiagSoNe += unwinnable;\n }\n\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n int valuew = consecutivevalue(countWdiagSoNe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBdiagSoNe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagSoNe + \"White consec hori \" + valuew + \" \" + countWdiagSoNe);\n }\n //S West N EAST Bot\n for (int a = 1; a <5 ; a++) {\n int countWdiagSoNe = 0;\n int countBdiagSoNe = 0;\n int y=5;\n int blacks = 0;\n int whites = 0;\n\n for (int x = a; x <5 ; x++) {\n\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y-1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0) {\n\n //countBdiagSoNe = countBdiagSoNe +\n blacks++;\n }\n if (pieces[x][y].ordinal() == 1 ) {\n\n //countWdiagSoNe = countWdiagSoNe +2;\n whites++;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 0 ) {\n\n countBdiagSoNe = countBdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y-1].ordinal() == 1 ) {\n\n countWdiagSoNe = countWdiagSoNe + blankspaceconsec;\n }\n if (x==1 && y==5){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==2 && y==4){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n if (x==3 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 1 && pieces[x+2][y-2].ordinal() == 0) {\n\n countWdiagSoNe = countWdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 0 && pieces[x+2][y-2].ordinal() == 1) {\n\n countBdiagSoNe = countBdiagSoNe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 1) {\n\n countWdiagSoNe = countWdiagSoNe +jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y-1].ordinal() == 2 && pieces[x+2][y-2].ordinal() == 0) {\n\n countBdiagSoNe = countBdiagSoNe + jointset;\n }\n }\n //System.out.println(x + \" y:\" + y +\" Black consec DIAGOMAAL \" + countBdiagSoNe + \"White consec hori \" + countWdiagSoNe);\n y--;\n\n\n }\n if (a==1 && blacks == 4 && whites==1){\n countBdiagSoNe += unwinnable;\n }\n /*if (blacks == 3 && whites==3){\n countBdiagSoNe += unwinnable;\n countWdiagSoNe += unwinnable;\n }*/\n if (a==1&& blacks == 1 && whites==4){\n countWdiagSoNe += unwinnable;\n }\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n int valuew = consecutivevalue(countWdiagSoNe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue(countBdiagSoNe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagSoNe + \"White consec hori \" + valuew + \" \" + countWdiagSoNe);\n }\n\n //NorthWest S EAST Left\n for (int a = 0; a <5 ; a++) {\n int countWdiagNoSe = 0;\n int countBdiagNoSe = 0;\n int y=0;\n int blacks = 0;\n int whites = 0;\n\n for (int x = a; x <5 ; x++) {\n //System.out.println(pbs+\"x \" + x+ \" y \" +y);\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y+1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0) {\n blacks++;\n //countBdiagNoSe = countBdiagNoSe +2;\n }\n if (pieces[x][y].ordinal() == 1) {\n whites++;\n //countWdiagNoSe = countWdiagNoSe +2;\n }\n\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countWdiagNoSe= countWdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe + blankspaceconsec;\n }\n\n if (x==0 && y==0){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==1 && y==1){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==2 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==3 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==1 && y==0){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==2 && y==1){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==3 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n y++;\n\n\n }\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n if (blacks == 4 && whites==2){\n countBdiagNoSe += unwinnable;\n }\n if (a==1 && blacks == 4 && whites==1){\n countBdiagNoSe += unwinnable;\n }\n if (blacks == 3 && whites==3){\n countBdiagNoSe += unwinnable;\n countWdiagNoSe += unwinnable;\n }\n if (blacks == 2 && whites==4){\n countWdiagNoSe += unwinnable;\n }\n if (a==1 && blacks == 1 && whites==4){\n countWdiagNoSe += unwinnable;\n }\n\n int valuew = consecutivevalue(countWdiagNoSe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue( countBdiagNoSe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagNoSe + \"White consec hori \" + valuew + \" \" + countWdiagNoSe);\n }\n //NorthWest S EAST Right\n for (int a = 1; a <5 ; a++) {\n int countWdiagNoSe = 0;\n int countBdiagNoSe = 0;\n int x=0;\n int blacks = 0;\n int whites = 0;\n\n for (int y = a; y <5 ; y++) {\n //System.out.println(\"x \" + x+ \" y \" +y);\n int r = pieces[x][y].ordinal();\n int s =pieces[x+1][y+1].ordinal();\n //System.out.println(\"x \" + x+ \" y \" +y);\n //System.out.println(\"first \" + r+ \" second \" +s);\n if (pieces[x][y].ordinal() == 0 ) {\n blacks++;\n //countBdiagNoSe = countBdiagNoSe +2;\n }\n if (pieces[x][y].ordinal() == 1) {\n whites++;\n //countWdiagNoSe = countWdiagNoSe +2;\n }\n\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 0 ) {\n\n countBdiagNoSe = countBdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe +consecvalue;\n }\n\n else if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 ) {\n\n countWdiagNoSe= countWdiagNoSe + blankspaceconsec;\n }\n\n else if (pieces[x][y].ordinal() == 2 && pieces[x+1][y+1].ordinal() == 1 ) {\n\n countWdiagNoSe = countWdiagNoSe + blankspaceconsec;\n }\n\n if (x==0 && y==1){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==1 && y==2){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n if (x==2 && y==3){\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 1 && pieces[x+2][y+2].ordinal() == 0) {\n\n countWdiagNoSe = countWdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 0 && pieces[x+2][y+2].ordinal() == 1) {\n\n countBdiagNoSe = countBdiagNoSe + disjointset;\n }\n if (pieces[x][y].ordinal() == 1 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 1) {\n\n countWdiagNoSe = countWdiagNoSe + jointset;\n }\n else if (pieces[x][y].ordinal() == 0 && pieces[x+1][y+1].ordinal() == 2 && pieces[x+2][y+2].ordinal() == 0) {\n\n countBdiagNoSe = countBdiagNoSe + jointset;\n }\n }\n x++;\n\n\n }\n if (a==1 && blacks == 1 && whites==4){\n countWdiagNoSe += unwinnable;\n }\n if (a==1 && blacks == 4 && whites==1){\n countBdiagNoSe += unwinnable;\n }\n //System.out.println(\"Black consec vert \" + countBdiagSoNe + \"White consec \" + countWdiagSoNe);\n int valuew = consecutivevalue(countWdiagNoSe);\n whitescore = whitescore +valuew;\n int valueb = consecutivevalue( countBdiagNoSe);\n blackscore = blackscore + valueb;\n //System.out.println(\"Black consec DIAGOMAAL \" + valueb + \" \" + countBdiagNoSe + \"White consec hori \" + valuew + \" \" + countWdiagNoSe);\n }\n\n\n\n\n\n //System.out.println(\"Black consec score \" + blackscore +\" \" + \"White consec scpre \" + whitescore);\n //System.out.println(\"max player is \" + maxplayer + \"My colour is \" + mycolour);\n int i = -123456789;\n if (mycolour == 0){\n //System.out.println(blackscore-whitescore +\" I am black\");\n\n\n i= blackscore-whitescore;\n return i;\n\n }\n else {\n //System.out.println(whitescore-blackscore +\" I am white\");\n i= whitescore-blackscore;\n return i;\n }\n /*\n if(i>0 && i<1000){\n return 100; //i*2;\n }\n else if(i>=1000 && i<10000){\n return 1000; //i*10;\n }\n else if(i>=10000 && i<100000){\n return 10000; //i*50;\n }\n else if(i>=100000){\n return 100000;//i*500;\n }\n else if(i<=0 && i>-100){\n return -100; //i*2;\n }\n else if(i<=-100 && i>-1000){\n return -1000; //i*10;\n }\n else if(i<=-1000 && i>-10000){\n return -10000; //i*50;\n }\n else if(i<=0 && i>-100000){\n return -100000;//i*500;\n }\n\n */\n\n\n }", "public static void main(String args[]){\n\n EasyReader e = new EasyReader();\n \n System.out.println(\"Type in a number between 1 and 20\");\n int x = e.readInt(); // (int)(Math.random()*20+1);\n \n if (x<20 && x >1){\n int computer = 7;// (int)(Math.random()*20+1);\n \n System.out.println(\"The number the computer generated is \" + computer);\n if (x == computer)\n System.out.println(\"You've won $10!\");\n else if (computer - 2 == x || computer + 2 ==x || computer -1 == x || computer +1 == x)\n System.out.println(\"You've won $5!\");\n else \n System.out.println(\"You've won nothing and you lost.\");\n }\n else \n System.out.println(\"The number is outside the range.\");\n \n }", "private Board computerMove(Board board)\n {\n LinkedList<Board> children = generate(board, COMPUTER);\n \n int maxIndex = 0;\n int maxValue = minmax(children.get(0), MIN, 1, Integer.MIN_VALUE, Integer.MAX_VALUE);\n \n for (int i = 1; i < children.size(); i ++)\n {\n int currentValue = minmax(children.get(i), MIN, 1, Integer.MAX_VALUE, Integer.MAX_VALUE);\n \n if (currentValue > maxValue)\n {\n maxIndex = i;\n maxValue = currentValue; \n }\n \n }\n \n Board result = children.get(maxIndex);\n \n System.out.println(\"Computer move:\");\n \n displayBoard(result);\n \n return result;\n \n }", "public static void main(String[] args) throws FileNotFoundException, IOException{\n\tScanner sc=new Scanner(new BufferedReader(new InputStreamReader (new FileInputStream(\"CodeJam2014/r1c_a/A-large.in\"))));\r\n\t\t//Scanner sc=new Scanner(new BufferedReader(new InputStreamReader(System.in)));\r\n\t\tPrintWriter ou=new PrintWriter(new FileWriter(\"CodeJam2014/r1c_a/testal.out\"));\r\n\t\tint res,rep,i,j;\r\n\t\tlong p,q,tp,tq,cp,cq;\r\n\t\tboolean vis;\r\n\t\tString s;\r\n\t\tString[] s2=new String[3];\r\n\t\tString out=\"\";\r\n\t\t\r\n\t\tres=sc.nextInt();\r\n\t\ts=sc.nextLine();\r\n\t\tfor(rep=1;rep<=res;rep++){\r\n\t\t\ts=sc.nextLine();\r\n\t\t\ts2=s.split(\"/\");\r\n\t\t\tp=0; q=0;\r\n\t\t\tfor(i=0;i<s2[0].length();i++){\r\n\t\t\t\tp*=10;\r\n\t\t\t\tp+=(int)s2[0].charAt(i)-(int)'0';\r\n\t\t\t}\r\n\t\t\tfor(i=0;i<s2[1].length();i++){\r\n\t\t\t\tq*=10;\r\n\t\t\t\tq+=(int)s2[1].charAt(i)-(int)'0';\r\n\t\t\t}\r\n\t\t\t//p=Integer.parseInt(s2[0]); q=Integer.parseInt(s2[1]);\r\n\t\t\t//p=sc.nextInt(); q=sc.nextInt();\r\n\t\t\ttp=p/gcd(p,q); tq=q/gcd(p,q);\r\n\t\t\tSystem.out.println(tp);\r\n\t\t\tcp=0; cq=0;\r\n\t\t\tvis=true;\r\n\t\t\twhile(tp!=1){\r\n\t\t\t\ttp=tp>>1;\r\n\t\t\t\tcp++;\r\n\t\t\t}\r\n\t\t\twhile(tq!=1){\r\n\t\t\t\tif (tq%2==1) {vis=false; break;}\r\n\t\t\t\ttq/=2;\r\n\t\t\t\tcq++;\r\n\t\t\t}\r\n\t\t\tou.print(\"Case #\"+rep+\": \");\r\n\t\t\tif (!vis) ou.print(\"impossible\");\r\n\t\t\telse ou.print(cq-cp);\r\n\t\t\tif (res!=rep) ou.println();\r\n\t\t\tSystem.out.println(cq-cp);\r\n\t\t}\r\n\t\tou.close();\r\n\t}", "static int distributeCandy(int[] score) {\n java.util.TreeMap<Integer,Integer> candcalmap=new java.util.TreeMap<Integer,Integer>();\n int totcand=0,numcan=1;\n /* for(int indx=1;indx<score.length;indx++)\n {\n while(score[indx-1]<(indx<score.length?score[indx]:Integer.MAX_VALUE))\n {\n numcan++;\n indx++;\n totcand+=numcan;\n //System.out.println(numcan+\"-\"+indx+\":\"+totcand);\n if(indx==score.length)\n break;\n }\n numcan=1;\n totcand+=numcan;\n \n }\n*/\tfor(int sc:score)\n {\n candcalmap.put(sc,candcalmap.get(sc)==null?1:candcalmap.get(sc)+1);\n }\n for(Map.Entry<Integer,Integer> e:candcalmap.entrySet())\n {\n totcand+=numcan*e.getValue();\n// System.out.println(e.getValue()+\"-\"+e.getKey()+\":\"+numcan+\" \"+totcand);\n numcan++;\n }\n return totcand;\n }", "public String solve() {\n char[] secret = new char[NUM_DIGITS];\n for (int i = 0; i < secret.length; i++) {\n shuffle(secret, i);\n }\n\n final int RoundThreshold = 10;\n int rounds = 0;\n int errors = distance(secret);\n int previous = errors;\n\n while (errors != 0) {\n // replace every digit by a different random number, keep\n // those that minimize the error metric\n for (int i = 0; i < secret.length; i++) {\n // replace by a new random digit\n char previousDigit = secret[i];\n shuffle(secret, i);\n\n int modified = distance(secret);\n if (modified <= errors) {\n // we have improvement, keep the digit\n errors = modified;\n } else {\n // restore previous digit if no improvement\n secret[i] = previousDigit;\n }\n }\n\n if (errors == previous) {\n // we didn't improve on the previous guess\n if (++rounds == RoundThreshold) {\n // stuck too long? try to escape local optimum by\n // changing a random number\n shuffle(secret, rand.nextInt(secret.length));\n errors = distance(secret);\n rounds = 0;\n }\n } else {\n // we got closer to the goal\n rounds = 0;\n previous = errors;\n }\n }\n\n return new String(secret);\n }", "static int comb(int big, int smal) \n\t{ \n\t\treturn (int) ((long) fact[big] * invfact[smal] % mod \n\t\t\t\t* invfact[big - smal] % mod); \n\t}", "public char winner (char comp, char user)\n {\n\tif (comp == user)\n\t return 'b';\n\telse if ((comp == 'F') && (user == 'W'))\n\t return 'u';\n\telse if ((comp == 'W') && (user == 'F'))\n\t return 'c';\n\telse if ((comp == 'G') && (user == 'W'))\n\t return 'c';\n\telse if ((comp == 'W') && (user == 'G'))\n\t return 'u';\n\telse if ((comp == 'G') && (user == 'F'))\n\t return 'u';\n\telse\n\t return 'c';\n\t//returns c for computer, u for user and b for both\n\n }", "public static void main(String args[]){\n int count = 1; \n long time1, time2;\n long redSum= 0;\n long blackSum =0;\n char[][] board = {\n {'W','B','W','B','W','B','W','B'},\n {'B','W','B','W','B','W','B','W'},\n {'W','B','X','B','X','B','X','B'},\n {'B','W','B','E','B','W','B','W'},\n {'W','B','X','B','X','B','X','B'},\n {'B','W','B','W','B','W','B','X'},\n {'X','B','X','B','X','B','X','B'},\n {'B','X','B','W','B','W','B','W'}\n \n } ;\n \n char[][] oldBoard = board;\n System.out.println(\"WIBB\");\n printBoard(board);\n while(count>0){\n \n time1 = new Date().getTime();\n for(int i =0; i<6; i++){\n \n // AlphaBetaTree isRedAI = new AlphaBetaTree(null, true, 0, -1000, 1000, 0, board, i);\n \n //isRedAI.getBestMove();\n \n }\n ArrayList<MoveCoordinates> aThing = new ArrayList<>();\n \n AlphaBetaTree isRedAI = new AlphaBetaTree(null, true, 0, -1000, 1000, 0, board, 3, aThing);\n // time1 = new Date().getTime();\n BoardMovesPair best= isRedAI.getBestMove();\n board = best.getBoard();\n if(board.equals(oldBoard)){\n \n break;\n }\n oldBoard = board;\n time2 = new Date().getTime();\n System.out.println(\"\\nRed's turn: \" + (count +1) );\n redSum+= (time2-time1);\n System.out.println(\"It took \" + (time2-time1 ) + \"ms\");\n printBoard(board);\n ArrayList<MoveCoordinates> allMoves = best.getAllMoves();\n if(allMoves == null){\n \n System.out.println(\"IS A NULL!!!\");\n \n }\n for(int i =0; i<allMoves.size(); i++){\n \n \n System.out.println(allMoves.get(i).getRow() + \" - \" + allMoves.get(i).getCol());\n \n }\n \n \n AlphaBetaTree isBlackAI = new AlphaBetaTree(null, false, 0, -1000, 1000, 0, board, 3, aThing);\n \n \n time1 = new Date().getTime();\n best = isBlackAI.getBestMove();\n board = best.getBoard();\n if(board.equals(oldBoard)){\n \n break;\n }\n oldBoard = board;\n time2 = new Date().getTime();\n System.out.println(\"\\nBlacks's turn: \" + (count +1) );\n blackSum+= (time2-time1);\n System.out.println(\"It took \" + (time2-time1 ) + \"ms\");\n \n printBoard(board);\n \n allMoves = best.getAllMoves();\n for(int i =0; i<allMoves.size(); i++){\n \n System.out.println(\"UM!? \" + allMoves.get(i).getRow() + \" - \" + allMoves.get(i).getCol());\n \n }\n \n count--;\n System.out.println(\"Count is: \" +count);\n }\n System.out.println(\"Red pieces: \" + BoardUtilities.countPieces('O', board));\n System.out.println(\"Red Kings: \" + BoardUtilities.countPieces('E', board));\n System.out.println(\"Average move: \" + (redSum/(count+1)) + \"ms\" );\n \n System.out.println(\"Black pieces: \" + BoardUtilities.countPieces('X', board));\n System.out.println(\"Black Kings: \" + BoardUtilities.countPieces('K', board));\n System.out.println(\"Average move: \" + (blackSum/(count+1)) + \"ms\" );\n printBoard(board);\n \n }", "public void findMaxComb() {\n\t\tHashMap<Integer, HashSet<Integer>> adj = new HashMap<Integer, HashSet<Integer>>();\n\t\tfor (int row=0; row< w; row++) {\n\t\t\tfor (int col=0; col<l; col++) {\n\t\t\t\tHashSet<Integer> hs = new HashSet<Integer>();\n\t\t\t\t//go left\n\t\t\t\tif (inBoard(row, col-1) && visited[row][col-1] != visited[row][col]) //in board and not equal\n\t\t\t\t\ths.add(visited[row][col-1]);\n\n\t\t\t\t//go up\n\t\t\t\tif (inBoard(row-1, col) && visited[row-1][col] != visited[row][col])\n\t\t\t\t\ths.add(visited[row-1][col]);\n\n\t\t\t\t//go right\n\t\t\t\tif (inBoard(row, col+1) && visited[row][col+1] != visited[row][col])\n\t\t\t\t\ths.add(visited[row][col+1]);\n\n\t\t\t\t//go down\n\t\t\t\tif (inBoard(row+1, col) && visited[row+1][col] != visited[row][col])\n\t\t\t\t\ths.add(visited[row+1][col]);\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tif (adj.containsKey(visited[row][col])) {\n\t\t\t\t\tHashSet<Integer> tt = adj.get(visited[row][col]);\n\t\t\t\t\ttt.addAll(hs);//union, return boolen\n\t\t\t\t\tadj.put(visited[row][col], tt); \n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tadj.put(visited[row][col], hs);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t}\n\t\tint tempMax = 0;\n\t\tfor (Integer key : adj.keySet()) {\n\t\t\tfor (Integer ele : adj.get(key)) {\n\t\t\t\ttempMax = Math.max(tempMax, map.get(key) + map.get(ele));\n\t\t\t}\n\t\t}\n\t\tmaxComb = tempMax;\n\t}", "private static int eval(Board board) {\n if (board.piecesContiguous(board.turn())) {\n return Integer.MAX_VALUE;\n } else if (board.piecesContiguous(board.turn().opposite())) {\n return Integer.MIN_VALUE;\n } else {\n Random r = new Random();\n return r.nextInt();\n }\n }", "@Override\n protected Move makeDecision() {\n myTurn = index();\n /* block the nearest + most effective player (as in, people who arent blocked) */\n ArrayList<Move> pathMoves = new ArrayList<>();\n ArrayList<Move> playMoves = new ArrayList<>();\n ArrayList<Move> discardMoves = new ArrayList<>();\n Map<Integer, Card> destroyCards = new HashMap<Integer, Card>();\n Map<Integer, Card> repairCards = new HashMap<Integer, Card>();\n Map<Integer, Card> blockCards = new HashMap<Integer, Card>();\n Map<Integer, Card> pathCards = new HashMap<Integer, Card>();\n Set<Position> reachable = game().board().getReachable();\n canSee=false;\n canMove=false;\n canBlock=false;\n canRockfall=false;\n canRepair=false;\n int len = hand().size();\n for (int i = 0; i < len; ++i) {\n Card c = hand().get(i);\n if (c instanceof PathCard && !isSabotaged()) {\n pathCards.put(i,c);\n// pathMoves.addAll(generatePossiblePaths(i, (PathCard) c));\n canMove = true;\n }\n if (c instanceof PlayerActionCard) {\n// playMoves.addAll(generatePossiblePlayerActions(i, (PlayerActionCard) c));\n if(c.type()== Card.Type.BLOCK) {\n blockCards.put(i, c);\n canBlock=true;\n }\n else if(c.type()== Card.Type.REPAIR) {\n repairCards.put(i, c);\n canRepair=true;\n }\n }\n if (c.type() == Card.Type.MAP) {\n// playMoves.addAll(generatePossibleMap(i));\n mapIndex = i;\n canSee = true;\n }\n if (c.type() == Card.Type.ROCKFALL) {\n destroyCards.put(i,c);\n// playMoves.addAll(generatePossibleRockfall(i));\n canRockfall = true;\n }\n discardMoves.add(Move.NewDiscardMove(index(), i));\n }\n\n if(canSee) {\n //sum of all heuristics\n double sumGoal[] = new double[3];\n for (Position h : reachable) {\n sumGoal[0]+=(9-(8-h.x)+ 5-(4-h.y));\n sumGoal[1]+=(9-(8-h.x)+ 5-(2-h.y));\n sumGoal[2]+=(9-(8-h.x)+ 5-(-h.y));\n }\n //update goldProb\n for(int i=0; i<3; i++) {\n int seenSum=0;\n for(int j=0; j<numPlayers; j++) {\n if(j!=myTurn) {\n if(haveSeen.get(j)[i]==1) seenSum++;\n }\n }\n goldProb[i] = (i==1?0.5:1)*(1-haveSeen.get(myTurn)[i])*(mapRate*(seenSum/numPlayers)+(sumGoal[i]/10));\n }\n }\n\n// System.out.println(hand());\n// System.out.println(pathMoves);\n\n\n if (role() == Role.GOLD_MINER) {\n //Path\n if(canSee && !goldFound) {\n int selection=0;\n double maxProb=goldProb[0];\n for(int i=0; i<3; i++) {\n if(goldProb[i]>maxProb) {\n maxProb = goldProb[i];\n selection=i;\n }\n }\n Move look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.TOP);\n switch(selection) {\n case 0:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.TOP);\n break;\n case 1:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.MIDDLE);\n break;\n case 2:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.BOTTOM);\n break;\n }\n return look;\n }\n if(canMove) {\n int globalIndex = 0;\n double maxH = 0;\n double oldH;\n Position bp = new Position(0,0);\n boolean rotate = false;\n //Find best path to place;\n Board board = game().board().copy();\n oldH = getClosest(board);\n// System.out.print(getClosest(board)+\" : \");\n for( Map.Entry<Integer, Card> p : pathCards.entrySet()) {\n int index = p.getKey();\n Card path = p.getValue();\n ((PathCard)path).setRotated(false);\n Set<Position> placeable = game().board().getPlaceable((PathCard)path);\n for (Position h : placeable) {\n Board simulated = board.simulatePlaceCardAt((PathCard)path, h.x, h.y);\n// System.out.println(path.type());\n double cH = getClosest(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n maxH = cH;\n rotate=false;\n }\n }\n ((PathCard) path).setRotated(true);\n placeable = game().board().getPlaceable((PathCard)path);\n for (Position h : placeable) {\n Board simulated = board.simulatePlaceCardAt((PathCard)path, h.x, h.y);\n// System.out.println(simulated);\n double cH = getClosest(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n rotate=true;\n maxH = cH;\n }\n }\n }\n// System.out.println(oldH+\": \"+maxH+\" (\"+abs(maxH-oldH)+\")\");\n oldBoard = game().board().copy();\n if(maxH>0 && abs(maxH-oldH)>0.01)\n return Move.NewPathMove(index(), globalIndex, bp.x, bp.y, rotate);\n }\n //Unblock\n if(canRepair) {\n double blockMore = 0.0;\n int targetPlayer = -1;\n int cardIndex = 0;\n for(int i=0; i<numPlayers; i++) {\n //heal self\n if(i == myTurn) {\n for(Map.Entry<Integer, Card> r : repairCards.entrySet()) {\n int index = r.getKey();\n// System.out.println(Arrays.toString(game().playerAt(index()).sabotaged()));\n PlayerActionCard repair = (PlayerActionCard) r.getValue();\n if (game().playerAt(index()).isRepairable(repair.effects())) {\n return Move.NewPlayerActionMove(index(),index, index());\n }\n }\n }\n else if(i!=myTurn) {\n for(Map.Entry<Integer, Card> r : repairCards.entrySet()) {\n int index = r.getKey();\n PlayerActionCard repair = (PlayerActionCard) r.getValue();\n// System.out.println(Arrays.toString(game().playerAt(i).sabotaged()));\n if (game().playerAt(i).isRepairable(repair.effects())) {\n //calculate the should i repair? function\n double shouldIBlockMore = Probability[i]+(0.03*(numPlayers-i));\n if(blockMore<shouldIBlockMore) {\n blockMore = shouldIBlockMore;\n targetPlayer = i;\n cardIndex = index;\n }\n }\n }\n }\n }\n if(blockMore>0.75 && targetPlayer>=0)\n return Move.NewPlayerActionMove(index(), cardIndex, targetPlayer);\n }\n //Block Enemy\n if(canBlock) {\n double blockMore = 0.0;\n int targetPlayer = -1;\n int cardIndex = 0;\n for (int i = 0; i < numPlayers; i++) {\n if (i != myTurn) {\n for (Map.Entry<Integer, Card> b : blockCards.entrySet()) {\n int index = b.getKey();\n PlayerActionCard block = (PlayerActionCard) b.getValue();\n if (game().playerAt(i).isSabotageable(block.effects()[0])) {\n //calculate the should i repair? function\n double shouldIBlockMore = (1 - Probability[i]) * ((1 - Probability[i]) + 0.2 * (numPlayers - i));\n if (blockMore < shouldIBlockMore) {\n blockMore = shouldIBlockMore;\n targetPlayer = i;\n cardIndex = index;\n }\n }\n }\n }\n }\n if(blockMore>0.6 && targetPlayer>=0)\n return Move.NewPlayerActionMove(index(), cardIndex, targetPlayer);\n }\n //Fix (Rockfall)\n if(canRockfall) {\n int globalIndex = 0;\n double maxH = 0.0;\n Position bp = new Position(0,0);\n //Find best path to place;\n Board board = game().board().copy();\n for( Map.Entry<Integer, Card> d : destroyCards.entrySet()) {\n int index = d.getKey();\n Set<Position> destroyable = game().board().getDestroyable();\n for (Position h : destroyable) {\n Board simulated = board.simulateRemoveCardAt(h.x, h.y);\n// System.out.println(path.type());\n double cH = getClosest(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n maxH = cH;\n }\n }\n }\n oldBoard = game().board().copy();\n if(maxH>0)\n return Move.NewRockfallMove(index(), globalIndex, bp.x, bp.y);\n }\n //See map\n\n //Conserve (Find the best card to discard)\n\n //calculate the heuristics and adjust accordingly,\n //choose between playing a card or discarding.\n } else if (role() == Role.SABOTEUR) {\n //See map\n if(canSee && !goldFound) {\n int selection=0;\n //specific for saboteurs\n double maxProb=goldProb[0];\n for(int i=0; i<3; i++) {\n if(goldProb[i]>maxProb) {\n maxProb = goldProb[i];\n selection=i;\n }\n }\n Move look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.TOP);\n switch(selection) {\n case 0:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.TOP);\n break;\n case 1:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.MIDDLE);\n break;\n case 2:\n look = Move.NewMapMove(index(), mapIndex, Board.GoalPosition.BOTTOM);\n break;\n }\n return look;\n }\n //Path\n if(canMove) {\n int globalIndex = 0;\n double maxH = 0.0;\n Position bp = new Position(0,0);\n boolean rotate = false;\n //Find best path to place;\n Board board = game().board().copy();\n double oldH = getClosestSabotage(board);\n for( Map.Entry<Integer, Card> p : pathCards.entrySet()) {\n int index = p.getKey();\n Card path = p.getValue();\n ((PathCard)path).setRotated(false);\n Set<Position> placeable = game().board().getPlaceable((PathCard)path);\n for (Position h : placeable) {\n Board simulated = board.simulatePlaceCardAt((PathCard)path, h.x, h.y);\n// System.out.println(path.type());\n double cH = getClosestSabotage(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n maxH = cH;\n rotate=false;\n }\n }\n ((PathCard) path).setRotated(true);\n placeable = game().board().getPlaceable((PathCard)path);\n for (Position h : placeable) {\n Board simulated = board.simulatePlaceCardAt((PathCard)path, h.x, h.y);\n// System.out.println(simulated);\n double cH = getClosestSabotage(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n rotate=true;\n maxH = cH;\n }\n }\n }\n oldBoard = game().board().copy();\n if(maxH>0 && abs(maxH-oldH)>0.01)\n return Move.NewPathMove(index(), globalIndex, bp.x, bp.y, rotate);\n }\n //Unblock Friend\n if(canRepair) {\n double blockMore = 0.0;\n int targetPlayer = -1;\n int cardIndex = 0;\n for(int i=0; i<numPlayers; i++) {\n if(i == myTurn) {\n for(Map.Entry<Integer, Card> r : repairCards.entrySet()) {\n int index = r.getKey();\n PlayerActionCard repair = (PlayerActionCard) r.getValue();\n if (game().playerAt(myTurn).isRepairable(repair.effects())) {\n return Move.NewPlayerActionMove(index(),index, index());\n }\n }\n }\n else if(i!=myTurn) {\n for(Map.Entry<Integer, Card> r : repairCards.entrySet()) {\n int index = r.getKey();\n PlayerActionCard repair = (PlayerActionCard) r.getValue();\n if (game().playerAt(i).isRepairable(repair.effects())) {\n //calculate the should i repair? function\n double shouldIBlockMore = (1-Probability[i])+(0.03*(numPlayers-i));\n if(blockMore<shouldIBlockMore) {\n blockMore = shouldIBlockMore;\n targetPlayer = i;\n cardIndex = index;\n }\n }\n }\n }\n }\n if(blockMore>0.75 && targetPlayer>=0)\n return Move.NewPlayerActionMove(index(), cardIndex, targetPlayer);\n }\n //Block Enemy\n if(canBlock) {\n double blockMore = 0.0;\n int targetPlayer = -1;\n int cardIndex = 0;\n for (int i = 0; i < numPlayers; i++) {\n if (i != myTurn) {\n for (Map.Entry<Integer, Card> b : blockCards.entrySet()) {\n int index = b.getKey();\n PlayerActionCard block = (PlayerActionCard) b.getValue();\n if (game().playerAt(i).isSabotageable(block.effects()[0])) {\n //calculate the should i repair? function\n double shouldIBlockMore = (Probability[i]) * ((Probability[i]) + 0.2 * (numPlayers - i));\n if (blockMore < shouldIBlockMore) {\n blockMore = shouldIBlockMore;\n targetPlayer = i;\n cardIndex = index;\n }\n }\n }\n }\n }\n if(blockMore>0.6 && targetPlayer>=0)\n return Move.NewPlayerActionMove(index(), cardIndex, targetPlayer);\n }\n //Sabotage (Rockfall)\n if(canRockfall) {\n int globalIndex = 0;\n double maxH = 0;\n Position bp = new Position(0,0);\n //Find best path to place;\n Board board = game().board().copy();\n for( Map.Entry<Integer, Card> d : destroyCards.entrySet()) {\n int index = d.getKey();\n Set<Position> destroyable = game().board().getDestroyable();\n for (Position h : destroyable) {\n Board simulated = board.simulateRemoveCardAt(h.x, h.y);\n// System.out.println(path.type());\n double cH = getClosestSabotage(simulated);\n if(maxH<cH) {\n bp=h;\n globalIndex = index;\n maxH = cH;\n }\n }\n }\n oldBoard = game().board().copy();\n if(maxH>0)\n return Move.NewRockfallMove(index(), globalIndex, bp.x, bp.y);\n }\n //Conserve (Find the best card to discard\n\n //calculate the heuristics and adjust accordingly,\n //choose between playing a card or discarding.\n }\n return discardMoves.get(0);\n }", "private Move produceHeuristicMove(Board board){\n\n\t\tint numRows = board.getNumberOfRows();\n\t\tint[][] bins = new int[numRows][BINARY_LENGTH];\n\t\tint[] binarySum = new int[BINARY_LENGTH];\n\t\tint bitIndex,higherThenOne=0,totalOnes=0,lastRow=0,lastLeft=0,lastSize=0,lastOneRow=0,lastOneLeft=0;\n\t\t\n\t\tfor(bitIndex = 0;bitIndex<BINARY_LENGTH;bitIndex++){\n\t\t\tbinarySum[bitIndex] = 0;\n\t\t}\n\t\t\n\t\tfor(int k=0;k<numRows;k++){\n\t\t\t\n\t\t\tint curRowLength = board.getRowLength(k+1);\n\t\t\tint i = 0;\n\t\t\tint numOnes = 0;\n\t\t\t\n\t\t\tfor(bitIndex = 0;bitIndex<BINARY_LENGTH;bitIndex++){\n\t\t\t\tbins[k][bitIndex] = 0;\n\t\t\t}\n\t\t\t\n\t\t\tdo {\n\t\t\t\tif(i<curRowLength && board.isStickUnmarked(k+1,i+1) ){\n\t\t\t\t\tnumOnes++;\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\tif(numOnes>0){\n\t\t\t\t\t\t\n\t\t\t\t\t\tString curNum = Integer.toBinaryString(numOnes);\n\t\t\t\t\t\twhile(curNum.length()<BINARY_LENGTH){\n\t\t\t\t\t\t\tcurNum = \"0\" + curNum;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor(bitIndex = 0;bitIndex<BINARY_LENGTH;bitIndex++){\n\t\t\t\t\t\t\tbins[k][bitIndex] += curNum.charAt(bitIndex)-'0'; //Convert from char to int\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(numOnes>1){\n\t\t\t\t\t\t\thigherThenOne++;\n\t\t\t\t\t\t\tlastRow = k +1;\n\t\t\t\t\t\t\tlastLeft = i - numOnes + 1;\n\t\t\t\t\t\t\tlastSize = numOnes;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttotalOnes++;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlastOneRow = k+1;\n\t\t\t\t\t\tlastOneLeft = i;\n\t\t\t\t\t\t\n\t\t\t\t\t\tnumOnes = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\ti++;\n\t\t\t}while(i<=curRowLength);\n\t\t\t\n\t\t\tfor(bitIndex = 0;bitIndex<BINARY_LENGTH;bitIndex++){\n\t\t\t\tbinarySum[bitIndex] = (binarySum[bitIndex]+bins[k][bitIndex])%2;\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t\t//We only have single sticks\n\t\tif(higherThenOne==0){\n\t\t\treturn new Move(lastOneRow,lastOneLeft,lastOneLeft);\n\t\t}\n\t\t\n\t\t//We are at a finishing state\t\t\t\t\n\t\tif(higherThenOne<=1){\n\t\t\t\n\t\t\tif(totalOnes == 0){\n\t\t\t\treturn new Move(lastRow,lastLeft,lastLeft+(lastSize-1) - 1);\n\t\t\t} else {\n\t\t\t\treturn new Move(lastRow,lastLeft,lastLeft+(lastSize-1)-(1-totalOnes%2));\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\tfor(bitIndex = 0;bitIndex<BINARY_LENGTH-1;bitIndex++){\n\t\t\t\n\t\t\tif(binarySum[bitIndex]>0){\n\t\t\t\t\n\t\t\t\tint finalSum = 0,eraseRow = 0,eraseSize = 0,numRemove = 0;\n\t\t\t\tfor(int k=0;k<numRows;k++){\n\t\t\t\t\t\n\t\t\t\t\tif(bins[k][bitIndex]>0){\n\t\t\t\t\t\teraseRow = k+1;\n\t\t\t\t\t\teraseSize = (int)Math.pow(2,BINARY_LENGTH-bitIndex-1);\n\t\t\t\t\t\t\n\t\t\t\t\t\tfor(int b2 = bitIndex+1;b2<BINARY_LENGTH;b2++){\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(binarySum[b2]>0){\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tif(bins[k][b2]==0){\n\t\t\t\t\t\t\t\t\tfinalSum = finalSum + (int)Math.pow(2,BINARY_LENGTH-b2-1);\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tfinalSum = finalSum - (int)Math.pow(2,BINARY_LENGTH-b2-1);\n\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\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tnumRemove = eraseSize - finalSum;\n\t\t\t\t\n\t\t\t\t//Now we find that part and remove from it the required piece\n\t\t\t\tint numOnes=0,i=0;\n\t\t\t\twhile(numOnes<eraseSize){\n\n\t\t\t\t\tif(board.isStickUnmarked(eraseRow,i+1)){\n\t\t\t\t\t\tnumOnes++;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnumOnes=0;\n\t\t\t\t\t}\n\t\t\t\t\ti++;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\treturn new Move(eraseRow,i-numOnes+1,i-numOnes+numRemove);\n\t\t\t}\n\t\t}\n\t\t\n\t\t//If we reached here, and the board is not symmetric, then we only need to erase a single stick\n\t\tif(binarySum[BINARY_LENGTH-1]>0){\n\t\t\treturn new Move(lastOneRow,lastOneLeft,lastOneLeft);\n\t\t}\n\t\t\n\t\t//If we reached here, it means that the board is already symmetric, and then we simply mark one stick from the last sequence we saw:\n\t\treturn new Move(lastRow,lastLeft,lastLeft);\t\t\n\t}", "@Override\n\tpublic void challenge7() {\n\n\t}", "public void allCombinations(){\n // Sorts the AI's rack\n combinations = new ArrayList<ArrayList<Piece>>();\n ArrayList<Piece> pieces = playersPieces;\n this.removeNulls(numOfNulls());\n for (int index = 0; index < pieces.size();index++){\n Piece temp = pieces.get(index);\n char compareWord = pieces.get(index).theLetter();\n int lowerIndex = index-1;\n\n while (lowerIndex >=0 && compareWord < pieces.get(lowerIndex).theLetter()){\n pieces.set(lowerIndex+1, pieces.get(lowerIndex));\n lowerIndex--;\n }\n\n pieces.set(lowerIndex+1,temp);\n }\n \n // Makes a list of all combinations through the recursive combine method\n combine(pieces, 0, new ArrayList<Piece>());\n insertionSort(combinations);\n combinations.remove(0);\n \n return;\n }", "public void evaluate_ciphertext_matrix() {\n // DES_Plaintext_Matrix := Die 65x64 Matrix der Plaintexte \"p + e_i\"\n // Initialisierung\n for (int z = 0; z < 65; z++)\n for (int s = 0; s < 64; s++)\n DES_Plaintext_Matrix[z][s] = DES_plaintext[s];\n\n for (int z = 1; z < 65; z++)\n DES_Plaintext_Matrix[z][64 - z] = 1 ^ DES_Plaintext_Matrix[z][64 - z];\n\n int[][] cipher_sequence_temporarily = new int[18][32];\n int[] m0_m1 = new int[64];\n\n int[][] K = new int[16][48];\n if (DES_action_type == 0)\n K = DES_K;\n else {\n K = DES_reversed_K;\n }\n\n // JOptionPane.showMessageDialog(null, \"Evaluating DES(k,p+e_i) && Action-Type = \" +\n // DES_action_type);\n\n // Initialisierung\n intialize_matrix(cipher_sequence_temporarily);\n\n for (int k = 0; k < 65; k++) {\n m0_m1 = select(DES_Plaintext_Matrix[k], IP);\n\n for (int j = 0; j < 32; j++) {\n cipher_sequence_temporarily[0][j] = m0_m1[j];\n cipher_sequence_temporarily[1][j] = m0_m1[32 + j];\n }\n\n // Befuellung aus der Matrix \"cipher_sequence_temporarily\"\n for (int i = 2; i < 18; i++) {\n int[] input_SBoxes = exclusive_or(expand_32bit(cipher_sequence_temporarily[i - 1]), K[i - 2]);\n int[] fmK = select(lookup_SBoxes(input_SBoxes), P);\n cipher_sequence_temporarily[i] = exclusive_or(cipher_sequence_temporarily[i - 2], fmK);\n }\n\n int[][] flipped_last2_cipher_rounds_matrix = new int[65][64];\n for (int a = 0; a < 32; a++)\n flipped_last2_cipher_rounds_matrix[k][a] = cipher_sequence_temporarily[17][a];\n\n for (int a = 32; a < 64; a++)\n flipped_last2_cipher_rounds_matrix[k][a] = cipher_sequence_temporarily[16][a - 32];\n\n DES_Ciphertext_Matrix[k] = select(flipped_last2_cipher_rounds_matrix[k], FP);\n }\n }", "private byte getSchluessel() {\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tString eingabe = new String(\"\");\n\t\tbyte schluessel = 0;\n\t\tboolean wiederhole2;\n\t\tdo {\n\t\t\twiederhole2 = true;\n\t\t\t\n\t\t\ttry {\n\t\t\t\teingabe = br.readLine().toLowerCase().trim();\n\t\t\t}\n\t\t\n\t\t\tcatch(IOException ioex) {\n\t\t\t\tSystem.out.println(\"Konnte die Eingabe nicht lesen! Bitte versuchen sie es erneut und verwenden Sie ausschliesslich Zahlen!\");\n\t\t\t\teingabe = \"\";\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tschluessel = Byte.parseByte(eingabe);\n\t\t\t\t\n\t\t\t}\t\n\t\t\tcatch (NumberFormatException nfex) {\n\t\t\t\tSystem.out.println(\"Konnte die Eingabe nicht zu einer Zahl konvertieren! Bitte erneut versuchen!\");\n\t\t\t\tschluessel = 30;\n\t\t\t\n\t\t\t}\n\t\t\t// Formatierung des Schluessels\n\t\t\tif((schluessel >=26 || schluessel <0 )&& (schluessel != 88)) {\n\t\t\t\tSystem.out.println(\"Der Wert des Schluessels muss im Intervall [0,25] liegen, bzw. 88 sein! Bitte nochmals eingeben!\");\n\t\t\t\n\t\t\t}\n\t\t\telse if(schluessel == 0) {\n\t\t\t\tSystem.out.println(\"Der Schluessel-Wert 0 veraendert bei der Caesar-Kodierung nichts. Bitte gib einen anderen Schluessel ein!\");\n\t\t\t}\n\t\t\telse {\n\t\t\twiederhole2 = false;\n\t\t\t}\n\t\t}\n\t\twhile(wiederhole2);\n\t\n\t\t// Schluesseleingabe ist erfolgt, 88 steht fuer Unbekannter Wert\n\t\treturn schluessel;\n\t}", "private boolean computerWin(Board board)\n {\n return check(board, COMPUTER);\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 static int calculate()\n {\n final List<Integer> oneToNine = IntStream.iterate(1, n -> n + 1)\n .limit(9)\n .boxed()\n .collect(toList());\n final List<List<Integer>> permutations = HeapPermutations.of(oneToNine);\n\n // System.out.println(permutations.size());\n //2- for each permutation\n // a. find all breaking 2 points to break\n // b. check first two sections' third is equal to the last section\n // c. if yes, add combintion to result, otherwise skip\n\n return permutations.stream()\n .flatMap(toTriples()) //find all combinations xx X yy = zz\n .filter(isPandigital()) // allow pandigital tripes through\n .map(Triple::getThird) // get the product\n .distinct() // get distinct products only given the problem statement does not allow repetition (see hint)\n .mapToInt(i -> i) // convert to primitive\n .sum(); // and finally get the sum\n }", "public Location attack() {\n resetBoard();\n\n if (getHits().isEmpty()) {\n// System.out.println(\"Hunting\");\n\n for (final int[] r : board) {\n for (int c = 0; c < r.length; c++) {\n if (getIntegers().contains(5) && (c < (r.length - 4)))\n if ((-1 != r[c]) && (-1 != r[c + 1]) && (-1 != r[c + 2]) && (-1 != r[c + 3]) && (-1 != r[c + 4])) {\n ++r[c];\n ++r[c + 1];\n ++r[c + 2];\n ++r[c + 3];\n ++r[c + 4];\n }\n\n if (getIntegers().contains(4) && (c < (r.length - 3)))\n if ((-1 != r[c]) && (-1 != r[c + 1]) && (-1 != r[c + 2]) && (-1 != r[c + 3])) {\n ++r[c];\n ++r[c + 1];\n ++r[c + 2];\n ++r[c + 3];\n }\n if (getIntegers().contains(3) && (c < (r.length - 2)))\n if ((-1 != r[c]) && (-1 != r[c + 1]) && (-1 != r[c + 2])) {\n ++r[c];\n ++r[c + 1];\n ++r[c + 2];\n\n }\n if (getIntegers().contains(3) && (2 == Collections.frequency(getIntegers(), 3)) && (c < (r.length - 2)))\n if ((-1 != r[c]) && (-1 != r[c + 1]) && (-1 != r[c + 2])) {\n ++r[c];\n ++r[c + 1];\n ++r[c + 2];\n\n }\n if (getIntegers().contains(2) && (c < (r.length - 1)))\n if ((-1 != r[c]) && (-1 != r[c + 1])) {\n ++r[c];\n ++r[c + 1];\n }\n }\n }\n\n for (int c = 0; c < board[0].length; c++) {\n for (int r = 0; r < board.length; r++) {\n if (getIntegers().contains(5) && (r < (board.length - 4)))\n if ((-1 != board[r][c]) && (-1 != board[r + 1][c]) && (-1 != board[r + 2][c]) && (-1 != board[r + 3][c]) && (-1 != board[r + 4][c])) {\n ++board[r][c];\n ++board[r + 1][c];\n ++board[r + 2][c];\n ++board[r + 3][c];\n ++board[r + 4][c];\n }\n\n if (getIntegers().contains(4) && (r < (board.length - 3)))\n if ((-1 != board[r][c]) && (-1 != board[r + 1][c]) && (-1 != board[r + 2][c]) && (-1 != board[r + 3][c])) {\n ++board[r][c];\n ++board[r + 1][c];\n ++board[r + 2][c];\n ++board[r + 3][c];\n }\n if (getIntegers().contains(3) && (r < (board.length - 2)))\n if ((-1 != board[r][c]) && (-1 != board[r + 1][c]) && (-1 != board[r + 2][c])) {\n\n ++board[r][c];\n ++board[r + 1][c];\n ++board[r + 2][c];\n\n\n }\n if (getIntegers().contains(3) && (2 == Collections.frequency(getIntegers(), 3)) && (r < (board.length - 2)))\n if ((-1 != board[r][c]) && (-1 != board[r + 1][c]) && (-1 != board[r + 2][c])) {\n\n ++board[r][c];\n ++board[r + 1][c];\n ++board[r + 2][c];\n\n\n }\n if (getIntegers().contains(2) && (r < (board.length - 1)))\n if ((-1 != board[r][c]) && (-1 != board[r + 1][c])) {\n ++board[r][c];\n ++board[r + 1][c];\n }\n }\n }\n } else {\n// System.out.println(\"Hitting\");\n\n for (final Location hit : getHits()) {\n final int r = hit.getRow();\n final int c = hit.getCol();\n\n if (getIntegers().contains(2)) {\n if ((0 <= (c - 1)) && (-1 != board[r][c]) && (-1 != board[r][c - 1])) {\n ++board[r][c];\n ++board[r][c - 1];\n }\n\n\n if (((c + 1) < board[0].length) && (-1 != board[r][c]) && (-1 != board[r][c + 1])) {\n ++board[r][c];\n ++board[r][c + 1];\n }\n\n if ((0 <= (r - 1)) && (-1 != board[r][c]) && (-1 != board[r - 1][c])) {\n ++board[r][c];\n ++board[r - 1][c];\n }\n\n if (((r + 1) < board.length) && (-1 != board[r][c]) && (-1 != board[r + 1][c])) {\n ++board[r][c];\n ++board[r + 1][c];\n }\n\n\n }\n if (getIntegers().contains(3)) {\n final int inc = Collections.frequency(getIntegers(), 3);\n\n if ((0 <= (c - 2)) && (-1 != board[r][c]) && (-1 != board[r][c - 1]) && (-1 != board[r][c - 2])) {\n board[r][c] += inc;\n board[r][c - 1] += inc;\n board[r][c - 2] += inc;\n }\n if (((c + 2) < board[0].length) && (-1 != board[r][c]) && (-1 != board[r][c + 1]) && (-1 != board[r][c + 2])) {\n board[r][c] += inc;\n board[r][c + 1] += inc;\n board[r][c + 2] += inc;\n }\n if ((0 <= (r - 2)) && (-1 != board[r][c]) && (-1 != board[r - 1][c]) && (-1 != board[r - 2][c])) {\n board[r][c] += inc;\n board[r - 1][c] += inc;\n board[r - 2][c] += inc;\n }\n if (((r + 2) < board.length) && (-1 != board[r][c]) && (-1 != board[r + 1][c]) && (-1 != board[r + 2][c])) {\n board[r][c] += inc;\n board[r + 1][c] += inc;\n board[r + 2][c] += inc;\n }\n\n\n }\n if (getIntegers().contains(4)) {\n if ((0 <= (c - 3)) && (-1 != board[r][c]) && (-1 != board[r][c - 1]) && (-1 != board[r][c - 2]) && (-1 != board[r][c - 3])) {\n ++board[r][c];\n ++board[r][c - 1];\n ++board[r][c - 2];\n ++board[r][c - 3];\n }\n if (((c + 3) < board[0].length) && (-1 != board[r][c]) && (-1 != board[r][c + 1]) && (-1 != board[r][c + 2]) && (-1 != board[r][c + 3])) {\n ++board[r][c];\n ++board[r][c + 1];\n ++board[r][c + 2];\n ++board[r][c + 3];\n }\n if ((0 <= (r - 3)) && (-1 != board[r][c]) && (-1 != board[r - 1][c]) && (-1 != board[r - 2][c]) && (-1 != board[r - 3][c])) {\n ++board[r][c];\n ++board[r - 1][c];\n ++board[r - 2][c];\n ++board[r - 3][c];\n }\n if (((r + 3) < board.length) && (-1 != board[r][c]) && (-1 != board[r + 1][c]) && (-1 != board[r + 2][c]) && (-1 != board[r + 3][c])) {\n ++board[r][c];\n ++board[r + 1][c];\n ++board[r + 2][c];\n ++board[r + 3][c];\n }\n\n\n }\n if (getIntegers().contains(5)) {\n if ((0 <= (c - 4)) && (-1 != board[r][c]) && (-1 != board[r][c - 1]) && (-1 != board[r][c - 2]) && (-1 != board[r][c - 3]) && (-1 != board[r][c - 4])) {\n ++board[r][c];\n ++board[r][c - 1];\n ++board[r][c - 2];\n ++board[r][c - 3];\n ++board[r][c - 4];\n }\n if (((c + 4) < board[0].length) && (-1 != board[r][c]) && (-1 != board[r][c + 1]) && (-1 != board[r][c + 2]) && (-1 != board[r][c + 3]) && (-1 != board[r][c + 4])) {\n ++board[r][c];\n ++board[r][c + 1];\n ++board[r][c + 2];\n ++board[r][c + 3];\n ++board[r][c + 4];\n }\n if ((0 <= (r - 4)) && (-1 != board[r][c]) && (-1 != board[r - 1][c]) && (-1 != board[r - 2][c]) && (-1 != board[r - 3][c]) && (-1 != board[r - 4][c])) {\n ++board[r][c];\n ++board[r - 1][c];\n ++board[r - 2][c];\n ++board[r - 3][c];\n ++board[r - 4][c];\n }\n if (((r + 4) < board.length) && (-1 != board[r][c]) && (-1 != board[r + 1][c]) && (-1 != board[r + 2][c]) && (-1 != board[r + 3][c]) && (-1 != board[r + 4][c])) {\n ++board[r][c];\n ++board[r + 1][c];\n ++board[r + 2][c];\n ++board[r + 3][c];\n ++board[r + 4][c];\n }\n }\n }\n\n for (final Location hit : getHits()) {\n board[hit.getRow()][hit.getCol()] = 0;\n }\n }\n\n// for (int[] i : board)\n// System.out.println(Arrays.toString(i));\n return findLargest();\n }", "int tournament() {\r\n \tint ch1,ch2;\r\n\t\tch1 = (int)Math.floor(Math.random()*SIZE);\r\n\t\tdo {\r\n\t\t\tch2 = (int)Math.floor(Math.random()*SIZE);\r\n\t\t} while (ch1==ch2);\r\n\t\tif (fit[ch1]<fit[ch2]) return ch1;\r\n\t\telse return ch2;\r\n }", "@Override\n\tpublic void challenge6() {\n\n\t}", "public String isWinnable(Card c[]) {\n\t\tString solutionEquation=\"There is no solution for this set\";\n\t\t// ++(+-/*)\n\t\tint i=0,j=1,k=2,l=3;\n\t\tansCount=0;\n\t\tint count=0;\n\t\tfor(count=0;count<25;count++) {\n\t\tif(c[i].getValue()+c[j].getValue()+c[k].getValue()+c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"+\"+c[j].getValue()+\"+\"+c[k].getValue()+\"+\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()+c[j].getValue()+c[k].getValue()-c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"+\"+c[j].getValue()+\"+\"+c[k].getValue()+\"-\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()+c[j].getValue()+c[k].getValue()/c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"+\"+c[j].getValue()+\"+\"+c[k].getValue()+\"/\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()+c[j].getValue()+c[k].getValue()*c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"+\"+c[j].getValue()+\"+\"+c[k].getValue()+\"*\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\t// +-(+-/*)\n\t\telse if(c[i].getValue()+c[j].getValue()-c[k].getValue()+c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"+\"+c[j].getValue()+\"-\"+c[k].getValue()+\"+\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()+c[j].getValue()-c[k].getValue()-c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"+\"+c[j].getValue()+\"-\"+c[k].getValue()+\"-\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()+c[j].getValue()-c[k].getValue()/c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"+\"+c[j].getValue()+\"-\"+c[k].getValue()+\"/\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()+c[j].getValue()-c[k].getValue()*c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"+\"+c[j].getValue()+\"-\"+c[k].getValue()+\"*\"+c[l].getValue();\t\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\t// +/(+-/*)\n\t\telse if(c[i].getValue()+c[j].getValue()/c[k].getValue()+c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"+\"+c[j].getValue()+\"/\"+c[k].getValue()+\"+\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()+c[j].getValue()/c[k].getValue()-c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"+\"+c[j].getValue()+\"/\"+c[k].getValue()+\"-\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()+c[j].getValue()/c[k].getValue()/c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"+\"+c[j].getValue()+\"/\"+c[k].getValue()+\"/\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()+c[j].getValue()/c[k].getValue()*c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"+\"+c[j].getValue()+\"/\"+c[k].getValue()+\"*\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\t// +*(+-/*)\n\t\telse if(c[i].getValue()+c[j].getValue()*c[k].getValue()+c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"+\"+c[j].getValue()+\"*\"+c[k].getValue()+\"+\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()+c[j].getValue()*c[k].getValue()-c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"+\"+c[j].getValue()+\"*\"+c[k].getValue()+\"-\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()+c[j].getValue()*c[k].getValue()/c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"+\"+c[j].getValue()+\"*\"+c[k].getValue()+\"/\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()+c[j].getValue()*c[k].getValue()*c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"+\"+c[j].getValue()+\"*\"+c[k].getValue()+\"*\"+c[l].getValue();\t\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\t////////////////\n\t\t////////////////\n\t\t// -+(+-/*)\n\t\telse if(c[i].getValue()-c[j].getValue()+c[k].getValue()+c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"-\"+c[j].getValue()+\"+\"+c[k].getValue()+\"+\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()-c[j].getValue()+c[k].getValue()-c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"-\"+c[j].getValue()+\"+\"+c[k].getValue()+\"-\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()-c[j].getValue()+c[k].getValue()/c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"-\"+c[j].getValue()+\"+\"+c[k].getValue()+\"/\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()-c[j].getValue()+c[k].getValue()*c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"-\"+c[j].getValue()+\"+\"+c[k].getValue()+\"*\"+c[l].getValue();\t\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\t// --(+-/*)\n\t\telse if(c[i].getValue()-c[j].getValue()-c[k].getValue()+c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"-\"+c[j].getValue()+\"-\"+c[k].getValue()+\"+\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()-c[j].getValue()-c[k].getValue()-c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"-\"+c[j].getValue()+\"-\"+c[k].getValue()+\"-\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()-c[j].getValue()-c[k].getValue()/c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"-\"+c[j].getValue()+\"-\"+c[k].getValue()+\"/\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()-c[j].getValue()-c[k].getValue()*c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"-\"+c[j].getValue()+\"-\"+c[k].getValue()+\"*\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\t// -/(+-/*)\n\t\telse if(c[i].getValue()-c[j].getValue()/c[k].getValue()+c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"-\"+c[j].getValue()+\"/\"+c[k].getValue()+\"+\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()-c[j].getValue()/c[k].getValue()-c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"-\"+c[j].getValue()+\"/\"+c[k].getValue()+\"-\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()-c[j].getValue()/c[k].getValue()/c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"-\"+c[j].getValue()+\"/\"+c[k].getValue()+\"/\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()-c[j].getValue()/c[k].getValue()*c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"-\"+c[j].getValue()+\"/\"+c[k].getValue()+\"*\"+c[l].getValue();\t\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\t// -*(+-/*)\n\t\telse if(c[i].getValue()-c[j].getValue()*c[k].getValue()+c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"-\"+c[j].getValue()+\"*\"+c[k].getValue()+\"+\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()-c[j].getValue()*c[k].getValue()-c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"-\"+c[j].getValue()+\"*\"+c[k].getValue()+\"-\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()-c[j].getValue()*c[k].getValue()/c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"-\"+c[j].getValue()+\"*\"+c[k].getValue()+\"/\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()-c[j].getValue()*c[k].getValue()*c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"-\"+c[j].getValue()+\"*\"+c[k].getValue()+\"*\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\t////////////////\n\t\t////////////////\n\t\t// /+(+-/*)\n\t\telse if(c[i].getValue()/c[j].getValue()+c[k].getValue()+c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"/\"+c[j].getValue()+\"+\"+c[k].getValue()+\"+\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()/c[j].getValue()+c[k].getValue()-c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"/\"+c[j].getValue()+\"+\"+c[k].getValue()+\"-\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()/c[j].getValue()+c[k].getValue()/c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"/\"+c[j].getValue()+\"+\"+c[k].getValue()+\"/\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()/c[j].getValue()+c[k].getValue()*c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"/\"+c[j].getValue()+\"+\"+c[k].getValue()+\"*\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\t// /-(+-/*)\n\t\telse if(c[i].getValue()/c[j].getValue()-c[k].getValue()+c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"/\"+c[j].getValue()+\"-\"+c[k].getValue()+\"+\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()/c[j].getValue()-c[k].getValue()-c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"/\"+c[j].getValue()+\"-\"+c[k].getValue()+\"-\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()/c[j].getValue()-c[k].getValue()/c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"/\"+c[j].getValue()+\"-\"+c[k].getValue()+\"/\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()/c[j].getValue()-c[k].getValue()*c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"/\"+c[j].getValue()+\"-\"+c[k].getValue()+\"*\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\t// //(+-/*)\n\t\telse if(c[i].getValue()/c[j].getValue()/c[k].getValue()+c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"/\"+c[j].getValue()+\"/\"+c[k].getValue()+\"+\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()/c[j].getValue()/c[k].getValue()-c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"/\"+c[j].getValue()+\"/\"+c[k].getValue()+\"-\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()/c[j].getValue()/c[k].getValue()/c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"/\"+c[j].getValue()+\"/\"+c[k].getValue()+\"/\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()/c[j].getValue()/c[k].getValue()*c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"/\"+c[j].getValue()+\"/\"+c[k].getValue()+\"*\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\t// /*(+-/*)\n\t\telse if(c[i].getValue()/c[j].getValue()*c[k].getValue()+c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"/\"+c[j].getValue()+\"*\"+c[k].getValue()+\"+\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()/c[j].getValue()*c[k].getValue()-c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"/\"+c[j].getValue()+\"*\"+c[k].getValue()+\"-\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()/c[j].getValue()*c[k].getValue()/c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"/\"+c[j].getValue()+\"*\"+c[k].getValue()+\"/\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()/c[j].getValue()*c[k].getValue()*c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"/\"+c[j].getValue()+\"*\"+c[k].getValue()+\"*\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\t////////////////\n\t\t////////////////\n\t\t// *+(+-/*)\n\t\telse if(c[i].getValue()*c[j].getValue()+c[k].getValue()+c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"*\"+c[j].getValue()+\"+\"+c[k].getValue()+\"+\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()*c[j].getValue()+c[k].getValue()-c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"*\"+c[j].getValue()+\"+\"+c[k].getValue()+\"-\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()*c[j].getValue()+c[k].getValue()/c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"*\"+c[j].getValue()+\"+\"+c[k].getValue()+\"/\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()*c[j].getValue()+c[k].getValue()*c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"*\"+c[j].getValue()+\"+\"+c[k].getValue()+\"*\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\t// *-(+-/*)\n\t\telse if(c[i].getValue()*c[j].getValue()-c[k].getValue()+c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"*\"+c[j].getValue()+\"-\"+c[k].getValue()+\"+\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()*c[j].getValue()-c[k].getValue()-c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"*\"+c[j].getValue()+\"-\"+c[k].getValue()+\"-\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()*c[j].getValue()-c[k].getValue()/c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"*\"+c[j].getValue()+\"-\"+c[k].getValue()+\"/\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()*c[j].getValue()-c[k].getValue()*c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"*\"+c[j].getValue()+\"-\"+c[k].getValue()+\"*\"+c[l].getValue();\t\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\t// /*(+-/*)\n\t\telse if(c[i].getValue()*c[j].getValue()/c[k].getValue()+c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"*\"+c[j].getValue()+\"/\"+c[k].getValue()+\"+\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()*c[j].getValue()/c[k].getValue()-c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"*\"+c[j].getValue()+\"/\"+c[k].getValue()+\"-\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()*c[j].getValue()/c[k].getValue()/c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"*\"+c[j].getValue()+\"/\"+c[k].getValue()+\"/\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()*c[j].getValue()/c[k].getValue()*c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"*\"+c[j].getValue()+\"/\"+c[k].getValue()+\"*\"+c[l].getValue();\t\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\t// **(+-/*)\n\t\telse if(c[i].getValue()*c[j].getValue()*c[k].getValue()+c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"*\"+c[j].getValue()+\"*\"+c[k].getValue()+\"+\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()*c[j].getValue()*c[k].getValue()-c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"*\"+c[j].getValue()+\"*\"+c[k].getValue()+\"-\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()*c[j].getValue()*c[k].getValue()/c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"*\"+c[j].getValue()+\"*\"+c[k].getValue()+\"/\"+c[l].getValue();\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\telse if(c[i].getValue()*c[j].getValue()*c[k].getValue()*c[l].getValue()==24) {\n\t\t\tsolutionEquation=\"\"+c[i].getValue()+\"*\"+c[j].getValue()+\"*\"+c[k].getValue()+\"*\"+c[l].getValue();\t\t\n\t\t\tsolutions[ansCount]=solutionEquation;\n\t\t\tansCount++;\n\t\t}\n\t\t\n\t\ti++;\n\t\tj++;\n\t\tk++;\n\t\tl++;\n\t\tif (i==4) \n\t\t\ti=0;\n\t\tif (j==4) \n\t\t\tj=0;\n\t\tif (k==4) \n\t\t\tk=0;\n\t\tif (l==4) \n\t\t\tl=0;\n\t\tSystem.out.println(\"i=\"+i);\n\t\tSystem.out.println(\"j=\"+j);\n\t\tSystem.out.println(\"k=\"+k);\t\t\n\t\tSystem.out.println(\"l=\"+l);\n\t\tSystem.out.println(\"Count: \"+count);\n\t\tSystem.out.println(\"Solution: \"+solutionEquation);\n\t\t}\n\t\t\n\t\tif (solutionEquation.equals(\"\"))\n\t\t\tsolutionEquation=\"There is no solution for this set\";\n\t\tSystem.out.println(\"Amount of Solutions: \"+ansCount);\n\t\t//for verify store all solutions into an array then check against the solution they enter\n\t\treturn solutionEquation;\n\t}", "public String cipher() {\n int[] r1taps = {13, 16, 17, 18};\n int[] r2taps = {20, 21};\n int[] r3taps = {7, 20, 21, 22};\n\n // Set register size and majority bits\n final int R1 = 19;\n final int R1M = 8;\n final int R2 = 22;\n final int R2M = 10;\n final int R3 = 23;\n final int R3M = 10;\n\n // Initialize variables\n String bs = \"\";\n byte[] key = HexStringToBytes(symKey);\n BitSet keySet = new BitSet();\n BitSet keyStream = new BitSet();\n BitSet messageSet = new BitSet();\n\n // Create a byte array length of sample message\n byte[] messageArray = new byte[message.length()];\n\n // Convert the sample message to a byte array\n try {\n messageArray = message.getBytes(\"ISO-8859-1\");\n } catch (Exception e) {\n System.out.println(\"Error: \" + e);\n }\n\n // Convert message sample byte array to string\n String as = \"\";\n for (int i = 0; i < messageArray.length; i++) {\n byte b1 = messageArray[i];\n String s = String.format(\"%8s\", Integer.toBinaryString(b1 & 0xFF))\n .replace(' ', '0');\n as += s;\n }\n\n // Convert string of bits to a BitSet\n messageSet = BitStringToBitSet(as);\n\n // Creates string from key byte array\n for (int i = 0; i < 8; i++) {\n byte b1 = key[i];\n String s = String.format(\"%8s\", Integer.toBinaryString(b1 & 0xFF))\n .replace(' ', '0');\n bs += s;\n }\n\n // Convert string of bits to a BitSet\n keySet = BitStringToBitSet(bs);\n\n // Initialize registers\n BitSet r1 = new BitSet();\n BitSet r2 = new BitSet();\n BitSet r3 = new BitSet();\n\n // Process key into registers\n for (int i = 0; i < 64; i++) {\n r1 = ShiftSet(r1, R1, keySet.get(i) ^ Tap(r1, r1taps));\n r2 = ShiftSet(r2, R2, keySet.get(i) ^ Tap(r2, r2taps));\n r3 = ShiftSet(r3, R3, keySet.get(i) ^ Tap(r3, r3taps));\n }\n\n // Clock additional 100 times for additional security (GSM standard)\n for (int i = 0; i < 100; i++) {\n int maj = 0;\n boolean[] ar = {false, false, false};\n if (r1.get(R1M) == true) {\n ar[0] = true;\n maj += 1;\n }\n if (r2.get(R2M) == true) {\n ar[1] = true;\n maj += 1;\n }\n if (r3.get(R3M) == true) {\n ar[2] = true;\n maj += 1;\n }\n // If majority is false (0 bit)\n if (maj <= 1) {\n if (ar[0] == false) {\n r1 = ShiftSet(r1, R1, Tap(r1, r1taps));\n }\n if (ar[1] == false) {\n r2 = ShiftSet(r2, R2, Tap(r2, r2taps));\n }\n if (ar[2] == false) {\n r3 = ShiftSet(r3, R3, Tap(r3, r3taps));\n }\n // Else majority is true\n } else {\n if (ar[0] == true) {\n r1 = ShiftSet(r1, R1, Tap(r1, r1taps));\n }\n if (ar[1] == true) {\n r2 = ShiftSet(r2, R2, Tap(r2, r2taps));\n }\n if (ar[2] == true) {\n r3 = ShiftSet(r3, R3, Tap(r3, r3taps));\n }\n }\n }\n\n // Create keystream as long as the sample message\n for (int i = 0; i < message.length() * 8; i++) {\n\n // Get keystream bit\n keyStream.set(i, r1.get(R1 - 1) ^ r2.get(R2 - 1) ^ r3.get(R3 - 1));\n\n // Shift majority registers\n int maj = 0;\n boolean[] ar = {false, false, false};\n if (r1.get(R1M) == true) {\n ar[0] = true;\n maj += 1;\n }\n if (r2.get(R2M) == true) {\n ar[1] = true;\n maj += 1;\n }\n if (r3.get(R3M) == true) {\n ar[2] = true;\n maj += 1;\n }\n // If majority is false (0 bit)\n if (maj <= 1) {\n if (ar[0] == false) {\n r1 = ShiftSet(r1, R1, Tap(r1, r1taps));\n }\n if (ar[1] == false) {\n r2 = ShiftSet(r2, R2, Tap(r2, r2taps));\n }\n if (ar[2] == false) {\n r3 = ShiftSet(r3, R3, Tap(r3, r3taps));\n }\n // Else majority is true\n } else {\n if (ar[0] == true) {\n r1 = ShiftSet(r1, R1, Tap(r1, r1taps));\n }\n if (ar[1] == true) {\n r2 = ShiftSet(r2, R2, Tap(r2, r2taps));\n }\n if (ar[2] == true) {\n r3 = ShiftSet(r3, R3, Tap(r3, r3taps));\n }\n }\n\n }\n\n // XOR the message with the created keystream and return as string\n messageSet.xor(keyStream);\n return BitStringToText(ReturnSet(messageSet, message.length() * 8));\n }", "public static void main(String[] args) {\n\t\tint M = Integer.parseInt(args[0]);\n\t\tint P = Integer.parseInt(args[1]);\n\t\tint S = Integer.parseInt(args[2]);\n\t\tint J = Integer.parseInt(args[3]);\n\t\tint N = Integer.parseInt(args[4]);\n\t\tString algorithm = args[5];\n\t\t\n\t\t//this is to match the output\n\t\tSystem.out.println(\"The machine size is \"+M);\n\t\tSystem.out.println(\"The page size is \"+P);\n\t\tSystem.out.println(\"The process size is \"+S);\n\t\tSystem.out.println(\"The job mix number is \"+J);\n\t\tSystem.out.println(\"The number of references per process is \"+N);\n\t\tSystem.out.println(\"The replacement algorithm is \"+algorithm+\"\\n\\n\");\n\t\t\n\t\t\n\t\t//attempt to read in the RandomInts.txt file\n\t\tScanner intScanner = null; \n\t\ttry {\n\t\t\tintScanner = new Scanner(new File(\"random-ints.txt\"));\n\t\t\t\n\t\t\t\n\t\t} catch (Exception e) {\n\t\t\tSystem.err.printf(\"Error: there was a problem reading the random file\");\n\t\t\tSystem.exit(0);\n\t\t}\n\t\t\n\t\tint quantum = 3;\n\t\t\n\t\tProcess currentProcess;\n\t\tArrayList<Process> processList = new ArrayList<Process>();\n\t\t\n\t\t//check now to see the job mix\n\t\tif(J == 1){\t\n\t\t\t//int processNumber, double a, double b, double c, int size, int numberOfReferences, int numberOfPages,Scanner randInt, String replacementAlgo\n\t\t\tcurrentProcess = new Process(1,1,0,0,S,N,S/P,intScanner,algorithm);\n\t\t\tprocessList.add(currentProcess);\n\t\t}\n\t\telse if(J ==2) {\n\t\t\t\n\t\t\tfor (int i = 0; i < 4; i++) {\n\t\t\t\tcurrentProcess = new Process(i+1,1,0,0,S,N,S/P,intScanner,algorithm);\n\t\t\t\tprocessList.add(currentProcess);\n\t\t\t}\n\t\t}\n\t\t\t\n\t\telse if (J == 3){\n\t\t\tfor (int i = 0; i < 4; i++) {\n\t\t\t\tcurrentProcess = new Process(i+1,0,0,0,S,N,S/P,intScanner,algorithm);\n\t\t\t\tprocessList.add(currentProcess);\n\t\t\t}\n\t\t}\n\t\t\t\n\t\telse {\n\t\t\t//1,2,3,4\n\t\t\tcurrentProcess = new Process(1,0.75,0.25,0,S,N,S/P,intScanner,algorithm);\n\t\t\tprocessList.add(currentProcess);\n\t\t\tcurrentProcess = new Process(2,0.75,0,0.25,S,N,S/P,intScanner,algorithm);\n\t\t\tprocessList.add(currentProcess);\n\t\t\tcurrentProcess = new Process(3,0.75,0.125,0.125,S,N,S/P,intScanner,algorithm);\n\t\t\tprocessList.add(currentProcess);\n\t\t\tcurrentProcess = new Process(4,0.5,0.125,0.125,S,N,S/P,intScanner,algorithm);\n\t\t\tprocessList.add(currentProcess);\n\t\t\t\n\t\t}\n\t\t\n\t\t//get the size of the frame table depending upon machine size and page size\n\t\t//remember we are also going to use the highest most frame as the first one\n\t\tint sizeOfFrame = M/P -1;\n\t\t\n\t\t\n\t\t//these are going to simply help us determine which frame is to be evicted if neccesary\n //linked list for LRU replacement algorithm\n LinkedList<Integer> LRUList = new LinkedList<Integer>();\n\n // we do not need a data structure for LIFO either because we will always replace the last frame\n \n //we do not need to use one for random since we do not need to keep track of which page we are getting rid of\n \n\t\t//this is going to hold the current process,page pair in each index so it will look like <1,{Process,page}>\n //having the Integer array will help us replace and update the frame easier then just maintaining if there's something in the map\n\t\tHashMap<Integer, Integer[]> frame = new HashMap<Integer, Integer[]>(); \n\t\t\n\t\tint time = 1;\n\t\t\n\t\tfor(int i=0; i < processList.size() * N; i++) {\n\t\t\t//get the current process\n\t\t\tProcess runningProcess = processList.get(i%processList.size());\n\t\t\t\n\t\t\tif(runningProcess.numberOfReferences <= 0) {\n\t\t\t\t//then the process is done running\n\t\t\t\ttime++;\n\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t}\n\t\t\t// this is simply to simulate the round robin simulation\n\t\t\tfor(int j=0; j < quantum; j++) {\n\t\t\t\t\n\t\t\t\tif(runningProcess.numberOfReferences <= 0) {\n\t\t\t\t\t//then the process is done running\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tint currentRef = runningProcess.currentReference;\n\t\t\t\t\n\t\t\t\t//now get the page index then check if it is MAX_VALUE or within the frame\n\t\t\t\tint pageIndex = currentRef/P;\n\t\t\t\tint processFrameIndex = runningProcess.pages[pageIndex];\n\t\t\t\t\n\n\t\t\t\t//we know we had a miss because the page table is not in the frame\n\t\t\t\tif(processFrameIndex == Integer.MAX_VALUE) {\n\t\t\t\t\t\n\t\t\t\t\trunningProcess.pageFaults++;\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t//now we determine where to place the pageTable in the frame\n\t\t\t\t\t//we know that if it is less than zero then there is no room on the frame table since we start from highest index\n\t\t\t\t\tif(sizeOfFrame < 0) {\n\t\t\t\t\t\t//then we must use some sort of replacement algorithm\n\t\t\t\t\t\tif(runningProcess.replacementAlgo.equalsIgnoreCase(\"LIFO\")) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//pop the last frame and get the necessary information\n\t\t\t\t\t\t\tInteger[] removeProcessPagePair = frame.remove(0);\n\t\t\t\t\t\t\tint removeIndex = removeProcessPagePair[0];\n\t\t\t\t\t\t\tint nullifyPageIndex = removeProcessPagePair[1];\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//get the actual process from the process list and update its values\n\t\t\t\t\t\t\tProcess updateProcess = processList.get(removeIndex);\n\t\t\t\t\t\t\tupdateProcess.pages[nullifyPageIndex] = Integer.MAX_VALUE;\n\t\t\t\t\t\t\tupdateProcess.numberOfEvictions++;\n\t\t\t\t\t\t\tupdateProcess.residencyTime += time - updateProcess.pageLoadTime[nullifyPageIndex];\n\t\t\t\t\t\t\tupdateProcess.pageLoadTime[nullifyPageIndex] = 0;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tsizeOfFrame++;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//update the pages array\n\t\t\t\t\t\t\trunningProcess.pages[pageIndex] = sizeOfFrame;\n\t\t\t\t\t\t\trunningProcess.pageLoadTime[pageIndex] = time;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//we will need to know which process to update and remember that to get processNum 1 \n\t\t\t\t\t\t\t//in the array list that is at index 0. Then to update its pageTable we will also need its pageIndex\n\t\t\t\t\t\t\tInteger[] processPagePair = {runningProcess.processNumber-1,pageIndex};\n\t\t\t\t\t\t\tframe.put(sizeOfFrame, processPagePair);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tsizeOfFrame--;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if(runningProcess.replacementAlgo.equalsIgnoreCase(\"LRU\")) {\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//remove the top of the LRULinked List and get the index of the frame\n\t\t\t\t\t\t\tint indexRemoveFrame = LRUList.remove();\n\n\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\t//pop the index of the frame and get the necessary information\n\t\t\t\t\t\t\tInteger[] removeProcessPagePair = frame.remove(indexRemoveFrame);\n\t\t\t\t\t\t\tint removeIndex = removeProcessPagePair[0];\n\t\t\t\t\t\t\tint nullifyPageIndex = removeProcessPagePair[1];\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//get the actual process from the process list and update its values\n\t\t\t\t\t\t\tProcess updateProcess = processList.get(removeIndex);\n\t\t\t\t\t\t\tupdateProcess.pages[nullifyPageIndex] = Integer.MAX_VALUE;\n\t\t\t\t\t\t\tupdateProcess.numberOfEvictions++;\n\t\t\t\t\t\t\tupdateProcess.residencyTime += time - updateProcess.pageLoadTime[nullifyPageIndex];\n\t\t\t\t\t\t\tupdateProcess.pageLoadTime[nullifyPageIndex] = 0;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//now add to the back of the linked list the most newly updated indexFrame\n\t\t\t\t\t\t\tLRUList.add(indexRemoveFrame);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//update the running process\n\t\t\t\t\t\t\trunningProcess.pages[pageIndex] = indexRemoveFrame;\n\t\t\t\t\t\t\trunningProcess.pageLoadTime[pageIndex] = time;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//we will need to know which process to update and remember that to get processNum 1 \n\t\t\t\t\t\t\t//in the array list that is at index 0. Then to update its pageTable we will also need its pageIndex\n\t\t\t\t\t\t\tInteger[] processPagePair = {runningProcess.processNumber-1,pageIndex};\n\t\t\t\t\t\t\tframe.put(indexRemoveFrame, processPagePair);\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\t//this indicates it is random replacement algorithm\n\t\t\t\t\t\telse if(runningProcess.replacementAlgo.equalsIgnoreCase(\"RANDOM\")) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//get the random int and then find out which random frame you are taking out\n\t\t\t\t\t\t\tint randomInt = intScanner.nextInt();\n\t\t\t\t\t\t\t//since it is probably some big number we have to accommodate it for our frame size\n\t\t\t\t\t\t\tint randomIntIndex = (randomInt + M/P)%(M/P);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//and pretty much do the same as the above but with the randomIntIndex\n\t\t\t\t\t\t\t//pop the index of the frame and get the necessary information\n\t\t\t\t\t\t\tInteger[] removeProcessPagePair = frame.remove(randomIntIndex);\n\t\t\t\t\t\t\tint removeIndex = removeProcessPagePair[0];\n\t\t\t\t\t\t\tint nullifyPageIndex = removeProcessPagePair[1];\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//get the actual process from the process list and update its values\n\t\t\t\t\t\t\tProcess updateProcess = processList.get(removeIndex);\n\t\t\t\t\t\t\tupdateProcess.pages[nullifyPageIndex] = Integer.MAX_VALUE;\n\t\t\t\t\t\t\tupdateProcess.numberOfEvictions++;\n\t\t\t\t\t\t\tupdateProcess.residencyTime += time - updateProcess.pageLoadTime[nullifyPageIndex];\n\t\t\t\t\t\t\tupdateProcess.pageLoadTime[nullifyPageIndex] = 0;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t/////DO IF CYCLE IS IN 38 DEBUGG IN HERE/////\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//update the running process\n\t\t\t\t\t\t\trunningProcess.pages[pageIndex] = randomIntIndex;\n\t\t\t\t\t\t\trunningProcess.pageLoadTime[pageIndex] = time;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//we will need to know which process to update and remember that to get processNum 1 \n\t\t\t\t\t\t\t//in the array list that is at index 0. Then to update its pageTable we will also need its pageIndex\n\t\t\t\t\t\t\tInteger[] processPagePair = {runningProcess.processNumber-1,pageIndex};\n\t\t\t\t\t\t\tframe.put(randomIntIndex, processPagePair);\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\t\n\t\t\t\t\t}\n\t\t\t\t\t//otherwise we will now place the pageTable into the frame\n\t\t\t\t\telse {\n\t\t\t\t\t\t\n\t\t\t\t\t\t//update the pages array\n\t\t\t\t\t\trunningProcess.pages[pageIndex] = sizeOfFrame;\n\t\t\t\t\t\trunningProcess.pageLoadTime[pageIndex] = time;\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\t//we will need to know which process to update and remember that to get processNum 1 \n\t\t\t\t\t\t//in the array list that is at index 0. Then to update its pageTable we will also need its pageIndex\n\t\t\t\t\t\tInteger[] processPagePair = {runningProcess.processNumber-1,pageIndex};\n\t\t\t\t\t\tframe.put(sizeOfFrame, processPagePair);\n\t\t\t\t\t\t\n\t\t\t\t\t\t//update the LRU if the process is using the algorithm\n\t\t\t\t\t\tif(runningProcess.replacementAlgo.equalsIgnoreCase(\"LRU\")) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//sizeOfFrame is also essentially the index of the frame\n\t\t\t\t\t\t\tLRUList.add(sizeOfFrame);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t//now there is one less frame available\n\t\t\t\t\t\tsizeOfFrame--;\n\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t//there was a page hit\n\t\t\t\telse {\n\n\t\t\t\t\t//update the most recently used page for LRU\n\t\t\t\t\tif(runningProcess.replacementAlgo.equalsIgnoreCase(\"LRU\")) {\n\t\t\t\t\t\t\n\t\t\t\t\t\t //to get it back to 0 in case we are on the last frame\n\t\t\t\t\t\t\n\t\t\t\t\t\tint removeIndex = LRUList.indexOf(processFrameIndex);\n\n\t\t\t\t\t\t//put to the end of the list\n\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\tint updatePage = LRUList.remove(removeIndex);\n\t\t\t\t\t\tLRUList.add(updatePage);\n\t\t\t\t\t\t //to indicate we have no more frames incase the next reference needs a new one\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\t//remember this also decrements the amount of references that the process has left \n\t\t\t\trunningProcess.getNextReference();\n\t\t\t\ttime++;\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t}\n\t\tint totalFaults = 0;\n\t\tint totalEvictions = 0;\n\t\tdouble totalResidency = 0;\n\t\t\n\t\tfor(int i=0; i<processList.size();i++) {\n\t\t\t\n\t\t\tif(processList.get(i).numberOfEvictions != 0) {\n\t\t\t\ttotalFaults += processList.get(i).pageFaults;\n\t\t\t\ttotalResidency += processList.get(i).residencyTime;\n\t\t\t\ttotalEvictions += processList.get(i).numberOfEvictions;\n\t\t\t\tSystem.out.printf(\"Process Number: %d had %d faults and an average residency of %f\",processList.get(i).processNumber,processList.get(i).pageFaults,processList.get(i).residencyTime/processList.get(i).numberOfEvictions);\n\t\t\t}\n\t\t\telse {\n\t\t\t\ttotalFaults += processList.get(i).pageFaults;\n\t\t\t\tSystem.out.printf(\"Process Number: %d had %d faults and with no evictions an average residency of undefined\",processList.get(i).processNumber,processList.get(i).pageFaults);\n\t\t\t}\n\t\t\tSystem.out.println(\"\");\n\t\t}\n\t\tSystem.out.println(\"\\n\");\n\t\t\n\t\t\n\t\tif(totalEvictions != 0) {\n\t\t\tdouble avgTotalResidency = totalResidency/totalEvictions;\n\t\t\tSystem.out.printf(\"The total number of faults is %d and the overall average residency is %f\", totalFaults,avgTotalResidency);\n\t\t}\n\t\telse {\n\t\t\tSystem.out.printf(\"The total number of faults is %d and the overall average residency is undefined\", totalFaults);\n\t\t}\n\t\tSystem.out.println(\"\");\n\t\t\n\n\t}", "private void CPUWork()\n\t\t\t{\n\t\t\t\tif (completionflag == false && bugflag == false)\n\t\t\t\t\t{\n\t\t\t\t\t\tif (m != 10)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tswitch (m)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcase 0:\n\t\t\t\t\t\t\t\t\t\tfor (k = 0; k <= 8; k += 4)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif (cpuflag[k] == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&& flag[k] == false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpuchoice = k;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\t\t\t\tfor (k = 0; k <= 2; k += 1)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif (cpuflag[k] == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&& flag[k] == false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpuchoice = k;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\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 2:\n\t\t\t\t\t\t\t\t\t\tfor (k = 3; k <= 5; k += 1)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif (cpuflag[k] == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&& flag[k] == false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpuchoice = k;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\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\tfor (k = 6; k <= 8; k += 1)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif (cpuflag[k] == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&& flag[k] == false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpuchoice = k;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\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 4:\n\t\t\t\t\t\t\t\t\t\tfor (k = 0; k <= 6; k += 3)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif (cpuflag[k] == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&& flag[k] == false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpuchoice = k;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\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 5:\n\t\t\t\t\t\t\t\t\t\tfor (k = 1; k <= 7; k += 3)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif (cpuflag[k] == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&& flag[k] == false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpuchoice = k;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\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 6:\n\t\t\t\t\t\t\t\t\t\tfor (k = 2; k <= 8; k += 3)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif (cpuflag[k] == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&& flag[k] == false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpuchoice = k;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\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 7:\n\t\t\t\t\t\t\t\t\t\tfor (k = 2; k <= 6; k += 2)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif (cpuflag[k] == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&& flag[k] == false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpuchoice = k;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else if (j != 10)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tswitch (j)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcase 0:\n\t\t\t\t\t\t\t\t\t\tfor (k = 0; k <= 8; k += 4)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif (cpuflag[k] == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&& flag[k] == false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpuchoice = k;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\t\t\t\tfor (k = 0; k <= 2; k += 1)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif (cpuflag[k] == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&& flag[k] == false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpuchoice = k;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\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 2:\n\t\t\t\t\t\t\t\t\t\tfor (k = 3; k <= 5; k += 1)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif (cpuflag[k] == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&& flag[k] == false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpuchoice = k;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\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\tfor (k = 6; k <= 8; k += 1)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif (cpuflag[k] == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&& flag[k] == false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpuchoice = k;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\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 4:\n\t\t\t\t\t\t\t\t\t\tfor (k = 0; k <= 6; k += 3)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif (cpuflag[k] == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&& flag[k] == false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpuchoice = k;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\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 5:\n\t\t\t\t\t\t\t\t\t\tfor (k = 1; k <= 7; k += 3)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif (cpuflag[k] == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&& flag[k] == false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpuchoice = k;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\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 6:\n\t\t\t\t\t\t\t\t\t\tfor (k = 2; k <= 8; k += 3)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif (cpuflag[k] == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&& flag[k] == false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpuchoice = k;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\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 7:\n\t\t\t\t\t\t\t\t\t\tfor (k = 2; k <= 6; k += 2)\n\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\tif (cpuflag[k] == false\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t&& flag[k] == false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tcpuchoice = k;\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tbreak;\n\n\t\t\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\twhile (true)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tcpuchoice = random.nextInt(8);\n\n\t\t\t\t\t\t\t\t\t\tif (cpuflag[cpuchoice] == false\n\t\t\t\t\t\t\t\t\t\t\t\t&& flag[cpuchoice] == false)\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\tcpuflag[cpuchoice] = true;\n\t\t\t\t\t\tswitch (cpuchoice)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcase 0:\n\t\t\t\t\t\t\t\t++lose[1];\n\t\t\t\t\t\t\t\t++lose[4];\n\t\t\t\t\t\t\t\t++lose[0];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 1:\n\t\t\t\t\t\t\t\t++lose[5];\n\t\t\t\t\t\t\t\t++lose[1];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 2:\n\t\t\t\t\t\t\t\t++lose[1];\n\t\t\t\t\t\t\t\t++lose[6];\n\t\t\t\t\t\t\t\t++lose[7];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 3:\n\t\t\t\t\t\t\t\t++lose[2];\n\t\t\t\t\t\t\t\t++lose[4];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 4:\n\t\t\t\t\t\t\t\t++lose[2];\n\t\t\t\t\t\t\t\t++lose[5];\n\t\t\t\t\t\t\t\t++lose[0];\n\t\t\t\t\t\t\t\t++lose[7];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 5:\n\t\t\t\t\t\t\t\t++lose[2];\n\t\t\t\t\t\t\t\t++lose[6];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 6:\n\t\t\t\t\t\t\t\t++lose[3];\n\t\t\t\t\t\t\t\t++lose[4];\n\t\t\t\t\t\t\t\t++lose[7];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 7:\n\t\t\t\t\t\t\t\t++lose[3];\n\t\t\t\t\t\t\t\t++lose[5];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 8:\n\t\t\t\t\t\t\t\t++lose[3];\n\t\t\t\t\t\t\t\t++lose[6];\n\t\t\t\t\t\t\t\t++lose[0];\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\tfor (j = 0; j < 8; ++j)\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tif (lose[j] == 3)\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tresult=j;\n\t\t\t\t\t\t\t\t\t\tIntent it2 = new Intent(Main.this,\n\t\t\t\t\t\t\t\t\t\t\t\tResult.class);\n\t\t\t\t\t\t\t\t\t\tBundle b1 = new Bundle();\n\t\t\t\t\t\t\t\t\t\tb1.putString(\"result\", name\n\t\t\t\t\t\t\t\t\t\t\t\t+ \" is a LOSER!!\");\n\t\t\t\t\t\t\t\t\t\tit2.putExtras(b1);\n\t\t\t\t\t\t\t\t\t\tfinish();\n\t\t\t\t\t\t\t\t\t\tstartActivity(it2);\n\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\n\t\t\t}", "public static void main(String[] args) throws Exception {\n\t\tString filePath = \"/Users/Alen/Documents/CodeJam/2013/Qualification/C-Large-1.in\";\n\n\t\tBufferedReader br = new BufferedReader(new FileReader(filePath));\n\t\tString outFile = filePath.substring(0, filePath.lastIndexOf('.'))\n\t\t\t\t+ \".out\";\n\t\tBufferedWriter bw = new BufferedWriter(new FileWriter(outFile));\n\t\t\n\t\tfinal int MAX_POWER = 16;\n\t\t\n\t\tint[] palindrome = new int[MAX_POWER / 2];\n\t\tInteger[] palindromeSquarePalindrome = new Integer[MAX_POWER];\n\t\tList<Integer[]> pspList = new ArrayList<Integer[]>();\n\t\t\n\t\tfor (int i = 1; i <= palindrome.length; i++) {\n\t\t\tfor (int i2 = 0; i2 < palindrome.length; i2++) {\n\t\t\t\tpalindrome[i2] = 0;\n\t\t\t}\n\t\t\tfor (int i3 = 0; i3 < palindromeSquarePalindrome.length; i3++) {\n\t\t\t\tpalindromeSquarePalindrome[i3] = 0;\n\t\t\t}\n\t\t\tpalindromeSquarePalindrome[palindromeSquarePalindrome.length - 1] = 2 * i - 1;\n\t\t\t\n\t\t\tint j = 0;\n\t\t\twhile (j >= 0 && j <= i / 2) {\n\t\t\t\tif (palindrome[j] == 0) {\n\t\t\t\t\tif (j == 0 || j >= (i - 1) / 2 ) palindrome[j] = palindrome[i - j - 1] = 1;\n\t\t\t\t\telse {\n\t\t\t\t\t\tj++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tboolean isPalindrome = true;\nk:\t\t\t\tfor (int k = 0; k < i; k++) {\n\t\t\t\t\tint palindromeSquare = 0;\n\t\t\t\t\tfor (int l = 0; l <= k; l++) {\n\t\t\t\t\t\tpalindromeSquare += palindrome[l] * palindrome[k - l];\n\t\t\t\t\t\tif (palindromeSquare > 9) {\n\t\t\t\t\t\t\tisPalindrome = false;\n\t\t\t\t\t\t\tbreak k;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tpalindromeSquarePalindrome[k] = palindromeSquare;\n\t\t\t\t\tpalindromeSquarePalindrome[2 * i - 2 - k] = palindromeSquare;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tif (isPalindrome) {\n\t\t\t\t\tpspList.add(palindromeSquarePalindrome.clone());\n\t\t\t\t\tif (j < (i - 1) / 2 || palindrome[j] == 9) {\n\t\t\t\t\t\tj++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tpalindrome[j] = 0;\n\t\t\t\t\tpalindrome[i - j - 1] = 0;\n\t\t\t\t\tj--;\n\t\t\t\t}\n\t\t\t\tif (j >= 0) {\n\t\t\t\t\tint newValue = palindrome[j] + 1;\n\t\t\t\t\t//newValue %= 10;\n\t\t\t\t\tif (j == 0 && newValue == 0) {\n\t\t\t\t\t\tnewValue = 1;\n\t\t\t\t\t}\n\t\t\t\t\tpalindrome[j] = newValue;\n\t\t\t\t\tpalindrome[i - j - 1] = newValue;\n\t\t\t\t}\n\n\t\t\t}\n\t\t}\n\t\t\n\t\tString line = br.readLine();\n\t\tint t = Integer.valueOf(line);\n\t\tfor (int i = 0; i < t; i++) {\n\t\t\t// TODO main logical\n\t\t\t// ...\n\t\t\tline = br.readLine();\n\t\t\tString[] strs = line.split(\" \");\n\t\t\tInteger[] a = new Integer[MAX_POWER];\n\t\t\tInteger[] b = new Integer[MAX_POWER];\n\t\t\ta[a.length - 1] = strs[0].length();\n\t\t\tfor (int k = 0; k < strs[0].length(); k++) {\n\t\t\t\ta[k] = strs[0].charAt(k) - 0x30;\n\t\t\t}\n\t\t\tb[b.length - 1] = strs[1].length();\n\t\t\tfor (int k = 0; k < strs[1].length(); k++) {\n\t\t\t\tb[k] = strs[1].charAt(k) - 0x30;\n\t\t\t}\n\t\t\t\n\t\t\tint start = 0;\n\t\t\tfor (int k = 0; k < pspList.size(); k++) {\n\t\t\t\tif (compare(a, pspList.get(k)) <= 0) {\n\t\t\t\t\tstart = k;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tint end = pspList.size();\n\t\t\tfor (int k = start; k < pspList.size(); k++) {\n\t\t\t\tif (compare(b, pspList.get(k)) < 0) {\n\t\t\t\t\tend = k;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// TODO output\n\t\t\tbw.write(String.format(\"Case #%d: %d\\r\\n\", i + 1, end - start));\n\t\t}\n\n\t\tbw.flush();\n\t\tbw.close();\n\t\tbr.close();\n\n\t}", "void solve() {\n num = new ArrayList<>();\n num.add(BigInteger.valueOf(4));\n for (int len = 2; len <= 100; len++)\n generate(\"4\", 1, len, false);\n Collections.sort(num);\n for (int tc = ii(); tc > 0; tc--) {\n long x = il();\n BigInteger X = BigInteger.valueOf(x);\n for (int i = 0; i < num.size(); i++) {\n if (num.get(i).mod(X).equals(BigInteger.ZERO)) {\n String z = num.get(i).toString();\n int end = z.lastIndexOf('4');\n int len = z.length();\n int a = 2 * (end+1);\n int b = len - end;\n out.println(a + b);\n break;\n }\n }\n }\n }", "@Override\n\tpublic void challenge8() {\n\n\t}", "public static void main(String[] args) {\n\t\tScanner scan = new Scanner(System.in);\n\t\tint people = scan.nextInt();\n\t\t\n\t\tlong[] memo = new long[people+1];\n\t\tlong ret = Handshake_memo(people, memo);\n\t\tSystem.out.println(\"Handshake_memo \" + ret + \" cnt \" + cnt);\n\t\tcnt = 0;\n\t\t\n\t\tHashMap<Integer, Long> mem = new HashMap<Integer, Long>();\n\t\tlong result = Handshake(people, mem);\n\t\tSystem.out.println(\"Handshake_hashmap \" + result + \" cnt \" + cnt);\n\t\tcnt = 0;\n\t\t\n\t\t\n\t\t/*\n\t\t\n\t\tbefore = System.currentTimeMillis();\n\t\tlong result = Handshake(people, mem);\n\t\tafter = System.currentTimeMillis();\n\t\tSystem.out.println(result + \" time \" + (after-before) + \" cnt \" + cnt);\n\t\t\n\t\t\n\t\tcnt = 0;\n\t\tSystem.out.println(\"_____________________________\");\n\t\tbefore = System.currentTimeMillis();\n\t\tlong result1 = Handshaking(people);\n\t\tafter = System.currentTimeMillis();\n\t\tSystem.out.println(result1 + \" time \" + (after-before) + \" cnt \" + cnt);*/\n\t\t\n\t\tlong result1 = Handshaking(people);\n\t\tSystem.out.println(\"Handshake normal \"+ result1 + \" cnt \" + cnt);\n\t\t\n\t\tcnt = 0;\n\t\tlong result2 = handShaking_DP(people);\n\t\tSystem.out.println(\"DP \"+ result2 + \" cnt \" + cnt);\n\t\t\n\t\t\n\t\tscan.close();\n\t}", "public static void dificil(char[][] vectM, String jogador, String maquina, boolean isJogadorComeca) {\n Scanner in = new Scanner(System.in);\n SecureRandom rand = new SecureRandom();\n int acabou = 0;\n int som = 0;\n int l, c;\n int lMaquina;\n int cMaquina;\n imprimeMatriz(vectM);\n do {\n if (!isJogadorComeca) { //maquina = 'X' && som % 2 = 0\n System.out.println(maquina + \" é sua vez de jogar!\");\n if (!checarVitoriaMaquinaOuJogador(vectM, som)) {\n do {\n lMaquina = rand.nextInt(3);\n cMaquina = rand.nextInt(3);\n System.out.println(\"sem condição bixo\");\n } while (isPosicaoPreenchida(lMaquina, cMaquina, vectM));\n vectM[lMaquina][cMaquina] = preencheSimbolo(som);\n }\n isJogadorComeca = true;\n } else {\n System.out.println(jogador + \" é sua vez de jogar!\");\n l = preencheLinha(in, vectM);\n c = preencheColuna(in, vectM);\n while (isPosicaoPreenchida(l, c, vectM)) {\n System.out.println(\"Posição já preenchida\");\n imprimeMatriz(vectM);\n l = preencheLinha(in, vectM);\n c = preencheColuna(in, vectM);\n }\n vectM[l][c] = preencheSimbolo(som);\n isJogadorComeca = false;\n }\n imprimeMatriz(vectM);\n acabou = isAcabou(vectM, som);\n if (acabou == 1) {\n quemGanhou(jogador, maquina, som);\n break;\n } else if (acabou == -1) {\n System.out.println(\"O jogo empatou!\");\n break;\n }\n som++;\n } while (acabou == 0);\n\n }", "public static void main(String args[]) {\n System.out.print(\"please enter the value of n: \");\n Scanner in = new Scanner(System.in);\n Long n = in.nextLong();\n // generate a prime number p\n p = GEN_pq(n);\n System.out.println(\"p: \" + p);\n // generate a prime number q\n do {\n q = GEN_pq(n);\n } while(p==q);\n\n System.out.println(\"q: \" + q);\n // compute the value of N\n N = p * q;\n System.out.println(\"N: \" + N);\n // compute the value of phi(N)\n phi_N = (p - 1) * (q - 1);\n System.out.println(\"phi(N) : \" + phi_N);\n // generate the exponential number e (e must be smaller than phi(N)\n // and it must be relative prime with phi(N))\n e = GEN_e(phi_N);\n System.out.println(\"e: \" + e);\n // the trapdoor for RSA: d = (k * phi(N) + 1) / e\n d = GEN_d(phi_N);\n// d = (2 * (phi_N) + 1) / e;\n System.out.println(\"d: \" + d);\n // find and add all possible values into set Zn*\n Z = new ArrayList<Long>();\n for (long i = 1; i < N; i++) {\n if (gcd(i, N) == 1) {\n Z.add(i);\n }\n }\n // randomly select an element from the set Zn*\n Random rand = new Random();\n int index = rand.nextInt(Z.size() - 1);\n x = Z.get(index);\n System.out.println(\"x: \" + x);\n long y = encrypt(x, e, N);\n System.out.println(\"y: \" + y);\n long x_prime = decrpyt(y, d, N);\n System.out.println(\"decrypted x: \" + x_prime);\n if (x_prime == x) System.out.println(\"The RSA algorithm is functioning correctly\");\n }", "public String getComputerChoice() {\n return generateRockPaperScissors(1, 3);\n }", "public static void main(String[] arrr){\n\t\tlong mod = 10000000011L;\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint[] arr = new int[n];\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\tarr[i]=sc.nextInt();\n\t\t}\n\t\tlong total=0;\n\t\tfor (int i = 0; i < arr.length; i++) {\n\t\t\ttotal = (total+((long)Math.pow((countBit(arr[i])),(i+1))%mod))%mod;\n\t\t}\n\t\tSystem.out.println(total);\n\t}", "private static void VergleichsTest()\r\n{\r\n\tSecp256k1 g = new Secp256k1();\r\n\tBigInteger[] NULL= new BigInteger[2];\r\n\tNULL[0] = BigInteger.ZERO;\r\n\tNULL[1] = BigInteger.ZERO; \r\n\tBigInteger[] pubK1 = new BigInteger[2];\r\n\tBigInteger[] pubK2 = new BigInteger[2];\r\n\tlong msec = 0;\r\n\tlong t0 = System.currentTimeMillis(); \r\n\tfor(int i=0; i<testRuns; i++)\r\n\t{\r\n\t\tt0 = System.currentTimeMillis();\r\n\t\tRandom rn = new Random();\r\n\t\tBigInteger priK = new BigInteger(255,rn);\r\n\t\tpubK1 = g.multiply_G(priK);\r\n\t\tString b = pubK1[0].toString(16);\r\n\t\tSystem.out.printf(\"\\nPublic Key: %S\",b);\r\n\t\tpubK2 = getPublicKeyOriginal(priK);\r\n\t\tb = pubK2[0].toString(16);\r\n\t\tSystem.out.printf(\"\\nPublic Key: %S\\n\",b);\t \r\n\t\tif(pubK1[0].equals(pubK2[0])) System.out.println(\"correct!\");\r\n\t\telse {System.out.println(\" >>>>>>>>>>>>>>>>>> Not correct! Schlüssel sind nicht gleich! <<<<<<<<<<<<\"); break;}\t \r\n\t\tSystem.out.printf(\"Zeit: %d ms\\n\", msec);\r\n\t\tmsec = System.currentTimeMillis()-t0;\r\n\t}\r\n}", "public static void main(String[] args) throws IOException{\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint m = sc.nextInt();\n\t\tint[] array = new int[n];\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tarray[i] = sc.nextInt();\n\t\t}\n\t\tint[][] dp = new int[n][n];\n\t\tint[][] c = new int[n][n];\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tint count=0,max=0;\n\t\t\tfor(int j=i;j<n;j++)\n\t\t\t{\n\t\t\t\tif(j==i){\n\t\t\t\t\tdp[i][j]=array[j];\n\t\t\t\t\tcount++;\n\t\t\t\t\tc[i][j]=count;\n\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\telse{\n\t\t\t\t\tif(array[j]==array[j-1]){\n\t\t\t\t\t\tcount++;\n\t\t\t\t\t\tif(max<count) {\n\t\t\t\t\t\t\tmax =count;\n\t\t\t\t\t\t\tdp[i][j]=array[j];\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse{\n\t\t\t\t\t\tdp[i][j]=dp[i][j-1];\n\t\t\t\t\t\t}\n\t\t\t\t\t\tc[i][j]=count;\n\t\t\t\t\t}\n\t\t\t\t\telse\n\t\t\t\t\t{\n\t\t\t\t\t\tcount =1;\n\t\t\t\t\t\tdp[i][j] = dp[i][j-1];\n\t\t\t\t\t\tc[i][j]=count;\n\t\t\t\t\t\t\n\t\t\t\t\t}\t\n\t\t\t\t}\n\t\t\t\t//System.out.print(dp[i][j]+\" \");\n\t\t\t}\n\t\t\t//System.out.println();\n\t\t}\n\t\t\n\t\tfor(int i=0;i<m;i++)\n\t\t{\n\t\t\tint l = sc.nextInt()-1;\n\t\t\tint r = sc.nextInt()-1;\n\t\t\tint k = sc.nextInt();\n\t\t\tif(c[l][r]>k)\n\t\t\t{\n\t\t\t\tSystem.out.println(dp[l][r]);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tSystem.out.println(-1);\n\t\t\t}\n\t\t}\n\t}", "public void generateComputerChoice() {\n\t\tgetRandomNumber();\n\t\tsetComputerChoice();\n\t}", "public String run() {\r\n\t// divisorSum[n] is the sum of all the proper divisors of n\r\n int divisorSum[]= new int[LIMIT+1];\r\n for(int i=1;i<=LIMIT;i++)\r\n {\r\n for(int j=i+i;j<=LIMIT;j+=i)\r\n divisorSum[j]+=i;\r\n }\r\n // Analyze the amicable chain length for each number in ascending order\r\n int maxChainLen=0;\r\n int minChainElem=-1;\r\n for(int i=0;i<=LIMIT;i++){\r\n Set<Integer> visited=new HashSet<>();\r\n for(int count=1,cur=i;;count++){\r\n visited.add(cur);\r\n int next=divisorSum[cur];\r\n if(next==i)\r\n {\r\n if(count>maxChainLen){\r\n minChainElem=i;\r\n maxChainLen=count;\r\n \r\n }\r\n break;\r\n }\r\n // Exceeds limit or not a chain (a rho shape instead)\r\n else if(next>LIMIT || visited.contains(next))\r\n break;\r\n else\r\n cur=next;\r\n }\r\n }\r\n return Integer.toString(minChainElem);\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 }", "Algorithm createAlgorithm();", "private RunGreatestCommonDivisor() {\r\n\t}", "public static void main(String[] args) {\n \tScanner sc = new Scanner(System.in);\n \n\t\tint t=sc.nextInt();\n\t\twhile(t-->0) {\n\t\t\t\n int n=sc.nextInt();\n\t\t\tint k=sc.nextInt();\n\t\t\tcurr_cc=0;\n\t\t\t\n\t\t\tadj=new ArrayList<>();\n\t\t\tfor(int i=0;i<=n;i++){\n adj.add(new ArrayList<Integer>());\n vis[i]=0;\n\t\t\t\tcc[i]=0;\n } \n\t\t\t\n ArrayList<Pair<Integer,Integer>> edgeList=new ArrayList<>();\n\t\t\t\n\t\t\twhile(k-->0) {\n\t\t\t\tint a=sc.nextInt();\n\t\t\t\tString op=sc.next();\n\t\t\t\tint b=sc.nextInt();\n\t\t\t\tif(op.equals(\"=\")) {\n\t\t\t\t\tadj.get(a).add(b);\n\t\t\t\t\tadj.get(b).add(a);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t edgeList.add(new Pair<Integer,Integer>(a,b));\n \n\t\t\t}\n\t\t\t\n\t\t\tfor(int i=1;i<=n;i++) {\n\t\t\t\tif(vis[i]==0) {\n\t\t\t\t\tcurr_cc++;\n\t\t\t\t\tdfs(i);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tboolean flag=true;\n\t\t\tfor(int i=0;i<edgeList.size();i++) {\n\t\t\t\tint a=edgeList.get(i).getKey();\n\t\t\t\tint b=edgeList.get(i).getValue();\n\t\t\t\tif(cc[a] == cc[b])\n\t\t\t\t{ flag=false;\n\t\t\t\t break;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n if(flag) System.out.println(\"YES\");\n\t\t\telse System.out.println(\"NO\");\n\t\t\t\n }\n\n\t}", "public static void main(String[] args) throws IOException {\n BufferedReader f = new BufferedReader(new InputStreamReader(System.in));\n PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));\n StringTokenizer st = new StringTokenizer(f.readLine());\n int a = Integer.parseInt(st.nextToken());\n int b = Integer.parseInt(st.nextToken());\n int c = Integer.parseInt(st.nextToken());\n int d = Integer.parseInt(st.nextToken());\n int x = -1;\n int y = -1;\n for(int i = 1; i < 45000; i++) {\n if(i*(i-1)/2 == a) {\n x = i;\n }\n if(i*(i-1)/2 == d) {\n y = i;\n }\n }\n if(x == -1 || y == -1) {\n out.println(\"Impossible\");\n } else {\n if(x*y == b+c) {\n int w = c/x;\n int z = c%x;\n out.println(\"1\".repeat(w)+\"0\".repeat(x-z)+\"1\".repeat(z > 0 ? 1 : 0)+\"0\".repeat(z)+\"1\".repeat(y-w-(z > 0 ? 1 : 0)));\n } else {\n if(b+c > 0) {\n out.println(\"Impossible\");\n } else if(x == 1) {\n out.println(\"1\".repeat(y));\n } else if(y == 1) {\n out.println(\"0\".repeat(x));\n } else {\n out.println(\"Impossible\");\n }\n }\n }\n f.close();\n out.close();\n }" ]
[ "0.6219617", "0.6116912", "0.6104521", "0.59120494", "0.5803767", "0.5748957", "0.5728884", "0.5726857", "0.5678149", "0.5663395", "0.56394553", "0.5620669", "0.5609737", "0.5582226", "0.55373365", "0.5528369", "0.5515192", "0.5505787", "0.55046314", "0.55021024", "0.54720044", "0.54642576", "0.5451286", "0.54433846", "0.54430676", "0.54361343", "0.543323", "0.54294544", "0.54243726", "0.54139477", "0.5411989", "0.54057354", "0.5397796", "0.5388064", "0.537318", "0.53530467", "0.5350463", "0.5349304", "0.5345818", "0.53442556", "0.53424597", "0.53412026", "0.53354055", "0.53327906", "0.5326341", "0.5321335", "0.5319544", "0.5306964", "0.530597", "0.53054523", "0.5299197", "0.5292858", "0.52921915", "0.5287214", "0.52862793", "0.52703935", "0.52698964", "0.52668434", "0.52655375", "0.5259439", "0.525874", "0.5258623", "0.5257797", "0.5257095", "0.52562356", "0.5241969", "0.52303785", "0.52280694", "0.52263486", "0.5225593", "0.5223078", "0.5201477", "0.52002615", "0.51914674", "0.5191241", "0.5185551", "0.51785386", "0.5176297", "0.51759857", "0.5174556", "0.51704746", "0.5165952", "0.5160596", "0.5160417", "0.51548564", "0.5152707", "0.51488113", "0.51483375", "0.5143692", "0.51433384", "0.5142856", "0.51379806", "0.51362085", "0.51338804", "0.51332694", "0.5126805", "0.5123567", "0.5118088", "0.5112829", "0.51074743", "0.5107023" ]
0.0
-1
i didnt really like the strategy alan gave us for random numbers and this orks just fine
static int roll() { Random rand = new Random(); //get large random number int num2 = rand.nextInt(); //convert from long to int return Math.abs(num2%6)+1; //num between 1 and 6 }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private int randomNum() {\r\n\t return((int)(Math.random() * 100));\r\n\t }", "private void random() {\n\n\t}", "private void setRand(){\n rand = generator.nextInt(9) + 1;\n }", "public static void main(String[] args) {\n\r\n\t\tRandom rr=new Random();\r\n\t\t\r\n\t\tSystem.out.println(Math.random());//[0,1)\r\n\t\t \r\n\t\t// 第一种情况 int(强转之后最终的值一定是0)\r\n\t\t// 第二种情况 int(强转之后将小数点舍去 1-5)\r\n\t\tSystem.out.println((int)Math.random()*5);//0.99*5永远到不了5\r\n\t\tSystem.out.println((int)(Math.random()*5+1));//[1,5.)\r\n\t\t\r\n\t\tSystem.out.println(rr.rand107());\r\n\t\tSystem.out.println(rr.rand107());\r\n\t\tSystem.out.println(rr.rand107());\r\n\t\tSystem.out.println(rr.rand107());\r\n\t\t\r\n\t\tfor(int i=0;i<=20;i++){\r\n\t\t\tSystem.out.print(i%7+\"-\");\r\n\t\t\t\r\n\t\t}\r\n\t\t//1-M的随机产生\r\n\t\t//(int)(Math.random()*M+1)\r\n\t\t\r\n\t\t\r\n\t\t//产生0 1的概率不同 Math.random()<p?0:1\r\n\t\tSystem.out.println(\"----\"+rr.rand01p());\r\n\t\tSystem.out.println(\"----\"+rr.rand01());\r\n\t\tfor(int i=0;i<=11;i++){\r\n\t\t\tSystem.out.print(i%6+\"-\");\r\n\t\t \t\r\n\t\t}\r\n\t\tSystem.out.println();\r\n\t\tSystem.out.println(rr.rand106());\r\n\t}", "@Override\n\tpublic double compete() {\n\t\tdouble result=MyTools.getRandomNum(10, 20); \t\n\t\tsetThisResult(result);\n\t\treturn result;\n\t}", "int randomPoint() { return 1 + (int)Math.round((Math.random()*20) % (size - 2)); }", "public static int randomNext() { return 0; }", "private int generateRandomNumber() {\n\t\treturn new SplittableRandom().nextInt(0, 3);\n\t}", "private int rand() {\n return (int)(Math.random()*(RAND_MAX + 1));\n }", "private double getRandomNumber(){\n double rand = Math.random();//produce a number between 0 and 1\n rand = rand - 0.5;\n return rand;\n }", "private int aleatorizarNaipe() {\n\t\tint aux;\n\t\taux = r.getIntRand(4);\n\t\treturn aux;\n\t}", "int random(int m)\n {\n return (int) (1 + Math.random()%m);\n }", "private int randomHelper() {\n\t\tRandom rand = new Random();\n\t\tint randomNum = rand.nextInt((10000 - 1) + 1) + 1;\n\t\treturn randomNum;\n\t}", "private double getRandom() {\n return 2*Math.random() - 1;\n }", "@Override\n\tpublic double compete() {\n\t\tdouble result=MyTools.getRandomNum(500, 800);\n\t\tsetThisResult(result);\n\t\treturn result;\n\t}", "public void randomNumberTest() {\n //Generating streams of random numbers\n Random random = new Random();\n random.ints(5)//(long streamSize, double randomNumberOrigin, double randomNumberBound)\n .sorted()\n .forEach(System.out::println);\n /*\n -1622707470\n -452508309\n 1346762415\n 1456878623\n 1783692417\n */\n }", "private int randomNumber(int high, int low){\n \t\t Random r = new Random();\n \t\t return (r.nextInt(high-low) + low);\n \t }", "private double randn(){\r\n\t\t//* http://www.mathworks.com/access/helpdesk/help/techdoc/matlab.html\r\n\t\t//RandomNumber rnd = new RandomNumber(System.currentTimeMillis());\r\n\t\t//return rnd.normal();\r\n\t\treturn rnd.nextGaussian();\r\n\t\t//return 0;\r\n\t}", "int lanzar(int n){\n int result = (int) (Math.random()* 6) + 1;\r\n if(result !=n ) result = (int) (Math.random()* 6) + 1;\r\n return result;\r\n \r\n /*\r\n * int result = (int) (Math.random()*9)+1;\r\n * if (result > 0 && result < 7) return result;\r\n * else if(result > 6 && result < 9) return n;\r\n * else return (int) (Math.random()*6)+1;\r\n *\r\n *\r\n */\r\n }", "Boolean getRandomize();", "int RandomGenerator0To29 (){\n\t\t int randomInt2 = 0;\n\t\t Random randomGenerator2 = new Random();\n\t\t for (int idx2 = 1; idx2 <= 10; ++idx2) {\n\t\t\t randomInt2 = randomGenerator2.nextInt(30);\n\t\t }\n\t\t return randomInt2;\n\t }", "public static void Random() {\n\t\tRandom ran =new Random();\r\n\t\trandom=ran.nextInt(6)+1;\r\n\t\t//random=1;\r\n\t\twho=A1063307_GUI.who2;\r\n\t\tif((ch[who].status)>0) {\r\n\t\t\tch[who].location=(ch[who].location)+random;\r\n\t\t\tch[who].status=(ch[who].status)-1;\r\n\t\t\t\r\n\t\t}else {\r\n\t\t\t\treturn;\r\n\t\t\t}\t\t\r\n\t}", "void setRandomNo() {\n\t\tno = 10000000 + (int) (Math.random() * 90000000);\n\t}", "private Random rand()\n\t{\n\t\treturn new Random();\n\t}", "Randomizer getRandomizer();", "int RandomGeneratorZeroToThree (){\n\t\t int randomInt = 0;\n\t\t Random randomGenerator = new Random();\n\t\t for (int idx = 1; idx <= 10; ++idx) {\n\t\t\t randomInt = randomGenerator.nextInt(4);\n\n\t\t }\n\t\t return randomInt;\n\t }", "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 }", "@Override\n public int orinar() {\n\n return (int) (Math.random() * 400) + 400;\n }", "private static int get() { \r\n Random r = new Random();\r\n return (r.nextInt(9));\r\n }", "private void randomizeNum() {\n randomNums.clear();\n for (int i = 0; i < 4; i++) {\n Integer rndNum = rnd.nextInt(10);\n randomNums.add(rndNum);\n }\n }", "private void getRandomNumber() {\n\t\tRandom random = new Random();\n\t\tint randomCount = 255;\n\t\tint randNum = 0; \n\t\tfor(int i = 0; i < numberAmt; i++) {\n\t\t\trandNum = random.nextInt(randomCount);\n\t\t\tswitch (numberType) {\n\t\t\tcase 1:\n\t\t\t\trandomNumbers.add(Integer.toString(randNum));\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\tif(randNum > 15)\n\t\t\t\t\trandomNumbers.add(String.format(\"%8s\", Integer.toBinaryString(randNum)).replace(\" \", \"0\"));\n\t\t\t\telse\n\t\t\t\t\trandomNumbers.add(String.format(\"%4s\", Integer.toBinaryString(randNum)).replace(\" \", \"0\"));\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\trandomNumbers.add(Integer.toHexString(randNum));\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "private void getRandomNumber() {\n\t\tRandom generator = new Random();\n\t\trandomNumber = generator.nextInt(POSSIBLE_CHOICE.length);\n\t}", "public void generateNumbers() {\n number1 = (int) (Math.random() * 10) + 1;\n number2 = (int) (Math.random() * 10) + 1;\n operator = (int) (Math.random() * 4) + 1;\n //50% chance whether the displayed answer will be right or wrong\n rightOrWrong = (int) (Math.random() * 2) + 1;\n //calculate the offset of displayed answer for a wrong equation (Error)\n error = (int) (Math.random() * 4) + 1;\n generateEquation();\n }", "private static int getSecretNum(int arg1) {\n Random rand = new Random();\n return rand.nextInt(UPPERBOUND)+1; //make range 1-100\n }", "static int random(int mod)\n {\n Random rand = new Random();\n int l= (rand.nextInt());\n if(l<0)\n l=l*-1;\n l=l%mod;\n return l;\n }", "private int randomValue() {\r\n\t\tRandom rand = new Random();\r\n\t\tint val = rand.nextInt(10);\r\n\t\tif(val == 9)\r\n\t\t\treturn 4;\r\n\t\telse\r\n\t\t\treturn 2;\r\n\t}", "public final void rand() {\n\t\tpush(randomNumberGenerator.nextDouble());\n\t}", "public static int randomNumber() {\n //Random rndNumbers = new Random();\n //for(int i = 0; i < 100; i++) {\n // int rndNumber = rndNumbers.nextInt();\n // System.out.println(rndNumber);\n int rand = (int) (Math.random() * 100);\n System.out.println(rand);\n if (rand > 50) {\n return rand;\n } else {\n System.out.println(\"-1\");\n }\n return rand;\n }", "private int generateRandomNumber() {\n\t\treturn (int) Math.floor(Math.random() * Constants.RANDOM_NUMBER_GENERATOR_LIMIT);\n\t}", "public static double randomNum(Random g)\n\t{\n\t\treturn -5+g.nextDouble()*10;\n\t}", "public void randomize() {\n\t\tx = ThreadLocalRandom.current().nextInt(0, 499 + 1);\n\t\ty = ThreadLocalRandom.current().nextInt(0, 499 + 1);\n\t}", "private int rand(int lower, int higher) {\n\t\treturn lower + (int) ((higher - lower + 1) * Math.random());\n\t\t\n\t}", "private int rand(int lower, int upper) {\n return lower + (int)(Math.random() * ((upper - lower) + 1));\n }", "private int randomWeight()\n {\n return dice.nextInt(1000000);\n }", "public int drawpseudocard(){\n Random random = new Random();\n return random.nextInt(9)+1;\n }", "private int evaluate() {\n return (int) (Math.random() * 8);\n }", "long random(long ws) {\r\n\t\treturn (System.currentTimeMillis() % ws);\r\n\t}", "public abstract void randomize();", "public static int getRandomAmount(){\n return rand.nextInt(1000);\n }", "public int rand(int idT){\r\n Random r = new Random(); \r\n int Low = ((idT*2) + (idT-2));\r\n int High = idT*3;\r\n \r\n int R = r.nextInt ((High+1)-Low) + Low;\r\n System.out.print(\"Low :\"+Low+\",\"+\" high :\"+High+ \" \");\r\n return R;\r\n }", "protected Random get_rand_value()\n {\n return rand;\n }", "public static int getRandomNumber(){\n int random = 0; // set variable to 0\r\n random = (int)(Math.random()*10) + 1; //generate random number between 1 and 10\r\n return random; //return random number\r\n }", "public static void main(String[] args) {\n\t\tdouble random_num1 = Math.random()*10;\n\t\tdouble random_num2 = Math.random()*9+1;\n\t\tdouble random_num3 = Math.random()*(35-20+1)+20;\n\t\tdouble random_num4 = Math.random()*2;\n\t\tdouble some = (int)(Math.random()*10+1) ;\n\t\t\n\t\tSystem.out.println(\"0~9 까지의 랜덤 수 : \"+(int)random_num1);\n\t\tSystem.out.println(\"1~10 까지의 랜덤 수 : \"+(int)random_num2);\n\t\tSystem.out.println(\"20~35 까지의 랜덤 수 : \"+(int)random_num3);\n\t\tSystem.out.println(\"0 또는 1 : \"+(int)random_num4);\n\t\tSystem.out.println(some);\n\t\t\n\t}", "public void generateR(){\n\t\t\tdo{\n\t\t\t\tr = new BigInteger(80, new Random());\n\t\t\t}while(!(q.gcd(r).equals(BigInteger.ONE)&&r.compareTo(q)<0&&r.compareTo(BigInteger.ONE)>=0));\n\t}", "private static void __exercise36(final int[] a) {\n final int N = a.length;\n for (int i = 0; i < N; ++i) {\n final int r = i + StdRandom.uniform(N - i);\n final int temp = a[i];\n a[i] = a[r];\n a[r] = temp;\n }\n }", "private Integer randomHemoglobina(){\n\t\t\tint Min = 9, Max = 23;\n\t\t\treturn Min + (int)(Math.random() * ((Max - Min) + 1));\n\t\t}", "public int getRandomsNumber(){\n Random random = new Random();\n int number = random.nextInt(12) + 1;\n return number;\n }", "@Test\n public void randomSeedNumTest()\n {\n int x = _city.getRandomNum(5);\n int y = _city.getRandomNum(5);\n assertEquals(x, y);\n }", "private int choose(){\n\t\tdouble temp = 10 * Math.random();\n\t\tint i = (int)temp;\n\t\treturn i;\n\t}", "private Integer randomBilirrubina(){\n\t\t\tint Min = 0, Max = 14;\n\t\t\treturn Min + (int)(Math.random() * ((Max - Min) + 1));\n\t\t}", "public int rollResult(){\r\n return rand.nextInt(6) + 1;\r\n }", "int randInt(int n) {\r\n return _randomSource.nextInt(n);\r\n }", "public int generateRandom() {\n\t\tint random = (int)(Math.random()*((6-1)+1))+1;\n\t\treturn random;\n\t}", "public void rollRandom() {\n\t\tthis.strength = randomWithRange();\r\n\t\tthis.wisdom = randomWithRange();\r\n\t\tthis.dexterity = randomWithRange();\r\n\t\tthis.constitution = randomWithRange();\r\n\t\tthis.intelligence = randomWithRange();\r\n\t\tthis.charisma = randomWithRange();\r\n\t}", "public int randomNum() {\n\t\treturn 1 + (int) (Math.random() * 3); // randomNum = minimum + (int)(Math.random() * maximum);\n\t}", "public int randomDP() {\n\t\treturn(getRandomInteger(10,250));\n\t}", "public int randomNum()\r\n {\r\n Random rand = new Random();\r\n int n = rand.nextInt(52)+1;\r\n return n;\r\n }", "static final int fast_rand()\n\t{\n\t\tRz = 36969 * (Rz & 65535) + (Rz >>> 16);// ((Rz >>> 16) & 65535);\n\t\tRw = 18000 * (Rw & 65535) + (Rw >>> 16);// ((Rw >>> 16) & 65535);\n\t\treturn (Rz << 16) + Rw;\n\t}", "private int randomGen(int upperBound) {\n\t\tRandom r = new Random();\n\t\treturn r.nextInt(upperBound);\n\t}", "private static int getRandomNumberOfRooms(){\r\n return r.nextInt(50)+1;\r\n }", "private void randomNumbers(){\n ranA = n.nextInt(9) + 1;\n\n //second digit\n do {\n ranB=n.nextInt(9)+1;\n }while(ranB == ranA);\n\n //third digit\n do {\n ranC=n.nextInt(9)+1;\n }while(ranC == ranA || ranC==ranB);\n\n //fourth digit\n do {\n ranD=n.nextInt(9)+1;\n }while(ranD == ranA || ranD == ranB || ranD == ranC);\n }", "private int randomPiece() {\n return (int)(Math.random()*N_PIECES);\n }", "public static void randomInit(int r) { }", "public void randomize()\n {\n for (int i=0; i<list.length; i++)\n list[i] = (int)(Math.random() * 100) + 1;\n }", "public void newGame() {\n\t\ttheNumber = (int)(Math.random()* 100 + 1);\r\n\t\t\r\n\t}", "@Override\r\n\tpublic int computeNextVal(boolean prediction) {\n\t\treturn (int) (Math.random()*10)%3;\r\n\t}", "private int randomInteger(int n) {\n return (int) (randGen.random() * (n - 1));\n }", "private static void __exercise37(final int[] a) {\n final int N = a.length;\n for (int i = 0; i < N; ++i) {\n final int r = StdRandom.uniform(N);\n final int temp = a[i];\n a[i] = a[r];\n a[r] = temp;\n }\n }", "public int randomGQ() {\n\t\treturn(getRandomInteger(10,100));\n\t}", "public int eDmg(){\r\n eDmg = rand.nextInt(13);\r\n return eDmg;\r\n }", "private int random(int from, int to) {\n return from + (int) (Math.random() * (to - from + 1));\n }", "public int randNums() {\n //Create a random number between 0-16\n int randNum = (int)(Math.random() * 16);\n\n //Go to the random number's index in the number array. Pull the random number\n //and set the index value to zero. Return the random number\n if(numsArray[randNum] != 0){\n numsArray[randNum] = 0;\n return randNum + 1;\n }\n\n //If the index value is zero then it was already chosen. Recursively try again\n else{\n return randNum = randNums();\n }\n }", "private int getRandNumber() {\n int randNum = 0;\n Random generator = new Random();\n randNum = generator.nextInt(LIST.length()-1);\n return randNum;\n }", "private static int newNumber()\n\t{\n\t\tdouble initial = Math.random();\n\t\tdouble rangeAdjusted = initial * (10000 - 1001) + 1000;\n\t\tint rounded = (int)Math.round(rangeAdjusted);\n\t\treturn rounded;\n\t}", "static int getRandomDelta() {\n int d = rand.nextInt(100);\n if (d < 50) {\n return -1;\n } else {\n return 1;\n }\n }", "private static int addRandomScore() {\n Random ran = new Random();\n return ran.nextInt(201) + 400;\n }", "public int generarDE(){\n int ts;\n float rnd=(float)Math.random();\n \n if(rnd<=0.35){ts=1;}\n else if(rnd<=0.75){ts=2;}\n else {ts=3;}\n \n return ts;\n }", "public static int randomGet() { return 0; }", "public void randomize()\n {\n int max = list.length;\n for (int i=0; i<list.length; i++)\n list[i] = (int)(Math.random() * max) + 1;\n }", "@Override\n public Integer pee() {\n return (int) (random() * 8);\n }", "int randInt(int n) {\n return _randomSource.nextInt(n);\n }", "private static int myRandom(int low, int high) {\n return (int) (Math.random() * (high + 1 - low) + low);\n }", "private int randomAge() {\n \tint low = 18;\n \tint high = 100;\n \tint offset = high - low;\n \tRandom r = new Random();\n \treturn r.nextInt(offset) + low;\n \t\n }", "private int randomInt(int lower, int upper) {\n\t\treturn (int) ((upper - lower + 1) * Math.random()) + lower;\n\t}", "private int getRandomPiece() {\r\n return new Random().nextInt(Constants.NUM_PIECES);\r\n }", "private int getRandomNumber() {\n int randomInt = 0;\n Random randomGenerator = new Random();\n randomInt = randomGenerator.nextInt(NUM_LIST.length());\n if (randomInt - 1 == -1) {\n return randomInt;\n } else {\n return randomInt - 1;\n }\n }", "public int compete() {\r\n\t\tint max = 20;\r\n\t\tint min = 10;\r\n\t\tRandom Rand = new Random();\r\n\t\tint ranNum = Rand.nextInt(max - min) + min;\r\n\t\treturn ranNum;\r\n\t}", "public int RandomNegativeNumbers() {\n\t\tint result = 0;\n\t\tresult = rnd.nextInt(10) - 10;\n\t\treturn result;\n\t}", "private int generatePiece()\n\t{\n\t\tint toReturn = 0;\n\t\tint max = 1;\n\t\tint min = -1;\n\t\t\n\t\twhile(toReturn == 0)\n\t\t{\n\t\t\ttoReturn = r.nextInt((max - min) + 1) + min;\n\t\t}\n\t\tSystem.out.println(toReturn);\n\t\treturn toReturn;\n\t}", "@Test\n public void genRandom() {\n runAndWait(() -> genRandom(10_000, 500, 1), 32, 2000);\n runAndWait(() -> genRandom(10_000, 500, 100), 32, 2000);\n runAndWait(() -> genRandom(250_000, 4000, 50), 4, 5_000);\n }", "private static int newSecretNumber(int min, int max)\n {\n Random rnd = new Random();\n return rnd.nextInt((max + 1 - min) + min);\n }" ]
[ "0.75911367", "0.75397116", "0.72897875", "0.7272908", "0.7271741", "0.7248562", "0.72414434", "0.72162706", "0.7198048", "0.7195712", "0.71949416", "0.7176044", "0.7151451", "0.712085", "0.71188825", "0.7095033", "0.70900005", "0.70838636", "0.70590556", "0.6986315", "0.69841427", "0.6968757", "0.69246876", "0.69052124", "0.69034725", "0.68984216", "0.68940157", "0.68783504", "0.6877092", "0.6864273", "0.6859148", "0.68380064", "0.6835923", "0.68268985", "0.68101144", "0.6804775", "0.68008506", "0.6799913", "0.67956233", "0.6780987", "0.6766337", "0.67652893", "0.6760663", "0.67327577", "0.67282075", "0.67205375", "0.6706912", "0.66794866", "0.6678531", "0.66729283", "0.66602093", "0.6660057", "0.66545933", "0.66456485", "0.66399544", "0.66297007", "0.6629683", "0.6625334", "0.66005844", "0.65984637", "0.65830773", "0.6583007", "0.6542692", "0.65418243", "0.6537902", "0.6536458", "0.65334356", "0.6523462", "0.6515805", "0.6512574", "0.6511054", "0.65059745", "0.6500674", "0.64998215", "0.64976805", "0.6493449", "0.64932394", "0.64859474", "0.6482618", "0.6481164", "0.6472731", "0.6467544", "0.646156", "0.6461362", "0.6457126", "0.6451498", "0.6445881", "0.6440508", "0.6440333", "0.64349395", "0.6432881", "0.64124966", "0.64055693", "0.6405166", "0.6404661", "0.6402728", "0.63970184", "0.6396646", "0.63916737", "0.6382313", "0.6370167" ]
0.0
-1
stores as many points on circle as the param lineAmount is in ArrayList onCirclePoints
public void generatePointsOnCircle(int lineAmount, Circle circle) { for (int i = 0; i < lineAmount; ++i) { // cosinus = ankathete / hypo | sinus = gegenkathete / hypo final double angle = Math.toRadians(((double) i / lineAmount) * 360d); // generating new point and declaring calulated coordinates to it onCirclePoints.add(new Point2D.Double(Math.cos(angle) * circle.getRadius() + circle.getMidpoint().getX(), Math.sin(angle) * circle.getRadius() + circle.getMidpoint().getY())); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void drawCircle() {\n mMap.clear();\n // Generate the points\n mMap.addPolygon(new PolygonOptions().addAll(points).strokeWidth(5).strokeColor(Color.RED).fillColor(Color.TRANSPARENT));\n // Create and return the polygon\n for (int i=0;i<points.size();i++){\n Log.v(\"DrawCircle\",\"drwaakmdaskfmlsmn\"+points.get(i));\n }\n\n\n\n }", "public void addPoint(int points){\n\t\tthis.fidelityCard.point += points;\t\t\n\t}", "public void generateLines(int lineAmount, PointManager pointManager, Triangle triangle, Circle circle) {\n pointManager.generatePointsOnCircle(lineAmount, circle);\n for (int i = 0; i < lineAmount; i++) {\n\n Line line = new Line();\n // randomly setting both points of line\n Random random = new Random();\n if (randomStartpoint) {\n line.setStartPoint(pointManager.getOnCirclePoints().get(random.nextInt(pointManager.getOnCirclePoints().size())));\n } else {\n line.setStartPoint(triangle.getFirstCorner());\n }\n line.setEndPoint(pointManager.getOnCirclePoints().get(random.nextInt(pointManager.getOnCirclePoints().size())));\n lines.add(line);\n }\n }", "public void addPoints(int point){\n\t\tthis.points += point;\n\t}", "@Override\n public void onDraw(final Canvas canv) {\n \t\n for (CircleArea circle : mCircles) {\n \t\n \tmCirclePaint.setColor(Color.GRAY);\n \tcanv.drawCircle(circle.centerX, circle.centerY, circle.radius+2, mCirclePaint);\n \tmCirclePaint.setColor(0xFFBFFFEF);\n canv.drawCircle(circle.centerX, circle.centerY, circle.radius, mCirclePaint);\n \n \n if(circle.isFinal){\n \tmCirclePaint.setColor(Color.GRAY);\n \tmCirclePaint.setStyle(Paint.Style.STROKE);\n \tmCirclePaint.setStrokeWidth(2);\n \tcanv.drawCircle(circle.centerX, circle.centerY, circle.radius-3, mCirclePaint);\n \tmCirclePaint.setStrokeWidth(40);\n \tmCirclePaint.setStyle(Paint.Style.FILL);\n }\n if(circle == this.initial){\n \tmCirclePaint.setColor(Color.BLACK);\n \tPath path = new Path();\n \tpath.moveTo(circle.centerX-circle.radius,circle.centerY);\n \tpath.lineTo(circle.centerX-circle.radius*2,(float) (circle.centerY - circle.radius/1.5));\n \tpath.lineTo(circle.centerX-circle.radius*2, (float) (circle.centerY+ circle.radius/1.5));\n \n \tcanv.drawPath(path, mCirclePaint);\n }\n \n \n mCirclePaint.setTextSize(23);\n mCirclePaint.setColor(Color.BLACK);\n canv.drawText(circle.id,circle.centerX-12,circle.centerY+8,mCirclePaint);\n }\n \n if(mLines.size() >= 1){\n \tmCirclePaint.setStrokeWidth(1);\n \tif(mode == 2 || mode == 3){\n\t \tfor(int i=0;i<mLines.size();i++){\n\t \n\t \t\t\n\t\t \t\t\n\t \t\t\tif(mLines.get(i).circleEnd != null){\n\t \t\t\t\t\n\n\t\t \t\t\tmCirclePaint.setColor(Color.BLACK);\n\t\t\t \tmCirclePaint.setStrokeWidth(1);\n\t\t\t \t\n\t\t\t \tint points[] = this.getPoints(\n\t\t\t \t\t\tmLines.get(i).circleStart.centerX,\n\t\t\t \t\t\tmLines.get(i).circleStart.centerY,\n\t\t\t \t\t\tmLines.get(i).circleEnd.centerX, \n\t\t\t \t\t\tmLines.get(i).circleEnd.centerY);\n\t\t\t \t\n\t\t\t \tcanv.drawLine(\n\t\t\t \t\t\tpoints[0],points[1],points[2],points[3], \n\t\t\t \t\t\tmCirclePaint);\n\t\t\t \t\n\t\t\t \tcanv.drawCircle(points[2], points[3], 4, mCirclePaint);\n\t\t\t \t\n\t\t\t \t//int rectPoints[] = this.rectBound(points);\n\t\t\t \t//RectF rectF = new RectF(rectPoints[0],rectPoints[1],rectPoints[2],rectPoints[3]);\n\t\t\t \tint rectPoints[] = {\n\t\t\t \t\t\tmLines.get(i).circleStart.centerX,\n\t\t\t \t\t\tmLines.get(i).circleStart.centerY,\n\t\t\t \t\t\tmLines.get(i).circleEnd.centerX, \n\t\t\t \t\t\tmLines.get(i).circleEnd.centerY};\n\t\t\t \t\n\t\t\t \t\t\t /*Path path = new Path();\n\t\t\t \t\t\t RectF oval = new RectF();\n\t\t\t \t\t\t \n\t\t\t \t\t\t mCirclePaint.setStyle(Style.STROKE);\n\t\t\t \t\t\t mCirclePaint.setColor(Color.BLACK);\n\t\t\t \t\t\t oval.set(rectPoints[0]-60,rectPoints[1],rectPoints[0],rectPoints[1]+60);\n\t\t\t \t\t\t path.arcTo(oval,250,-230,true);\n\t\t\t \t\t\t canv.drawPath(path, mCirclePaint);\n\t\t\t \t\t\t \n\t\t\t \t\t\t mCirclePaint.setStyle(Style.FILL);*/\n\t\t\t \t\t\t \n\t\t\t \t\n\t\t\t \tif(mLines.get(i).name != null){\n\t\t\t\t \tmCirclePaint.setTextSize(20);\n\t\t\t\t \t\n\t\t\t\t \tmLines.get(i).textCoordsX = (points[0]+points[2])/2;\n\t\t\t\t \tmLines.get(i).textCoordsY = (points[1]+points[3])/2;\n\t\t\t\t \tmCirclePaint.setColor(Color.BLUE);\n\t\t\t\t canv.drawText(mLines.get(i).name,mLines.get(i).textCoordsX-5,mLines.get(i).textCoordsY+3,mCirclePaint);\n\t\t\t\t mCirclePaint.setColor(Color.BLACK);\n\t\t\t\t \n\t\t\t\t mCirclePaint.setTextSize(12);\n\t\t\t \t}\n\t\t\t \t\n\t\t\t \t\n\t\t \t\t}\n\t\t \t\telse{\n\t\t \t\t\tcanv.drawLine(\n\t\t \t \t\t\tmLines.get(mLines.size()-1).startX, \n\t\t \t \t\t\tmLines.get(mLines.size()-1).startY,\n\t\t \t \t\t\tmLines.get(mLines.size()-1).endX, \n\t\t \t \t\t\tmLines.get(mLines.size()-1).endY, \n\t\t \t \t\t\tmCirclePaint);\n\t\t \t\t}\n\t \t\t}\n\t \t\t\n\t \t\t\n\t \t\n\t \t\n\t \n\t \t\n \t}\n \telse if(mode == 1 || mode ==0){\n \t\tfor(int i=0;i<mLines.size();i++){\n\t \tmCirclePaint.setColor(Color.BLACK);\n\t \tmCirclePaint.setStrokeWidth(1);\n\t \tint points[] = this.getPoints(\n\t \t\t\tmLines.get(i).circleStart.centerX,\n\t \t\t\tmLines.get(i).circleStart.centerY,\n\t \t\t\tmLines.get(i).circleEnd.centerX, \n\t \t\t\tmLines.get(i).circleEnd.centerY);\n\t \t\n\t \tcanv.drawLine(\n\t \t\t\tpoints[0],points[1],points[2],points[3], \n\t \t\t\tmCirclePaint);\n\t \t\n\t \tmCirclePaint.setTextSize(20);\n\t \t\n\n\t \t\n\t \tcanv.drawCircle(points[2], points[3], 4, mCirclePaint);\n\t \tmLines.get(i).textCoordsX = (points[0]+points[2])/2;\n\t \tmLines.get(i).textCoordsY = (points[1]+points[3])/2;\n\t \tmCirclePaint.setColor(Color.BLUE);\n\t canv.drawText(mLines.get(i).name,mLines.get(i).textCoordsX-5,mLines.get(i).textCoordsY+3,mCirclePaint);\n\t mCirclePaint.setColor(Color.BLACK);\n\t \n\t mCirclePaint.setTextSize(12);\n\t }\t\n \t}\n }\n \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 }", "private void definePoints(){\n defineLinePoints(x1, y1, x2, y2);\n defineLinePoints(x1,y1, x3, y3);\n defineLinePoints(x2,y2, x3, y3);\n }", "public void setPoints(int amount) {\n // Cannot have a negative amount of points\n if (amount < 0) {\n throw new IllegalArgumentException(\"Invalid point amount - cannot be less than 1\");\n }\n\n // Set the points\n points = amount;\n }", "public void setNumPoints(int np);", "public void addPoint() {\n points += 1;\n }", "private void defineLinePoints(int x1, int y1,int x2,int y2){\n Line line1 = new Line(x1, y1, x2, y2);\n for(int i = 0; i < line1.points.size(); i++){\n super.points.add(line1.points.get(i));\n }\n }", "public void givePoints(int amount) {\n givePoints(amount, PointSource.SPECIAL);\n }", "public void setPoints(List<GeoPoint> points){\n\t\tclearPath();\n\t\tint size = points.size();\n\t\tmOriginalPoints = new int[size][2];\n\t\tfor (int i=0; i<size; i++){\n\t\t\tGeoPoint p = points.get(i);\n\t\t\tmOriginalPoints[i][0] = p.getLatitudeE6();\n\t\t\tmOriginalPoints[i][1] = p.getLongitudeE6();\n\t\t\tif (!mGeodesic){\n\t\t\t\taddPoint(p);\n\t\t\t} else {\n\t\t\t\tif (i>0){\n\t\t\t\t\t//add potential intermediate points:\n\t\t\t\t\tGeoPoint prev = points.get(i-1);\n\t\t\t\t\tfinal int greatCircleLength = prev.distanceTo(p);\n\t\t\t\t\t//add one point for every 100kms of the great circle path\n\t\t\t\t\tfinal int numberOfPoints = greatCircleLength/100000;\n\t\t\t\t\taddGreatCircle(prev, p, numberOfPoints);\n\t\t\t\t}\n\t\t\t\taddPoint(p);\n\t\t\t}\n\t\t}\n\t}", "public void addCircle(Circle circle){\n circles.add(circle);\n }", "public void usePoints(int amount) {\n // Cannot use too few points\n if (amount < 0) {\n throw new IllegalArgumentException(\"Invalid points amount - cannot be less than 1\");\n }\n\n // Cannot use more points than obtained\n if (amount > points) {\n throw new IllegalArgumentException(\"Invalid points amount - more than current total\");\n }\n\n // Use the points\n points -= amount;\n }", "public void addPoints(int i, List<Point2D> points);", "public void addLineVehicles(Circle c)\r\n {\r\n this.all_line_vehicles.add(c);\r\n return;\r\n }", "public static void addCircle(MapLocation center, float size, float desire) {\n switch (circleCount) {\n case 0:\n Z1c_desire = desire;\n Z1c_center = center;\n Z1c_size = size;\n circleCount++;\n break;\n case 1:\n Z2c_desire = desire;\n Z2c_center = center;\n Z2c_size = size;\n circleCount++;\n break;\n case 2:\n Z3c_desire = desire;\n Z3c_center = center;\n Z3c_size = size;\n circleCount++;\n break;\n case 3:\n Z4c_desire = desire;\n Z4c_center = center;\n Z4c_size = size;\n circleCount++;\n break;\n case 4:\n Z5c_desire = desire;\n Z5c_center = center;\n Z5c_size = size;\n circleCount++;\n break;\n case 5:\n Z6c_desire = desire;\n Z6c_center = center;\n Z6c_size = size;\n circleCount++;\n break;\n case 6:\n Z7c_desire = desire;\n Z7c_center = center;\n Z7c_size = size;\n circleCount++;\n break;\n case 7:\n Z8c_desire = desire;\n Z8c_center = center;\n Z8c_size = size;\n circleCount++;\n break;\n case 8:\n Z9c_desire = desire;\n Z9c_center = center;\n Z9c_size = size;\n circleCount++;\n break;\n case 9:\n Z10c_desire = desire;\n Z10c_center = center;\n Z10c_size = size;\n circleCount++;\n break;\n case 10:\n Z11c_desire = desire;\n Z11c_center = center;\n Z11c_size = size;\n circleCount++;\n break;\n case 11:\n Z12c_desire = desire;\n Z12c_center = center;\n Z12c_size = size;\n circleCount++;\n break;\n case 12:\n Z13c_desire = desire;\n Z13c_center = center;\n Z13c_size = size;\n circleCount++;\n break;\n case 13:\n Z14c_desire = desire;\n Z14c_center = center;\n Z14c_size = size;\n circleCount++;\n break;\n case 14:\n Z15c_desire = desire;\n Z15c_center = center;\n Z15c_size = size;\n circleCount++;\n break;\n case 15:\n Z16c_desire = desire;\n Z16c_center = center;\n Z16c_size = size;\n circleCount++;\n break;\n case 16:\n Z17c_desire = desire;\n Z17c_center = center;\n Z17c_size = size;\n circleCount++;\n break;\n case 17:\n Z18c_desire = desire;\n Z18c_center = center;\n Z18c_size = size;\n circleCount++;\n break;\n case 18:\n Z19c_desire = desire;\n Z19c_center = center;\n Z19c_size = size;\n circleCount++;\n break;\n case 19:\n Z20c_desire = desire;\n Z20c_center = center;\n Z20c_size = size;\n circleCount++;\n break;\n }\n }", "private final void \n\tputArcPointsInBuffer(\n\t\t\tfinal float x,\n\t\t\tfinal float y,\n\t\t\tfinal float radiusX,\n\t\t\tfinal float radiusY,\n\t\t\tfinal float startAngle,\n\t\t\tfinal float angle,\n\t\t\tfinal float pointCount,\n\t\t\tfinal float wantCenterPoint ) {\n\t\t\n\t\t// calculation of the step width:\n\t\t// 2 * Pi is a full circle multiplied by the float representation of the angle == the desired angle \n\t\t// The desired angle is divided by the given BitsApp.CirclePoints == the step width for the desired angle with the given circle points\n\t\tfinal float stepWidth = (2f * (float)(Math.PI) * (angle / 360f)) / pointCount;\n\n\t\t//calculate the start angle/step\n\t\tfloat currentStep = (2f * (float)Math.PI) * (startAngle / 360f);\n\t\tint totalSteps = (int) (pointCount); //how many steps between \n\t\t\n\t\tif( wantCenterPoint == 0 ) {\n\t\t\t// show a center point if the arc is not 360 degrees\n\t\t\tif(angle > 0 && angle < 360) {\n\t\t\t\tthis.mVertices[this.mBufferIndex++] = x;\n\t\t\t\tthis.mVertices[this.mBufferIndex++] = y;\n\t\t\t}\n\t\t}\n\n\t\t// calculating the steps\n\t\tfor (int i = 0; i < totalSteps; i++) {\n\t\t\tthis.mVertices[this.mBufferIndex++] = (float) (Math.cos(currentStep) * radiusX + x);\n\t\t\tthis.mVertices[this.mBufferIndex++] = (float) (Math.sin(currentStep) * radiusY + y);\n\t\t\tcurrentStep += stepWidth;\n\t\t}\n\n\t\t// setting the last point to the desired angle position (step width does not always get to this point)\n\t\tthis.mVertices[this.mBufferIndex++] = (float) (Math.cos(currentStep) * radiusX + x);\n\t\tthis.mVertices[this.mBufferIndex++] = (float) (Math.sin(currentStep) * radiusY + y);\n\t}", "public void setPoints(int points) {\n this.points = points;\n }", "private void paintBeanMachine(){\n Line baseLine = new Line();\n\n baseLine.startXProperty().bind(widthProperty().multiply(0.2));\n baseLine.startYProperty().bind(heightProperty().multiply(0.8));\n baseLine.endXProperty().bind(widthProperty().multiply(0.8));\n baseLine.endYProperty().bind(heightProperty().multiply(0.8));\n\n // distance gap per circle\n double distance = (baseLine.getEndX() - baseLine.getStartX()) / SLOTS;\n ballRadius = distance / 2;\n\n //Draw pegs\n DoubleBinding dist = baseLine.endXProperty().subtract(baseLine.startXProperty()).divide(SLOTS);\n Circle[] pegs = new Circle[factorialSum(SLOTS)];\n int index = 0;\n\n for(int row = 0; row < SLOTS; row++){\n DoubleBinding y = baseLine.startYProperty().subtract(heightProperty().multiply(0.2).divide(row + 1));\n\n for(int col = 0; col < SLOTS - row; col++){\n Circle peg = new Circle(5, Color.BLUE);\n\n peg.centerXProperty().bind(baseLine.startXProperty()\n .add(dist.multiply(row).multiply(0.5))\n .add(dist.divide(2))\n .add(dist.multiply(row)));\n peg.centerYProperty().bind(y);\n\n //peg = new Circle(x, y, mWidth * 0.012, Color.BLUE);\n System.out.println(index);\n pegs[index++] = peg;\n\n Line line = new Line();\n line.startXProperty().bind(peg.centerXProperty());\n line.startYProperty().bind(peg.centerYProperty());\n line.endXProperty().bind(peg.centerXProperty());\n line.endYProperty().bind(baseLine.startYProperty());\n getChildren().add(line);\n }\n }\n\n /*\n for(int i = 1; i <= SLOTS; i++){\n double x = baseLine.getStartX() + (i * distance * 0.50) + distance / 2;\n double y = baseLine.getStartY() - (distance * i) - distance / 2;\n\n for(int j = 0; j <= SLOTS - i; j++){\n Circle peg = new Circle(5, Color.BLUE);\n DoubleBinding dist = baseLine.endXProperty().subtract(baseLine.startXProperty()).divide(SLOTS);\n\n peg.centerXProperty().bind(baseLine.startXProperty()\n .add(dist.multiply(i).multiply(0.5))\n .add(dist.divide(2)));\n peg.centerYProperty().bind(baseLine.startYProperty()\n .subtract(dist.multiply(i))\n .subtract(dist.divide(2)));\n\n //peg = new Circle(x, y, mWidth * 0.012, Color.BLUE);\n System.out.println(index);\n pegs[index++] = peg;\n x += distance;\n }\n }\n */\n\n distance = distance + (distance / 2) - pegs[0].getRadius();\n // Connect the base of the triangle with lowerLine\n // NOT including left most and right most line\n Line[] lines = new Line[SLOTS - 1];\n for (int i = 0; i < SLOTS - 1; i++) {\n double x1 = pegs[i].getCenterX() + pegs[i].getRadius() * Math.sin(Math.PI);\n double y1 = pegs[i].getCenterY() - pegs[i].getRadius() * Math.cos(Math.PI);\n lines[i] = new Line(x1, y1, x1, y1 + distance);\n\n }\n // Draw right most and left most most line\n Line[] sides = new Line[6];\n sides[0] = new Line(\n baseLine.getEndX(), baseLine.getEndY(),\n baseLine.getEndX(), baseLine.getEndY() - distance);\n sides[1] = new Line(\n baseLine.getStartX(), baseLine.getStartY(),\n baseLine.getStartX(), baseLine.getStartY() - distance);\n\n //Draw left side line\n /*\n for(int i = 2; i < 4; i++){\n double x = pegs[pegs.length - i].getCenterX();\n double y = pegs[pegs.length - i].getCenterY() - distance;\n sides[i] = new Line(x, y, sides[i - 2].getEndX(), sides[i - 2].getEndY());\n }\n */\n\n // Draw the upper 2 lines on top of the triangle\n /*\n for (int i = 4; i < sides.length; i++){\n sides[i] = new Line(\n sides[i-2].getStartX(), sides[i-2].getStartY(),\n sides[i-2].getStartX(), sides[i-2].getStartY() - (distance * 0.6)\n );\n }\n */\n\n getChildren().addAll(baseLine);\n getChildren().addAll(pegs);\n //getChildren().addAll(lines);\n //getChildren().addAll(sides);\n }", "private void setNewValues(Line[] line, Text[] angles, Circle[] points) {\r\n for (int i = 0; i < 3; i++) {\r\n int ind = i == 2 ? 0 : (i+1); //needed to prevent NullPointerException\r\n line[i].setStartX(points[i].getCenterX());\r\n line[i].setEndX(points[ind].getCenterX());\r\n line[i].setStartY(points[i].getCenterY());\r\n line[i].setEndY(points[ind].getCenterY());\r\n\r\n }\r\n //distances\r\n double a,b,c;\r\n a = calculateDistance(points[0], points[1]);\r\n b = calculateDistance(points[1], points[2]);\r\n c = calculateDistance(points[2], points[0]);\r\n\r\n //angles\r\n int A,B,C;\r\n A = (int) Math.toDegrees(Math.acos((a*a - b*b - c*c) / (-2 * b * c)));\r\n B = (int) Math.toDegrees(Math.acos((b*b - a*a - c*c) / (-2 * a * c)));\r\n C = (int) Math.toDegrees(Math.acos((c*c - b*b - a*a) / (-2 * a * b)));\r\n\r\n angles[0].setText(String.valueOf(String.valueOf(B)));\r\n angles[1].setText(String.valueOf(String.valueOf(C)));\r\n angles[2].setText(String.valueOf(String.valueOf(A)));\r\n\r\n //set location of angle labels\r\n for(int i = 0; i < angles.length;i++) {\r\n angles[i].setX(points[i].getCenterX() + 10);\r\n angles[i].setY(points[i].getCenterY() + 10);\r\n\r\n }\r\n\r\n }", "void drawPointArr(Graphics2D g2d, ArrayList<Point2D.Double> l){\r\n\t\tfor(int i=0; i<l.size()-1; i++){\r\n\t\t\tLine2D.Double line=new Line2D.Double(l.get(i), l.get(i+1));\r\n\t\t\tg2d.draw(line);\r\n\t\t}\r\n\r\n\t}", "public int getPoints();", "public void SetNPoints(int n_points);", "public void addPoints(int addP){\n this.points += addP;\n }", "public CircleOfFifths(){fillArrayLists();}", "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 void drawLineBetweenCircle(float x1, float y1, float x2, float y2, float radius, Canvas canvas, boolean isLast) {\n float x = Math.abs(x1 - x2);\n float y = Math.abs(y1 - y2);\n double z = Math.sqrt(x * x + y * y);\n double angle = Math.asin(y / z);\n if (z <= radius) {\n return;\n }\n float distanceX = (float) (radius * Math.cos(angle));\n float distanceY = (float) (radius * Math.sin(angle));\n float xPoint1 = x1 < x2 ? x1 + distanceX : x1 - distanceX;\n float yPoint1 = y1 < y2 ? y1 + distanceY : y1 - distanceY;\n float xPoint2 = x1 < x2 ? x2 - distanceX : x2 + distanceX;\n float yPoint2 = y1 < y2 ? y2 - distanceY : y2 + distanceY;\n if (isLast) {\n canvas.drawLine(xPoint1, yPoint1, x2, y2, mGestureLinePaint);\n } else {\n canvas.drawLine(xPoint1, yPoint1, xPoint2, yPoint2, mGestureLinePaint);\n }\n }", "public int getPoints() { return points; }", "int getPoints();", "private void DrawDots(List<HashMap<String, String>> result,ArrayList point2) {\n map.clear();\n MarkerOptions options = new MarkerOptions();\n\n // this is the start location marker in green\n options.position(origin);\n options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN));\n // the is the end location marker in red\n map.addMarker(options);\n options.position(dest);\n\n options.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED));\n\n map.addMarker(options);\n ArrayList points = null;\n\n PolylineOptions lineOptions = null;\n\n MarkerOptions markerOptions = new MarkerOptions();\n points = new ArrayList();\n\n\n lineOptions = new PolylineOptions();\n List<HashMap<String, String>> path = result;\n\n for (int j = 1; j < path.size(); j++) {\n HashMap<String, String> point = path.get(j);\n\n double lat = Double.parseDouble(point.get(\"lat\"));\n double lng = Double.parseDouble(point.get(\"lng\"));\n LatLng position = new LatLng(lat, lng);\n points.add(position);\n\n }\n\n lineOptions.addAll(points);\n lineOptions.width(12);\n\n lineOptions.color(Color.RED);\n\n lineOptions.geodesic(true);\n map.addPolyline(lineOptions);\n\n for (Object k : points2) {\n map.addCircle(new CircleOptions()\n .center((LatLng) k)\n .radius(3)\n .strokeColor(Color.BLUE)\n .fillColor(Color.BLUE));\n }\n }", "public int addPoints(int points) {\n if (!isClosed()) {\n pointsHistory.add(points);\n }\n return points;\n }", "public void setPoints(int points)\n\t{\n\t\tthis.points = points;\n\t}", "Float getTotalPoints();", "public void setLifepointsIncrease(int amount) {\r\n this.lifepointsIncrease = amount;\r\n }", "public LineData() {\n\t\t\tallPoints = new ArrayList<>(SIZE_OF_ORIGINAL_LIST);\n\t\t}", "public static void addVectorCircle(MapLocation center, float size, float baseDesire, float distanceDesire) {\n switch (vectorCircleCount) {\n case 0:\n Z1vc_baseDesire = baseDesire + (distanceDesire * size);\n Z1vc_distanceDesire = -distanceDesire;\n Z1vc_center = center;\n Z1vc_size = size;\n vectorCircleCount++;\n break;\n case 1:\n Z2vc_baseDesire = baseDesire + (distanceDesire * size);\n Z2vc_distanceDesire = -distanceDesire;\n Z2vc_center = center;\n Z2vc_size = size;\n vectorCircleCount++;\n break;\n case 2:\n Z3vc_baseDesire = baseDesire + (distanceDesire * size);\n Z3vc_distanceDesire = -distanceDesire;\n Z3vc_center = center;\n Z3vc_size = size;\n vectorCircleCount++;\n break;\n case 3:\n Z4vc_baseDesire = baseDesire + (distanceDesire * size);\n Z4vc_distanceDesire = -distanceDesire;\n Z4vc_center = center;\n Z4vc_size = size;\n vectorCircleCount++;\n break;\n case 4:\n Z5vc_baseDesire = baseDesire + (distanceDesire * size);\n Z5vc_distanceDesire = -distanceDesire;\n Z5vc_center = center;\n Z5vc_size = size;\n vectorCircleCount++;\n break;\n case 5:\n Z6vc_baseDesire = baseDesire + (distanceDesire * size);\n Z6vc_distanceDesire = -distanceDesire;\n Z6vc_center = center;\n Z6vc_size = size;\n vectorCircleCount++;\n break;\n case 6:\n Z7vc_baseDesire = baseDesire + (distanceDesire * size);\n Z7vc_distanceDesire = -distanceDesire;\n Z7vc_center = center;\n Z7vc_size = size;\n vectorCircleCount++;\n break;\n case 7:\n Z8vc_baseDesire = baseDesire + (distanceDesire * size);\n Z8vc_distanceDesire = -distanceDesire;\n Z8vc_center = center;\n Z8vc_size = size;\n vectorCircleCount++;\n break;\n case 8:\n Z9vc_baseDesire = baseDesire + (distanceDesire * size);\n Z9vc_distanceDesire = -distanceDesire;\n Z9vc_center = center;\n Z9vc_size = size;\n vectorCircleCount++;\n break;\n case 9:\n Z10vc_baseDesire = baseDesire + (distanceDesire * size);\n Z10vc_distanceDesire = -distanceDesire;\n Z10vc_center = center;\n Z10vc_size = size;\n vectorCircleCount++;\n break;\n case 10:\n Z11vc_baseDesire = baseDesire + (distanceDesire * size);\n Z11vc_distanceDesire = -distanceDesire;\n Z11vc_center = center;\n Z11vc_size = size;\n vectorCircleCount++;\n break;\n case 11:\n Z12vc_baseDesire = baseDesire + (distanceDesire * size);\n Z12vc_distanceDesire = -distanceDesire;\n Z12vc_center = center;\n Z12vc_size = size;\n vectorCircleCount++;\n break;\n case 12:\n Z13vc_baseDesire = baseDesire + (distanceDesire * size);\n Z13vc_distanceDesire = -distanceDesire;\n Z13vc_center = center;\n Z13vc_size = size;\n vectorCircleCount++;\n break;\n case 13:\n Z14vc_baseDesire = baseDesire + (distanceDesire * size);\n Z14vc_distanceDesire = -distanceDesire;\n Z14vc_center = center;\n Z14vc_size = size;\n vectorCircleCount++;\n break;\n case 14:\n Z15vc_baseDesire = baseDesire + (distanceDesire * size);\n Z15vc_distanceDesire = -distanceDesire;\n Z15vc_center = center;\n Z15vc_size = size;\n vectorCircleCount++;\n break;\n case 15:\n Z16vc_baseDesire = baseDesire + (distanceDesire * size);\n Z16vc_distanceDesire = -distanceDesire;\n Z16vc_center = center;\n Z16vc_size = size;\n vectorCircleCount++;\n break;\n case 16:\n Z17vc_baseDesire = baseDesire + (distanceDesire * size);\n Z17vc_distanceDesire = -distanceDesire;\n Z17vc_center = center;\n Z17vc_size = size;\n vectorCircleCount++;\n break;\n case 17:\n Z18vc_baseDesire = baseDesire + (distanceDesire * size);\n Z18vc_distanceDesire = -distanceDesire;\n Z18vc_center = center;\n Z18vc_size = size;\n vectorCircleCount++;\n break;\n case 18:\n Z19vc_baseDesire = baseDesire + (distanceDesire * size);\n Z19vc_distanceDesire = -distanceDesire;\n Z19vc_center = center;\n Z19vc_size = size;\n vectorCircleCount++;\n break;\n case 19:\n Z20vc_baseDesire = baseDesire + (distanceDesire * size);\n Z20vc_distanceDesire = -distanceDesire;\n Z20vc_center = center;\n Z20vc_size = size;\n vectorCircleCount++;\n break;\n }\n }", "public void setPoints(Integer points) {\r\n this.points = points;\r\n }", "public void addPoints(final int points) {\n\t\tPoints.addPoints(this.player, points);\n\t}", "public static double noLineDelineation() \n {\n int nTries = 0; //the number of tries (landing both inside and outside the circle)\n int inCircle = 0; //the number of points that landed inside the circle\n \n double x, y; //the x and y coordinates (random) of the point chosen\n \n for (int i = 0; i < ITERATIONS; i++) \n {\n // (2*Math.random()-1) returns a random number from -1 to 1\n \n x = 2 * Math.random() - 1; \n y = 2 * Math.random() - 1;\n \n //if the point lands on the line or in the circle, increment the inCircle count\n if (x * x + y * y <= 1) \n {\n inCircle++;\n }\n \n nTries++;\n }\n \n /*\n * Prints the output if DEBUG is set to true. The output consists of two lines:\n * an estimate of pi to 30 decimal places using the no line delineation method \n * as well as an error percentage from the real value (Math.PI).\n */\n if(DEBUG) \n {\n System.out.printf(\"[no line boolean] pi = %.30f\\n\", 4. * (double) inCircle / (double) nTries);\n System.out.printf(\"[no line boolean] Error = %.30f\\n\", (((4. * (double) inCircle / (double) nTries) - Math.PI)/Math.PI));\n }\n \n //returns the estimated value of pi\n return 4. * (double) inCircle / (double) nTries;\n }", "private void positionCircles_()\n\t{\n\t\tIterator<PVCircle> it = circles.iterator();\n\t\tint indx = 0;\n\t\tRandom rng = new Random();\n\t\twhile (it.hasNext())\n\t\t{\t\n\t\t\tPVCircle currCircle = it.next();\n\t\t\t//currCircle.setRadius(MAX_RADIUS * (double) currCircle.getWeight() / totalWeight);\n\t\t\tboolean collision = true;\n\t\t\tint loopCount = 0;\n\t\t\twhile(collision && loopCount < 100)\n\t\t\t{\n\t\t\t\tcurrCircle.setPosition(res_x * rng.nextDouble(), res_y * rng.nextDouble());\n\t\t\t\tcollision = checkCollision(currCircle, indx, indx);\n\t\t\t\tloopCount++;\n\t\t\t}\n\t\t\tif(loopCount == 100)\n\t\t\t{\n\t\t\t\t//Log.d(\"position\", \"Circle too big to fit\");\n\t\t\t\tit.remove();\n\t\t\t}\n\t\t\telse indx++;\n\t\t}\n\t}", "public void setPoints(int points) {\n\t\tthis.points = points;\n\t}", "public void givePlayerPoints(int pointsToAdd) {\n this.points = this.points + pointsToAdd;\n }", "private void addCircle() {\n\t\tdouble r = getRadius();\n\t\tadd(new GOval(getWidth() / 2.0 - r, getHeight() / 2.0 - r, 2 * r, 2 * r));\n\t}", "public void addPoints(List<Point2D> points);", "public void addPoint(Point p) {\r\n line.add(p);\r\n }", "public static double lineDelineation() \n {\n int nTries = 0; //the number of tries (landing both inside and outside the circle)\n int inCircle = 0; //the number of points that landed inside the circle\n boolean lineBool = false; //flipped every time a point lands on the circumference\n \n double x, y; //the x and y coordinates (random) of the point chosen\n\n for (int i = 0; i < ITERATIONS; i++) \n {\n // (2*Math.random()-1) returns a random number from -1 to 1\n \n x = 2 * Math.random() - 1; \n y = 2 * Math.random() - 1;\n \n // if the point is clearly within the circle, increment the inCircle counts\n if (x * x + y * y < 1) \n {\n inCircle++;\n }\n \n /*\n * If the point is on the circumference of the circle, check the line\n * boolean value. If the line boolean value is set to true, increment\n * the inCircle count and set the boolean value to false. If the line\n * boolean value is set to false, do not increment the inCircle count, but\n * flip the boolean for the next point that lands on the circumference.\n */\n else if (x * x + y * y == 1) \n {\n if(lineBool) \n {\n inCircle++;\n }\n lineBool = !lineBool;\n }\n \n nTries++;\n }\n\n /*\n * Prints the output if DEBUG is set to true. The output consists of two lines:\n * an estimate of pi to 30 decimal places using th line delineation method \n * as well as an error percentage from the real value (Math.PI).\n */\n if(DEBUG) \n {\n System.out.printf(\"[yes line boolean] pi = %.30f\\n\", 4. * (double) inCircle / (double) nTries);\n System.out.printf(\"[yes line boolean] Error = %.30f\\n\", (((4. * (double) inCircle / (double) nTries) - Math.PI)/Math.PI));\n }\n \n //returns the estimated value of pi\n return 4. * (double) inCircle / (double) nTries;\n }", "public PseudoCircle( List<Point2D> ps){\n for( Point2D x: ps){\n this.addPoint(x);\n }\n }", "private void addPoints(MapReader mr, Map<Integer, Mdr5Record> cityMap) {\n \t\tList<Point> list = mr.pointsForLevel(0);\n \t\tfor (Point p : list) {\n \t\t\tLabel label = p.getLabel();\n \t\t\tif (p.getNumber() > 256) {\n \t\t\t\t// I think we limit the number of points+ind-points, but just in case\n \t\t\t\tSystem.out.println(\"point number too big\");\n \t\t\t\tcontinue;\n \t\t\t}\n \n \t\t\tMdr5Record city = null;\n \t\t\tif (p.getType() < 0x11) {\n \t\t\t\t// This is itself a city, it gets a reference to its own MDR 5 record.\n\t\t\t\tint cnum = (p.getSubdiv().getNumber() << 8) + p.getNumber();\n\t\t\t\tcity = cityMap.get(cnum);\n \n \t\t\t} else {\n \t\t\t\t// This is not a city, but we have information about which city\n \t\t\t\t// it is in. If so then add the mdr5 record number of the city.\n \t\t\t\tPOIRecord poi = p.getPOIRecord();\n \t\t\t\tCity c = poi.getCity();\n \t\t\t\tif (c != null)\n\t\t\t\t\tcity = cityMap.get(c.getIndex());\n\t\t\t}\n\n\t\t\tif (city != null) {\n\t\t\t\tcity.setLblOffset(label.getOffset());\n\t\t\t\tcity.setName(label.getText());\n \t\t\t}\n \n \t\t\tif (label != null && label.getText().trim().length() > 0)\n \t\t\t\tmdrFile.addPoint(p, city);\n \t\t}\n \t}", "void add(Point point) {\n\t\tpoints[posit]=point;\n\t\tposit++;\n\t\t//if method add is applied, size should also change\n\t\tsize++;\n\t}", "public void incrementPrayerPoints(double amount) {\r\n prayerPoints += amount;\r\n if (prayerPoints < 0) {\r\n prayerPoints = 0;\r\n }\r\n if (prayerPoints > staticLevels[PRAYER]) {\r\n prayerPoints = staticLevels[PRAYER];\r\n }\r\n if (entity instanceof Player) {\r\n PacketRepository.send(SkillLevel.class, new SkillContext((Player) entity, PRAYER));\r\n }\r\n }", "public abstract int getPoints();", "@Override\n\t\t\tpublic void onLine(String line) {\n\t\t\t\tPoint p = Point.parse(line);\n\t\t\t\tNearestPointStats stats = p.getNearestPoint(centers);\n\t\t\t\tsum.set(0, sum.get(0) + stats.distance);\n\t\t\t}", "public void calculatePoints() {\n /*\n for (int i = 0; i < getRacers().size(); i++) {\n String username = getRacers().get(i).getUsername();\n int total = 0;\n for (int j = 0; j < getRounds().size(); j++) {\n Slot slot = getRounds().get(j).findRacerInRound(username);\n if (slot != null) {\n total = total + slot.getPoints();\n }\n }\n getRacers().get(i).setPoints(total);\n }*/\n }", "public SmoothLine(Point2D[] points){ \n this.points = points; \n }", "private void initDots(Canvas canvas){\n int tenthWidth = canvas.getWidth()/10;\n int tenthHeight = canvas.getHeight()/10;\n int calculatedRadius = tenthWidth/2;\n for(int i = 0; i <=4; i++){\n int verticalPoint = (i*(2*tenthHeight))+tenthHeight;\n for(int t = 0; t <= 4; t++){\n gameDots.add(new Circle(t*(2*tenthWidth)+tenthWidth,verticalPoint,calculatedRadius));\n }\n }\n int targetDot = r.nextInt(gameDots.size()-1);\n gameDots.get(targetDot).setTarget(true);\n previousIndex = targetDot;\n previousSize = gameDots.size();\n dotsSet=true;\n }", "@Override\n public void onDirectionSuccess(List<Points> point) {\n for (Points points:point){\n PolylineOptions polyLineOptions = new PolylineOptions().geodesic(true).color(Color.BLUE\n ).width(15);\n for (int i = 0; i < points.points.size(); i++)\n polyLineOptions.add(points.points.get(i));\n\n polylinePaths.add(mMap.addPolyline(polyLineOptions));\n\n }\n\n }", "private void createScaledCirclePoints(float scaling) {\n\t\tfor (MyCircle circle : circlesList) {\n\t\t\tfloat point[] = { (float) circle.getCenterX(),\n\t\t\t\t\t(float) circle.getCenterY() };\n\t\t\tscaleAndRotateMatrix.mapPoints(point);\n\t\t\tscaledCircleList.add(new MyCircle((int) point[0], (int) point[1],\n\t\t\t\t\t(int) (circle.getRadius() * scaling)));\n\t\t}\n\t}", "@Override\n\tpublic void spendPoints(int points) {\n\n\t}", "public CircleComponent()\n {\n circles = new ArrayList<>();\n circleCounter = 0;\n\n }", "public void draw() {\n for (Point2D p: mPoints) {\n StdDraw.filledCircle(p.x(), p.y(), 0.002);\n }\n }", "public void pointsCollected(List<Point> points);", "public void afficherPoints(){\n for(Point point : pointArrayList){\n getMapPane().getChildren().add(point.getImageView());\n visualObjects.add(point);\n }\n }", "public void setRevisedPoints(int thePoints)\r\n {\r\n points = points + thePoints;\r\n }", "public ArrayList<Coordinate> getAffectedPointsTraffic(ArrayList<Line> affected_lines)\r\n {\r\n ArrayList<Coordinate> new_affected_points = new ArrayList<Coordinate>();\r\n\r\n for (Street s : this.getStreetsMap()) {\r\n for (Line l : affected_lines) {\r\n if (s.begin().getX() == l.getStartX() && s.begin().getY() == l.getStartY() && s.end().getX() == l.getEndX() && s.end().getY() == l.getEndY()) {\r\n System.out.println(\"Street of line is affected with traffic now\");\r\n\r\n for (int i = 0; i < this.transportLinePath().size(); i++) {\r\n if (this.transportLinePath().get(i).isBetweenTwoCoordinates(s.begin(), s.end()) || (this.transportLinePath().get(i).getX() == s.begin().getX() && this.transportLinePath().get(i).getY() == s.begin().getY()) || (this.transportLinePath().get(i).getX() == s.end().getX() && this.transportLinePath().get(i).getY() == s.end().getY())) {\r\n System.out.println(\"Affected points: \" + this.transportLinePath().get(i).getX() + \", \" + this.transportLinePath().get(i).getY());\r\n new_affected_points.add(this.transportLinePath().get(i));\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n return new_affected_points;\r\n }", "public void setPilotPoints(int points) {\n if (pointsPullCheck(points)) {\n pilotPoints += points;\n }\n }", "private static void add(List<Point> points, int param, double value, boolean measured) {\r\n points.add(new Point(param, value, measured));\r\n }", "public void add(double amount) {\n x += amount;\n y += amount;\n }", "private ArrayList<Vector2f> drawRasterLine(Graphics g, Vector2f p0, Vector2f p1) {\r\n g.setColor(Color.BLUE);\r\n // Storage for drawn points\r\n ArrayList<Vector2f> vertices = new ArrayList<>();\r\n // Get pixels on the canvas\r\n int x0 = (int) world2Pixel(p0).x;\r\n int y0 = (int) world2Pixel(p0).y;\r\n int x1 = (int) world2Pixel(p1).x;\r\n int y1 = (int) world2Pixel(p1).y;\r\n // Delta x\r\n float dx = Math.abs(x1 - x0);\r\n // Step for x-value\r\n int sx = x0 < x1 ? 1 : -1;\r\n // Delta y\r\n float dy = -Math.abs(y1 - y0);\r\n // Step for y-value\r\n int sy = y0 < y1 ? 1 : -1;\r\n // Error values to determine with step to take\r\n float err = dx + dy, e2;\r\n // Loop until algorithm has finished\r\n while(true) {\r\n // Draw point on current coordinates\r\n g.drawArc(x0, y0, 1, 1, 0, 360);\r\n // Add point to drawn points list\r\n vertices.add(new Vector2f(x0, y0));\r\n // Loop condition\r\n if (x0==x1 && y0==y1) break;\r\n // Check which step to take for next point to draw\r\n e2 = 2 * err;\r\n if (e2 > dy) {\r\n err += dy;\r\n x0 += sx;\r\n }\r\n if (e2 < dx) {\r\n err += dx;\r\n y0 += sy;\r\n }\r\n }\r\n // Return all drawn points\r\n return vertices;\r\n }", "public int getPoints() {\n return points;\n }", "public int getPoints() {\n return points;\n }", "public int getPoints() {\n return points;\n }", "public int getPoints() {\n return points;\n }", "public void addVertices(int num){ \n this.nrVertices += num;\n }", "private void setUpMap() {\n if (points.size()>2) {\n drawCircle();\n }\n\n\n }", "public static void setNextCircle(int nextCircle) {\n\t\tblockContext.nextCircle = nextCircle;\n\t}", "@Override\n public int getPoints(){\n\n }", "private static void add(List<Point> points, int param, double value) {\r\n add(points, param, value, false);\r\n }", "public Line() {\r\n this.line = new ArrayList < Point > ();\r\n this.clickedPoint = null;\r\n this.direction = null;\r\n }", "public void addPoint(Point pon)\n {\n poly[size] = pon;\n size++;\n }", "List<GeodeticPoint> getVisibilityCircle(ICoordinate coordinate, int points) throws OrekitException;", "private LineData generateDataLine(int cnt, String name, ArrayList<Double> mainEmotion) {\n\n ArrayList<Entry> values1 = new ArrayList<>();\n\n //int[] val = {(int) happinessr, (int) sadnessr, (int) surpriser, (int) fearr, (int) neutralr, (int) contemptr, (int) angerr, (int) disgustr};\n\n for (int i = 0; i < mainEmotion.size(); i++) {\n values1.add(new Entry(i, mainEmotion.get(i).intValue()));\n }\n\n LineDataSet d1 = new LineDataSet(values1, name);\n d1.setLineWidth(2.5f);\n d1.setCircleRadius(4.5f);\n //Toast.makeText(getContext().getApplicationContext(), name, Toast.LENGTH_LONG).show();\n\n switch (name) {\n case \"Happiness\":\n d1.setColor(Color.rgb(189, 237, 255));\n d1.setCircleColors(Color.rgb(189, 237, 255));\n break;\n case \"Sadness\":\n d1.setColor(Color.rgb(74, 88, 176));\n d1.setCircleColors(Color.rgb(74, 88, 176));\n break;\n case \"Contempt\":\n d1.setColor(Color.rgb(242, 5, 92));\n d1.setCircleColors(Color.rgb(242, 5, 92));\n break;\n case \"Disgust\":\n d1.setColor(Color.rgb(79, 139, 62));\n d1.setCircleColors(Color.rgb(79, 139, 62));\n break;\n case \"Fear\":\n d1.setColor(Color.rgb(89, 72, 122));\n d1.setCircleColors(Color.rgb(89, 72, 122));\n break;\n case \"Surprise\":\n d1.setColor(Color.rgb(205, 185, 39));\n d1.setCircleColors(Color.rgb(205, 185, 39));\n break;\n case \"Anger\":\n d1.setColor(Color.rgb(189, 73, 84));\n d1.setCircleColors(Color.rgb(189, 73, 84));\n break;\n case \"Neutral\":\n d1.setColor(Color.rgb(220, 235, 221));\n d1.setCircleColors(Color.rgb(220, 235, 221));\n break;\n default:\n break;\n\n }\n\n d1.setHighLightColor(Color.rgb(255, 0, 0));\n d1.setDrawValues(false);\n\n ArrayList<Entry> values2 = new ArrayList<>();\n\n for (int i = 0; i < mainEmotion.size(); i++) {\n values2.add(new Entry(i, values1.get(i).getY() - 30));\n }\n\n ArrayList<ILineDataSet> sets = new ArrayList<>();\n sets.add(d1);\n //sets.add(d2);\n\n return new LineData(sets);\n }", "public void givePoints(int amount, PointSource source) {\n // Cannot give a non-positive amount of points\n if (amount < 1) {\n throw new IllegalArgumentException(\"Invalid point amount - cannot be less than 1\");\n }\n\n // Call the event\n PlayerGainSkillPointsEvent event = new PlayerGainSkillPointsEvent(this, amount, source);\n Bukkit.getPluginManager().callEvent(event);\n\n // Add the points if not cancelled\n if (!event.isCancelled()) {\n points += event.getAmount();\n }\n }", "@Override\n protected void onDraw(Canvas canvas) {\n super.onDraw(canvas);\n\n for (int i = 0; i < value_degree.length; i++) {//values2.length; i++) {\n if (i == 0) {\n paint.setColor(COLORS[i]);\n canvas.drawArc(rectf, 0, value_degree[i], true, paint);\n \n } \n else\n {\n temp += value_degree[i - 1];\n paint.setColor(COLORS[i]);\n canvas.drawArc(rectf, temp, value_degree[i], true, paint);\n Log.i(\"sum\"+(temp+value_degree[i]), temp+\" : \"+value_degree[i]);\n\n }\n }\n }", "int getPointsCount();", "public void addEntries(LineChart chart, int point)\n {\n LineData data = chart.getData();\n LineDataSet set;\n\n if(data != null)\n {\n set = data.getDataSetByIndex(0);\n\n if(set == null)\n {\n //Create a DataSet\n set = createSet();\n data.addDataSet(set);\n }\n\n //Add values\n data.addXValue(\"\");\n data.addEntry(new Entry(point, set.getEntryCount()), 0);\n\n //Notify the chart about the new data\n chart.notifyDataSetChanged();\n\n //Limit the number of visible entries\n chart.setVisibleXRange(0, 70);\n\n //Move to the last entry\n chart.moveViewToX(data.getXValCount() - 71);\n\n //Refresh the chart, used for dynamic data readings\n chart.invalidate();\n }\n }", "@Override\n public void run() {\n XYChart.Data<Number, Number> data = new XYChart.Data<>(-x, y);\n data.setNode(new Circle(5, javafx.scene.paint.Color.GREY));\n series.getData().add(data);\n lineChart.getData().add(series);\n }", "public void agregar_linea(RecyclingImageView c)\n {\n array_lineas.add(c);\n }", "public int getPoints() {\r\n\t\treturn points;\r\n\t}", "public void drawCurve (int x1, int y1, int x2, int y2, int x3, int y3 , int x4, int y4,int mylines, Graphics g ){\r\n \tList<Point> points = new ArrayList();\r\n \t//step is var that describes the \r\n \tdouble step = 1/ (double)mylines;\r\n \t//X matrix\r\n \tdouble[] arrX = {x1,x2,x3,x4};\r\n \t//Y matrix\r\n \tdouble[] arrY = {y1,y2,y3,y4};\r\n \t//bezier matrix\r\n \tfinal double [][]bezier = {{-1,3,-3,1},{3,-6,3,0},{-3,3,0,0},{1,0,0,0}};\r\n \t//create the paramters for x and y {a,b,c,d}\r\n \tdouble [] resultX = matrixMultiply(bezier,arrX);\r\n \tdouble [] resultY = matrixMultiply(bezier,arrY);\r\n \t//x,y - the new points calculated on the curve\r\n \tdouble x,y;\r\n \t//calculate points on the curve accroding the Folinm .\r\n\t\tfor (double t = 0; t < 1 ; t+=step)\r\n\t\t{\r\n\t\t\tx = (double) (resultX[0]*t*t*t +resultX[1]*t*t+ resultX[2]*t + resultX[3]);\r\n \t\ty = (double) (resultY[0]*t*t*t +resultY[1]*t*t+ resultY[2]*t + resultY[3]);\r\n\t \tpoints.add(new Point((int)x,(int)y));\r\n \t}\r\n\t\t\r\n\t\t//The curve should end in the (x4,y4) check point\r\n\t\tpoints.add(new Point (x4,y4));\r\n\t\t\r\n\t\t//draw line between all the points \r\n\t for (int i = 0; i < points.size() - 1; i++) {\r\n\t \tdrawLine((int)points.get(i).getX(),(int)points.get(i).getY(), (int)points.get(i+1).getX(),(int)points.get(i+1).getY(),g);\r\n\t }\r\n\t \r\n\t \r\n }", "private static List<Point> genererPointsAlea(int nbPoints) {\n /*List<Point> points = new ArrayList<>();\n Random rand = new Random(0);\n for(int i=0; i<nbPoints; i++) {\n Point p = new Point(rand.nextDouble(), rand.nextDouble());\n points.add(p);\n }\n return points;*/\n return null;\n }", "public void drawLine(Point[] Points,String lineNames){\n\t\tfloat x1 = Points[0].x;\r\n\t\tfloat y1 = Points[0].y;\r\n\t\tfloat x2 = Points[1].x;\r\n\t\tfloat y2 = Points[1].y;\r\n//\t\tString paramLineNames = Arrays.asList(lineNames).toString();\r\n\t\tJSXController.getInstance().invoke(\"createPath\", x1 + \"\",y1 + \"\",x2 + \"\",y2 + \"\",lineNames);\r\n\t}", "public LineManager(LinkedList<ControlPoint> controlPoints, Pane pane){\n\t\tthis.controlPoints = controlPoints;\n\t\tlineLists = new LinkedList<>();\n\t\tlineLists.add(new LinkedList<Line>());\n\t\tbezierCurve = new LinkedList<Line>();\n\t\tthis.pane = pane;\n\t}", "void addLine(int index, Coordinate start, Coordinate end);", "public Map<String, List<DataPoint>> processLines(String[] lines, int linesLimit) throws ParseException {\n Map<String, List<DataPoint>> ret = new LinkedHashMap<>();\r\n //for single thread sending\r\n allPoints = new ArrayList<>();\r\n\r\n String headLine = lines[0].replace(\"\\uFEFF\",\"\").toLowerCase();\r\n String[] separators = new String[]{ \"\\t\", \";\", \",\" };\r\n int sepIndex = 0;\r\n String[] splitted = headLine.split(separators[sepIndex]);\r\n while(splitted.length==1){\r\n sepIndex++;\r\n splitted = headLine.split(separators[sepIndex]);\r\n }\r\n\r\n List<String> headings = Arrays.asList(splitted);\r\n String separator = separators[sepIndex];\r\n\r\n int limit = linesLimit;\r\n if(limit<=0)\r\n limit = lines.length;\r\n logger.debug(\"Processing {} lines\", limit);\r\n\r\n for(int i=1; i<limit; i++){\r\n try {\r\n DataPoint point = new DataPoint(lines[i], headings, separator);\r\n\r\n String shipId = point.getValue(\"ship_id\").toString();\r\n\r\n allPoints.add(point);\r\n\r\n List<DataPoint> shipPoints = new ArrayList<DataPoint>();\r\n if (ret.containsKey(shipId))\r\n shipPoints = ret.get(shipId);\r\n shipPoints.add(point);\r\n ret.put(shipId, shipPoints);\r\n\r\n\r\n }\r\n catch (Exception e){\r\n logger.error(e.getMessage());\r\n }\r\n\r\n }\r\n logger.debug(\"Processing finished\");\r\n return ret;\r\n }", "public void onDraw(Canvas canvas) {\n int measuredHeight = getMeasuredHeight() / 2;\n int paddingLeft = this.mDotRadius + getPaddingLeft();\n int i = 0;\n while (i < this.mDotCount) {\n this.mDotPaint.setColor(i == this.mCurrentIndex ? this.mDotColorSelected : this.mDotColorNormal);\n canvas.drawCircle((float) paddingLeft, (float) measuredHeight, (float) this.mDotRadius, this.mDotPaint);\n paddingLeft += this.mDotInterval;\n i++;\n }\n }", "protected void addGreatCircle(final GeoPoint startPoint, final GeoPoint endPoint, final int numberOfPoints) {\n\t\tfinal double lat1 = startPoint.getLatitude() * MathConstants.DEG2RAD;\n\t\tfinal double lon1 = startPoint.getLongitude() * MathConstants.DEG2RAD;\n\t\tfinal double lat2 = endPoint.getLatitude() * MathConstants.DEG2RAD;\n\t\tfinal double lon2 = endPoint.getLongitude() * MathConstants.DEG2RAD;\n\n\t\tfinal double d = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin((lat1 - lat2) / 2), 2) + Math.cos(lat1) * Math.cos(lat2)\n\t\t\t\t* Math.pow(Math.sin((lon1 - lon2) / 2), 2)));\n\t\tdouble bearing = Math.atan2(Math.sin(lon1 - lon2) * Math.cos(lat2),\n\t\t\t\tMath.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon1 - lon2))\n\t\t\t\t/ -MathConstants.DEG2RAD;\n\t\tbearing = bearing < 0 ? 360 + bearing : bearing;\n\t\t\n\t\tfor (int i = 1; i <= numberOfPoints; i++) {\n\t\t\tfinal double f = 1.0 * i / (numberOfPoints+1);\n\t\t\tfinal double A = Math.sin((1 - f) * d) / Math.sin(d);\n\t\t\tfinal double B = Math.sin(f * d) / Math.sin(d);\n\t\t\tfinal double x = A * Math.cos(lat1) * Math.cos(lon1) + B * Math.cos(lat2) * Math.cos(lon2);\n\t\t\tfinal double y = A * Math.cos(lat1) * Math.sin(lon1) + B * Math.cos(lat2) * Math.sin(lon2);\n\t\t\tfinal double z = A * Math.sin(lat1) + B * Math.sin(lat2);\n\n\t\t\tfinal double latN = Math.atan2(z, Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2)));\n\t\t\tfinal double lonN = Math.atan2(y, x);\n\t\t\taddPoint((int) (latN * MathConstants.RAD2DEG * 1E6), (int) (lonN * MathConstants.RAD2DEG * 1E6));\n\t\t}\n\t}", "public void givePoints(int n) throws RuntimeException {\n if (n < 0)\n throw new RuntimeException(\"n can't be negative\");\n points += n;\n }", "public void addPoint(double x, double y)\t{\n\t\tdouble[][] pointsCopy = new double[points.length][3];\n\t\tfor (int i = 0; i < points.length; i++)\t{\n\t\t\tpointsCopy[i][0] = points[i][0];\n\t\t\tpointsCopy[i][1] = points[i][1];\n\t\t\tpointsCopy[i][2] = points[i][2];\n\t\t}\n\t\tpoints = new double[points.length+1][3];\n\t\tint stopon = 0;\n\t\tfor (int i = 0; i < pointsCopy.length; i++)\t{\n\t\t\tif (x < pointsCopy[i][0]) break;\n\t\t\tstopon = i + 1;\n\t\t\tpoints[i][0] = pointsCopy[i][0];\n\t\t\tpoints[i][1] = pointsCopy[i][1];\n\t\t\tpoints[i][2] = pointsCopy[i][2];\n\t\t}\n\t\tfor (int i = stopon; i < pointsCopy.length; i++)\t{\n\t\t\tpoints[i+1][0] = pointsCopy[i][0];\n\t\t\tpoints[i+1][1] = pointsCopy[i][1];\n\t\t\tpoints[i+1][2] = pointsCopy[i][2];\n\t\t}\n\t\tpoints[stopon][0] = x;\n\t\tpoints[stopon][1] = y;\n\t\tpoints[stopon][2] = lineon;\n\t\tif (x > maxX) maxX = x;\n\t\tif (y > maxY)\tmaxY = y;\n\t\tif (maxX > XEnd) XEnd = maxX;\n\t\tif (maxY > YEnd) YEnd = maxY;\n\t\tif (autoUpdate) repaint();\n\t}" ]
[ "0.62785274", "0.61697185", "0.61681104", "0.5900169", "0.5842977", "0.582654", "0.5814216", "0.5788633", "0.57568586", "0.57240784", "0.56899375", "0.56833047", "0.56664884", "0.5658884", "0.5623702", "0.5623075", "0.56166995", "0.5594599", "0.55865496", "0.55779004", "0.55575573", "0.5537819", "0.55046725", "0.54572153", "0.5444355", "0.54400253", "0.54384834", "0.54302305", "0.5414854", "0.5414012", "0.5403002", "0.5400457", "0.538226", "0.53611374", "0.5359925", "0.53448933", "0.5341707", "0.53404635", "0.5328533", "0.53272235", "0.53167444", "0.53165954", "0.5314797", "0.5314114", "0.5308981", "0.5307753", "0.5304948", "0.52963644", "0.5285869", "0.52846515", "0.5282165", "0.52808994", "0.5270103", "0.5269497", "0.5260817", "0.5255605", "0.5229573", "0.52255887", "0.52219576", "0.5220496", "0.5207508", "0.5190504", "0.51829857", "0.51711947", "0.5170188", "0.51698494", "0.51669353", "0.516216", "0.51615685", "0.5161314", "0.5160875", "0.5160875", "0.5160875", "0.5160875", "0.5158022", "0.5150324", "0.5150156", "0.51497793", "0.51472", "0.5140183", "0.5130884", "0.51301783", "0.5122939", "0.51212996", "0.5112467", "0.5109201", "0.5109025", "0.50955695", "0.5095102", "0.50826055", "0.5082294", "0.5080294", "0.5078295", "0.5075003", "0.50689805", "0.5064804", "0.506177", "0.5059583", "0.50553447", "0.50466096" ]
0.79401517
0
/ Initialize the event handler
@Override public void onEnable() { setGMEventHandler(new GroupManagerEventHandler(this)); onEnable(false); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\r\n\tprotected void initEvents() {\n\t\t\r\n\t}", "private void initializeEvents() {\r\n\t}", "private void eventhandler() {\n\r\n\t}", "public void init() {\r\n setEventType(4);\r\n }", "@Override\r\n\tpublic void initEvent() {\n\r\n\t}", "public void initEventsAndProperties() {\r\n }", "private void initListener() {\n }", "private void initHandlers(){\n\t\tlabel.setOnMouseClicked(new EventHandler<MouseEvent>() {\n\t\t\tpublic void handle(MouseEvent e) {\n\t\t\t\tfor(TLEventLabel label : eventLabels){\n\t\t\t\t\tlabel.setSelected(false);\n\t\t\t\t}\n\t\t\t\tsetSelected(true);\n\t\t\t\tnew Thread(new Runnable() {\n\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\tmodel.selectEvent(event);\n\t\t\t\t\t}\n\t\t\t\t}).start();\n\t\t\t}\n\t\t});\n\t}", "@Override\n protected void initEventAndData() {\n }", "private void initEvent() {\n\t\tmBtnPower.setOnClickListener(this);\n\t\tmBtnProfile.setOnClickListener(this);\n\t\tmBtnArea.setOnClickListener(this);\n\t\tmBtnSkipTime.setOnClickListener(this);\n\t\tmBtnFrequencyPoint.setOnClickListener(this);\n\t\tmBtnAlgorithm.setOnClickListener(this);\n\t}", "private void initEvents() {\n\t\tuser_head_img.setOnClickListener(this);\r\n\t\ttxt_zcgl.setOnClickListener(this);\r\n\t\ttxt_tzgl.setOnClickListener(this);\r\n\t\ttxt_jlcx.setOnClickListener(this);\r\n\t\ttxt_wdyhk.setOnClickListener(this);\r\n\t\ttxt_wdxx.setOnClickListener(this);\r\n\t\tlayout_zhaq.setOnClickListener(this);\r\n\t\tlayout_ssmm.setOnClickListener(this);\r\n\t\ttxt_myredpager.setOnClickListener(this);\r\n\t}", "@Override\n protected void initializeEventList()\n {\n }", "protected void initEvent() {\n\t\tbase_ib.setOnClickListener(new OnClickListener() {\n\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\n\t\t\t\tmainActivity.getSlidingMenu().toggle();\n\n\t\t\t}\n\t\t});\n\t}", "public void initListener() {\n }", "@Override\n\tprotected void initListener() {\n\n\t}", "public void onInitHandler() {\n }", "@Override\r\n\tpublic void initListener() {\n\r\n\t}", "private void initListener() {\n initPieceListener();\n initButtonsListener();\n }", "@Override\r\n\tprotected void bindEvents() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void bindEvents() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initListener() {\n\t\tsuper.initListener();\r\n\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\t\t\t\t \n\t\t\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\t\t\t\t \n\t\t\t}", "@Override\r\n\tpublic void onEvent(Object e) {\n\t}", "private void createEvents() {\n\t}", "public void initEventHandle() {\n this.gui.getTblVerify().addMouseListener(new MouseAdapter() {\n public void mousePressed(MouseEvent evt) {\n if (SwingUtilities.isRightMouseButton(evt)) {\n gui.getPopupVerifySign().show(evt.getComponent(), evt.getX(), evt.getY());\n }\n }\n });\n\n // Handle get prepare files to sign\n // Drag and Drop files to get prepare verify list files\n this.gui.getLblSelFileToVerify().setDropTarget(new DropTarget() {\n public synchronized void drop(DropTargetDropEvent evt) {\n try {\n evt.acceptDrop(DnDConstants.ACTION_COPY);\n List<File> droppedFiles = (List<File>) evt.getTransferable().getTransferData(DataFlavor.javaFileListFlavor);\n loadFiles(droppedFiles);\n } catch (Exception ex) {\n ex.printStackTrace();\n }\n }\n });\n\n // Open result folder after verify\n this.gui.getMenuItemVerifyOpenFolder().addMouseListener(new MouseAdapter() {\n public void mousePressed(MouseEvent evt) {\n\n }\n });\n\n // Remove files\n this.gui.getMenuItemVerifyRemoveFile().addMouseListener(new MouseAdapter() {\n public void mousePressed(MouseEvent evt) {\n gui.getPopupVerifySign().setVisible(false);\n removeFiles();\n }\n });\n\n // Single verify\n this.gui.getBtnVerify().addMouseListener(new MouseAdapter() {\n public void mousePressed(MouseEvent evt) {\n handleVerify(false);\n }\n });\n\n this.gui.getBtnDoubleVerify().addMouseListener(new MouseAdapter() {\n public void mousePressed(MouseEvent evt) {\n handleVerify(true);\n }\n });\n\n // Clicked open folder\n this.gui.getMenuItemVerifyOpenFolder().addMouseListener(new MouseAdapter() {\n public void mousePressed(MouseEvent evt) {\n handleOpenFolder();\n }\n });\n }", "private void init() {\n\r\n\t\tmyTerminal.inputSource.addUserInputEventListener(this);\r\n//\t\ttextSource.addUserInputEventListener(this);\r\n\r\n\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\n\t\t\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\n\t\t\t}", "private void init() {\n mEventBus = new AsyncEventBus(new HandlerExecutor());\n mEventBus.register(this);\n }", "public void initListener() {\n this.mSearchView.setOnQueryTextListener(this);\n this.mTopDisplayAdapter.setOnItemClickListener(new BaseSearchContactActivity$$Lambda$2(this));\n this.mSearchAdapter.setOnItemClickListener(new BaseSearchContactActivity$$Lambda$3(this));\n }", "private void initEvent() {\n airConditional.getAirTempIndexLabel().addPropertyChangeListener(new PropertyChangeListener() {\n public void propertyChange(PropertyChangeEvent evt) {\n airTempStateChanged(evt);\n }\n });\n }", "private void registerEvents() {\n MouseEventHandler handler = new MouseEventHandler();\n setOnMousePressed(handler);\n setOnMouseReleased(handler);\n setOnMouseMoved(handler);\n setOnMouseEntered(handler);\n setOnMouseExited(handler);\n\n }", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\t\t\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\t\t\t}", "@Override\n\t\t\tpublic void handleEvent(Event event) {\n\t\t\t}", "public static void init() {\r\n load();\r\n registerEventListener();\r\n }", "private void init() {\n initView();\n setListener();\n }", "EventManager()\n {\n }", "private void setListener() {\n\t}", "public M_Hompeage1_evt() {\n initComponents();\n }", "private void setupMouseEventHandlers() {\n this.setOnMouseClicked(event -> {\n if (event.getButton() == MouseButton.PRIMARY) {\n fireEvent(new MenuSelectedEvent(\n MenuManager.MenuType.BUILDING, this.getSpriteType(),\n event.getSceneX(), event.getSceneY()));\n }\n });\n }", "@Override\n\tpublic void handleEvent(Event arg0) {\n\t\t\n\t}", "private void initializeHandlers() {\n ivBack.setOnClickListener(this);\n }", "@Override\r\n\tpublic void handleEvent(Event event) {\n\r\n\t}", "@Override\r\n\tpublic void onEvent(Event arg0) {\n\r\n\t}", "public void consulterEvent() {\n\t\t\n\t}", "public void init(FMLInitializationEvent event) {\n }", "@Override\n\tprotected void initListeners() {\n\t\t\n\t}", "private void listenersInitiation() {\n ActionSelectors listener = new ActionSelectors();\n submit.addActionListener(listener);\n goBack.addActionListener(listener);\n }", "private void initEvents() {\r\n\t\teventPool = new EventPool();\r\n\t\teventPool.addEvent(new BlockGeneratorEvent(this));\r\n\t\teventPool.addEvent(new BlockOffScreenEvent(this));\r\n\t\teventPool.addEvent(new DeathEvent(myDropThis, this));\r\n\t}", "public void onInitHandle() {\n }", "public static void init(FMLInitializationEvent event) {\n }", "private void initEvents(){\n ArrayList<Event> en = new ArrayList();\n en.add(new Event_MessangerOfGods(this.village));\n en.add(new Event_PaganPriest(this.village));\n this.events = en;\n }", "Event () {\n // Nothing to do here.\n }", "public void initListeners() {\n\t\tlogoGrabListener = new LogoGrabListener() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onResponse(JSONObject response) {\n\t\t\t\tLog.i(TAG, \"LogoGrab Application responded with: \" + response.toString());\n\t\t\t}\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onError(String error) {\n\t\t\t\tLog.e(TAG, error);\n\t\t\t}\n\t\t};\n\t\t\n\t\t// set LogoGrabListener\n\t\tLogoGrabInterface.setLogoGrabListener(logoGrabListener);\n\t\t\n\t\t\n\t\t// init OnClickListener\n\t\tonClickListener = new OnClickListener() {\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tLogoGrabInterface.startLogoGrab(MainActivity.this);\n\t\t\t}\n\t\t};\n\t\t\n\t\t// set OnClickListener\n\t\tlogoGrabButton.setOnClickListener(onClickListener);\n\t}", "@FXML private void initialize(){\n\n\t\t//Attach Event Handlers\n\t\tbtnLoadLog.setOnAction(new EventHandler<ActionEvent>(){\n\t\t\tpublic void handle(ActionEvent e){\n\t\t\t\tonLoadLogClicked();\n\t\t\t}\n\t\t});\n\n\t\tbtnClearLog.setOnAction(new EventHandler<ActionEvent>(){\n\t\t\tpublic void handle(ActionEvent e){\n\t\t\t\tonClearClicked();\n\t\t\t}\n\t\t});\n\n\t\tbtnSaveLog.setOnAction(new EventHandler<ActionEvent>(){\n\t\t\tpublic void handle(ActionEvent e){\n\t\t\t\tonSaveClicked();\n\t\t\t}\n\t\t});\n\n\t}", "public EventHandlerRegistry() {\n }", "@Override\r\n\tpublic void startEvent() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void startEvent() {\n\t\t\r\n\t}", "public void startEventHandler() {\n Thread eventThread = new Thread(this, \"Nxt Event Handler\");\n eventThread.setDaemon(true);\n eventThread.start();\n }", "@Override\n public void onCreate() {\n super.onCreate();\n handler = new Handler();\n BusProvider.register(this);\n }", "public MouseHandler()\n {\n // initialise instance variables:\n //INSTANTIATE listeners list:\n _listeners = new ArrayList<IMouseListener>();\n \n }", "@Override\r\n\tpublic void initListeners() {\n\t\t\r\n\t}", "public MainEvent() {\n super.register(new HelloWorld());\n }", "@Override\n\tprotected void setListener() {\n\n\t}", "@Override\n\tprotected void setListener() {\n\n\t}", "@Override\n public void onCreate() {\n super.onCreate();\n mHandler = new Handler();\n }", "@Mod.EventHandler\r\n\tpublic void Init(FMLInitializationEvent event)\r\n\t{\r\n\t\t//GUI register\r\n\t\tNetworkRegistry.INSTANCE.registerGuiHandler(this, new GuiHandler());\r\n\t\t\r\n\t\tModOres.oreDictRegister();\r\n\t\t\r\n\t\tModEvents.init();\r\n\t\t\r\n//\t\tModRecipes.init(); //TODO dep\r\n\t\t\r\n\t\tLogHelper.info(\"INFO: Init completed.\");\r\n\t\t\r\n\t\t//Waila tooltip provider TODO\r\n //FMLInterModComms.sendMessage(\"Waila\", \"register\", \"com.lulan.shincolle.waila.WailaDataProvider.callbackRegister\");\r\n\t}", "private void myInit() {\n init_key();\n init_tbl_messages();\n\n init_tbl_members();\n data_cols_members();\n tbl_members.addMouseListener(new MouseAdapter() {\n @Override\n public void mouseClicked(MouseEvent e) {\n select_member();\n }\n });\n }", "public void createEvents(){\r\n\t\tbtnCurrent.addActionListener((ActionEvent e) -> JLabelDialog.run());\r\n\t}", "public MEventHandler() {\r\n this(false);\r\n }", "@Override\n\tpublic void onStart() {\n\t\tsuper.onStart();\n\t\tdisplayEvent();\n\t}", "@Override\n public void init() {\n f = new SampleFrame2(\"Handle Mouse events.\");\n f.setSize(300, 200);\n f.setVisible(true);\n\n // register this object to receive its own mouse events\n addMouseListener(this);\n addMouseMotionListener(this);\n }", "protected void initSDK() {\n\t\tSMSSDK.initSDK(this,\"672e0e8c7203\",\"c3728cc22e8e1d75501de2a100b4586c\");\n\t\tEventHandler eventHandler = new EventHandler() {\n\t\t\tpublic void afterEvent(int event, int result, Object data) {\n\t\t\t\tMessage msg = new Message();\n\t\t\t\tmsg.arg1 = event;\n\t\t\t\tmsg.arg2 = result;\n\t\t\t\tmsg.obj = data;\n\t\t\t\thandler.sendMessage(msg);\n\t\t\t}\n\t\t};\n\t\n\t\tSMSSDK.registerEventHandler(eventHandler);\n\t\tready=true;\n\t}", "protected ICEvent() {}", "@EventHandler\n\tpublic void init(FMLInitializationEvent event) {\n\t}", "private void setupEventHandlers() {\n myMap.addEventHandler(MapViewEvent.MAP_CLICKED, event -> {\n event.consume();\n final Coordinate newPosition = event.getCoordinate().normalize();\n latitude.setText(newPosition.getLatitude().toString());\n longitude.setText(newPosition.getLongitude().toString());\n\n this.markerClick.setPosition(newPosition);\n this.myMap.addMarker(this.markerClick);\n });\n }", "@Override\r\n\tpublic void setListener() {\n\r\n\t}", "@Override\r\n\tpublic void setListener() {\n\r\n\t}", "private void setupEventListeners(){\n\t\t//Check boxes.k\n\t\tchkVisible.addClickHandler(new ClickHandler(){\n\t\t\tpublic void onClick(ClickEvent event){\n\t\t\t\t((QuestionDef)propertiesObj).setVisible(chkVisible.getValue() == true);\n\t\t\t\tformChangeListener.onFormItemChanged(propertiesObj);\n\t\t\t}\n\t\t});\n\n\t\tchkEnabled.addClickHandler(new ClickHandler(){\n\t\t\tpublic void onClick(ClickEvent event){\n\t\t\t\t((QuestionDef)propertiesObj).setEnabled(chkEnabled.getValue() == true);\n\t\t\t\tformChangeListener.onFormItemChanged(propertiesObj);\n\t\t\t}\n\t\t});\n\n\t\tchkLocked.addClickHandler(new ClickHandler(){\n\t\t\tpublic void onClick(ClickEvent event){\n\t\t\t\t((QuestionDef)propertiesObj).setLocked(chkLocked.getValue() == true);\n\t\t\t\tformChangeListener.onFormItemChanged(propertiesObj);\n\t\t\t}\n\t\t});\n\n\t\tchkRequired.addClickHandler(new ClickHandler(){\n\t\t\tpublic void onClick(ClickEvent event){\n\t\t\t\t((QuestionDef)propertiesObj).setRequired(chkRequired.getValue() == true);\n\t\t\t\tformChangeListener.onFormItemChanged(propertiesObj);\n\t\t\t}\n\t\t});\n\n\t\t//Text boxes.\n\t\ttxtDefaultValue.addChangeHandler(new ChangeHandler(){\n\t\t\tpublic void onChange(ChangeEvent event){\n\t\t\t\tif(checkDefaultValueAgainstQuestionType()){\n\t\t\t\t\tupdateDefaultValue();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\ttxtDefaultValue.addKeyUpHandler(new KeyUpHandler(){\n\t\t\tpublic void onKeyUp(KeyUpEvent event) {\n\t\t\t\tif(checkDefaultValueAgainstQuestionType()){\n\t\t\t\t\tupdateDefaultValue();\n\t\t\t\t}\n\t\t\t\telse{\n\t\t\t\t\tWindow.alert(LocaleText.get(\"invalidDefaultValueForQuestionType\"));\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\ttxtHelpText.addChangeHandler(new ChangeHandler(){\n\t\t\tpublic void onChange(ChangeEvent event){\n\t\t\t\tupdateHelpText();\n\t\t\t}\n\t\t});\n\t\ttxtHelpText.addKeyUpHandler(new KeyUpHandler(){\n\t\t\tpublic void onKeyUp(KeyUpEvent event) {\n\t\t\t\tupdateHelpText();\n\t\t\t}\n\t\t});\n\n\t\ttxtHelpText.addKeyDownHandler(new KeyDownHandler(){\n\t\t\tpublic void onKeyDown(KeyDownEvent event) {\n\t\t\t\tint keyCode = event.getNativeKeyCode();\n\t\t\t\tif(keyCode == KeyCodes.KEY_ENTER || keyCode == KeyCodes.KEY_DOWN)\n\t\t\t\t\tcbDataType.setFocus(true);\n\t\t\t\telse if(keyCode == KeyCodes.KEY_UP){\n\t\t\t\t\ttxtText.setFocus(true);\n\t\t\t\t\ttxtText.selectAll();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\ttxtBinding.addChangeHandler(new ChangeHandler(){\n\t\t\tpublic void onChange(ChangeEvent event){\n\t\t\t\tupdateBinding();\n\t\t\t}\n\t\t});\n\t\ttxtBinding.addKeyUpHandler(new KeyUpHandler(){\n\t\t\tpublic void onKeyUp(KeyUpEvent event) {\n\t\t\t\tString s = txtBinding.getText();\n\n\t\t\t\ts = s.replace(\"%\", \"\");\n\t\t\t\ts = s.replace(\"(\", \"\");\n\t\t\t\ts = s.replace(\"!\", \"\");\n\t\t\t\ts = s.replace(\"&\", \"\");\n\t\t\t\t//s = s.replace(\".\", \"\"); //Looks like this is an allowed character in xml node names.\n\t\t\t\ts = s.replace(\"'\", \"\");\n\t\t\t\ts = s.replace(\"\\\"\", \"\");\n\t\t\t\ts = s.replace(\"$\", \"\");\n\t\t\t\ts = s.replace(\"#\", \"\");\n\n\t\t\t\ttxtBinding.setText(s);\n\t\t\t\tupdateBinding();\n\t\t\t}\n\t\t});\n\n\t\ttxtBinding.addKeyDownHandler(new KeyDownHandler(){\n\t\t\tpublic void onKeyDown(KeyDownEvent event) {\n\t\t\t\tif(event.getNativeKeyCode() == KeyCodes.KEY_UP){\n\t\t\t\t\tif(cbDataType.isEnabled())\n\t\t\t\t\t\tcbDataType.setFocus(true);\n\t\t\t\t\telse{\n\t\t\t\t\t\ttxtText.setFocus(true);\n\t\t\t\t\t\ttxtText.selectAll();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\ttxtBinding.addKeyPressHandler(new KeyPressHandler(){\n\t\t\tpublic void onKeyPress(KeyPressEvent event) {\n\t\t\t\tif(propertiesObj instanceof PageDef){\n\t\t\t\t\tif(!Character.isDigit(event.getCharCode())){\n\t\t\t\t\t\t((TextBox) event.getSource()).cancelKey(); \n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\telse if(propertiesObj instanceof FormDef || propertiesObj instanceof QuestionDef){\n\t\t\t\t\tif(((TextBox) event.getSource()).getCursorPos() == 0){\n\t\t\t\t\t\tif(!isAllowedXmlNodeNameStartChar(event.getCharCode())){\n\t\t\t\t\t\t\t((TextBox) event.getSource()).cancelKey(); \n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if(!isAllowedXmlNodeNameChar(event.getCharCode())){\n\t\t\t\t\t\t((TextBox) event.getSource()).cancelKey(); \n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t} //else OptionDef varname can be anything\n\t\t\t}\n\t\t});\n\n\t\ttxtText.addChangeHandler(new ChangeHandler(){\n\t\t\tpublic void onChange(ChangeEvent event){\n\t\t\t\tString orgText = getSelObjetOriginalText();\n\t\t\t\tupdateText();\n\t\t\t\tupdateSelObjBinding(orgText);\n\t\t\t}\n\t\t});\n\t\ttxtText.addKeyUpHandler(new KeyUpHandler(){\n\t\t\tpublic void onKeyUp(KeyUpEvent event) {\n\t\t\t\tString orgText = getSelObjetOriginalText();\n\t\t\t\tupdateText();\n\t\t\t\tupdateSelObjBinding(orgText);\n\t\t\t}\n\t\t});\n\n\t\ttxtText.addKeyDownHandler(new KeyDownHandler(){\n\t\t\tpublic void onKeyDown(KeyDownEvent event) {\n\t\t\t\tif(event.getNativeKeyCode() == KeyCodes.KEY_ENTER || event.getNativeKeyCode() == KeyCodes.KEY_DOWN){\n\t\t\t\t\tif(txtHelpText.isEnabled())\n\t\t\t\t\t\ttxtHelpText.setFocus(true);\n\t\t\t\t\telse{\n\t\t\t\t\t\ttxtBinding.setFocus(true);\n\t\t\t\t\t\ttxtBinding.selectAll();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\ttxtDescTemplate.addChangeHandler(new ChangeHandler(){\n\t\t\tpublic void onChange(ChangeEvent event){\n\t\t\t\tupdateDescTemplate();\n\t\t\t}\n\t\t});\n\t\ttxtDescTemplate.addKeyUpHandler(new KeyUpHandler(){\n\t\t\tpublic void onKeyUp(KeyUpEvent event) {\n\t\t\t\tupdateDescTemplate();\n\t\t\t}\n\t\t});\n\n\t\ttxtCalculation.addChangeHandler(new ChangeHandler(){\n\t\t\tpublic void onChange(ChangeEvent event){\n\t\t\t\tupdateCalculation();\n\t\t\t}\n\t\t});\n\t\ttxtCalculation.addKeyUpHandler(new KeyUpHandler(){\n\t\t\tpublic void onKeyUp(KeyUpEvent event) {\n\t\t\t\tupdateCalculation();\n\t\t\t}\n\t\t});\n\n\t\t//Combo boxes\n\t\tcbDataType.addClickHandler(new ClickHandler(){\n\t\t\tpublic void onClick(ClickEvent event){\n\t\t\t\tupdateDataType();\n\t\t\t}\n\t\t});\n\t\tcbDataType.addChangeHandler(new ChangeHandler(){\n\t\t\tpublic void onChange(ChangeEvent event){\n\t\t\t\tupdateDataType();\n\t\t\t}\n\t\t});\n\t\tcbDataType.addKeyDownHandler(new KeyDownHandler(){\n\t\t\tpublic void onKeyDown(KeyDownEvent event) {\n\t\t\t\tint keyCode = event.getNativeEvent().getKeyCode();\n\t\t\t\tif(keyCode == KeyCodes.KEY_ENTER || keyCode == KeyCodes.KEY_DOWN){\n\t\t\t\t\ttxtBinding.setFocus(true);\n\t\t\t\t\ttxtBinding.selectAll();\n\t\t\t\t}\n\t\t\t\telse if(keyCode == KeyCodes.KEY_UP){\n\t\t\t\t\ttxtHelpText.setFocus(true);\n\t\t\t\t\ttxtHelpText.selectAll();\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\ttxtFormKey.addChangeHandler(new ChangeHandler(){\n\t\t\tpublic void onChange(ChangeEvent event){\n\t\t\t\tupdateFormKey();\n\t\t\t}\n\t\t});\n\t\ttxtFormKey.addKeyUpHandler(new KeyUpHandler(){\n\t\t\tpublic void onKeyUp(KeyUpEvent event) {\n\t\t\t\tupdateFormKey();\n\t\t\t}\n\t\t});\n\t}", "@Override\n public void handle(Event event) {\n }", "public void tmplInitialize(TemplateEvent e) {\r\n }", "@Override\r\n\tprotected void initEvent() {\n\t\ttimer = new Timer(1000, new ActionListener() {\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\t// TODO Auto-generated method stub\r\n\t\t\t\ttimer_tick(e);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t}", "public void tmplInitialize( TemplateEvent e ) {\r\n }", "@Override\n public void onReady(ReadyEvent event) {\n\n }", "public void init() {\n\n // sends a callback when the mouse is moved\n glfwSetCursorPosCallback(window.getWindowHandle(), (window, xpos, ypos) -> {\n currentPos.x = xpos;\n currentPos.y = ypos;\n });\n // sends a callback when the mouse enters the window\n glfwSetCursorEnterCallback(window.getWindowHandle(), (windowHandle, entered) -> {\n inWindow = entered;\n });\n // sends a callback when one action occurs\n glfwSetMouseButtonCallback(window.getWindowHandle(), (windowHandle, button, action, mode) -> {\n // checks is the left mouse button is pressed\n leftButtonPressed = button == GLFW_MOUSE_BUTTON_1 && action == GLFW_PRESS;\n });\n }", "protected void init() {\n /* 66 */\n super.init();\n /* */\n /* 68 */\n this.mChartTouchListener = new PieRadarChartTouchListener(this);\n /* */\n }", "private void setListener() {\n\t\tmSlidingLayer.setOnInteractListener(this);\r\n\t\tmMsgNotifySwitch.setOnCheckedChangeListener(this);\r\n\t\tmMsgSoundSwitch.setOnCheckedChangeListener(this);\r\n\t\tmShowHeadSwitch.setOnCheckedChangeListener(this);\r\n\t\tmAccountSetting.setOnClickListener(this);\r\n\t\tmMyProfile.setOnClickListener(this);\r\n\t\tmFaceJazzEffect.setOnClickListener(this);\r\n\t\tmAcountInfo.setOnClickListener(this);\r\n\t\tmFeedBack.setOnClickListener(this);\r\n\t\tmExitAppBtn.setOnClickListener(this);\r\n\r\n\t}", "@Override\n\tpublic void initListeners() {\n\t\tmClick.setOnClickListener(this);\n\t}", "private void init() {\n listeners = new PropertyChangeSupport(this);\n }", "public void setupEvent(Controller controller) {\n this.cylinderContainer.setOnMouseClicked(e -> controller.setSelectedPiece(this));\n }", "public void init()\n\t{\n\t\taddKeyListener(this);\n\t\taddMouseListener(this);\n\t\taddMouseMotionListener(this);\n\t\n\t}", "private void addEventHandlers()\n {\n DepartureBox self = this;\n\n departureTimeField.textProperty().addListener((observable, oldValue, newValue) -> {\n if (null != currentDeparture) {\n Change<Departure, String> change = new Change<>(currentDeparture, oldValue, newValue, \"departureTime\");\n self.execute(IEventListener.EVENT_CHANGE, change, \"depbox\");\n }\n });\n\n destinationField.textProperty().addListener((observable, oldValue, newValue) -> {\n if (null != currentDeparture) {\n Change<Departure, String> change = new Change<>(currentDeparture, oldValue, newValue, \"destination\");\n self.execute(IEventListener.EVENT_CHANGE, change, \"depbox\");\n }\n });\n }", "public void addHandler(EventHandler handler);", "public void handleEvent(Event event) {\n\t\t\t\t}", "public CallbackHandler() {\r\n // TODO Auto-generated constructor stub\r\n }", "private void createMainEvents() {\n\t\taddWindowListener(new WindowAdapter() {\n\t\t\t@Override\n\t\t\tpublic void windowClosing(WindowEvent arg0) {\n\t\t\t\tjdbc.closeSQLConnection();\n\t\t\t}\n\t\t});\n\t\t\n\t\tbtn_settings.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t}\n\t\t});\n\n\t}" ]
[ "0.79296315", "0.78209746", "0.74354905", "0.7368418", "0.7336461", "0.72025937", "0.7154433", "0.71273965", "0.71203536", "0.7082328", "0.70365953", "0.6956832", "0.6935094", "0.6920438", "0.69000995", "0.6782885", "0.676704", "0.6761415", "0.6757891", "0.6757891", "0.67532796", "0.674496", "0.674496", "0.66903937", "0.66866624", "0.66545945", "0.664912", "0.6645366", "0.6645366", "0.6645366", "0.6645366", "0.6645366", "0.6636404", "0.66350913", "0.6613551", "0.66124374", "0.6606159", "0.6606159", "0.6606159", "0.65714633", "0.65407723", "0.6535002", "0.65193105", "0.6516073", "0.64832747", "0.6481935", "0.6468198", "0.6466648", "0.64581937", "0.6458068", "0.6454234", "0.64520717", "0.64442444", "0.6426883", "0.6421354", "0.6404614", "0.63879293", "0.6387204", "0.63699925", "0.63618976", "0.6345632", "0.63445187", "0.63445187", "0.6332338", "0.6329481", "0.63243926", "0.63134474", "0.6302145", "0.6292738", "0.6292738", "0.62802786", "0.62800103", "0.627521", "0.62695014", "0.6267899", "0.6245299", "0.62408024", "0.6238706", "0.62341505", "0.6232233", "0.6226066", "0.62224567", "0.62224567", "0.62195116", "0.6216536", "0.6208574", "0.62008834", "0.6197306", "0.6189522", "0.6180845", "0.61639464", "0.61590445", "0.61514246", "0.6150607", "0.6119125", "0.61129963", "0.6109313", "0.61086607", "0.6092099", "0.607599", "0.6071431" ]
0.0
-1
Called when a command registered by this plugin is received.
@Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { boolean playerCanDo = false; boolean isConsole = false; Player senderPlayer = null, targetPlayer = null; Group senderGroup = null; User senderUser = null; boolean isOpOverride = config.isOpOverride(); boolean isAllowCommandBlocks = config.isAllowCommandBlocks(); // PREVENT GM COMMANDS BEING USED ON COMMANDBLOCKS if (sender instanceof BlockCommandSender && !isAllowCommandBlocks) { Block block = ((BlockCommandSender)sender).getBlock(); GroupManager.logger.warning(ChatColor.RED + "GM Commands can not be called from CommandBlocks"); GroupManager.logger.warning(ChatColor.RED + "Location: " + ChatColor.GREEN + block.getWorld().getName() + ", " + block.getX() + ", " + block.getY() + ", " + block.getZ()); return true; } // DETERMINING PLAYER INFORMATION if (sender instanceof Player) { senderPlayer = (Player) sender; if (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase("manload")) { sender.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'."); return true; } senderUser = worldsHolder.getWorldData(senderPlayer).getUser(senderPlayer.getUniqueId().toString()); senderGroup = senderUser.getGroup(); isOpOverride = (isOpOverride && (senderPlayer.isOp() || worldsHolder.getWorldPermissions(senderPlayer).has(senderPlayer, "groupmanager.op"))); if (isOpOverride || worldsHolder.getWorldPermissions(senderPlayer).has(senderPlayer, "groupmanager." + cmd.getName())) { playerCanDo = true; } } else { if (!lastError.isEmpty() && !commandLabel.equalsIgnoreCase("manload")) { sender.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'."); return true; } isConsole = true; } // PERMISSIONS FOR COMMAND BEING LOADED dataHolder = null; permissionHandler = null; if (senderPlayer != null) { dataHolder = worldsHolder.getWorldData(senderPlayer); } String selectedWorld = selectedWorlds.get(sender.getName()); if (selectedWorld != null) { dataHolder = worldsHolder.getWorldData(selectedWorld); } if (dataHolder != null) { permissionHandler = dataHolder.getPermissionsHandler(); } // VARIABLES USED IN COMMANDS int count; PermissionCheckResult permissionResult = null; ArrayList<User> removeList = null; String auxString = null; List<String> match = null; User auxUser = null; Group auxGroup = null; Group auxGroup2 = null; GroupManagerPermissions execCmd = null; try { execCmd = GroupManagerPermissions.valueOf(cmd.getName()); } catch (Exception e) { // this error happened once with someone. now im prepared... i think GroupManager.logger.severe("==================================================="); GroupManager.logger.severe("= ERROR REPORT START ="); GroupManager.logger.severe("==================================================="); GroupManager.logger.severe("= COPY AND PASTE THIS TO A GROUPMANAGER DEVELOPER ="); GroupManager.logger.severe("==================================================="); GroupManager.logger.severe(this.getDescription().getName()); GroupManager.logger.severe(this.getDescription().getVersion()); GroupManager.logger.severe("An error occured while trying to execute command:"); GroupManager.logger.severe(cmd.getName()); GroupManager.logger.severe("With " + args.length + " arguments:"); for (String ar : args) { GroupManager.logger.severe(ar); } GroupManager.logger.severe("The field '" + cmd.getName() + "' was not found in enum."); GroupManager.logger.severe("And could not be parsed."); GroupManager.logger.severe("FIELDS FOUND IN ENUM:"); for (GroupManagerPermissions val : GroupManagerPermissions.values()) { GroupManager.logger.severe(val.name()); } GroupManager.logger.severe("==================================================="); GroupManager.logger.severe("= ERROR REPORT ENDED ="); GroupManager.logger.severe("==================================================="); sender.sendMessage("An error occurred. Ask the admin to take a look at the console."); } if (isConsole || playerCanDo) { switch (execCmd) { case manuadd: // Validating arguments if ((args.length != 2) && (args.length != 3)) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manuadd <player> <group> | optional [world])"); return true; } // Select the relevant world (if specified) if (args.length == 3) { dataHolder = worldsHolder.getWorldData(args[2]); permissionHandler = dataHolder.getPermissionsHandler(); } // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } auxGroup = dataHolder.getGroup(args[1]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return false; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly."); return false; } // Validating permissions if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "Can't modify a player with the same permissions as you, or higher."); return true; } if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) { sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher."); return true; } if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getUUID(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getUUID(), auxGroup.getName()))) { sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit."); return true; } // Seems OK auxUser.setGroup(auxGroup); if (!sender.hasPermission("groupmanager.notify.other") || (isConsole)) sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getLastName() + "' group to '" + auxGroup.getName() + "' in world '" + dataHolder.getName() + "'."); return true; case manudel: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manudel <player>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return true; } // Seems OK dataHolder.removeUser(auxUser.getUUID()); sender.sendMessage(ChatColor.YELLOW + "You changed player '" + auxUser.getLastName() + "' to default settings."); // If the player is online, this will create new data for the user. if(auxUser.getUUID() != null) { targetPlayer = this.getServer().getPlayer(UUID.fromString(auxUser.getUUID())); if (targetPlayer != null) BukkitPermissions.updatePermissions(targetPlayer); } return true; case manuaddsub: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) { sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed."); sender.sendMessage(ChatColor.RED + "Use /manselect <world>"); return true; } } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manuaddsub <player> <group>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } auxGroup = dataHolder.getGroup(args[1]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return true; } // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return true; } if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) { sender.sendMessage(ChatColor.RED + "The sub-group can't be the same as yours, or higher."); return true; } if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getUUID(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getUUID(), auxGroup.getName()))) { sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit."); return true; } // Seems OK if (auxUser.addSubGroup(auxGroup)) sender.sendMessage(ChatColor.YELLOW + "You added subgroup '" + auxGroup.getName() + "' to player '" + auxUser.getLastName() + "'."); else sender.sendMessage(ChatColor.RED + "The subgroup '" + auxGroup.getName() + "' is already available to '" + auxUser.getLastName() + "'."); return true; case manudelsub: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manudelsub <user> <group>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } auxGroup = dataHolder.getGroup(args[1]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return true; } // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return true; } // Seems OK auxUser.removeSubGroup(auxGroup); sender.sendMessage(ChatColor.YELLOW + "You removed subgroup '" + auxGroup.getName() + "' from player '" + auxUser.getLastName() + "' list."); // targetPlayer = this.getServer().getPlayer(auxUser.getName()); // if (targetPlayer != null) // BukkitPermissions.updatePermissions(targetPlayer); return true; case mangadd: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangadd <group>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup != null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group already exists!"); return true; } // Seems OK auxGroup = dataHolder.createGroup(args[0]); sender.sendMessage(ChatColor.YELLOW + "You created a group named: " + auxGroup.getName()); return true; case mangdel: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangdel <group>)"); return false; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } // Seems OK dataHolder.removeGroup(auxGroup.getName()); sender.sendMessage(ChatColor.YELLOW + "You deleted a group named " + auxGroup.getName() + ", it's users are default group now."); BukkitPermissions.updateAllPlayers(); return true; case manuaddp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length < 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manuaddp <player> <permission> [permission2] [permission3]...)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating your permissions if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "Can't modify player with same group than you, or higher."); return true; } for (int i = 1; i < args.length; i++) { auxString = args[i].replace("'", ""); permissionResult = permissionHandler.checkFullUserPermission(senderUser, auxString); if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { sender.sendMessage(ChatColor.RED + "You can't add a permission you don't have: '" + auxString + "'"); continue; } // Validating permissions of user permissionResult = permissionHandler.checkUserOnlyPermission(auxUser, auxString); if (checkPermissionExists(sender, auxString, permissionResult, "user")) { continue; } // Seems Ok auxUser.addPermission(auxString); sender.sendMessage(ChatColor.YELLOW + "You added '" + auxString + "' to player '" + auxUser.getLastName() + "' permissions."); } targetPlayer = this.getServer().getPlayer(auxUser.getLastName()); if (targetPlayer != null) BukkitPermissions.updatePermissions(targetPlayer); return true; case manudelp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length < 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manudelp <player> <permission> [permission2] [permission3]...)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } for (int i = 1; i < args.length; i++) { auxString = args[i].replace("'", ""); if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "You can't modify a player with same group as you, or higher."); continue; } // Validating your permissions permissionResult = permissionHandler.checkFullUserPermission(senderUser, auxString); if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { sender.sendMessage(ChatColor.RED + "You can't remove a permission you don't have: '" + auxString + "'"); continue; } // Validating permissions of user permissionResult = permissionHandler.checkUserOnlyPermission(auxUser, auxString); if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { sender.sendMessage(ChatColor.RED + "The user doesn't have direct access to that permission: '" + auxString + "'"); continue; } if (!auxUser.hasSamePermissionNode(auxString)) { sender.sendMessage(ChatColor.RED + "This permission node doesn't match any node."); sender.sendMessage(ChatColor.RED + "But might match node: " + permissionResult.accessLevel); continue; } auxUser.removePermission(auxString); sender.sendMessage(ChatColor.YELLOW + "You removed '" + auxString + "' from player '" + auxUser.getLastName() + "' permissions."); } // Seems OK targetPlayer = this.getServer().getPlayer(auxUser.getLastName()); if (targetPlayer != null) BukkitPermissions.updatePermissions(targetPlayer); return true; case manuclearp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manuclearp <player>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating your permissions if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "You can't modify a player with same group as you, or higher."); return true; } for (String perm : auxUser.getPermissionList()) { permissionResult = permissionHandler.checkFullUserPermission(senderUser, perm); if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { sender.sendMessage(ChatColor.RED + "You can't remove a permission you don't have: '" + perm + "'."); } else { auxUser.removePermission(perm); } } sender.sendMessage(ChatColor.YELLOW + "You removed all permissions from player '" + auxUser.getLastName() + "'."); targetPlayer = this.getServer().getPlayer(auxUser.getLastName()); if (targetPlayer != null) BukkitPermissions.updatePermissions(targetPlayer); return true; case manulistp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if ((args.length == 0) || (args.length > 2)) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manulistp <player> (+))"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating permission // Seems OK auxString = ""; for (String perm : auxUser.getPermissionList()) { auxString += perm + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); sender.sendMessage(ChatColor.YELLOW + "The player '" + auxUser.getLastName() + "' has following permissions: " + ChatColor.WHITE + auxString); sender.sendMessage(ChatColor.YELLOW + "And all permissions from group: " + auxUser.getGroupName()); auxString = ""; for (String subGroup : auxUser.subGroupListStringCopy()) { auxString += subGroup + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); sender.sendMessage(ChatColor.YELLOW + "And all permissions from subgroups: " + auxString); } } else { sender.sendMessage(ChatColor.YELLOW + "The player '" + auxUser.getLastName() + "' has no specific permissions."); sender.sendMessage(ChatColor.YELLOW + "Only all permissions from group: " + auxUser.getGroupName()); auxString = ""; for (String subGroup : auxUser.subGroupListStringCopy()) { auxString += subGroup + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); sender.sendMessage(ChatColor.YELLOW + "And all permissions from subgroups: " + auxString); } } // bukkit perms if ((args.length == 2) && (args[1].equalsIgnoreCase("+"))) { targetPlayer = this.getServer().getPlayer(auxUser.getLastName()); if (targetPlayer != null) { sender.sendMessage(ChatColor.YELLOW + "Superperms reports: "); for (String line : BukkitPermissions.listPerms(targetPlayer)) sender.sendMessage(ChatColor.YELLOW + line); } } return true; case manucheckp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manucheckp <player> <permission>)"); return true; } auxString = args[1].replace("'", ""); if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } targetPlayer = this.getServer().getPlayer(auxUser.getLastName()); // Validating permission permissionResult = permissionHandler.checkFullGMPermission(auxUser, auxString, false); if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { // No permissions found in GM so fall through and check Bukkit. sender.sendMessage(ChatColor.YELLOW + "The player doesn't have access to that permission"); } else { // This permission was found in groupmanager. if (permissionResult.owner instanceof User) { if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) { sender.sendMessage(ChatColor.YELLOW + "The user has directly a negation node for that permission."); } else if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { sender.sendMessage(ChatColor.YELLOW + "The user has directly an Exception node for that permission."); } else { sender.sendMessage(ChatColor.YELLOW + "The user has directly this permission."); } sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel); } else if (permissionResult.owner instanceof Group) { if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) { sender.sendMessage(ChatColor.YELLOW + "The user inherits a negation permission from group: " + permissionResult.owner.getLastName()); } else if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { sender.sendMessage(ChatColor.YELLOW + "The user inherits an Exception permission from group: " + permissionResult.owner.getLastName()); } else { sender.sendMessage(ChatColor.YELLOW + "The user inherits the permission from group: " + permissionResult.owner.getLastName()); } sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel); } } // superperms if (targetPlayer != null) { sender.sendMessage(ChatColor.YELLOW + "SuperPerms reports Node: " + targetPlayer.hasPermission(args[1]) + ((!targetPlayer.hasPermission(args[1]) && targetPlayer.isPermissionSet(args[1])) ? " (Negated)": "")); } return true; case mangaddp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length < 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangaddp <group> <permission> [permission2] [permission3]...)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return false; } for (int i = 1; i < args.length; i++) { auxString = args[i].replace("'", ""); // Validating your permissions permissionResult = permissionHandler.checkFullUserPermission(senderUser, auxString); if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { sender.sendMessage(ChatColor.RED + "You can't add a permission you don't have: '" + auxString + "'"); continue; } // Validating permissions of user permissionResult = permissionHandler.checkGroupOnlyPermission(auxGroup, auxString); if (checkPermissionExists(sender, auxString, permissionResult, "group")) { continue; } // Seems OK auxGroup.addPermission(auxString); sender.sendMessage(ChatColor.YELLOW + "You added '" + auxString + "' to group '" + auxGroup.getName() + "' permissions."); } BukkitPermissions.updateAllPlayers(); return true; case mangdelp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length < 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangdelp <group> <permission> [permission2] [permission3]...)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } for (int i = 1; i < args.length; i++) { auxString = args[i].replace("'", ""); // Validating your permissions permissionResult = permissionHandler.checkFullUserPermission(senderUser, auxString); if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { sender.sendMessage(ChatColor.RED + "Can't remove a permission you don't have: '" + auxString + "'"); continue; } // Validating permissions of user permissionResult = permissionHandler.checkGroupOnlyPermission(auxGroup, auxString); if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { sender.sendMessage(ChatColor.YELLOW + "The group doesn't have direct access to that permission: '" + auxString + "'"); continue; } if (!auxGroup.hasSamePermissionNode(auxString)) { sender.sendMessage(ChatColor.RED + "This permission node doesn't match any node."); sender.sendMessage(ChatColor.RED + "But might match node: " + permissionResult.accessLevel); continue; } // Seems OK auxGroup.removePermission(auxString); sender.sendMessage(ChatColor.YELLOW + "You removed '" + auxString + "' from group '" + auxGroup.getName() + "' permissions."); } BukkitPermissions.updateAllPlayers(); return true; case mangclearp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangclearp <group>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } for (String perm : auxGroup.getPermissionList()) { permissionResult = permissionHandler.checkFullUserPermission(senderUser, perm); if (!isConsole && !isOpOverride && (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND) || permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION))) { sender.sendMessage(ChatColor.RED + "Can't remove a permission you don't have: '" + perm + "'."); } else { auxGroup.removePermission(perm); } } sender.sendMessage(ChatColor.YELLOW + "You removed all permissions from group '" + auxGroup.getName() + "'."); BukkitPermissions.updateAllPlayers(); return true; case manglistp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manglistp <group>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } // Validating permission // Seems OK auxString = ""; for (String perm : auxGroup.getPermissionList()) { auxString += perm + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); sender.sendMessage(ChatColor.YELLOW + "The group '" + auxGroup.getName() + "' has following permissions: " + ChatColor.WHITE + auxString); auxString = ""; for (String grp : auxGroup.getInherits()) { auxString += grp + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); sender.sendMessage(ChatColor.YELLOW + "And all permissions from groups: " + auxString); } } else { sender.sendMessage(ChatColor.YELLOW + "The group '" + auxGroup.getName() + "' has no specific permissions."); auxString = ""; for (String grp : auxGroup.getInherits()) { auxString += grp + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); sender.sendMessage(ChatColor.YELLOW + "Only all permissions from groups: " + auxString); } } return true; case mangcheckp: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangcheckp <group> <permission>)"); return true; } auxString = args[1]; if (auxString.startsWith("'") && auxString.endsWith("'")) { auxString = auxString.substring(1, auxString.length() - 1); } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } // Validating permission permissionResult = permissionHandler.checkGroupPermissionWithInheritance(auxGroup, auxString); if (permissionResult.resultType.equals(PermissionCheckResult.Type.NOTFOUND)) { sender.sendMessage(ChatColor.YELLOW + "The group doesn't have access to that permission"); return true; } // Seems OK // auxString = permissionHandler.checkUserOnlyPermission(auxUser, args[1]); if (permissionResult.owner instanceof Group) { if (permissionResult.resultType.equals(PermissionCheckResult.Type.NEGATION)) { sender.sendMessage(ChatColor.YELLOW + "The group inherits the negation permission from group: " + permissionResult.owner.getLastName()); } else if (permissionResult.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { sender.sendMessage(ChatColor.YELLOW + "The group inherits an Exception permission from group: " + permissionResult.owner.getLastName()); } else { sender.sendMessage(ChatColor.YELLOW + "The group inherits the permission from group: " + permissionResult.owner.getLastName()); } sender.sendMessage(ChatColor.YELLOW + "Permission Node: " + permissionResult.accessLevel); } return true; case mangaddi: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangaddi <group1> <group2>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } auxGroup2 = dataHolder.getGroup(args[1]); if (auxGroup2 == null) { sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance."); return true; } // Validating permission if (permissionHandler.hasGroupInInheritance(auxGroup, auxGroup2.getName())) { sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " already inherits " + auxGroup2.getName() + " (might not be directly)"); return true; } // Seems OK auxGroup.addInherits(auxGroup2); sender.sendMessage(ChatColor.YELLOW + "Group " + auxGroup2.getName() + " is now in " + auxGroup.getName() + " inheritance list."); BukkitPermissions.updateAllPlayers(); return true; case mangdeli: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangdeli <group1> <group2>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } auxGroup2 = dataHolder.getGroup(args[1]); if (auxGroup2 == null) { sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support inheritance."); return true; } // Validating permission if (!permissionHandler.hasGroupInInheritance(auxGroup, auxGroup2.getName())) { sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " does not inherit " + auxGroup2.getName() + "."); return true; } if (!auxGroup.getInherits().contains(auxGroup2.getName())) { sender.sendMessage(ChatColor.RED + "Group " + auxGroup.getName() + " does not inherit " + auxGroup2.getName() + " directly."); return true; } // Seems OK auxGroup.removeInherits(auxGroup2.getName()); sender.sendMessage(ChatColor.YELLOW + "Group " + auxGroup2.getName() + " was removed from " + auxGroup.getName() + " inheritance list."); BukkitPermissions.updateAllPlayers(); return true; case manuaddv: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length < 3) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manuaddv <user> <variable> <value>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating permission // Seems OK auxString = ""; for (int i = 2; i < args.length; i++) { auxString += args[i]; if ((i + 1) < args.length) { auxString += " "; } } auxString = auxString.replace("'", ""); auxUser.getVariables().addVar(args[1], Variables.parseVariableValue(auxString)); sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + ":'" + ChatColor.GREEN + auxString + ChatColor.YELLOW + "' added to the user " + auxUser.getLastName()); return true; case manudelv: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manudelv <user> <variable>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating permission if (!auxUser.getVariables().hasVar(args[1])) { sender.sendMessage(ChatColor.RED + "The user doesn't have directly that variable!"); return true; } // Seems OK auxUser.getVariables().removeVar(args[1]); sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + " removed from the user " + ChatColor.GREEN + auxUser.getLastName()); return true; case manulistv: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manulistv <user>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating permission // Seems OK auxString = ""; for (String varKey : auxUser.getVariables().getVarKeyList()) { Object o = auxUser.getVariables().getVarObject(varKey); auxString += ChatColor.GOLD + varKey + ChatColor.WHITE + ":'" + ChatColor.GREEN + o.toString() + ChatColor.WHITE + "', "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); } sender.sendMessage(ChatColor.YELLOW + "Variables of user " + auxUser.getLastName() + ": "); sender.sendMessage(auxString + "."); sender.sendMessage(ChatColor.YELLOW + "Plus all variables from group: " + auxUser.getGroupName()); return true; case manucheckv: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manucheckv <user> <variable>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating permission auxGroup = auxUser.getGroup(); auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1]); if (!auxUser.getVariables().hasVar(args[1])) { // Check sub groups if (!auxUser.isSubGroupsEmpty() && auxGroup2 == null) for (Group subGroup : auxUser.subGroupListCopy()) { auxGroup2 = permissionHandler.nextGroupWithVariable(subGroup, args[1]); if (auxGroup2 != null) continue; } if (auxGroup2 == null) { sender.sendMessage(ChatColor.YELLOW + "The user doesn't have access to that variable!"); return true; } } // Seems OK if (auxUser.getVariables().hasVar(auxString)) { sender.sendMessage(ChatColor.YELLOW + "The value of variable '" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + "' is: '" + ChatColor.GREEN + auxUser.getVariables().getVarObject(args[1]).toString() + ChatColor.WHITE + "'"); sender.sendMessage(ChatColor.YELLOW + "This user own directly the variable"); } sender.sendMessage(ChatColor.YELLOW + "The value of variable '" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + "' is: '" + ChatColor.GREEN + auxGroup2.getVariables().getVarObject(args[1]).toString() + ChatColor.WHITE + "'"); if (!auxGroup.equals(auxGroup2)) { sender.sendMessage(ChatColor.YELLOW + "And the value was inherited from group: " + ChatColor.GREEN + auxGroup2.getName()); } return true; case mangaddv: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length < 3) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangaddv <group> <variable> <value>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes."); return true; } // Validating permission // Seems OK auxString = ""; for (int i = 2; i < args.length; i++) { auxString += args[i]; if ((i + 1) < args.length) { auxString += " "; } } auxString = auxString.replace("'", ""); auxGroup.getVariables().addVar(args[1], Variables.parseVariableValue(auxString)); sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + ":'" + ChatColor.GREEN + auxString + ChatColor.YELLOW + "' added to the group " + auxGroup.getName()); return true; case mangdelv: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangdelv <group> <variable>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes."); return true; } // Validating permission if (!auxGroup.getVariables().hasVar(args[1])) { sender.sendMessage(ChatColor.RED + "The group doesn't have directly that variable!"); return true; } // Seems OK auxGroup.getVariables().removeVar(args[1]); sender.sendMessage(ChatColor.YELLOW + "Variable " + ChatColor.GOLD + args[1] + ChatColor.YELLOW + " removed from the group " + ChatColor.GREEN + auxGroup.getName()); return true; case manglistv: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manglistv <group>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes."); return true; } // Validating permission // Seems OK auxString = ""; for (String varKey : auxGroup.getVariables().getVarKeyList()) { Object o = auxGroup.getVariables().getVarObject(varKey); auxString += ChatColor.GOLD + varKey + ChatColor.WHITE + ":'" + ChatColor.GREEN + o.toString() + ChatColor.WHITE + "', "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); } sender.sendMessage(ChatColor.YELLOW + "Variables of group " + auxGroup.getName() + ": "); sender.sendMessage(auxString + "."); auxString = ""; for (String grp : auxGroup.getInherits()) { auxString += grp + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); sender.sendMessage(ChatColor.YELLOW + "Plus all variables from groups: " + auxString); } return true; case mangcheckv: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mangcheckv <group> <variable>)"); return true; } auxGroup = dataHolder.getGroup(args[0]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[0] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "GlobalGroups do NOT support Info Nodes."); return true; } // Validating permission auxGroup2 = permissionHandler.nextGroupWithVariable(auxGroup, args[1]); if (auxGroup2 == null) { sender.sendMessage(ChatColor.RED + "The group doesn't have access to that variable!"); } // Seems OK sender.sendMessage(ChatColor.YELLOW + "The value of variable '" + ChatColor.GOLD + args[1] + ChatColor.YELLOW + "' is: '" + ChatColor.GREEN + auxGroup2.getVariables().getVarObject(args[1]).toString() + ChatColor.WHITE + "'"); if (!auxGroup.equals(auxGroup2)) { sender.sendMessage(ChatColor.YELLOW + "And the value was inherited from group: " + ChatColor.GREEN + auxGroup2.getName()); } return true; case manwhois: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manwhois <player>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Seems OK sender.sendMessage(ChatColor.YELLOW + "Name: " + ChatColor.GREEN + auxUser.getLastName()); sender.sendMessage(ChatColor.YELLOW + "Group: " + ChatColor.GREEN + auxUser.getGroup().getName()); // Compile a list of subgroups auxString = ""; for (String subGroup : auxUser.subGroupListStringCopy()) { auxString += subGroup + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); sender.sendMessage(ChatColor.YELLOW + "subgroups: " + auxString); } sender.sendMessage(ChatColor.YELLOW + "Overloaded: " + ChatColor.GREEN + dataHolder.isOverloaded(auxUser.getUUID())); auxGroup = dataHolder.surpassOverload(auxUser.getUUID()).getGroup(); if (!auxGroup.equals(auxUser.getGroup())) { sender.sendMessage(ChatColor.YELLOW + "Original Group: " + ChatColor.GREEN + auxGroup.getName()); } // victim.permissions.add(args[1]); return true; case tempadd: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/tempadd <player>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "Can't modify player with same permissions than you, or higher."); return true; } // Seems OK if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) { overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>()); } dataHolder.overloadUser(auxUser.getUUID()); overloadedUsers.get(dataHolder.getName().toLowerCase()).add(dataHolder.getUser(auxUser.getUUID())); sender.sendMessage(ChatColor.YELLOW + "Player set to overload mode!"); return true; case tempdel: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/tempdel <player>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return true; } // Seems OK if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) { overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>()); } dataHolder.removeOverload(auxUser.getUUID()); if (overloadedUsers.get(dataHolder.getName().toLowerCase()).contains(auxUser)) { overloadedUsers.get(dataHolder.getName().toLowerCase()).remove(auxUser); } sender.sendMessage(ChatColor.YELLOW + "Player overload mode is now disabled."); return true; case templist: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // WORKING auxString = ""; removeList = new ArrayList<User>(); count = 0; for (User u : overloadedUsers.get(dataHolder.getName().toLowerCase())) { if (!dataHolder.isOverloaded(u.getUUID())) { removeList.add(u); } else { auxString += u.getLastName() + ", "; count++; } } if (count == 0) { sender.sendMessage(ChatColor.YELLOW + "There are no users in overload mode."); return true; } auxString = auxString.substring(0, auxString.lastIndexOf(",")); if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) { overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>()); } overloadedUsers.get(dataHolder.getName().toLowerCase()).removeAll(removeList); sender.sendMessage(ChatColor.YELLOW + " " + count + " Users in overload mode: " + ChatColor.WHITE + auxString); return true; case tempdelall: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // WORKING removeList = new ArrayList<User>(); count = 0; for (User u : overloadedUsers.get(dataHolder.getName().toLowerCase())) { if (dataHolder.isOverloaded(u.getUUID())) { dataHolder.removeOverload(u.getUUID()); count++; } } if (count == 0) { sender.sendMessage(ChatColor.YELLOW + "There are no users in overload mode."); return true; } if (overloadedUsers.get(dataHolder.getName().toLowerCase()) == null) { overloadedUsers.put(dataHolder.getName().toLowerCase(), new ArrayList<User>()); } overloadedUsers.get(dataHolder.getName().toLowerCase()).clear(); sender.sendMessage(ChatColor.YELLOW + " " + count + "All users in overload mode are now normal again."); return true; case mansave: boolean forced = false; if ((args.length == 1) && (args[0].equalsIgnoreCase("force"))) forced = true; try { worldsHolder.saveChanges(forced); sender.sendMessage(ChatColor.YELLOW + "All changes were saved."); } catch (IllegalStateException ex) { sender.sendMessage(ChatColor.RED + ex.getMessage()); } return true; case manload: /** * Attempt to reload a specific world */ if (args.length > 0) { if (!lastError.isEmpty()) { sender.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'."); return true; } auxString = ""; for (int i = 0; i < args.length; i++) { auxString += args[i]; if ((i + 1) < args.length) { auxString += " "; } } isLoaded = false; // Disable Bukkit Perms update and event triggers globalGroups.load(); worldsHolder.loadWorld(auxString); sender.sendMessage("The request to reload world '" + auxString + "' was attempted."); isLoaded = true; BukkitPermissions.reset(); } else { /** * Reload all settings and data as no world was specified. */ /* * Attempting a fresh load. */ onDisable(true); onEnable(true); sender.sendMessage("All settings and worlds were reloaded!"); } /** * Fire an event as none will have been triggered in the reload. */ if (GroupManager.isLoaded()) GroupManager.getGMEventHandler().callEvent(GMSystemEvent.Action.RELOADED); return true; case listgroups: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // WORKING auxString = ""; String auxString2 = ""; for (Group g : dataHolder.getGroupList()) { auxString += g.getName() + ", "; } for (Group g : getGlobalGroups().getGroupList()) { auxString2 += g.getName() + ", "; } if (auxString.lastIndexOf(",") > 0) { auxString = auxString.substring(0, auxString.lastIndexOf(",")); } if (auxString2.lastIndexOf(",") > 0) { auxString2 = auxString2.substring(0, auxString2.lastIndexOf(",")); } sender.sendMessage(ChatColor.YELLOW + "Groups Available: " + ChatColor.WHITE + auxString); sender.sendMessage(ChatColor.YELLOW + "GlobalGroups Available: " + ChatColor.WHITE + auxString2); return true; case manpromote: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manpromote <player> <group>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } auxGroup = dataHolder.getGroup(args[1]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly."); return true; } // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return true; } if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) { sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher."); return true; } if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getUUID(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getUUID(), auxGroup.getName()))) { sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit."); return true; } if (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())) { sender.sendMessage(ChatColor.RED + "You can't modify a player using groups with different heritage line."); return true; } if (!permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())) { sender.sendMessage(ChatColor.RED + "The new group must be a higher rank."); return true; } // Seems OK auxUser.setGroup(auxGroup); if (!sender.hasPermission("groupmanager.notify.other") || (isConsole)) sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getLastName() + " group to " + auxGroup.getName() + "."); return true; case mandemote: // Validating state of sender if (dataHolder == null || permissionHandler == null) { if (!setDefaultWorldHandler(sender)) return true; } // Validating arguments if (args.length != 2) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mandemote <player> <group>)"); return true; } if ((validateOnlinePlayer) && ((match = validatePlayer(args[0], sender)) == null)) { return false; } if (match != null) { auxUser = dataHolder.getUser(match.get(0)); } else { auxUser = dataHolder.getUser(args[0]); } auxGroup = dataHolder.getGroup(args[1]); if (auxGroup == null) { sender.sendMessage(ChatColor.RED + "'" + args[1] + "' Group doesnt exist!"); return true; } if (auxGroup.isGlobal()) { sender.sendMessage(ChatColor.RED + "Players may not be members of GlobalGroups directly."); return true; } // Validating permission if (!isConsole && !isOpOverride && (senderGroup != null ? permissionHandler.inGroup(auxUser.getUUID(), senderGroup.getName()) : false)) { sender.sendMessage(ChatColor.RED + "You can't modify a player with same permissions as you, or higher."); return true; } if (!isConsole && !isOpOverride && (permissionHandler.hasGroupInInheritance(auxGroup, senderGroup.getName()))) { sender.sendMessage(ChatColor.RED + "The destination group can't be the same as yours, or higher."); return true; } if (!isConsole && !isOpOverride && (!permissionHandler.inGroup(senderUser.getUUID(), auxUser.getGroupName()) || !permissionHandler.inGroup(senderUser.getUUID(), auxGroup.getName()))) { sender.sendMessage(ChatColor.RED + "You can't modify a player involving a group that you don't inherit."); return true; } if (!permissionHandler.hasGroupInInheritance(auxUser.getGroup(), auxGroup.getName()) && !permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())) { sender.sendMessage(ChatColor.RED + "You can't modify a player using groups with different inheritage line."); return true; } if (permissionHandler.hasGroupInInheritance(auxGroup, auxUser.getGroupName())) { sender.sendMessage(ChatColor.RED + "The new group must be a lower rank."); return true; } // Seems OK auxUser.setGroup(auxGroup); if (!sender.hasPermission("groupmanager.notify.other") || (isConsole)) sender.sendMessage(ChatColor.YELLOW + "You changed " + auxUser.getLastName() + " group to " + auxGroup.getName() + "."); return true; case mantogglevalidate: validateOnlinePlayer = !validateOnlinePlayer; sender.sendMessage(ChatColor.YELLOW + "Validate if player is online, now set to: " + Boolean.toString(validateOnlinePlayer)); if (!validateOnlinePlayer) { sender.sendMessage(ChatColor.GOLD + "From now on you can edit players that are not connected... BUT:"); sender.sendMessage(ChatColor.LIGHT_PURPLE + "From now on you should type the whole name of the player, correctly."); } return true; case mantogglesave: if (scheduler == null) { enableScheduler(); sender.sendMessage(ChatColor.YELLOW + "The auto-saving is enabled!"); } else { disableScheduler(); sender.sendMessage(ChatColor.YELLOW + "The auto-saving is disabled!"); } return true; case manworld: auxString = selectedWorlds.get(sender.getName()); if (auxString != null) { sender.sendMessage(ChatColor.YELLOW + "You have the world '" + dataHolder.getName() + "' in your selection."); } else { if (dataHolder == null) { sender.sendMessage(ChatColor.YELLOW + "There is no world selected. And no world is available now."); } else { sender.sendMessage(ChatColor.YELLOW + "You don't have a world in your selection.."); sender.sendMessage(ChatColor.YELLOW + "Working with the direct world where your player is."); sender.sendMessage(ChatColor.YELLOW + "Your world now uses permissions of world name: '" + dataHolder.getName() + "' "); } } return true; case manselect: if (args.length < 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/manselect <world>)"); sender.sendMessage(ChatColor.YELLOW + "Worlds available: "); ArrayList<OverloadedWorldHolder> worlds = worldsHolder.allWorldsDataList(); auxString = ""; for (int i = 0; i < worlds.size(); i++) { auxString += worlds.get(i).getName(); if ((i + 1) < worlds.size()) { auxString += ", "; } } sender.sendMessage(ChatColor.YELLOW + auxString); return false; } auxString = ""; for (int i = 0; i < args.length; i++) { if (args[i] == null) { logger.warning("Bukkit gave invalid arguments array! Cmd: " + cmd.getName() + " args.length: " + args.length); return false; } auxString += args[i]; if (i < (args.length - 1)) { auxString += " "; } } dataHolder = worldsHolder.getWorldData(auxString); permissionHandler = dataHolder.getPermissionsHandler(); selectedWorlds.put(sender.getName(), dataHolder.getName()); sender.sendMessage(ChatColor.YELLOW + "You have selected world '" + dataHolder.getName() + "'."); return true; case manclear: if (args.length != 0) { sender.sendMessage(ChatColor.RED + "Review your arguments count!"); return false; } selectedWorlds.remove(sender.getName()); sender.sendMessage(ChatColor.YELLOW + "You have removed your world selection. Working with current world(if possible)."); return true; case mancheckw: if (args.length < 1) { sender.sendMessage(ChatColor.RED + "Review your arguments count! (/mancheckw <world>)"); sender.sendMessage(ChatColor.YELLOW + "Worlds available: "); ArrayList<OverloadedWorldHolder> worlds = worldsHolder.allWorldsDataList(); auxString = ""; for (int i = 0; i < worlds.size(); i++) { auxString += worlds.get(i).getName(); if ((i + 1) < worlds.size()) { auxString += ", "; } } sender.sendMessage(ChatColor.YELLOW + auxString); return false; } auxString = ""; for (int i = 0; i < args.length; i++) { if (args[i] == null) { logger.warning("Bukkit gave invalid arguments array! Cmd: " + cmd.getName() + " args.length: " + args.length); return false; } auxString += args[i]; if (i < (args.length - 1)) { auxString += " "; } } dataHolder = worldsHolder.getWorldData(auxString); sender.sendMessage(ChatColor.YELLOW + "You have selected world '" + dataHolder.getName() + "'."); sender.sendMessage(ChatColor.YELLOW + "This world is using the following data files.."); sender.sendMessage(ChatColor.YELLOW + "Groups:" + ChatColor.GREEN + " " + dataHolder.getGroupsFile().getAbsolutePath()); sender.sendMessage(ChatColor.YELLOW + "Users:" + ChatColor.GREEN + " " + dataHolder.getUsersFile().getAbsolutePath()); return true; default: break; } } sender.sendMessage(ChatColor.RED + "You are not allowed to use that command."); return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract CommandResponse onCommand(CommandSender sender, String label, String[] args);", "private void registerCommands() {\n }", "public void handleCommand(String command);", "CommandHandler() {\n registerArgument(new ChallengeCmd());\n registerArgument(new CreateCmd());\n }", "@Override\n\tpublic void onCommand(CommandSender sender, String[] args) {\n\t\t\n\t}", "@Override\n\tpublic void onCommand(CommandSender sender, String[] args) {\n\t\t\n\t}", "public abstract void onCommand(MessageEvent context) throws Exception;", "public abstract void onInvoked(CommandSender sender, String[] args);", "@Override\n\tpublic void onMessage(CommandMessage msg) {\n\t}", "public void addCommand(Object cmd) {\n Message msg = this.handler.obtainMessage(0);\n msg.obj = cmd;\n this.handler.sendMessage(msg);\n }", "@Override\n public void addCommand(CommandConfig command) {\n }", "@Override\r\n public void execute(Command command) {\n\r\n }", "void commandStarted(Command c);", "protected abstract void registerCommands(CommandHandler handler);", "public void handleCommand(String command, String args[], Player player){\n\t}", "@Override\n\tpublic void processCommand(JMVCommandEvent arg0) {\n\t}", "boolean onCommand(CommandSender sender, String command, String[] args, Object... objects);", "@Override\n\tpublic void execute() {\n\t\tcmdReceiver.send();\n\t}", "@Override\n public void onEnable(){\n \tgetLogger().info(\"onEnable has been invoked!\");\n \t// This will throw a NullPointerException if you don't have the command defined in your plugin.yml file!\n \tgetCommand(\"basic\").setExecutor(new BetatestCommandExecutor(this));\n \tgetCommand(\"WhatAmI\").setExecutor(new BetatestCommandExecutor(this));\n \tgetCommand(\"isonline\").setExecutor(new BetatestCommandExecutor(this));\n }", "public void\n\t\t\thandleCommand(/*@ non_null */ String command);", "public void postExecution() throws CommandListenerException;", "public abstract void execute(CommandSender sender, String[] args);", "void sendCommand(CommandEvent event);", "void registerCommandBusForCommand( CommandBus commandBus, String commandName );", "public void sendCommand(String command){\n sendCommand(command, true);\n fromPlugin = false;\n\n }", "@Override\r\n public void onMessage(MessageEvent message) {\r\n String newMessage = message.getMessage();\r\n String response;\r\n\r\n //split the message on spaces to identify the command\r\n String[] messageArray = newMessage.split(\" \");\r\n \r\n switch (messageArray[0]) {\r\n case \"!command\":\r\n if (message.getChannel().getOps().contains(message.getUser())) {\r\n if (messageArray.length == 2) {\r\n if (messageArray[1].equals(\"off\")) {\r\n commandsActive = false;\r\n } \r\n if (messageArray[1].equals(\"on\")) {\r\n commandsActive = true;\r\n }\r\n }\r\n }\r\n break;\r\n //command to make a custom command for the bot\r\n case \"!addcom\":\r\n if (commandsActive) {\r\n if (message.getChannel().getOps().contains(message.getUser())) {\r\n response = addCom(messageArray, message.getChannel().getName());\r\n message.getChannel().send().message(response);\r\n } \r\n else {\r\n message.respond(\"You are not allowed to add commands.\");\r\n }\r\n }\r\n break;\r\n case \"!commands\":\r\n if (commandsActive) {\r\n if (messageArray.length ==1) {\r\n ArrayList<String> commands = manager.getCommands(message.getChannel().getName());\r\n String commandList = \"The custom commands available to everyone for this channel are: \";\r\n while (!commands.isEmpty()) {\r\n commandList += commands.remove(0) + \", \";\r\n }\r\n message.getChannel().send().message(commandList);\r\n }\r\n }\r\n break;\r\n //command to delete a custom command from the bot\r\n case \"!delcom\":\r\n if (commandsActive) {\r\n if (message.getChannel().getOps().contains(message.getUser())) {\r\n response = delCom(messageArray[1], message.getChannel().getName());\r\n message.getChannel().send().message(response);\r\n } \r\n else {\r\n message.respond(\"You are not allowed to remove commands.\");\r\n }\r\n }\r\n break;\r\n //command to edit a custom command the bot has\r\n case \"!editcom\":\r\n if (commandsActive) {\r\n if (message.getChannel().getOps().contains(message.getUser())) {\r\n response = editCom(messageArray, message.getChannel().getName());\r\n message.getChannel().send().message(response);\r\n } \r\n else {\r\n message.respond(\"You are not allowed to edit commands.\");\r\n }\r\n }\r\n break;\r\n\r\n //default message handling for custom commands\r\n default:\r\n if (commandsActive) {\r\n if (message.getMessage().startsWith(\"!\") && !messageArray[0].equals(\"!permit\")&& !messageArray[0].equals(\"!spam\")) {\r\n customCommands(message);\r\n }\r\n }\r\n break;\r\n }\r\n }", "public void setCommand(String command) {\n this.command = command;\n }", "public void addCommand(Command m);", "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}", "@Override\n public void addPostCommand(String postCommand) {\n }", "public String getCommand() { return command; }", "public void fireOnItemAddedToInventoryCommands();", "@Override\n public void recordCommandExecution(String commandInputString) {\n\n }", "@Override\r\n\tpublic void command() {\n\t\tSystem.out.println(\"CommandAttack Process\");\r\n\t}", "public void addCommand(CommandIF command) {\r\n\t\tmelody.add(command);\r\n\t}", "@Override\n\tpublic void setCommand(String cmd) {\n\t\t\n\t}", "public void sendCommFromPlugin(String command){\n\n sendCommand(command, true);\n this.fromPlugin = true;\n }", "public void getTagCommand() {\n\n }", "@FXML\n\tpublic void onProcessCommand() {\n\t\tString command = prompt.getText().trim();\n\t\tif (!command.isEmpty()) {\n\t\t\t// Print what the user entered to the screen\n\t\t\tscreen.appendText(\"> \" + command + \"\\n\");\n\t\t\tswitch (command) {\n\t\t\t\tcase \"clear\":\n\t\t\t\t\tscreen.clear();\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t// Print the output of the commandName\n\t\t\t\t\tscreen.appendText(commandDispatch.processCommand(command) + \"\\n\");\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Clear the prompt - ready for new input\n\t\t\tprompt.clear();\n\t\t}\n\t}", "@Override\n public void initDefaultCommand() {\n\n }", "public void setCommand(String command)\n {\n this.command = command;\n }", "public abstract boolean commandExecution(CommandSender sender, String label, String[] args);", "public void registerCommand(Command c) {\n\t\tcommands.add(c);\n\t}", "@Override\n\tpublic void handleServerCmd() {\n\t\t\n\t}", "@Override\n public void initDefaultCommand() \n {\n }", "@Override\n public void onGuildMessageReceived(@NotNull GuildMessageReceivedEvent event) {\n if (event.getAuthor().isBot()) { // ignore other bots and ourselves too\n return;\n }\n\n String[] args = event.getMessage().getContentRaw().split(\"\\\\s+\");\n\n if (args[0].startsWith(CommandHandler.prefix)) { // Check if prefix is correct\n Molly.logger.info(\"User \" + event.getAuthor().getName() + \" tried to invoke \" + args[0].substring(1).toLowerCase());\n switch (args[0].substring(1).toLowerCase()) {\n case \"info\":\n new Info(args, event).run();\n break;\n case \"summon\":\n new Summon(args, event).run();\n break;\n case \"ping\":\n new Pong(args, event).run();\n break;\n case \"sad\":\n new Sad(args, event).run();\n break;\n case \"annoy\":\n new Annoy(args, event).run();\n break;\n case \"say\":\n new Say(args, event).run();\n break;\n default:\n event.getChannel().sendMessage(\"I don't know this command. Type ** \" + CommandHandler.prefix + \"info** for a list of all commands.\").queue();\n }\n }\n }", "public void setCommand(String command) {\n this.command = command;\n }", "public void setCommand(String command) {\n _command = command;\n }", "boolean commandUse(CommandSender sender, String[] args);", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n }", "@Override\r\n\tpublic final void receiveCommand(Command cmd) {\n\t\tif (cmd.getCommand().equals(Constants.CMD_PARAMETER)) {\r\n\t\t\tString param = cmd.getParameter(\"NAME\");\r\n\t\t\tString value = cmd.getParameter(\"VALUE\");\r\n\t\t\tif (param != null && value != null && parameters.containsKey(param)) {\r\n\t\t\t\t// Calls user method\r\n\t\t\t\tif (!parameterUpdate(param, value)) {\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\t// TODO Alguns parâmetros não podem ser mudados!\r\n\t\t\t\tparameters.put(param, value);\r\n\t\t\t\t// Let the console knows about the updated parameter\r\n\t\t\t\tcmd = new Command(getAddress(), \"/console\", \"UPDATE\");\r\n\t\t\t\tcmd.addParameter(\"AGENT\", getAgent().getAgentName());\r\n\t\t\t\tcmd.addParameter(\"COMPONENT\", getComponentName());\r\n\t\t\t\tcmd.addParameter(\"NAME\", param);\r\n\t\t\t\tcmd.addParameter(\"VALUE\", value);\r\n\t\t\t\tsendCommand(cmd);\r\n\t\t\t}\r\n\t\t}\r\n\t\telse {\r\n\t\t\tprocessCommand(cmd);\r\n\t\t}\r\n\t}", "@NotNull\n CommandResult onCommand(@NotNull Player player, @NotNull String[] params);", "default boolean onCommand(CommandSender sender, ConnectionCommand connectionCommand) {\n String[] split = connectionCommand.getCommand().split(\" \");\n\n return onCommand(sender, split[0], Arrays.copyOfRange(split, 1, split.length), connectionCommand.getArgs());\n }", "public interface Command {\n\n\n}", "@Override\r\n\tpublic void onMessageCreate(MessageCreateEvent event) {\n\t\tif (event.getMessageContent().startsWith(\"!\") && event.getChannel().getId() == 310560101352210432L) {\r\n\t\t\t// remove prefix from string and anything after\r\n\t\t\tString command = event.getMessageContent().substring(1).split(\" \")[0].toLowerCase();\r\n\t\t\t// check if original command name\r\n\t\t\tif (commands.containsKey(command))\r\n\t\t\t\tcommands.get(command).process(event);\r\n\t\t\t// check if alternative name for command\r\n\t\t\telse if (commandAlternative.containsKey(command))\r\n\t\t\t\tcommands.get(commandAlternative.get(command)).process(event);\r\n\r\n\t\t\tlogger.info(event.getMessageAuthor().getDiscriminatedName() + \" invoked: \" + command);\r\n\t\t}\r\n\r\n\t}", "public void onCmd(String cmd) \n {\n \tString split[] = cmd.split(\" \");\n \tif (split.length <= 1)\n \t{\n \t\tacm(\"No command was typed. Use \\\"help\\\" for a list of commands\");\n \t\treturn;\n \t}\n \telse\n \t{\n \t\tfor (ICommand command : commands)\n \t\t{\n \t\t\tif (command.getCommand().equalsIgnoreCase(split[1]))\n \t\t\t{\n \t\t\t\tcommand.onCmd(split);\n \t\t\t\treturn;\n \t\t\t}\n \t\t}\n \t\tacm(\"\\\"\" + split[1] + \"\\\" Unknown command. Use \\\"help\\\" for a list of commands\");\n \t}\n }", "@Inject (\n inClass = \"org.bukkit.craftbukkit.{nms_version}.CraftServer\",\n inMethod = \"dispatchCommand(\" +\n \"Lorg/bukkit/command/CommandSender;\" +\n \"Ljava/lang/String;\" +\n \")Z\",\n at = Inject.Position.BEGINNING\n )\n public static void checkCommandDispatch(MethodParam<?> sender, MethodParam<String> command) {\n onCommand(command.getValue());\n }", "public void registerCommand(String cmd, BaseCommand executor) throws Exception {\n\t\tPluginCommand command = Bukkit.getServer().getPluginCommand(cmd.toLowerCase());\n\t\tif (command == null) {\n\t\t\tConstructor<?> constructor = PluginCommand.class.getDeclaredConstructor(String.class, Plugin.class);\n\t\t\tconstructor.setAccessible(true);\n\t\t\tcommand = (PluginCommand) constructor.newInstance(cmd, RavenPlugin.get());\n\t\t}\n\t\tcommand.setExecutor(executor);\n\t\tList<String> list = Arrays.asList(executor.aliases);\n\t\tcommand.setAliases(list);\n\t\tif (command.getAliases() != null) {\n\t\t\tfor (String alias : command.getAliases())\n\t\t\t\tunregisterCommand(alias);\n\t\t}\n\t\ttry {\n\t\t\tField field = executor.getClass().getDeclaredField(\"description\");\n\t\t\tfield.setAccessible(true);\n\t\t\tif (field != null && field.get(executor) instanceof String)\n\t\t\t\tcommand.setDescription(ChatColor.translateAlternateColorCodes('&', (String) field.get(executor)));\n\t\t} catch (Exception ex) {}\n\t\tcommandMap.register(cmd, command);\n\t}", "@Override\n public void initDefaultCommand() {\n }", "public void setCommand(String command)\r\n\t{\r\n\t\tthis.command = command;\r\n\t}", "public void sendCommand(Command cmd);", "private void sendGameCommand(){\n\n }", "@Override\n public final Command getCommand() {\n return commandIdentifier;\n }", "@Override\n public void onMessageReceived(MessageReceivedEvent event) {\n if(event.getAuthor().isBot())\n return;\n\n Message msg = event.getMessage();\n String content = msg.getContentRaw();\n\n if(content.charAt(0) == PREFIX) {\n handleCommand(msg, content.substring(1));\n }\n }", "CommandTypes(String command) {\n this.command = command;\n }", "public String getCommand() {\r\n return command;\r\n }", "public String getCommand(){\n return command;\n }", "private void registerCommands() {\r\n\t\tif(getSettings().getBoolean(KEY_PREFIX+KEYS.HOME.toString())) {\r\n\t\t\t(new HomeCommand(this)).register();\r\n\t\t\t(new SetHomeCommand(this)).register();\r\n\t\t\t(new DelHomeCommand(this)).register();\r\n\t\t\t(new ListHomesCommand(this)).register();\r\n\t\t\t(new NearbyHomesCommand(this)).register();\r\n\t\t}\r\n\t\t\r\n\t\tif(getSettings().getBoolean(KEY_PREFIX+KEYS.BACK.toString())) {\r\n\t\t\t(new Back(this)).register();\r\n\t\t}\r\n\t\t\r\n\t\tif(getSettings().getBoolean(KEY_PREFIX+KEYS.TPASK.toString())) {\r\n\t\t\t(new TeleportToggle(this)).register();\r\n\t\t\t(new TpAsk(this)).register();\r\n\t\t\t(new TpAskHere(this)).register();\r\n\t\t\t(new TeleportAccept(this)).register();\r\n\t\t\t(new TeleportDeny(this)).register();\r\n\t\t}\r\n\t\t\r\n\t\tif(getSettings().getBoolean(KEY_PREFIX+KEYS.TELEPORT.toString())) {\r\n\t\t\t(new Teleport(this)).register();\r\n\t\t}\r\n\t\t\r\n\t\tif(getSettings().getBoolean(KEY_PREFIX+KEYS.SPEED_SETTING.toString())) {\r\n\t\t\t(new SpeedCommand(this)).register();\r\n\t\t}\r\n\t\t\r\n\t\tif(getSettings().getBoolean(KEY_PREFIX+KEYS.FLY.toString())) {\r\n\t\t\t(new FlyCommand(this)).register();\r\n\t\t}\r\n\t\t\r\n\t\tif(getSettings().getBoolean(KEY_PREFIX+KEYS.GAMEMODE.toString())) {\r\n\t\t\tGameModeCommand gmc = new GameModeCommand(this);\r\n\t\t\tPlayerLoader loader = new PlayerLoader(true, false, false, false);\r\n\t\t\tGameModeLoader gml = new GameModeLoader(true);\r\n\t\t\tgmc.setLoader(gml);\r\n\t\t\tgml.setLoader(loader);\r\n\t\t\tgmc.register();\r\n\t\t}\r\n\t\t\r\n\t\tif(getSettings().getBoolean(KEY_PREFIX+KEYS.PLAYER_CMD.toString())) {\r\n\t\t\t// create command and player loader\r\n\t\t\tPlayerCommand pc = new PlayerCommand();\r\n\t\t\tPlayerLoader playerLoader = new PlayerLoader(true, false, false, false);\r\n\t\t\t\r\n\t\t\t// create components\r\n\t\t\tFeedComponent fc = new FeedComponent();\r\n\t\t\tfc.setLoader(playerLoader);\r\n\t\t\tStarveComponent sc = new StarveComponent();\r\n\t\t\tsc.setLoader(playerLoader);\r\n\t\t\tHealComponent hc = new HealComponent();\r\n\t\t\thc.setLoader(playerLoader);\r\n\t\t\tKillComponent kc = new KillComponent();\r\n\t\t\tkc.setLoader(playerLoader);\r\n\t\t\tBurnComponent bc = new BurnComponent();\r\n\t\t\tbc.setLoader(playerLoader);\r\n\t\t\tExtinguishComponent ec = new ExtinguishComponent();\r\n\t\t\tec.setLoader(playerLoader);\r\n\t\t\tLightningComponent lc = new LightningComponent();\r\n\t\t\tlc.setLoader(playerLoader);\r\n\t\t\tLightningEffectComponent lec = new LightningEffectComponent();\r\n\t\t\tlec.setLoader(playerLoader);\r\n\t\t\t\r\n\t\t\tPlayerLoader gcLoader = new PlayerLoader(false, false, false, false);\r\n\t\t\tBinaryLoader ooc = new BinaryLoader(true, BinaryLoader.BINARY.ENABLE_DISABLE);\r\n\t\t\tooc.setLoader(gcLoader);\r\n\t\t\t\r\n\t\t\tInvincibleComponent gc = new InvincibleComponent();\r\n\t\t\tgc.setLoader(ooc);\r\n\t\t\t\r\n\t\t\t// add components\r\n\t\t\tpc.addComponent(\"feed\", fc);\r\n\t\t\tpc.addComponent(\"starve\", sc);\r\n\t\t\tpc.addComponent(\"heal\", hc);\r\n\t\t\tpc.addComponent(\"invincible\", gc);\r\n\t\t\tpc.addComponent(\"kill\", kc);\r\n\t\t\tpc.addComponent(\"burn\", bc);\r\n\t\t\tpc.addComponent(\"extinguish\", ec);\r\n\t\t\tpc.addComponent(\"lightning\", lc);\r\n\t\t\tpc.addComponent(\"lightningeffect\", lec);\r\n\t\t\t\r\n\t\t\t// register command\r\n\t\t\tpc.register();\r\n\t\t}\r\n\t\t\r\n\t\tif(getSettings().getBoolean(KEY_PREFIX+KEYS.HAT.toString())) {\r\n\t\t\t// /hat command\r\n\t\t\t(new HatCommand()).register();\r\n\t\t}\r\n\t\t\r\n\t\tif(getSettings().getBoolean(KEY_PREFIX+KEYS.WORKBENCH_ENDERCHEST.toString())) {\r\n\t\t\t// /enderchest and /workbench commands\r\n\t\t\tWorkbenchCommand wb = new WorkbenchCommand();\r\n\t\t\twb.setPermission(\"karanteenials.inventory.workbench\");\r\n\t\t\twb.register();\r\n\t\t\t\r\n\t\t\tEnderChestCommand ec = new EnderChestCommand();\r\n\t\t\tec.setPermission(\"karanteenials.inventory.enderchest\");\r\n\t\t\tec.register();\r\n\t\t}\r\n\t\t\r\n\t\tif(getSettings().getBoolean(KEY_PREFIX+KEYS.CLEAR_INVENTORY.toString())) {\r\n\t\t\tClearInventoryCommand cic = new ClearInventoryCommand();\r\n\t\t\tPlayerLoader pl = new PlayerLoader(true, false, false, false);\r\n\t\t\tMaterialLoader ml = new MaterialLoader(true, false, false);\r\n\t\t\tpl.setLoader(ml);\r\n\t\t\tcic.setLoader(pl);\r\n\t\t\tpl.setPermission(\"karanteenials.inventory.clear-multiple\");\r\n\t\t\tcic.setPermission(\"karanteenials.inventory.clear\");\r\n\t\t\tcic.register();\r\n\t\t}\r\n\t\t\r\n\t\t// /nick command\r\n\t\t/*if(getSettings().getBoolean(KEY_PREFIX+KEYS.NICK.toString())) {\r\n\t\t\tNickCommand nc = new NickCommand();\r\n\t\t\tnc.register();\r\n\t\t}*/\r\n\t\t\r\n\t\t\r\n\t\t// /enchant command\r\n\t\tif(getSettings().getBoolean(KEY_PREFIX+KEYS.ENCHANT_COMMAND.toString())) {\r\n\t\t\tEnchantCommand ec = new EnchantCommand();\r\n\t\t\t\r\n\t\t\tGiveEnchantmentComponent gec = new GiveEnchantmentComponent();\r\n\t\t\tgec.setPermission(\"karanteenials.enchant.set\");\r\n\t\t\t\r\n\t\t\tRemoveEnchantmentComponent rec = new RemoveEnchantmentComponent();\r\n\t\t\trec.setPermission(\"karanteenials.enchant.remove\");\r\n\t\t\t\r\n\t\t\tec.addComponent(\"give\", gec);\r\n\t\t\tec.addComponent(\"remove\", rec);\r\n\t\t\t\r\n\t\t\tEnchantmentLoader giveEnchLoader = new EnchantmentLoader();\r\n\t\t\tgec.setLoader(giveEnchLoader);\r\n\t\t\t\r\n\t\t\tEnchantmentLoader removeEnchLoader = new EnchantmentLoader();\r\n\t\t\trec.setLoader(removeEnchLoader);\r\n\t\t\t\r\n\t\t\tLevelLoader ll = new LevelLoader();\r\n\t\t\tgiveEnchLoader.setLoader(ll);\r\n\t\t\t\r\n\t\t\tec.register();\r\n\t\t}\r\n\t\t\r\n\t\t// /rtp command\r\n\t\tif(getSettings().getBoolean(KEY_PREFIX+KEYS.RANDOM_TELEPORT.toString())) {\r\n\t\t\tRandomTeleport rtp = new RandomTeleport();\r\n\t\t\tPlayerLoader pl = new PlayerLoader(true, false, true, false);\r\n\t\t\trtp.setLoader(pl);\r\n\t\t\trtp.register();\r\n\t\t}\r\n\t\t\r\n\t\tif(getSettings().getBoolean(KEY_PREFIX+KEYS.NEAR_COMMAND.toString())) {\r\n\t\t\tNearCommand nc = new NearCommand();\r\n\t\t\tnc.setPermission(\"karanteenials.near\");\r\n\t\t\tnc.register();\r\n\t\t}\r\n\t}", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void initDefaultCommand() {\n }", "@Override\n public void addPreCommand(String preCommand) {\n }", "@Override\n public void registerClientCommands(CommandHandler handler) {\n new InGameCommands(handler);\n }", "@Override\n public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {\n\n // If the sender is a PLAYER\n if (sender instanceof Player) {\n final Player p = (Player) sender;\n\n // If there are arguments and not the main command alone\n if (args.length > 0) {\n boolean cont = false;\n CmdProperties cmdClass = null;\n\n // Assign all commands to their name in the hashmap\n for (final Map.Entry<String, CmdProperties> entry : commandClasses.entrySet()) {\n if (!cont) {\n if (entry.getKey().equalsIgnoreCase(args[0])) {\n cont = true;\n cmdClass = entry.getValue();\n }\n }\n }\n\n // check for permission i think? idk whats entirely going on here, review later\n if (cont) {\n final int argsNeeded = cmdClass.getLength();\n if (args.length - 1 >= argsNeeded) {\n if (p.hasPermission(cmdClass.getPermission())) {\n if (args[argsNeeded] == null) {\n args[argsNeeded] = \"Nothing\";\n }\n final StringBuilder sb = new StringBuilder();\n for (int i = argsNeeded; i < args.length; i++) {\n sb.append(args[i]).append(\" \");\n }\n\n final String allArgs = sb.toString().trim();\n if (cmdClass.isAlias())\n cmdClass.getAlias().perform(p, allArgs, args);\n else\n cmdClass.perform(p, allArgs, args);\n return true;\n } else {\n // D: no permission!\n MsgUtils.error (sender, \"(no permission)\");\n return true;\n }\n } else {\n // Not the right amount of arguments for the command. Maybe put something like cmdClass.getUsage() here to show the player how to use the command\n MsgUtils.error (sender, cmdClass.getUsage());\n return true;\n }\n } else {\n // The argument doesn't exist.\n MsgUtils.error (sender, \"/ca \" + MsgUtils.Colors.VARIABLE + args[0] + MsgUtils.Colors.ERROR + \" is not a command\");\n return true;\n }\n } else {\n // Not enough arguments (show help here)\n MsgUtils.raw(p, \"&e-=-=-=- &7Availible &bClanArena &7Commands: &e-=-=-=-\");\n for (final Map.Entry<String, CmdProperties> entry : commandClasses.entrySet()) {\n if (p.hasPermission(entry.getValue().getPermission())) {\n MsgUtils.sendMessage(p, \"/ca \" + MsgUtils.Colors.VARIABLE + entry.getKey() + MsgUtils.Colors.INFO + \": \" + entry.getValue().getHelpMessage());\n }\n }\n return true;\n }\n } else {\n // Sender isn't a player\n MsgUtils.error (sender, \"Sorry! No console commands are available yet :(\");\n return true;\n }\n }", "public interface CommandHandler {\n\n\t/**\n\t * Receive and handle the given Command.\n\t * @param c The Command to be handled.\n\t */\n\tpublic void handleCommand(String command);\n}", "public abstract String getCommand();", "@Override\r\n \tpublic void clientCommandReceivedCallback(RoMClient client, ClientCommand clientCommand) {\r\n \t\tLogger.logMessage(client.getSessionID() + \" newCommand: \" + clientCommand);\r\n \r\n \t\tthis.processClientCommand(client, clientCommand);\r\n \t}", "public abstract void exec(CommandSender sender, String[] args);", "public void onPluginStart()\n\t{\n\t\tfor (Integer event : this.getNetworkCommands())\n\t\t\tCalicoEventHandler.getInstance().addListener(event.intValue(), this, CalicoEventHandler.ACTION_PERFORMER_LISTENER);\n\t\t\n\t\tCanvasStatusBar.addMenuButtonRightAligned(CreateCustomScrapButton.class);\n\t\t\n\t\t//Add an additional voice to the bubble menu\n\t\t//CGroup.registerPieMenuButton(SaveToPaletteButton.class);\n\t\t\n\t\t//Register to the events I am interested in from Calico's core events\n\t\t//Example: CalicoEventHandler.getInstance().addListener(NetworkCommand.VIEWING_SINGLE_CANVAS, this, CalicoEventHandler.PASSIVE_LISTENER);\n\n\t}", "@Command\n\tpublic void buscar() {\n\t}", "protected void setCommand(String command)\n {\n Command = command;\n }", "private void registerArgument(final CmdProperties baseCmd) {\n commandClasses.put(baseCmd.getCommand(), baseCmd);\n }", "private void registerCommands(){\n getCommand(\"mineregion\").setExecutor(new MineRegionCommand());\n getCommand(\"cellblock\").setExecutor(new CellBlockCommand());\n getCommand(\"cell\").setExecutor(new CellCommand());\n getCommand(\"prisonblock\").setExecutor(new PrisonBlockCommand());\n getCommand(\"rankup\").setExecutor(new RankUpCommand());\n getCommand(\"portal\").setExecutor(new PortalCommand());\n }", "public void analyzeCommand(String cmd)\n {\n commandEntered(cmd);\n }", "private void registerCommands() {\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"arrecurtick\")\n\t\t\t\t\t\t.then(argument(\"Number of Ticks Between Sends\", integer())\n\t\t\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\t\t\tconfig.timeBetween = getInteger(c, \"Number of Ticks Between Sends\");\n\t\t\t\t\t\t\t\t\tConfigManager.saveConfig(config, \"AutoReplyConfigFile\");\n\t\t\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"Recurring message will be sent every \" + getInteger(c, \"Number of Ticks Between Sends\") + \" ticks.\"), false);\n\t\t\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t\t\t}))\n\t\t));\n\t\t//arrecurphrase [Recurring Phrase]\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"arrecurphrase\")\n\t\t\t\t\t\t.then(argument(\"Recurring Phrase\", string())\n\t\t\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\t\t\tconfig.persistentPhrase = getString(c, \"Recurring Phrase\");\n\t\t\t\t\t\t\t\t\tConfigManager.saveConfig(config, \"AutoReplyConfigFile\");\n\t\t\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"Recurring message set to \\\"\" + getString(c, \"Recurring Phrase\") + \"\\\".\"), false);\n\t\t\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t\t\t}))\n\t\t));\n\t\t//arrecurtoggle\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"arrecurtoggle\")\n\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\tconfig.persistentChat = !config.persistentChat;\n\t\t\t\t\t\t\tConfigManager.saveConfig(config, \"AutoReplyConfigFile\");\n\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"Recurring message has been turned \" + (config.persistentChat ? \"on\" : \"off\") + \".\"), false);\n\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t})\n\t\t));\n\t\t//arrecur [Enabled?]\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"arrecur\")\n\t\t\t\t\t\t.then(argument(\"Enabled?\", bool())\n\t\t\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\t\t\tconfig.persistentChat = getBool(c, \"Enabled?\");\n\t\t\t\t\t\t\t\t\tConfigManager.saveConfig(config, \"AutoReplyConfigFile\");\n\t\t\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"Recurring message set to \\\"\" + (config.persistentChat ? \"on\" : \"off\") + \"\\\".\"), false);\n\t\t\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t\t\t}))\n\t\t));\n\t\t//aradditem [Item Name] [Trigger Term]\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"araddterm\")\n\t\t\t\t\t\t.then(argument(\"Item Name\", string())\n\t\t\t\t\t\t\t\t.then(argument(\"Trigger Term\", string())\n\t\t\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\t\t\tconfig.terms.add(getString(c, \"Trigger Term\") + \"|\" + getString(c, \"Item Name\"));\n\t\t\t\t\t\t\t\t\tConfigManager.saveConfig(config, \"AutoReplyConfigFile\");\n\t\t\t\t\t\t\t\t\tHelper.setupChatMessages();\n\t\t\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"Added term \\\"\" + getString(c, \"Trigger Term\") + \"\\\" to item \\\"\" + getString(c, \"Item Name\") + \"\\\".\"), false);\n\t\t\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t\t\t})))\n\t\t));\n\t\t//araddin [In Phrase]\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"araddin\")\n\t\t\t\t\t\t.then(argument(\"In Phrase\", string())\n\t\t\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\t\t\tconfig.ins.add(getString(c, \"In Phrase\"));\n\t\t\t\t\t\t\t\t\tConfigManager.saveConfig(config, \"AutoReplyConfigFile\");\n\t\t\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"Added in-phrase \\\"\" + getString(c, \"In Phrase\") + \"\\\".\"), false);\n\t\t\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t\t\t}))\n\t\t));\n\t\t//araddout [Out Phrase]\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"araddout\")\n\t\t\t\t\t\t.then(argument(\"Out Phrase\", string())\n\t\t\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\t\t\tconfig.outs.add(getString(c, \"Out Phrase\"));\n\t\t\t\t\t\t\t\t\tConfigManager.saveConfig(config, \"AutoReplyConfigFile\");\n\t\t\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"Added out-phrase \\\"\" + getString(c, \"Out Phrase\") + \"\\\".\"), false);\n\t\t\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t\t\t}))\n\t\t));\n\t\t//arreload\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"arreload\")\n\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\tarreload();\n\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"AutoReply config reloaded.\"), false);\n\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t})\n\t\t));\n\t\t//araddshopitem [Item Name] [Quantity] [Price]\n\t\tCommandRegistry.INSTANCE.register(false, (dispatcher) -> dispatcher.register(\n\t\t\t\tCommandManager.literal(\"araddshopitem\")\n\t\t\t\t\t\t.then(argument(\"Item Name\", string()).then(argument(\"Quantity\", string()).then(argument(\"Price\", string())\n\t\t\t\t\t\t.executes(c -> {\n\t\t\t\t\t\t\tconfig.shopItems.add(getString(c, \"Item Name\") + \"|\" + getString(c, \"Quantity\") + \"|$\" + getString(c, \"Price\"));\n\t\t\t\t\t\t\tConfigManager.saveConfig(config, \"AutoReplyConfigFile\");\n\t\t\t\t\t\t\tc.getSource().sendFeedback(new StringTextComponent(\"Added \" + getString(c, \"Item Name\") + \" to shop stock.\"), false);\n\t\t\t\t\t\t\treturn Command.SINGLE_SUCCESS;\n\t\t\t\t\t\t}))))\n\t\t));\n\t}", "private void customCommands(MessageEvent message) {\r\n String command = message.getMessage();\r\n \r\n if (!reservedCommands.contains(command)) {\r\n String[]info;\r\n info = manager.getCommandFromDatabase(command, message.getChannel().getName());\r\n\r\n //checks if the command is in custom mod commands\r\n if (info[1].matches(\"-m\")) {\r\n if (message.getChannel().getOps().contains(message.getUser())) {\r\n message.getChannel().send().message(info[0]);\r\n } \r\n else {\r\n message.respond(\"You're not allowed to use this command.\");\r\n }\r\n }\r\n //checks if the command is in the custom commands available to everyone\r\n else if (info[1].matches(\"-e\")) {\r\n message.getChannel().send().message(info[0]);\r\n } \r\n else {\r\n message.respond(\"No such command exists\");\r\n }\r\n }\r\n }", "@Override\n\tpublic void onEnable() {\n\n\t\tinstance = this;\n\n\t\tCommon.registerCommands(\n\t\t\t\tnew CommandHat(),\n\t\t\t\tnew CommandFly(),\n\t\t\t\tnew CommandFeed(),\n\t\t\t\tnew CommandHeal(),\n\t\t\t\tnew CommandClearInv(),\n\t\t\t\tnew CommandBroadcast(),\n\t\t\t\tnew CommandHome(),\n\t\t\t\tnew CommandSetHome(),\n\t\t\t\tnew CommandRC(),\n\t\t\t\tnew CommandBackpack()\n\t\t\t\t);\n\n\t\tCommon.registerEvents(this, \n\t\t\t\tnew JoinLeaveListener(),\n\t\t\t\tnew PlayerChatListener(),\n\t\t\t\tnew BackpackListener()\n\t\t\t\t);\n\n\t\t//adding custom recipes\n\t\tCustomRecipes.addCustomRecipes();\n\t\t\n\t\tloadConfigManager();\n\n\t\tCommon.log(\"Initialized RoyalCommands. [Version \" + this.getDescription().getVersion() + \"]\");\n\t}", "@Override\n public void process(Serializable msg) {\n ((Command) msg).execute(arg);\n }", "@Override\n\tprotected void initDefaultCommand() {\n\t\t\n\t}", "@Override\n\tprotected void initDefaultCommand() {\n\t\t\n\t}", "@Override\n\tprotected void initDefaultCommand() {\n\t\t\n\t}", "public boolean test(CommandSender sender, MCommand command);" ]
[ "0.7034979", "0.70176387", "0.6928326", "0.68536615", "0.6828531", "0.6828531", "0.68186337", "0.67533964", "0.66733444", "0.6539449", "0.6501462", "0.63953525", "0.6373059", "0.63489896", "0.6334775", "0.6264612", "0.62580913", "0.6192993", "0.61830395", "0.61286414", "0.61093813", "0.609807", "0.6096291", "0.6091094", "0.6090905", "0.60677713", "0.6057071", "0.60378677", "0.602377", "0.6017412", "0.60130686", "0.5976371", "0.59608537", "0.5955405", "0.59524965", "0.5949261", "0.5923706", "0.592042", "0.5912078", "0.5910414", "0.5907831", "0.58927625", "0.5890589", "0.5884841", "0.5855373", "0.5852822", "0.5838155", "0.58346564", "0.58315724", "0.58180565", "0.58180565", "0.58180565", "0.58180565", "0.58180565", "0.58180565", "0.58180565", "0.58088356", "0.58082974", "0.5805271", "0.5788065", "0.5782774", "0.5768308", "0.5755643", "0.575418", "0.5719573", "0.5710318", "0.57075673", "0.5704849", "0.57041025", "0.57031226", "0.57001895", "0.5692611", "0.5692555", "0.5688723", "0.5686239", "0.5686239", "0.5686239", "0.5686239", "0.5686239", "0.5686239", "0.5685775", "0.56855303", "0.5683129", "0.56796485", "0.5678097", "0.5677843", "0.5677232", "0.56726104", "0.5666674", "0.56568605", "0.56549406", "0.565198", "0.5650748", "0.56499064", "0.56484073", "0.5642128", "0.5638274", "0.563288", "0.563288", "0.563288", "0.56276685" ]
0.0
-1
Checks if a permission exists and of a lower or same priority.
private boolean checkPermissionExists(CommandSender sender, String newPerm, PermissionCheckResult oldPerm, String type) { if (newPerm.startsWith("+")) { if (oldPerm.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { sender.sendMessage(ChatColor.RED + "The " + type + " already has direct access to that permission."); sender.sendMessage(ChatColor.RED + "Node: " + oldPerm.accessLevel); return true; } } else if (newPerm.startsWith("-")) { if (oldPerm.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { sender.sendMessage(ChatColor.RED + "The " + type + " already has an exception for this node."); sender.sendMessage(ChatColor.RED + "Node: " + oldPerm.accessLevel); return true; } else if (oldPerm.resultType.equals(PermissionCheckResult.Type.NEGATION)) { sender.sendMessage(ChatColor.RED + "The " + type + " already has a matching negated node."); sender.sendMessage(ChatColor.RED + "Node: " + oldPerm.accessLevel); return true; } } else { if (oldPerm.resultType.equals(PermissionCheckResult.Type.EXCEPTION)) { sender.sendMessage(ChatColor.RED + "The " + type + " already has an exception for this node."); sender.sendMessage(ChatColor.RED + "Node: " + oldPerm.accessLevel); } else if (oldPerm.resultType.equals(PermissionCheckResult.Type.NEGATION)) { sender.sendMessage(ChatColor.RED + "The " + type + " already has a matching negated node."); sender.sendMessage(ChatColor.RED + "Node: " + oldPerm.accessLevel); } else if (oldPerm.resultType.equals(PermissionCheckResult.Type.FOUND)) { sender.sendMessage(ChatColor.RED + "The " + type + " already has direct access to that permission."); sender.sendMessage(ChatColor.RED + "Node: " + oldPerm.accessLevel); // Since not all plugins define wildcard permissions, allow setting the permission anyway if the permissions dont match exactly. return (oldPerm.accessLevel.equalsIgnoreCase(newPerm)); } } return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean checkPermission(Permission permission);", "boolean isHasPermissions();", "@Override\n\tpublic boolean can(String permission)\n\t{\n\t\treturn this.auth() != null && this.auth().getRole() != null && this.auth().getRole().getPermissions().parallelStream().filter(p -> Pattern.compile(p.getName()).matcher(permission).groupCount() == 0).count() != 0;\n\t}", "@Test\n public void testCheckExistsPermission() throws Exception\n {\n permission = permissionManager.getPermissionInstance(\"OPEN_OFFICE\");\n permissionManager.addPermission(permission);\n assertTrue(permissionManager.checkExists(permission));\n Permission permission2 = permissionManager.getPermissionInstance(\"CLOSE_OFFICE\");\n assertFalse(permissionManager.checkExists(permission2));\n }", "boolean hasPermission(final Player sniper, final String permission);", "static boolean checkPermissionAllowed(Context context, String permission) {\n if (android.os.Build.VERSION.SDK_INT >= 23) {\n boolean hasPermission = false;\n try {\n // Invoke checkSelfPermission method from Android 6 (API 23 and UP)\n java.lang.reflect.Method methodCheckPermission = Activity.class.getMethod(\"checkSelfPermission\", java.lang.String.class);\n Object resultObj = methodCheckPermission.invoke(context, permission);\n int result = Integer.parseInt(resultObj.toString());\n hasPermission = (result == PackageManager.PERMISSION_GRANTED);\n } catch (Exception ex) {\n\n }\n\n return hasPermission;\n } else {\n return true;\n }\n }", "public boolean hasPermission(String sid, Permission p) {\n\t\tfor (; p != null; p = p.impliedBy) {\n\t\t\tSet<String> set = grantedPermissions.get(p);\n\t\t\tif (set != null && set.contains(sid))\n\t\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public boolean isPermissionGranted(String permission){\n return true;\n// else\n// return false;\n }", "public boolean hasPermission ( String name ) {\n\t\treturn extract ( handle -> handle.hasPermission ( name ) );\n\t}", "boolean check(Permission permission, Surrogate surrogate, boolean permissionRequired) throws T2DBException;", "@Override\n public void checkPermission(Permission perm) {\n }", "boolean hasPriority();", "boolean hasPriority();", "boolean hasPriority();", "public void permission_check() {\n //Usage Permission\n if (!isAccessGranted()) {\n new LovelyStandardDialog(MainActivity.this)\n .setTopColorRes(R.color.colorPrimaryDark)\n .setIcon(R.drawable.ic_perm_device_information_white_48dp)\n .setTitle(getString(R.string.permission_check_title))\n .setMessage(getString(R.string.permission_check_message))\n .setPositiveButton(android.R.string.ok, new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n Intent intent = new Intent(android.provider.Settings.ACTION_USAGE_ACCESS_SETTINGS);\n startActivity(intent);\n }\n })\n .setNegativeButton(android.R.string.no, null)\n .show();\n }\n }", "public void checkPermission(String permission, int requestCode)\n {\n if (ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_DENIED) {\n // Requesting the permission\n ActivityCompat.requestPermissions(this, new String[] { permission }, requestCode);\n }\n else {\n Toast.makeText(this, \"Permission already granted\", Toast.LENGTH_SHORT).show();\n }\n }", "public boolean hasPermission ( Permission perm ) {\n\t\treturn extract ( handle -> handle.hasPermission ( perm ) );\n\t}", "public boolean hasPermissions(Set<Permission> p) {\n if (p.isEmpty()) {\n return true;\n }\n return hasPermissionsFor(request, subject, p);\n }", "private static boolean isPermissionGranted(Context context, String permission) {\n if (ContextCompat.checkSelfPermission(context, permission)\n == PackageManager.PERMISSION_GRANTED) {\n Log.i(TAG, permission + \" granted\");\n return true;\n }\n Log.i(TAG, permission + \" not granted yet\");\n return false;\n }", "@Test\n public void testCheckExistsPermissionWithString() throws Exception\n {\n permission = permissionManager.getPermissionInstance(\"OPEN_OFFICE2\");\n permissionManager.addPermission(permission);\n assertTrue(permissionManager.checkExists(permission.getName()));\n Permission permission2 = permissionManager.getPermissionInstance(\"CLOSE_OFFICE2\");\n assertFalse(permissionManager.checkExists(permission2.getName()));\n }", "private void checkIfPermissionGranted() {\n\n //if user already allowed the permission, this condition will be true\n if (ContextCompat.checkSelfPermission(this, PERMISSION_CODE)\n == PackageManager.PERMISSION_GRANTED) {\n Intent launchIntent = getPackageManager().getLaunchIntentForPackage(\"com.example.a3\");\n if (launchIntent != null) {\n startActivity(launchIntent);//null pointer check in case package name was not found\n }\n }\n //if user didn't allow the permission yet, then ask for permission\n else {\n ActivityCompat.requestPermissions(this, new String[]{PERMISSION_CODE}, 0);\n }\n }", "boolean memberHasPermission(String perm, Member m);", "public boolean hasPermission(String permission) {\n return SecurityUtil.getListPermissions()\n .map(list -> list.contains(StringUtils.lowerCase(permission)))\n .orElse(false);\n }", "private boolean permisos() {\n for(String permission : PERMISSION_REQUIRED) {\n if(ContextCompat.checkSelfPermission(getContext(), permission) != PackageManager.PERMISSION_GRANTED) {\n return false;\n }\n }\n return true;\n }", "private boolean checkPermission() {\r\n int result = ContextCompat.checkSelfPermission(getApplicationContext(), READ_CONTACTS);\r\n int result1 = ContextCompat.checkSelfPermission(getApplicationContext(), CAMERA);\r\n int result2 = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_FINE_LOCATION);\r\n int result3 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);\r\n int result4 = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\r\n int result5 = ContextCompat.checkSelfPermission(getApplicationContext(), READ_PHONE_STATE);\r\n int result6 = ContextCompat.checkSelfPermission(getApplicationContext(), RECORD_AUDIO);\r\n int result7 = ContextCompat.checkSelfPermission(getApplicationContext(), SEND_SMS);\r\n //int result8 = ContextCompat.checkSelfPermission(getApplicationContext(), BLUETOOTH);\r\n\r\n return result == PackageManager.PERMISSION_GRANTED && result1 == PackageManager.PERMISSION_GRANTED && result2 == PackageManager.PERMISSION_GRANTED &&\r\n result3 == PackageManager.PERMISSION_GRANTED && result4 == PackageManager.PERMISSION_GRANTED && result5 == PackageManager.PERMISSION_GRANTED &&\r\n result6 == PackageManager.PERMISSION_GRANTED && result7 == PackageManager.PERMISSION_GRANTED/*&& result8== PackageManager.PERMISSION_GRANTED*/;\r\n }", "@Override\n public void checkPermission(Permission perm, Object context) {\n }", "private Boolean checkRuntimePermission() {\n List<String> permissionsNeeded = new ArrayList<String>();\n\n final List<String> permissionsList = new ArrayList<String>();\n if (!addPermission(permissionsList, Manifest.permission.READ_EXTERNAL_STORAGE))\n permissionsNeeded.add(\"Storage\");\n if (!addPermission(permissionsList, Manifest.permission.CAMERA))\n permissionsNeeded.add(\"Camera\");\n /* if (!addPermission(permissionsList, Manifest.permission.WRITE_CONTACTS))\n permissionsNeeded.add(\"Write Contacts\");*/\n\n if (permissionsList.size() > 0) {\n if (permissionsNeeded.size() > 0) {\n // Need Rationale\n String message = \"You need to grant access to \" + permissionsNeeded.get(0);\n for (int i = 1; i < permissionsNeeded.size(); i++)\n message = message + \", \" + permissionsNeeded.get(i);\n showMessageOKCancel(message,\n new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(permissionsList.toArray(new String[permissionsList.size()]),\n REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);\n }\n }\n });\n return false;\n }\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n requestPermissions(permissionsList.toArray(new String[permissionsList.size()]),\n REQUEST_CODE_ASK_MULTIPLE_PERMISSIONS);\n }\n return false;\n }\n return true;\n }", "private void checkIfPermissionGranted(List<String> requiredPermissions, String permissionToCheck){\n if (ActivityCompat.checkSelfPermission(activity, permissionToCheck)\n != PackageManager.PERMISSION_GRANTED) {\n requiredPermissions.add(permissionToCheck);\n }\n }", "private static boolean hasPermission(String username, Permission requiredPermission) throws IOException, SQLException {\n ArrayList<Boolean> userPermissions = retrieveUserPermissionsFromDb(username);\n switch (requiredPermission) {\n case CreateBillboard:\n if (userPermissions.get(0)) return true;\n return false;\n case EditBillboard:\n if (userPermissions.get(1)) return true;\n return false;\n case ScheduleBillboard:\n if (userPermissions.get(2)) return true;\n return false;\n case EditUser:\n if (userPermissions.get(3)) return true;\n return false;\n default:\n return false; // Default to false if permission cannot be identified\n }\n }", "private boolean hasPermission(String permission) {\n if (canMakeSmores()) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n return (checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED);\n }\n }\n return true;\n }", "private boolean checkPermission() {\n if (Build.VERSION.SDK_INT >= 23 &&\n ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {\n // Permission is not granted\n return false;\n } else {\n return true;// Permission has already been granted }\n }\n }", "public static boolean m45181a() {\n Context b = m45183b();\n if (b != null) {\n try {\n PackageManager packageManager = b.getPackageManager();\n if (packageManager == null) {\n return true;\n }\n String[] strArr = packageManager.getPackageInfo(b.getPackageName(), 4096).requestedPermissions;\n if (strArr == null) {\n return false;\n }\n String[] strArr2 = f31382a;\n for (String str : strArr2) {\n boolean a = m45182a(strArr, str);\n f31383b.put(str, Boolean.valueOf(a));\n if (!a) {\n TLogger.m45340ee(\"PermissionChecker\", \"The required permission of <\" + str + \"> does not found!\");\n return false;\n }\n }\n return true;\n } catch (Throwable th) {\n TLogger.m45339e(\"PermissionChecker\", \"check required permissins exception.\", th);\n return false;\n }\n } else {\n throw new IllegalArgumentException(\"The context parameter can not be null!\");\n }\n }", "public boolean hasPerms()\n {\n return ContextCompat.checkSelfPermission(itsActivity, itsPerm) ==\n PackageManager.PERMISSION_GRANTED;\n }", "@Override\n public boolean containsPermission(Class<? extends AeroCommandBase<?>> command, String permission) {\n if (!containsPermissions(command)) {\n return false;\n }\n\n return permissions.get(command).contains(permission.toLowerCase());\n }", "public boolean hasPermission(T object, Permission permission, User user);", "private boolean checkPermissions(HttpServletRequest request, RouteAction route) {\n\t\treturn true;\n\t}", "public boolean accesspermission()\n {\n AppOpsManager appOps = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);\n int mode = 0;\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {\n mode = appOps.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS,\n Process.myUid(),context.getPackageName());\n }\n if (mode == AppOpsManager.MODE_ALLOWED) {\n\n return true;\n }\n return false;\n\n }", "public abstract boolean impliesWithoutTreePathCheck(Permission permission);", "public boolean isPermissionExists(Permission permission) {\n boolean hasPermission = false;\n Connection conn = null;\n PreparedStatement ps = null;\n ResultSet resultSet = null;\n String query = null;\n try {\n conn = getConnection();\n query = queryManager.getQuery(conn, QueryManager.CHECK_PERMISSION_EXISTS_QUERY);\n ps = conn.prepareStatement(query);\n ps.setString(1, permission.getAppName());\n ps.setString(2, permission.getPermissionString());\n resultSet = ps.executeQuery();\n while (resultSet.next()) {\n hasPermission = true;\n }\n } catch (SQLException e) {\n log.debug(\"Failed to execute SQL query {}\", query);\n throw new PermissionException(\"Unable to execute check permissions.\", e);\n } finally {\n closeConnection(conn, ps, resultSet);\n }\n return hasPermission;\n }", "public boolean checkPermission(PermissionCheckContext context) {\n PolarAccountInfo account = accountPrivilegeData.getAndCheckById(context.getAccountId());\n if (PolarAuthorizer.hasPermission(account, context.getPermission())) {\n return true;\n }\n\n return account.getRolePrivileges().getActiveRoleIds(context.getActiveRoles(), config.getMandatoryRoleIds())\n .stream()\n .map(accountPrivilegeData::getById)\n .filter(Objects::nonNull)\n .anyMatch(role -> PolarAuthorizer.hasPermission(role, context.getPermission()));\n }", "public boolean checkPermissions(String account,String group, String resource, String action)\n throws Exception\n {\n return checkPermissions(new PolicyCredentials(account,group),resource,action);\n }", "@Override\n public boolean implies(Permission p) {\n\n\t// Quick reject tests\n\tif (p == null)\n\t return false;\n\tif (!(p instanceof SharedActivationPolicyPermission))\n\t return false;\n\n SharedActivationPolicyPermission other = \n (SharedActivationPolicyPermission)p; \n\n // Delegate to FilePermission logic \n boolean\tanswer = policyPermission.implies(other.policyPermission);\n\n\tif (DEBUG) {\n \t System.out.println(\"SharedActivationPolicyPermission::implies() - \" \n\t + \"checking \" + policyPermission + \" vs. \" \n\t + other.policyPermission + \": \" + answer);\n\t}\n\n\treturn answer;\n }", "public int checkNotificationPermission() throws android.os.RemoteException;", "public boolean hasPermission(Permission permission)\n throws Exception\n {\n boolean value = false;\n TurbineAccessControlList<?> acl = data.getACL();\n if (acl == null ||\n !acl.hasPermission(permission))\n {\n data.setScreen(failScreen);\n data.setMessage(message);\n }\n else\n {\n value = true;\n }\n return value;\n }", "private boolean validateAccess(String permission) {\n\t\tif (\"READ\".equalsIgnoreCase(permission)) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "boolean check(Permission permission, DBObject dBObject,\n\t\t\tboolean permissionRequired) throws T2DBException;", "private boolean hasResourceActionAllowPermissions(Resource resource,\n String action) {\n String whereClause = \"p.resource = :resource AND (\"\n + \"(p.action = :action AND p.type = :typeAllow) OR \"\n + \"(p.type = :typeAllowAll))\";\n Map<String, Object> parameters = new HashMap<String, Object>();\n parameters.put(\"resource\", resource.getIdentifier());\n parameters.put(\"action\", action);\n parameters.put(\"typeAllow\", PermissionType.ALLOW);\n parameters.put(\"typeAllowAll\", PermissionType.ALLOW_ALL);\n\n Long count = FacadeFactory.getFacade().count(PermissionEntity.class,\n whereClause, parameters);\n\n return count > 0 ? true : false;\n }", "public boolean checkIfUserHasPermission(long userId, Permission permission) {\n final Optional<User> user = userRepository.findById(userId);\n\n return user.isPresent()\n && permission != null\n && user.get().getRole().getPermissions().contains(permission);\n\n }", "public boolean validatePermissions()\r\n\t{\n\t\treturn true;\r\n\t}", "public boolean checkPerms()\n {\n boolean perms = hasPerms();\n if (!perms) {\n ActivityCompat.requestPermissions(\n itsActivity, new String[] { itsPerm }, itsPermsRequestCode);\n }\n return perms;\n }", "public boolean checkPermissions(String permission) {\r\n Log.d(TAG, \"checkPermissions: checking permission: \" + permission);\r\n\r\n int permissionRequest = ActivityCompat.checkSelfPermission(EditProfileActivity.this, permission);\r\n\r\n if (permissionRequest != PackageManager.PERMISSION_GRANTED) {\r\n Log.d(TAG, \"checkPermissions: \\n Permission was not granted for: \" + permission);\r\n Toast.makeText(this, \"Permissions not granted to access camera,\\n\" +\r\n \"please give permissions to GetAplot\", Toast.LENGTH_SHORT).show();\r\n return false;\r\n } else {\r\n Log.d(TAG, \"checkPermissions: \\n Permission was granted for: \" + permission);\r\n return true;\r\n }\r\n }", "public boolean has(Player player, String permission)\n {\n if (player == null)\n {\n return true;\n }\n\n if (handler != null)\n {\n if (handler.has(player, \"preciousstones.blacklist\") && !handler.has(player, \"preciousstones.admintest\"))\n {\n return false;\n }\n\n return handler.has(player, permission);\n }\n else\n {\n return player.hasPermission(permission);\n }\n }", "@Override\n public boolean hasPermission(CommandSender sender, String pNode) {\n if (!(sender instanceof Player)) return true;\n return hasPermission((Player) sender, pNode);\n }", "public boolean hasPermissions(Player player) {\n\t\tif (!m_bHasPermissions && player.isOp())\n\t\t\treturn true;\n\t\telse if (m_bHasPermissions && m_PermissionHandler.has(player, \"lord.orbitalstrike\"))\n\t\t\treturn true;\n\t\telse {\n\t\t\tOrbitalStrike.sendMessage(player, \"You do not have permission to use this plugin.\");\n\t\t\tOrbitalStrike.logInfo(\"Player \" + player + \" does not have permission.\", 1);\n\t\t\treturn false;\n\t\t}\n\t}", "public boolean hasPermission(Uri uri)\n\t{\n\t\treturn getPermissibleRoot(uri) != null;\n\t}", "public boolean CheckingPermissionIsEnabledOrNot() {\n int FirstPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), INTERNET);\n int SecondPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_NETWORK_STATE);\n int ThirdPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), WRITE_EXTERNAL_STORAGE);\n int ForthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), READ_EXTERNAL_STORAGE);\n int FifthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_COARSE_LOCATION);\n int SixthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), ACCESS_FINE_LOCATION);\n int SeventhPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), VIBRATE);\n// int EighthPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), CALL_PHONE);\n// int NinethPermissionResult = ContextCompat.checkSelfPermission(getApplicationContext(), SEND_SMS);\n\n return FirstPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SecondPermissionResult == PackageManager.PERMISSION_GRANTED &&\n ThirdPermissionResult == PackageManager.PERMISSION_GRANTED &&\n ForthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n FifthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SixthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n SeventhPermissionResult == PackageManager.PERMISSION_GRANTED;\n// EighthPermissionResult == PackageManager.PERMISSION_GRANTED &&\n// NinethPermissionResult == PackageManager.PERMISSION_GRANTED;\n }", "public boolean addPermission(Permission permission);", "private boolean checkAndRequestPermissions() {\n List<String> listPermissionsNeeded = new ArrayList<>();\n for (String pem : appPermissions){\n if (ContextCompat.checkSelfPermission(this, pem) != PackageManager.PERMISSION_GRANTED){\n listPermissionsNeeded.add(pem);\n }\n }\n\n //ask for non-granted permissions\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray(new String[listPermissionsNeeded.size()]), PERMISSION_REQUEST_CODE);\n return false;\n }\n return true;\n }", "public boolean hasPermission(Player player, String pNode) {\n if (player == null) return true;\n\n // If the player has the permission directly, use that\n boolean hasPermission = player.hasPermission(pNode);\n if (player.isPermissionSet(pNode)) {\n return hasPermission;\n }\n\n // Check for wildcards, this is particularly important for lists\n // Only going to look up one level though, and hope the perm system handles it from there\n if (pNode.contains(\".\")) {\n String parentNode = pNode.substring(0, pNode.lastIndexOf('.') + 1) + \"*\";\n // We will use the wildcard default as the default\n // this lets me make lists that default to true or false by controlling the default wildcard perm\n // This should never fall back to using an unset default, so we should always have a wildcard set for\n // any lists in plugin.yml\n return player.hasPermission(parentNode);\n }\n\n // Use default permission\n return hasPermission;\n }", "public boolean doesPrincipalHavePermission(\n IAuthorizationPrincipal principal,\n String owner,\n String activity,\n String target,\n IPermissionPolicy policy)\n throws AuthorizationException;", "int getPermissionRead();", "public boolean hasPermission(String permission)\n throws Exception\n {\n Permission permissionObject = null;\n try\n {\n permissionObject = securityService.getPermissionManager().getPermissionByName(permission);\n }\n catch (UnknownEntityException e)\n {\n if(initialize)\n {\n permissionObject = securityService.getPermissionManager().getPermissionInstance(permission);\n securityService.getPermissionManager().addPermission(permissionObject);\n\n Role role = null;\n TurbineAccessControlList<?> acl = data.getACL();\n RoleSet roles = acl.getRoles();\n if(roles.size() > 0)\n {\n\t\t\t\t\trole = roles.toArray(new Role[0])[0];\n\t\t\t\t}\n\n if(role == null)\n {\n /*\n * The User within data has no roles yet, let us grant the permission\n * to the first role available through SecurityService.\n */\n roles = securityService.getRoleManager().getAllRoles();\n if(roles.size() > 0)\n {\n\t\t\t\t\t\trole = roles.toArray(new Role[0])[0];\n\t\t\t\t\t}\n }\n\n if(role != null)\n {\n /*\n * If we have no role, there is nothing we can do about it. So only grant it,\n * if we have a role to grant it to.\n */\n TurbineModelManager modelManager = (TurbineModelManager)securityService.getModelManager();\n modelManager.grant(role, permissionObject);\n }\n }\n else\n {\n throw(e);\n }\n }\n\n return hasPermission(permissionObject);\n }", "@NonNull\n public PendingResult<PermissionStatus> checkPermissionStatus(@NonNull Permission permission) {\n UALog.d(\"Checking permission for %s\", permission);\n\n synchronized (pendingCheckResults) {\n return pendingOrCall(permission, pendingCheckResults, delegate -> {\n final PendingResult<PermissionStatus> pendingResult = new PendingResult<>();\n\n if (delegate == null) {\n UALog.d(\"No delegate for permission %s\", permission);\n pendingResult.setResult(PermissionStatus.NOT_DETERMINED);\n return pendingResult;\n }\n\n synchronized (pendingCheckResults) {\n pendingCheckResults.put(delegate, pendingResult);\n }\n\n mainHandler.post(() -> delegate.checkPermissionStatus(context, status -> {\n UALog.d(\"Check permission %s status result: %s\", permission, status);\n updatePermissionStatus(permission, status);\n pendingResult.setResult(status);\n\n synchronized (pendingCheckResults) {\n pendingCheckResults.remove(delegate);\n }\n }));\n\n return pendingResult;\n });\n }\n }", "public boolean hasPermission(Context paramContext, String paramString) {\n }", "private boolean checkPermissionFromDevice(int permissions) {\n\n switch (permissions) {\n case RECORD_AUDIO_PERMISSION_CODE: {\n // int variables will be 0 if permissions are not granted already\n int write_external_storage_result =\n ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE);\n int record_audio_result =\n ContextCompat.checkSelfPermission(this, Manifest.permission.RECORD_AUDIO);\n\n // returns true if both permissions are already granted\n return write_external_storage_result == PackageManager.PERMISSION_GRANTED &&\n record_audio_result == PackageManager.PERMISSION_GRANTED;\n }\n default:\n return false;\n }\n }", "public boolean hasPermission(CommandSender sender) {\n return this.reason == Reason.PROPERTY_NOT_FOUND ||\n this.property.hasPermission(sender, this.name);\n }", "public boolean checkPermissions(String... permissions) {\n if (permissions != null) {\n for (String permission : permissions) {\n if (ActivityCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) {\n return false;\n }\n }\n }\n return true;\n }", "public int getPermission(Integer resourceId);", "private static boolean hasPermissions(Context context, String... permissions) {\n for (String permission : permissions) {\n if (ContextCompat.checkSelfPermission(context, permission)\n != PackageManager.PERMISSION_GRANTED) {\n return false;\n }\n }\n return true;\n }", "public boolean checkPermissions(String check)\n {\n Log.d(TAG,\"check single PErmission\");\n int permissionRequest= ActivityCompat.checkSelfPermission(UploadActivity.this,check);\n if(permissionRequest!= PackageManager.PERMISSION_GRANTED)\n {\n Log.d(TAG,\"check PErmission\\nPermission was not granted for:\"+check);\n return false;\n }\n else\n {\n Log.d(TAG,\"check PErmission\\nPermission was granted for:\"+check);\n return true;\n }\n\n }", "private boolean checkPermissions(Activity activity) {\n String[] permissions = getRequiredAndroidPermissions();\n return handler.areAllPermissionsGranted(activity, permissions);\n }", "@Override\n\tpublic synchronized boolean implies(Permission p) {\n\t for (int i = perms.size(); --i >= 0; ) {\n\t\tif (((Permission)perms.get(i)).implies(p))\n\t\t return true;\n\t }\n\t return false;\n\t}", "void check(Permission permission, Surrogate surrogate) throws T2DBException;", "public void checkpermission()\n {\n permissionUtils.check_permission(permissions,\"Need GPS permission for getting your location\",1);\n }", "public Map<String, Boolean> hasPermission(String login, List<String> permissions);", "public void checkPermissionStatus(@NonNull Permission permission, @NonNull Consumer<PermissionStatus> callback) {\n checkPermissionStatus(permission).addResultCallback(callback::accept);\n }", "public boolean hasPermission(TwitchAccount account, String permissionKey) {\n\n // Team has global access\n User user = ServiceRegistry.get(DataService.class).get(UserRepository.class).getByTwitchId(account.getTwitchId());\n if (user != null && user.getRank().equals(UserRank.TEAM)) {\n return true;\n }\n\n for (Permissions perm : getPermissions()) {\n if (perm.hasPermission(account, permissionKey)) {\n return true;\n }\n }\n\n return false;\n }", "private boolean addPermission(List<String> permissionsList, String permission) {\n if (ContextCompat.checkSelfPermission(BecomeHostActivity.this, permission) != PackageManager.PERMISSION_GRANTED) {\n permissionsList.add(permission);\n // Check for Rationale Option\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {\n if (!shouldShowRequestPermissionRationale(permission))\n return false;\n }\n }\n return true;\n }", "boolean requestIfNeeded(Activity activity, Permission permission);", "public void checkPermission() {\n Log.e(\"checkPermission\", \"checkPermission\");\n\n // Here, thisActivity is the current activity\n if (ContextCompat.checkSelfPermission(RegisterActivity.this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(RegisterActivity.this,\n Manifest.permission.ACCESS_FINE_LOCATION)) {\n ActivityCompat.requestPermissions(RegisterActivity.this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n // Show an expanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n\n } else {\n\n // No explanation needed, we can request the permission.\n\n ActivityCompat.requestPermissions(RegisterActivity.this,\n new String[]{Manifest.permission.ACCESS_FINE_LOCATION},\n MY_PERMISSIONS_REQUEST_READ_CONTACTS);\n\n // MY_PERMISSIONS_REQUEST_READ_CONTACTS is an\n // app-defined int constant. The callback method gets the\n // result of the request.\n }\n }\n\n\n }", "public void checkPermission() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.RECORD_AUDIO) +\n ContextCompat.checkSelfPermission(this, Manifest.permission.MODIFY_AUDIO_SETTINGS)\n != PackageManager.PERMISSION_GRANTED) {\n\n ActivityCompat.requestPermissions(this, perms, permsRequestCode);\n permissionGranted = false;\n } else {\n permissionGranted = true;\n }\n }", "public boolean checkPermission(final DataBucketBean bucket, final String permission) {\r\n\t\t\treturn _security_service.isUserPermitted(principalName, bucket, Optional.of(permission));\r\n\t\t}", "private void checkRunTimePermission() {\n\n if(checkPermission()){\n\n Toast.makeText(MainActivity.this, \"All Permissions Granted Successfully\", Toast.LENGTH_LONG).show();\n\n }\n else {\n\n requestPermission();\n }\n }", "private void checkpermission() {\n permissionUtils = new PermissionUtils(context, this);\n permissions.add(Manifest.permission.ACCESS_FINE_LOCATION);\n permissions.add(Manifest.permission.ACCESS_COARSE_LOCATION);\n permissionUtils.check_permission(permissions, \"Need GPS permission for getting your location\", LOCATION_REQUEST_CODE);\n }", "public static boolean hasPermission(Player player, String permission){\n \t\tif (player.hasPermission(permission)){\n \t\t\treturn true;\n \t\t}\n \t\tString permWithWild = \"\";\n \t\tString[] nodes = permission.split(\"\\\\.\");\n \t\tSystem.out.println(nodes.length);\n \t\tfor (int i = 0; i + 1 <= nodes.length; i++){\n \t\t\tif (i + 1 == nodes.length){\n \t\t\t\tpermWithWild += \"*\";\n \t\t\t\tif (player.hasPermission(permWithWild)){\n \t\t\t\t\treturn true;\n \t\t\t\t}\n \t\t\t} else {\n \t\t\t\tpermWithWild += nodes[i] + \".\";\n \t\t\t\tif (player.hasPermission(permWithWild + \"*\")){\n \t\t\t\t\treturn true;\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\treturn false;\n \t}", "private boolean checkPermission() {\n Log.d(\"TAG\", \"checkPermission()\");\n // Ask for permission if it wasn't granted yet\n return (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED );\n }", "private boolean checkPermission() {\n\n if ((ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE)\n != PackageManager.PERMISSION_GRANTED) &&\n (ContextCompat.checkSelfPermission(this,\n Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED)\n\n ) {\n\n // Permission is not granted\n return false;\n\n }\n return true;\n }", "private boolean checkAndRequestPermissions() {\n\n List<String> listPermissionsNeeded = new ArrayList<>();\n /*if (camera != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(android.Manifest.permission.CAMERA);\n }\n\n if (wstorage != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(android.Manifest.permission.WRITE_EXTERNAL_STORAGE);\n }\n\n if (rstorage != PackageManager.PERMISSION_GRANTED) {\n listPermissionsNeeded.add(Manifest.permission.READ_EXTERNAL_STORAGE);\n }\n if (rphoneState != PackageManager.PERMISSION_GRANTED)\n {\n listPermissionsNeeded.add(Manifest.permission.READ_PHONE_STATE);\n }*/\n\n// if(cLocation != PackageManager.PERMISSION_GRANTED){\n// listPermissionsNeeded.add(Manifest.permission.ACCESS_COARSE_LOCATION);\n// }\n//\n// if(fLocation != PackageManager.PERMISSION_GRANTED){\n// listPermissionsNeeded.add(Manifest.permission.ACCESS_FINE_LOCATION);\n// }\n\n if (!listPermissionsNeeded.isEmpty()) {\n ActivityCompat.requestPermissions(this, listPermissionsNeeded.toArray\n (new String[listPermissionsNeeded.size()]), REQUEST_ID_MULTIPLE_PERMISSIONS);\n return false;\n }\n success();\n return true;\n }", "public boolean isAccessGranted() {\n try {\n PackageManager packageManager = getPackageManager();\n ApplicationInfo applicationInfo = packageManager.getApplicationInfo(getPackageName(), 0);\n AppOpsManager appOpsManager = (AppOpsManager) getSystemService(Context.APP_OPS_SERVICE);\n int mode;\n assert appOpsManager != null;\n mode = appOpsManager.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS,\n applicationInfo.uid, applicationInfo.packageName);\n return (mode == AppOpsManager.MODE_ALLOWED);\n\n } catch (PackageManager.NameNotFoundException e) {\n return false;\n }\n }", "public boolean doesPrincipalHavePermission(\n IAuthorizationPrincipal principal,\n String owner,\n String activity,\n String target)\n throws AuthorizationException;", "public int checkCallingPermission(String permission) {\n return this.mService.checkCallingPermission(permission);\n }", "public boolean handlesExclusively(Permission pond) {\n\t\treturn false;\n\t}", "public boolean checkPerm(String tenantId, String username, String systemId, String path, Permission perm)\n throws ServiceException\n {\n try {\n // 99% of the time, a user will have access to the root of the storage system, so lets\n // just check that first. If they have access to the top level, anything below is also permitted.\n FilePermCacheKey topKey = new FilePermCacheKey(tenantId, systemId, \"/\", username, perm);\n boolean hasTopAccess = cache.get(topKey);\n if (hasTopAccess) return true;\n // If that didn't catch it, lets check for the true path given.\n FilePermCacheKey key = new FilePermCacheKey(tenantId, systemId, path, username, perm);\n return cache.get(key);\n } catch (ExecutionException ex) {\n String msg = LibUtils.getMsg(\"FILES_CACHE_ERR\", \"FilePerms\", tenantId, systemId, username, ex.getMessage());\n throw new ServiceException(msg, ex);\n }\n }", "public boolean checkPermissions() {\n if (ContextCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_FINE_LOCATION)\n != PackageManager.PERMISSION_GRANTED) {\n\n // Should we show an explanation?\n if (ActivityCompat.shouldShowRequestPermissionRationale(this,\n Manifest.permission.ACCESS_FINE_LOCATION)) {\n\n // Show an explanation to the user *asynchronously* -- don't block\n // this thread waiting for the user's response! After the user\n // sees the explanation, try again to request the permission.\n new AlertDialog.Builder(this)\n .setTitle(\"TITLE\")\n .setMessage(\"TEXT\")\n .setPositiveButton(\"OKAY\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialogInterface, int i) {\n //Prompt the user once explanation has been shown\n ActivityCompat.requestPermissions(MapsActivity.this,\n new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQ_LOC);\n }\n })\n .create()\n .show();\n\n\n } else {\n // No explanation needed, we can request the permission.\n ActivityCompat.requestPermissions(this,\n new String[]{\n Manifest.permission.ACCESS_FINE_LOCATION},\n PERMISSION_REQ_LOC);\n }\n return false;\n } else {\n return true;\n }\n }", "public boolean isPermissionSet ( String name ) {\n\t\treturn extract ( handle -> handle.isPermissionSet ( name ) );\n\t}", "private boolean checkPermission() {\n Log.d(TAG, \"checkPermission()\");\n // Ask for permission if it wasn't granted yet\n return (ContextCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION)\n == PackageManager.PERMISSION_GRANTED);\n }", "public static boolean testPermission(CommandSender sender, String perm) {\n return !(sender instanceof Player) || sender.hasPermission(\"SlapPlugin.\" + perm);\n }", "public boolean implies( Permission permission ) \n {\n if ( !( permission instanceof WrapperEventPermission ) )\n {\n return false;\n }\n\n WrapperEventPermission wsp = (WrapperEventPermission)permission;\n \n int desiredMask = wsp.getActionMask();\n int pendingMask = desiredMask;\n int foundMask = 0;\n \n for ( Enumeration en = m_permissions.elements(); en.hasMoreElements(); )\n {\n WrapperEventPermission p2 =\n (WrapperEventPermission)en.nextElement();\n if ( ( pendingMask & p2.getActionMask() ) != 0 )\n {\n // This permission has one or more eventTypes that we need.\n if ( wsp.impliesIgnoreEventTypeMask( p2 ) )\n {\n foundMask |= desiredMask & p2.getActionMask();\n if ( foundMask == desiredMask )\n {\n return true;\n }\n pendingMask = desiredMask ^ foundMask;\n }\n }\n }\n \n return false;\n }", "private boolean checkPermissions() {\n int permissionState1 = ActivityCompat.checkSelfPermission(this,\n android.Manifest.permission.ACCESS_FINE_LOCATION);\n\n int permissionState2 = ActivityCompat.checkSelfPermission(this,\n Manifest.permission.ACCESS_COARSE_LOCATION);\n return permissionState1 == PackageManager.PERMISSION_GRANTED && permissionState2 == PackageManager.PERMISSION_GRANTED;\n }", "@Override\n\tpublic boolean hasPermissions(File file, int position, String permissionLetter) {\n\t\treturn true;\n\t}" ]
[ "0.6877882", "0.66491205", "0.63882357", "0.63589895", "0.6333975", "0.626502", "0.6259388", "0.62329936", "0.6207168", "0.61218673", "0.60808724", "0.6040488", "0.6040488", "0.6040488", "0.5989745", "0.5973831", "0.5972375", "0.5961492", "0.5952838", "0.5951377", "0.59475577", "0.5914171", "0.59031296", "0.58793616", "0.58719987", "0.58641255", "0.58602506", "0.5849634", "0.58289295", "0.57568586", "0.57553893", "0.5753267", "0.57471883", "0.5744796", "0.5736182", "0.573407", "0.57246864", "0.5722203", "0.5695358", "0.5669312", "0.5668655", "0.5657515", "0.56475735", "0.5647215", "0.5646475", "0.56336033", "0.5633198", "0.5629528", "0.56245446", "0.5617028", "0.5614781", "0.5611891", "0.5580153", "0.5577372", "0.55731374", "0.55586576", "0.55506706", "0.5549912", "0.55240065", "0.5517129", "0.5505329", "0.5497472", "0.54937136", "0.546577", "0.54639816", "0.54543316", "0.54498255", "0.5448106", "0.5446741", "0.5439018", "0.54295135", "0.54285425", "0.5426802", "0.5405267", "0.5398144", "0.5397286", "0.53875005", "0.53815246", "0.5380307", "0.5380013", "0.53733546", "0.5361366", "0.5359153", "0.53570145", "0.53530306", "0.5352745", "0.53407025", "0.5326002", "0.5319066", "0.5315277", "0.5296821", "0.5294718", "0.529121", "0.5290088", "0.52893186", "0.52791077", "0.5261076", "0.5258482", "0.52572966", "0.525347" ]
0.57770276
29
Sets up the default world for use.
private boolean setDefaultWorldHandler(CommandSender sender) { dataHolder = worldsHolder.getWorldData(worldsHolder.getDefaultWorld().getName()); permissionHandler = dataHolder.getPermissionsHandler(); if ((dataHolder != null) && (permissionHandler != null)) { selectedWorlds.put(sender.getName(), dataHolder.getName()); sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. Default world '" + worldsHolder.getDefaultWorld().getName() + "' selected."); return true; } sender.sendMessage(ChatColor.RED + "Couldn't retrieve your world. World selection is needed."); sender.sendMessage(ChatColor.RED + "Use /manselect <world>"); return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected abstract void initializeWorld();", "public World()\n\t{\n\t\tinitWorld();\t\n\t}", "@BeforeClass\n\tpublic static void setup() {\n\t\tbaseWorld = new BaseWorld(1000 ,1500);\n \tGameManager.get().setWorld(new BaseWorld(1000, 1500));\n\t}", "@Override\n\tpublic void init() {\n\t\tworld = new World(gsm);\n\t\tworld.init();\n\t\t\n\t\tif(worldName == null){\n\t\t\tworldName = \"null\";\n\t\t\tmap_name = \"map\";\n\t\t} \n\t\tworld.generate(map_name);\n\t}", "private void configureWorlds(){\n switch (gameWorld){\n case NORMAL:\n world.setPVP(true);\n world.setKeepSpawnInMemory(false);\n world.setAutoSave(false);\n world.setStorm(false);\n world.setThundering(false);\n world.setAnimalSpawnLimit((int) (mobLimit * 0.45));\n world.setMonsterSpawnLimit((int) (mobLimit * 0.45));\n world.setWaterAnimalSpawnLimit((int) (mobLimit * 0.1));\n world.setDifficulty(Difficulty.HARD);\n break;\n case NETHER:\n world.setPVP(true);\n world.setAutoSave(false);\n world.setKeepSpawnInMemory(false);\n world.setStorm(false);\n world.setThundering(false);\n world.setMonsterSpawnLimit((int) (mobLimit * 0.45));\n world.setAnimalSpawnLimit((int) (mobLimit * 0.45));\n world.setWaterAnimalSpawnLimit((int) (mobLimit * 0.1));\n world.setDifficulty(Difficulty.HARD);\n break;\n }\n }", "public OverWorld()\n { \n // Create a new world with 800x600 cells with a cell size of 1x1 pixels.\n super(1024, 600, 1, false);\n Setup();\n }", "public void setWorld(World world) {\n this.world = world;\n }", "public void initializeWorld() {\n checkWorldAndGameManager();\n if (this.worldDisplay == null) {\n throw new GameSetupException(\"World display has not been passed to\" +\n \" WorldDisplayManager\");\n } if (this.renderer == null) {\n throw new GameSetupException(\"Renderer is not initialized\" +\n \" for WorldDisplayManager\");\n }\n // Instantiate the helper managers\n tilesManager = new TilesManager(this.world, this.worldDisplay);\n\n // render the tiles\n tilesManager.renderInitialWorld();\n\n // Load the rendering engine\n renderer.setTilesManager(tilesManager);\n renderer.setMainEntityManager(gameManager.getMainEntityManager());\n\n }", "public MyWorld()\n { \n // Create a new world with 600x400 cells with a cell size of 1x1 pixels.\n super(1000, 600, 1);\n planets();\n stars();\n }", "public void setWorld(GameData world) {\r\n this.world = world;\r\n }", "public Main()\n { \n // Create a new world with 600x400 cells with a cell size of 1x1 pixels.\n super(600, 600, 1); \n\n prepare();\n }", "private void createWorld() {\n world = new World();\n world.setEventDeliverySystem(new BasicEventDeliverySystem());\n //world.setSystem(new MovementSystem());\n world.setSystem(new ResetPositionSystem());\n world.setSystem(new RenderingSystem(camera, Color.WHITE));\n\n InputSystem inputSystem = new InputSystem();\n InputMultiplexer inputMultiplexer = new InputMultiplexer();\n inputMultiplexer.addProcessor(inputSystem);\n inputMultiplexer.addProcessor(new GestureDetector(inputSystem));\n Gdx.input.setInputProcessor(inputMultiplexer);\n world.setSystem(inputSystem);\n world.setSystem(new MoveCameraSystem(camera));\n\n world.initialize();\n }", "protected WorldController() {\n\t\tthis(new Rectangle(0,0,DEFAULT_WIDTH,DEFAULT_HEIGHT), \n\t\t\t\tnew Vector2(0,DEFAULT_GRAVITY));\n\t}", "public void initAndSetWorld() {\n\t\tHashMap<String, Location> gameWorld = new HashMap<String, Location>();\r\n\t\tthis.world = gameWorld;\r\n\t\t\r\n\t\t// CREATING AND ADDING LOCATIONS, LOCATION AND ITEM HASHES ARE AUTOMATICALLY SET BY CALLING CONSTRUCTOR\r\n\t\tLocation valley = new Location(\"valley\", \"Evalon Valley. A green valley with fertile soil.\",\r\n\t\t\t\t\"You cannot go in that direction.\",true);\r\n\t\tthis.addLocation(valley);\r\n\t\tLocation plains = new Location(\"plains\", \"West Plains. A desolate plain.\",\r\n\t\t\t\t\"You cannot go in that direction. There is nothing but dust over there.\",true);\r\n\t\tthis.addLocation(plains);\r\n\t\tLocation mountain = new Location(\"mountain\", \"Northern Mountains. A labyrinth of razor sharp rocks.\",\r\n\t\t\t\t\"You cannot go in that direction. The Mountain is not so easily climbed.\",true);\r\n\t\tthis.addLocation(mountain);\r\n\t\tLocation shore = new Location(\"shore\", \"Western Shore. The water is calm.\",\r\n\t\t\t\t\"You cannot go in that direction. There might be dangerous beasts in the water.\",true);\r\n\t\tthis.addLocation(shore);\r\n\t\tLocation woods = new Location(\"woods\", \"King's Forest. A bright forest with high pines.\",\r\n\t\t\t\t\"You cannot go in that direction. Be careful not to get lost in the woods.\",true);\r\n\t\tthis.addLocation(woods);\r\n\t\tLocation hills = new Location(\"hills\", \"Evalon hills.\",\r\n\t\t\t\t\"You cannot go in that direction.\",true);\r\n\t\tthis.addLocation(hills);\r\n\t\tLocation cave = new Location(\"cave\", \"Blood Cave. Few of those who venture here ever return.\",\r\n\t\t\t\t\"The air smells foul over there, better not go in that direction.\",true);\r\n\t\tthis.addLocation(cave);\r\n\t\tLocation innercave = new Location(\"innercave\", \"Blood Cave. This path must lead somewhere.\",\r\n\t\t\t\t\"Better not go over there.\",true);\r\n\t\t\r\n\t\tLocation westhills = new Location(\"westhills\", \"Thornhills. A great many trees cover the steep hills.\",\r\n\t\t\t\t\"You cannot go in that direction. Watch out for the thorny bushes.\",true);\r\n\t\tthis.addLocation(westhills);\r\n\t\t\r\n\t\tLocation lake = new Location(\"lake\", \"Evalon Lake. A magnificent lake with a calm body of water.\",\r\n\t\t\t\t\"You cannot go in that direction, nothing but fish over there.\",true);\r\n\t\tthis.addLocation(lake);\r\n\t\t\r\n\t\tLocation laketown = new Location(\"laketown\", \"Messny village. A quiet village with wooden houses and a dirt road.\",\r\n\t\t\t\t\"You cannot go in that direction, probably nothing interesting over there.\",true);\r\n\t\t\r\n\t\tLocation inn = new Room(\"inn\", \"Messny Inn. A small but charming inn in the centre of the village.\",\r\n\t\t\t\t\"You cannot go in that direction.\",false);\r\n\t\t\r\n\t\t// CONNECTING LOCATIONS\r\n\t\t// IT DOES NOT MATTER ON WHICH LOCATION THE METHOD ADDPATHS IS CALLED\r\n\t\tvalley.addPaths(valley, \"east\", plains, \"west\");\r\n\t\tvalley.addPaths(valley, \"north\", mountain, \"south\");\r\n\t\tvalley.addPaths(valley, \"west\", shore, \"east\");\r\n\t\tvalley.addPaths(valley, \"south\", woods, \"north\");\r\n\t\twoods.addPaths(woods, \"east\", hills, \"west\");\r\n\t\thills.addPaths(hills, \"south\", westhills, \"north\");\r\n\t\twesthills.addPaths(westhills, \"west\", lake, \"east\");\r\n\t\tlake.addPaths(woods, \"south\", lake, \"north\");\r\n\t\tlake.addPaths(lake, \"west\", laketown, \"east\");\r\n\t\tmountain.addPaths(mountain, \"cave\", cave, \"exit\");\r\n\t\tlaketown.addPaths(laketown, \"inn\", inn, \"exit\");\r\n\t\t\r\n\r\n\t\t\r\n\t\t// CREATE EMPTY ARMOR SET FOR GAME START AND UNEQUIPS\r\n\t\tBodyArmor noBodyArmor = new BodyArmor(\"unarmored\", 0, 0, true, 0);\r\n\t\tthis.setDefaultBodyArmor(noBodyArmor);\r\n\t\tBoots noBoots = new Boots(\"unarmored\", 0, 0, true, 0);\r\n\t\tthis.setDefaultBoots(noBoots);\r\n\t\tHeadgear noHeadgear = new Headgear(\"unarmored\", 0, 0, true, 0);\r\n\t\tthis.setDefaultHeadgear(noHeadgear);\r\n\t\tGloves noGloves = new Gloves(\"unarmored\", 0, 0, true, 0);\r\n\t\tthis.setDefaultGloves(noGloves);\r\n\t\tWeapon noWeapon = new Weapon(\"unarmored\", 0, 0, true, 5, false);\r\n\t\tthis.setDefaultWeapon(noWeapon);\r\n\t\t\r\n\t\tthis.getPlayer().setBodyArmor(noBodyArmor);\r\n\t\tthis.getPlayer().setBoots(noBoots);\r\n\t\tthis.getPlayer().setGloves(noGloves);\r\n\t\tthis.getPlayer().setHeadgear(noHeadgear);\r\n\t\tthis.getPlayer().setWeapon(noWeapon);\r\n\t\t\r\n\t\t\r\n\t\t// CREATING AND ADDING ITEMS TO PLAYER INVENTORY \r\n\t\tItem potion = new Potion(\"potion\", 1, 100, true, 10);\r\n\t\tthis.getPlayer().addItem(potion);\r\n\t\tWeapon sword = new Weapon(\"sword\", 10, 200, true, 10, false);\r\n\t\tvalley.addItem(sword);\r\n\t\t\r\n\t\tWeapon swordEvalon = new Weapon(\"EvalonianSword\", 15, 400, true, 1, 15, false);\r\n\t\thills.addItem(swordEvalon);\r\n\t\t\r\n\t\tPotion potion2 = new Potion(\"largepotion\", 2, 200, true, 25);\r\n\t\tPotion potion3 = new Potion(\"potion\", 2, 200, true, 25);\r\n\t\tPotion potion4 = new Potion(\"potion\", 2, 200, true, 25);\r\n\t\tlake.addItem(potion3);\r\n\t\tinn.addItem(potion4);\r\n\t\t\r\n\t\tItem potion5 = new Potion(\"potion\", 1, 100, true, 10);\r\n\t\tItem potion6 = new Potion(\"potion\", 1, 100, true, 10);\r\n\t\twoods.addItem(potion6);\r\n\t\t\r\n\t\tPurse purse = new Purse(\"purse\",0,0,true,100);\r\n\t\tvalley.addItem(purse);\r\n\t\t\r\n\t\tChest chest = new Chest(\"chest\", 50, 100, false, 50);\r\n\t\tvalley.addItem(chest);\r\n\t\tchest.addItem(potion2);\r\n\t\t\r\n\t\tChest chest2 = new Chest(\"chest\", 10, 10, false, 20);\r\n\t\tinn.addItem(chest2);\r\n\t\t\r\n\t\t// ENEMY LOOT\r\n\t\tBodyArmor chestplate = new BodyArmor(\"chestplate\", 20, 200, true, 20);\r\n\t\t\r\n\t\t// ADDING NPC TO WORLD\r\n\t\tNpc innkeeper = new Npc(\"Innkeeper\", false, \"Hello, we have rooms available if you want to stay over night.\",true,1000);\r\n\t\tinn.addNpc(innkeeper);\r\n\t\t\r\n\t\tItem potion7 = new Potion(\"potion\", 1, 100, true, 10);\r\n\t\tItem potion8 = new Potion(\"potion\", 1, 100, true, 10);\r\n\t\tinnkeeper.addItem(potion7);\r\n\t\tinnkeeper.addItem(potion8);\r\n\t\t\r\n\t\tNpc villager = new Npc(\"Lumberjack\", false, \"Gotta get those logs back to the mill soon, but first a few pints at the inn!\",false,0);\r\n\t\tlaketown.addNpc(villager);\r\n\t\t\r\n\t\tEnemy enemy1 = new Enemy(\"Enemy\", true, \"Come at me!\", 50, chestplate, 200, 10);\r\n\t\tmountain.addNpc(enemy1);\r\n\t\t\r\n\t\tEnemyGuardian guardian = new EnemyGuardian(\"Guardian\", true, \"I guard this cave.\", 100, potion5, 600, 15, innercave, \"An entrance reveals itself behind the fallen Guardian.\", \"inwards\", \"entrance\");\r\n\t\tcave.addNpc(guardian);\r\n\t\t\r\n\t\t// ADDING SPAWNER TO WORLD\r\n\t\tthis.setNpcSpawner(new BanditSpawner()); \r\n\t\t\r\n\t\t// ADDING PLAYER TO THE WORLD\r\n\t\tthis.getPlayer().setLocation(valley);\r\n\t\t\r\n\t\t// QUEST\r\n\t\tQuest noquest = new Quest(\"noquest\",\"nodesc\",\"nocomp\",false,true,1000,0,0,0);\r\n\t\tthis.setCurrentQuest(noquest);\r\n\t\t\r\n\t\t\r\n\t\tQuest firstquest = new Quest(\"A New Journey\",\"Find the lost sword of Evalon.\",\"You have found the lost sword of Evalon!\",false,false,1,400,0,1);\r\n\t\t\r\n\t\tScroll scroll = new Scroll(\"Questscroll\",1,1,true,firstquest);\r\n\t\tmountain.addItem(scroll);\r\n\t\t\r\n\t\tSystem.out.println(\"All set up.\");\r\n\t}", "public WiuWorld()\n { \n // Create a new world with 600x400 cells with a cell size of 1xpixels.\n super(WIDTH_WORLD, HEIGHT_WORLD, 1); \n }", "@Override\n public void world() {\n super.world();\n }", "@Model\n\tprotected void setWorld(World world) {\n\t\tthis.world = world;\n\t}", "public RobotWorld()\n { \n // Create a new world with 600x400 cells with a cell size of 1x1 pixels.\n super(800, 600, 1); \n prepare();\n }", "public MyWorld()\n {\n super(600, 400, 1);\n }", "public World makeWorld() {\n World world = new World(1000, 1000);\n world.createEntity().addComponent(new CursorComponent());\n \n ProjectileSystem projectileSystem = new ProjectileSystem();\n world.addSystem(projectileSystem, 1);\n \n return world;\n }", "public static void setWorld(World aWorld)\r\n/* */ {\r\n\t \tlogger.info(count++ + \" About to setWotld : \" + \"Agent\");\r\n/* 43 */ \tworldForAgent = aWorld;\r\n/* */ }", "@Override\n public void afterWorldInit() {\n }", "public MyWorld()\n { \n // Create a new world with 600x400 cells with a cell size of 1x1 pixels.\n super(1078, 672, 1); \n preparePlayer1();\n preparePlayer2();\n prepareTitle();\n //playmusic();\n }", "public void loadWorld() {\n\t\tint[][] tileTypes = new int[100][100];\n\t\tfor (int x = 0; x < 100; x++) {\n\t\t\tfor (int y = 0; y < 100; y++) {\n\t\t\t\ttileTypes[x][y] = 2;\n\t\t\t\tif (x > 40 && x < 60 && y > 40 && y < 60) {\n\t\t\t\t\ttileTypes[x][y] = 1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tEntityList entities = new EntityList(0);\n\t\tPlayer player = new Player(Direction.SOUTH_WEST, 50, 50);\n\t\tentities.addEntity(player);\n\t\tentities.addEntity(new Tree(Direction.SOUTH_WEST,49, 49));\n\t\tworld = new World(new Map(tileTypes), player, entities);\n\t}", "public UIMainWorld()\n { \n super(600, 400, 1); \n startScreen();\n }", "private static void setupLocations() {\n\t\tcatanWorld = Bukkit.createWorld(new WorldCreator(\"catan\"));\n\t\tspawnWorld = Bukkit.createWorld(new WorldCreator(\"world\"));\n\t\tgameLobby = new Location(catanWorld, -84, 239, -647);\n\t\tgameSpawn = new Location(catanWorld, -83, 192, -643);\n\t\thubSpawn = new Location(spawnWorld, 8, 20, 8);\n\t\twaitingRoom = new Location(catanWorld, -159, 160, -344);\n\t}", "public VolcanoWorld() {\n this(DEFAULT_WIDTH, DEFAULT_HEIGHT);\n }", "public World (){\n\t\tpattern = new ShapePattern (PATTERN_SIZE);\n\t\tscroll = new ShapeScroll (SCROLL_SIZE);\n\t}", "public World() {\n\t\tbackgroundLoader.submit(new Callable<Object>() {\n\t\t\t@Override\n\t\t\tpublic Object call() throws Exception {\n\t\t\t\tItemDefinition.load();\n\t\t\t\treturn null;\n\t\t\t}\n\t\t});\n\t\tbackgroundLoader.submit(new Callable<Object>() {\n\t\t\t@Override\n\t\t\tpublic Object call() throws Exception {\n\t\t\t\tNPCDefinition.load();\n\t\t\t\tNPCStyle.init();\n\t\t\t\treturn null;\n\t\t\t}\n\t\t});\n\t\tbackgroundLoader.submit(new Callable<Object>() {\n\t\t\t@Override\n\t\t\tpublic Object call() throws Exception {\n\t\t\t\tDegradeSystem.init();\n\t\t\t\tProjectileManager.init();\n\t\t\t\treturn null;\n\t\t\t}\n\t\t});\n\t\tbackgroundLoader.submit(new Callable<Object>() {\n\t\t\t@Override\n\t\t\tpublic Object call() throws Exception {\n\t\t\t\tShops.loadShopFile();\n\t\t\t\treturn null;\n\t\t\t}\n\t\t});\n\t}", "public WaterWorld()\r\n { \r\n // Create a new world with 600x400 cells with a cell size of 1x1 pixels.\r\n super(600, 400, 1); \r\n populateWorld();\r\n }", "public MyWorld()\n { \n super(1200, 600, 1); \n prepare();\n bienvenida();\n instrucciones();\n sonido();\n }", "public static void main(String [] args)\n\t{\n\t\tWorld newWorld = new World();\n\n\t\t//Adding everything into the world\n\t\tnewWorld.treesShrubsToWorld();\n\t\tnewWorld.grassToWorld();\n\t\tnewWorld.caterpillarToWorld();\n\t\tnewWorld.grasshopperToWorld();\n\t\tnewWorld.deerToWorld();\n\t\tnewWorld.bluejayToWorld();\n\t\tnewWorld.squirrelToWorld();\n\t\tnewWorld.mouseToWorld();\n\t\tnewWorld.rabbitToWorld();\n\t\tnewWorld.hawkToWorld();\n\t\tnewWorld.foxToWorld();\n\t\tnewWorld.wolfToWorld();\n\n\t\t//Printing out the world onto the console\n\t\tnewWorld.printWorld();\n\t\t\n\t}", "public SideScrollingWorld()\n { \n // Create a new world with 640x480 cells with a cell size of 1x1 pixels.\n // Final argument of 'false' means that actors in the world are not restricted to the world boundary.\n // See: https://www.greenfoot.org/files/javadoc/greenfoot/World.html#World-int-int-int-boolean-\n super(VISIBLE_WIDTH, VISIBLE_HEIGHT, 1, false);\n\n // Set up the starting scene\n setup();\n\n // Game on\n isGameOver = false;\n\n }", "public void setupWorld()\r\n\t{\r\n\t\t//build walls\r\n\t\twall1.add(new PointD(-500, 500));\r\n\t\twall1.add(new PointD(-490, 500));\r\n\t\twall1.add(new PointD(-490, -500));\r\n\t\twall1.add(new PointD(-500, -500));\r\n\r\n\t\twall2.add(new PointD(-500, 500));\r\n\t\twall2.add(new PointD(2000, 500));\r\n\t\twall2.add(new PointD(2000, 490));\r\n\t\twall2.add(new PointD(-500, 490));\r\n\t\t\r\n\t\twall3.add(new PointD(2000, 500));\r\n\t\twall3.add(new PointD(1990, 500));\r\n\t\twall3.add(new PointD(1990, -500));\r\n\t\twall3.add(new PointD(2000, -500));\r\n\r\n\t\twall4.add(new PointD(-500, -500));\r\n\t\twall4.add(new PointD(2000, -500));\r\n\t\twall4.add(new PointD(2000, -490));\r\n\t\twall4.add(new PointD(-500, -490));\r\n\r\n\t\tobjects.add(wall1);\r\n\t\tobjects.add(wall2);\r\n\t\tobjects.add(wall3);\r\n\t\tobjects.add(wall4);\r\n\t\t\r\n\t\t\r\n\t\t//add people\r\n\t\tGameVars.people = people;\r\n\t\tGameVars.aSquare = aSquare;\r\n\t\t\r\n\t\tobjects.add(grandson.boundary);\r\n\t\tpeople.add(grandson);\r\n\t\t\r\n\t\tobjects.add(son.boundary);\r\n\t\tpeople.add(son);\r\n\t\t\r\n\t\tobjects.add(triangle.boundary);\r\n\t\tpeople.add(triangle);\r\n\r\n\t\tobjects.add(wife.boundary);\r\n\t\tpeople.add(wife);\r\n\r\n\t\tobjects.add(runaway.boundary);\r\n\t\tpeople.add(runaway);\r\n\t\t\r\n\t\t\r\n\t\t//set aSquare's position\r\n\t\taSquare.rotate(220);\r\n\t\t\r\n\t}", "private void buildWorld() {\r\n\t\tremoveAll();\r\n\t\tintro = null;\r\n\t\tfacingEast = true;\r\n\t\t\r\n\t\taddLevels();\r\n\t\taddCharacters();\r\n\t\taddLifeDisplay();\r\n\t}", "public final void setDefault() {\n wind.setCoordinates(DEFAULT_TURBULENCES, DEFAULT_TURBULENCES,\n DEFAULT_TURBULENCES);\n }", "public void newGame()\n\t{\n\t\tmap = new World(3, viewSize, playerFactions);\n\t\tview = new WorldView(map, viewSize, this);\n\t\tbar = new Sidebar(map, barSize);\n\t}", "public void resetWorld(){\r\n\t\tSystem.out.println(\"Resetting world\");\r\n\t\tengine.removeAllEntities();\r\n\t\tlvlFactory.resetWorld();\r\n\t\t\r\n\t\tplayer = lvlFactory.createPlayer(cam);\r\n\t\tlvlFactory.createFloor();\r\n lvlFactory.createWaterFloor();\r\n \r\n int wallWidth = (int) (1*RenderingSystem.PPM);\r\n int wallHeight = (int) (60*RenderingSystem.PPM);\r\n TextureRegion wallRegion = DFUtils.makeTextureRegion(wallWidth, wallHeight, \"222222FF\");\r\n lvlFactory.createWalls(wallRegion); //TODO make some damn images for this stuff \r\n \r\n // reset controller controls (fixes bug where controller stuck on directrion if died in that position)\r\n controller.left = false;\r\n controller.right = false;\r\n controller.up = false;\r\n controller.down = false;\r\n controller.isMouse1Down = false;\r\n controller.isMouse2Down = false;\r\n controller.isMouse3Down = false;\r\n\t\t\r\n\t}", "public void createWorld(){\n\n }", "public abstract World create(World world);", "public void setWorld(World world) {\n\t\tthis.world = world;\n\n\t\tsetPlaying(world.isPlayOnStart());\n\t}", "World getWorld();", "public GameWorld(){\r\n\t\t\r\n\t}", "@Override\n protected void initGame() {\n getGameWorld().setEntityFactory(new PlatformerFactory());\n getGameWorld().setLevelFromMap(\"Platformergame1.json\");\n\n // Sets spawnloction of the player\n player = getGameWorld().spawn(\"player\", 50, 50);\n }", "public void init() {\n try {\n java.net.URL codeBase = getCodeBase();\n codeBaseString = codeBase.toString();\n } catch (Exception e) {\n // probably running as an application, try the application\n // code base\n codeBaseString = \"file:./\";\n }\n\n if (colorMode == USE_COLOR) {\n objColor = red;\n } else {\n objColor = white;\n }\n\n Container contentPane = getContentPane();\n\n contentPane.setLayout(new BorderLayout());\n\n GraphicsConfiguration config = SimpleUniverse\n .getPreferredConfiguration();\n\n canvas = new Canvas3D(config);\n\n u = new SimpleUniverse(canvas);\n\n if (isApplication) {\n offScreenCanvas = new OffScreenCanvas3D(config, true);\n // set the size of the off-screen canvas based on a scale\n // of the on-screen size\n Screen3D sOn = canvas.getScreen3D();\n Screen3D sOff = offScreenCanvas.getScreen3D();\n Dimension dim = sOn.getSize();\n dim.width *= OFF_SCREEN_SCALE;\n dim.height *= OFF_SCREEN_SCALE;\n sOff.setSize(dim);\n sOff.setPhysicalScreenWidth(sOn.getPhysicalScreenWidth()\n * OFF_SCREEN_SCALE);\n sOff.setPhysicalScreenHeight(sOn.getPhysicalScreenHeight()\n * OFF_SCREEN_SCALE);\n\n // attach the offscreen canvas to the view\n u.getViewer().getView().addCanvas3D(offScreenCanvas);\n\n }\n contentPane.add(\"Center\", canvas);\n\n // setup the env nodes and their GUI elements\n setupLights();\n setupBackgrounds();\n setupFogs();\n setupSounds();\n\n // Create a simple scene and attach it to the virtual universe\n BranchGroup scene = createSceneGraph();\n\n // set up sound\n u.getViewer().createAudioDevice();\n\n // get the view\n view = u.getViewer().getView();\n\n // Get the viewing platform\n ViewingPlatform viewingPlatform = u.getViewingPlatform();\n\n // Move the viewing platform back to enclose the -4 -> 4 range\n double viewRadius = 4.0; // want to be able to see circle\n // of viewRadius size around origin\n // get the field of view\n double fov = u.getViewer().getView().getFieldOfView();\n\n // calc view distance to make circle view in fov\n float viewDistance = (float) (viewRadius / Math.tan(fov / 2.0));\n tmpVector.set(0.0f, 0.0f, viewDistance);// setup offset\n tmpTrans.set(tmpVector); // set trans to translate\n // move the view platform\n viewingPlatform.getViewPlatformTransform().setTransform(tmpTrans);\n\n // add an orbit behavior to move the viewing platform\n OrbitBehavior orbit = new OrbitBehavior(canvas, OrbitBehavior.STOP_ZOOM);\n orbit.setSchedulingBounds(infiniteBounds);\n viewingPlatform.setViewPlatformBehavior(orbit);\n\n u.addBranchGraph(scene);\n\n contentPane.add(\"East\", guiPanel());\n }", "public MyWorld()\n { \n // Create a new world with 600x400 cells with a cell size of 1x1 pixels.\n super(1200, 800, 1); \n GreenfootImage bg = new GreenfootImage(\"background.jpg\");\n bg.scale(getWidth(), getHeight());\n setBackground(bg);\n initialize();\n \n }", "private IWorld worldCreator(){\n if (gameWorld == GameWorld.NORMAL) return\n new Normal();\n else return\n new Nether();\n }", "public ShamWorld(WorldSettings settings) {\n super(null, name, null, settings, null);\n }", "@Override\r\n public void generateWorld(World world) {\r\n // create the static non-moving bodies\r\n this.creator.createWorld(world, this, COLLISIONLAYERS);\r\n // create the transition areas\r\n this.creator.createTransition(world, this, NORTHTRANSITION, NORTH);\r\n this.creator.createTransition(world, this, SOUTHTRANSITION, SOUTH);\r\n \r\n }", "public void setWorldDisplay(Pane worldDisplay) {\n this.worldDisplay = worldDisplay;\n }", "public void initializeObliqueLaunch(){\r\n world = new Environment();\r\n cannon = new Thrower();\r\n ball = new Projectile();\r\n this.setInitialValues();\r\n }", "private void setDefaultMode(GlobalState gs) {\n center = gs.cnt;\n double diagonal = gs.vDist * cos(gs.phi);\n double z = sin(gs.phi) * gs.vDist;\n double x = diagonal * cos(gs.theta);\n double y = diagonal * sin(gs.theta);\n \n eye = new Vector(x, y, z);\n \n }", "@Override\n\n //-----------------\n\n public void init() {\n //test(); // <---------------- Uncomment to TEST!\n\n // %-distribution of RED, BLUE and NONE\n double[] dist = {0.49, 0.49, 0.02};\n\n // Number of locations (places) in world (square)\n int nLocations = 950;\n\n Actor[] distArray = distribution(nLocations, dist); //Generates array with correct distribution.\n distArray = shuffle(distArray); //Shuffles array\n world = toMatrix(distArray, nLocations, world); //Generates the start world.\n // Should be last\n fixScreenSize(nLocations);\n }", "private void init() {\n\t\n\t\tthis.setSize(DEFAULT_W, DEFAULT_H);\n\t\tthis.setLocation(DEFAULT_X, DEFAULT_X);\n\t\tthis.setTitle(DEFAULT_TITLE);\n\n\t}", "private void init_settings() {\n\t\tSettings.setDifficulty(Difficulty.NORMAL);\n\t\tSettings.setGravity(BowmanConstants.DEFAULT_GRAVITY);\n\t}", "public void newGameWorld()\r\n {\r\n addObject(new Blackout(\"Fade\"), getWidth() / 2, getHeight() / 2);\r\n removeAllObjects();\r\n\r\n GameWorld gameWorld = new GameWorld();\r\n Greenfoot.setWorld(gameWorld);\r\n }", "private GameWorld getGameWorld(){\n\t\tHashMap<String, Location> locations = new HashMap<String, Location>();\n\t\tHashMap<Avatar, Location> avatarLocations = new HashMap<Avatar, Location>();\n\t\tArrayList<Avatar> avatars = new ArrayList<Avatar>();\n\t\t\n\t\tLocation testLocation = new Location(\"Test Location\");\n\t\tAvatar testAvatar = new Avatar(\"Slim\", 1);\n\t\t\n\t\tlocations.put(\"testLocation\", testLocation);\n\t\tavatarLocations.put(testAvatar, testLocation);\n\t\tavatars.add(testAvatar);\n\t\t\n\t\treturn new GameWorld(locations, avatarLocations, avatars);\n\t}", "public static void main (String [] args)\n {\n\tWorld myWorld = new World (10, 10);\n\n\t// Create a red robot called \"Demo One\"\n\tRobot myRobot = new Robot (\"Demo One\", Color.RED);\n\tmyRobot.takeReallyBigSteps();\n\n\t// Add Demo to the world at position (0,0) facing South\n\tmyWorld.addRobot (myRobot, 0, 0, Direction.SOUTH);\n\n\t// Move and turn the robot\n\tmyRobot.move ();\n\tmyRobot.move ();\n\tmyRobot.move ();\n\tmyRobot.turnLeft ();\n\tmyRobot.move ();\n\tmyRobot.move ();\n\tmyRobot.turnRight ();\n\tmyRobot.move ();\n\tmyRobot.move ();\n\tmyRobot.move ();\n\n }", "public WorldState ()\n\t{\n\t\tproperties = new HashMap<String, WorldStateProperty>();\n\t}", "public pr3s1()\n { \n // Create a new world with 600x400 cells with a cell size of 1x1 pixels.\n super(1280, 720, 1); \n prepare();\n }", "private void GameInitialize()\r\n { \r\n // set to fullscreen to use the entire \r\n // display or false to only use\r\n // the area inbetween the two bars on the display\r\n setFullScreenMode(true);\r\n\r\n // setup 3D\r\n try\r\n {\r\n Object3D[] buffer = Loader.load(\"/RaptorWalk.m3g\");\r\n\r\n for(int i = 0; i < buffer.length; i++)\r\n {\r\n if(buffer[i] instanceof World)\r\n {\r\n // get our world node\r\n mWorld = (World)buffer[i];\r\n mEnemy = (SkinnedMesh)mWorld.find(56);\r\n mEnemyTimer = 0;\r\n break;\r\n }\r\n }\r\n }\r\n catch(Exception e) \r\n { System.out.println(\"Loading error!\" + e.getMessage()); }\r\n\r\n // create a game font\r\n mGameFont = Font.getFont(Font.FACE_MONOSPACE, \r\n Font.STYLE_PLAIN, Font.SIZE_SMALL);\r\n\r\n // Get the active camera from the world\r\n mCam = mWorld.getActiveCamera();\r\n mCam.translate(0, 1.0f, 0);\r\n\r\n // Create an ambient light and add it to the world node\r\n Light light = new Light();\r\n light.setMode(Light.AMBIENT);\r\n light.setIntensity(3);\r\n mWorld.addChild(light);\r\n }", "private static WorldDescription createWorld() {\r\n \t\tWorldDescription world = new WorldDescription();\t \r\n \t\tworld.setPlaneSize(100);\t\t\r\n \t \tObstacleGenerator generator = new ObstacleGenerator();\r\n \t generator.obstacalize(obstacleType, world); // activate to add obstacles\r\n \t // world.setPlaneTexture(WorldDescription.WHITE_GRID_TEXTURE);\r\n \t\treturn world;\r\n \t}", "protected void updateWorld(World world) {\r\n\t\tthis.world = world;\r\n\t\tsetup(); //Call setup again to re assign certain variables that depend\r\n\t\t\t\t // on the world\r\n\t\tbufferWorld(); //Buffer the new world\r\n\t}", "public static void initialize() {\n BroadphaseInterface aabbInterface = new DbvtBroadphase(); //Checks if objects could collide\n CollisionConfiguration collisionConfiguration = new DefaultCollisionConfiguration();\n CollisionDispatcher collisionDispatcher = new CollisionDispatcher(collisionConfiguration); //Handles collisions\n ConstraintSolver constraintSolver = new SequentialImpulseConstraintSolver();\n\n world = new DiscreteDynamicsWorld(collisionDispatcher, aabbInterface, constraintSolver, collisionConfiguration);\n world.setGravity(DataTypeHelper.stringToVector3f(PreferenceHelper.getValue(\"gravity\")));\n }", "public static void main(String args[]) {\n BallWorld world = new BallWorld();\n }", "@Override\n\tpublic void create() {\n\t\tGdx.app.setLogLevel(Application.LOG_DEBUG);\n\t\t\n\t\t//Load assets\n\t\tAssets.instance.init(new AssetManager());\n\t\t\n\t\t//initialize controller and renderer\n\t\tworldController = new WorldController();\n\t\tworldRenderer= new WorldRenderer(worldController);\n\t\t\n\t\t//The world is not paused on start\n\t\tpaused = false;\n\t}", "public void init() {\n\n setBackground(Color.lightGray);\n\n x = xo = 10;\n y = yo = 10;\n // loading the first wold in the world table\n loadWorld();\n\n // registering listeners\n addKeyListener(this);\n addMouseListener(this);\n addMouseMotionListener(this);\n setFocusable(true);\n enableEvents(AWTEvent.FOCUS_EVENT_MASK);\n\n requestFocus();\n /*\n // building the popup menu\n menu = new PopupMenu();\n MenuItem start = new MenuItem(\"Start\");\n start.addActionListener(this);\n start.setActionCommand(\"start\");\n menu.add(start);\n MenuItem next = new MenuItem(\"Next\");\n next.addActionListener(this);\n next.setActionCommand(\"next\");\n menu.add(next);\n MenuItem previous = new MenuItem(\"Previous\");\n previous.addActionListener(this);\n previous.setActionCommand(\"previous\");\n menu.add(previous);\n\n menu.addSeparator();\n\n MenuItem undo = new MenuItem(\"Undo\");\n undo.addActionListener(this);\n undo.setActionCommand(\"undo\");\n menu.add(undo);\n MenuItem redo = new MenuItem(\"Redo\");\n redo.addActionListener(this);\n redo.setActionCommand(\"redo\");\n menu.add(redo);\n\n menu.addSeparator();\n\n beep = new CheckboxMenuItem(\"Beep\", beepOn);\n beep.addItemListener(this);\n beep.setActionCommand(\"beep\");\n menu.add(beep);\n\n add(menu);\n */\n }", "private void setup() {\n this.primaryStage.setTitle(Constants.APP_NAME);\n\n this.root = new VBox();\n root.setAlignment(Pos.TOP_CENTER);\n root.getChildren().addAll(getMenuBar());\n\n Scene scene = new Scene(root);\n this.primaryStage.setScene(scene);\n\n // set the default game level.\n setGameLevel(GameLevel.BEGINNER);\n\n // fix the size of the game window.\n this.primaryStage.setResizable(false);\n this.primaryStage.show();\n }", "public World() {\n\t\tblockIDArray = new byte[WORLD_SIZE][WORLD_HEIGHT][WORLD_SIZE];\n\t\tentities\t = new ArrayList<Entity>();\n\t\trand\t\t = new Random();\n\t\t\n new GravityThread(this);\n\t\t\t\t\n\t\tgenerateWorld();\n\t}", "public HowToPlay()\n { \n // Create a new world with 600x400 cells with a cell size of 1x1 pixels.\n super(763, 578, 1); \n //HowToPlay play = new HowToPlay();\n }", "@Override\n\tpublic void show() {\n\t\tworld = new Worlds();\n\t\trenderer = new WorldRenderer(world, false);\n\t\tcontroller = new WorldController(world);\n\t\tGdx.input.setInputProcessor(this);\n\t}", "public World(){\r\n locations = new Location[3][3];\r\n for(int r=0; r<3; r+=1){\r\n for(int c=0; c<3; c+=1){\r\n locations[r][c] = new EmptyLocation(new Position(r,c), \"Nothing here to see.\");\r\n }\r\n }\r\n home = locations[0][0];\r\n players = new ArrayList<Player>();\r\n }", "public void addToWorld(World world);", "protected WorldWindow createWorldWindow() {\n\t\treturn new WorldWindowGLJPanel();\r\n\t\t//return new WorldWindow();\r\n\t}", "public Game() { \n // Create the new environment. Must be done in the same\n // method as the game loop\n env = new Env();\n \n // Sets up the camera\n env.setCameraXYZ(25, 50, 55);\n env.setCameraPitch(pitch);\n\n // Turn off the default controls\n env.setDefaultControl(false);\n\n // Make the room 50 x 50.\n env.setRoom(new Room());\n creatures = new ArrayList<Creature>();\n }", "private void setUpGame() {\n\t\tsetUpBlocks();\n\t\tsetUpBall();\n\t\tsetUpPaddle();\n\t\taddMouseListeners();\n\t}", "public WorldModel(){\t\n\t}", "public void setupGame(boolean cl) {\n currentScore = 0;\n GameWorldGenerator.generateWorld(this);\n setup = new GameSetup(this, cl);\n if (!cl) {\n new SetupWindow(this);\n }\n }", "@Override\n public void preInitialise(Context rootContext) {\n this.window = new GlfwWindow(\"ChunkWorld\", 1350, 900, false, true, false);\n rootContext.put(IWindow.class, window);\n window.init();\n }", "public void setWorldDefault(WorldRef world, T value) {\n Objects.requireNonNull(world, \"world\");\n Objects.requireNonNull(value, \"value\");\n\n synchronized (mutationLock) {\n List<T> worldValues = this.allWorldValues.get(world);\n if (worldValues == null) {\n // Make world-specific values possible\n worldValues = singletonArrayList(value);\n this.allWorldValues.put(world, worldValues);\n return;\n }\n\n // Default value is stored in last slot\n worldValues.set(worldValues.size() - 1, value);\n }\n }", "public void defaultGame() {\n //CREATE A BOARD\n Board board = new Board(10, 10, 0);\n ArrayList<Boat> boats = createDefaultBoatArray();\n //CREATE A GAME\n GameData game = new GameData(board, boats, false);\n //POSITION BOATS\n randomPosBoats(game);\n\n //!!tile matrix is empty\n Game.getInstance().setGameData(game);\n Game.getInstance().setEnded(false);\n }", "@Override\n public void simpleInitApp()\n {\n makeInitialWorld();\n \tAudio audio = new Audio(assetManager, rootNode);\n inputManager.setCursorVisible(false);\n \trootNode.attachChild(overlayNode);\n\n \tflyCam.setEnabled(true);\n flyCam.setMoveSpeed(25);\n\n setDisplayFps(true);\n setDisplayStatView(true);\n\n GUIInfo guiInfo = new GUIInfo(guiNode, assetManager.loadFont(\"Interface/Fonts/Console.fnt\"));\n guiNode.addControl(guiInfo);\n }", "public World(int width, int height)\n {\n this(width, height, AIR_EL);\n }", "public lv3()\n { \n // Create a new world with 600x400 cells with a cell size of 1x1 pixels.\n //super(950, 600, 1); \n //prepare();\n prepare();\n stopped();\n started();\n }", "private void initializeWithDefaultValues() {\n setProjectFolder(\"projectFolder\");\n setContext(\"context\");\n setGroupId(\"com.company.project\");\n setArtifactId(\"project\");\n setModulePrefix(\"project-\");\n setVersion(\"0.0.1-SNAPSHOT\");\n setName(\"Project Name\");\n setDescription(\"Project Description\");\n setUrl(\"https://www.company-project.com\");\n setInceptionYear(String.valueOf(LocalDateTime.now().getYear()));\n setOrganizationName(\"Your Company Name\");\n setOrganizationUrl(\"https://www.company.com\");\n setLicenseName(\"apache_v2\");\n setLicenseUrl(\"https://www.license-url.com\");\n setScmConnection(\"\");\n setScmDeveloperConnection(\"\");\n setScmUrl(\"\");\n setDistributionProfile(\"\");\n setExtraModules(new LinkedHashSet<>());\n setContextDescriptions(new LinkedHashSet<>());\n setAppConfigLocationType(AppConfigLocationType.INSIDE);\n }", "private void init() throws LWJGLException {\n gameLogic.init(window);\n }", "@Override\n public void initialize(URL location, ResourceBundle resources) {\n renderer = new WorldDisplayRenderer();\n renderer.start();\n\n }", "default void initialize(GameIO io, Config config) {}", "public static World getWorld() {\n\t\treturn world;\n\t}", "protected void initialize() {\n \tclaw = Robot.getClaw();\n\n \tclaw.open();\n }", "public Ocean()\n { \n // Create a new world with 600x400 cells with a cell size of 1x1 pixels.\n super(600, 400, 1); \n BF bf = new BF();\n addObject(bf,500,300);\n SF sf = new SF();\n addObject(sf,100,300);\n }", "@Override\n\tpublic World getWorld() { return world; }", "void update(Env world) throws Exception;", "public void init() {\r\n\t\t\r\n\t\tsetSize(WIDTH, HEIGHT);\r\n\t\tColor backgroundColor = new Color(60, 0, 60);\r\n\t\tsetBackground(backgroundColor);\r\n\t\tintro = new GImage(\"EvilMehranIntroGraphic.png\");\r\n\t\tintro.setLocation(0,0);\r\n\t\tadd(intro);\r\n\t\tplayMusic(new File(\"EvilMehransLairThemeMusic.wav\"));\r\n\t\tinitAnimationArray();\r\n\t\taddKeyListeners();\r\n\t\taddMouseListeners();\r\n\t\twaitForClick();\r\n\t\tbuildWorld();\r\n\t}", "private void initialize() {\n\t\troot = new Group();\n\t\tgetProperties();\n\t\tsetScene();\n\t\tsetStage();\n\t\tsetGUIComponents();\n\t}", "public void setUpEcosystem() {\n Pool skookumchuk = setUpSkookumchuk();\n Pool rutherford = setUpRutherford();\n Pool gamelin = setUpGamelin();\n\n ecosystem.addPool(skookumchuk);\n ecosystem.addPool(rutherford);\n ecosystem.addPool(gamelin);\n\n ecosystem.addStream(new Stream(skookumchuk, rutherford));\n ecosystem.addStream(new Stream(rutherford, gamelin));\n }", "public WorldData init()\n {\n WorldData startWorldData = new WorldData();\n model.appendWorldData(startWorldData);\n return startWorldData;\n }", "public SaboWorld()\n { \n // Create a new world with 600x400 cells with a cell size of 1x1 pixels.\n super(600, 400, 1);\n addObject(counter, 100, 380); //Add the scoreboard\n addObject(healthBar, 300, 370); //Add the health bar\n addObject(turret, getWidth()/2-5, getHeight()-turret.getImage().getWidth()); \n }", "public void initialize() {\n warpController = new WarpController(this);\n kitController = new KitController(this);\n crafting = new CraftingController(this);\n mobs = new MobController(this);\n items = new ItemController(this);\n enchanting = new EnchantingController(this);\n anvil = new AnvilController(this);\n blockController = new BlockController(this);\n hangingController = new HangingController(this);\n entityController = new EntityController(this);\n playerController = new PlayerController(this);\n inventoryController = new InventoryController(this);\n explosionController = new ExplosionController(this);\n requirementsController = new RequirementsController(this);\n worldController = new WorldController(this);\n arenaController = new ArenaController(this);\n arenaController.start();\n if (CompatibilityLib.hasStatistics() && !CompatibilityLib.hasJumpEvent()) {\n jumpController = new JumpController(this);\n }\n File examplesFolder = new File(getPlugin().getDataFolder(), \"examples\");\n examplesFolder.mkdirs();\n\n File urlMapFile = getDataFile(URL_MAPS_FILE);\n File imageCache = new File(dataFolder, \"imagemapcache\");\n imageCache.mkdirs();\n maps = new MapController(this, urlMapFile, imageCache);\n\n // Initialize EffectLib.\n if (com.elmakers.mine.bukkit.effect.EffectPlayer.initialize(plugin, getLogger())) {\n getLogger().info(\"EffectLib initialized\");\n } else {\n getLogger().warning(\"Failed to initialize EffectLib\");\n }\n\n // Pre-create schematic folder\n File magicSchematicFolder = new File(plugin.getDataFolder(), \"schematics\");\n magicSchematicFolder.mkdirs();\n\n // One-time migration of legacy configurations\n migrateConfig(\"enchanting\", \"paths\");\n migrateConfig(\"automata\", \"blocks\");\n migrateDataFile(\"automata\", \"blocks\");\n\n // Ready to load\n load();\n resourcePacks.startResourcePackChecks();\n }", "@Override\n public void simpleInitApp()\n {\n stateManager.detach(stateManager.getState(StatsAppState.class));\n\n // Activate windowed input behavior.\n flyCam.setDragToRotate(true);\n inputManager.setCursorVisible(true);\n\n viewPort.setBackgroundColor(new ColorRGBA(0.7f, 0.9f, 1, 1));\n\n materialFactory = createMaterialFactory();\n spatialFactory = createSpatialFactory();\n board = (Node)spatialFactory.createBoard(assetManager);\n squaresNode = (Node)board.getChild(\"squares\");\n tokensNode = (Node)board.getChild(\"tokens\");\n\n rootNode.attachChild(board);\n rootNode.addLight(createDirectionalLight());\n rootNode.addLight(createAmbientLight());\n\n initKeys();\n\n reconcileTokens();\n setTheScene();\n }" ]
[ "0.72478825", "0.70878947", "0.6901916", "0.6901743", "0.67412", "0.6720045", "0.66934717", "0.6630383", "0.65675", "0.65396154", "0.64848447", "0.6484093", "0.6476936", "0.6414608", "0.6399229", "0.6396616", "0.638602", "0.63727665", "0.6361678", "0.6321302", "0.629667", "0.6260574", "0.6247237", "0.6221449", "0.6218161", "0.62107176", "0.61823696", "0.6146969", "0.6117871", "0.60922503", "0.60798943", "0.60628897", "0.60379267", "0.6026517", "0.6024355", "0.5991181", "0.59848356", "0.5970841", "0.59580106", "0.59347343", "0.59344095", "0.5897837", "0.5894837", "0.5872468", "0.58497804", "0.5840694", "0.57989275", "0.5796628", "0.579345", "0.5772671", "0.5755419", "0.5754419", "0.5727355", "0.57229483", "0.5721776", "0.5716304", "0.5702085", "0.5699064", "0.5666581", "0.5658135", "0.5652951", "0.565264", "0.5644976", "0.5644396", "0.56364095", "0.5629419", "0.56269264", "0.56181663", "0.5610209", "0.5605483", "0.55865324", "0.55847245", "0.5581548", "0.55781746", "0.5576652", "0.5558894", "0.55584955", "0.5552912", "0.55516267", "0.5547204", "0.55460805", "0.5536759", "0.5536111", "0.5531087", "0.55272603", "0.5524638", "0.55161166", "0.55156416", "0.5511504", "0.5508642", "0.5507053", "0.55015457", "0.5499903", "0.5488044", "0.5483797", "0.5482013", "0.5481622", "0.54797286", "0.5478155", "0.5472696" ]
0.5818008
46
Send confirmation of a group change. using permission nodes... groupmanager.notify.self groupmanager.notify.other
public static void notify(String name, String msg) { Player player = Bukkit.getServer().getPlayerExact(name); for (Player test : Bukkit.getServer().getOnlinePlayers()) { if (!test.equals(player)) { if (test.hasPermission("groupmanager.notify.other")) test.sendMessage("§7[ §aGizemliOyuncu §7] §e" + ChatColor.YELLOW + name + " §eAdlı Oyuncunun Yeni Yetki Grubu: §b" + msg); } else if ((player != null) && ((player.hasPermission("groupmanager.notify.self")) || (player.hasPermission("groupmanager.notify.other")))) player.sendMessage("§7[ §aGizemliOyuncu §7] §eYetki Grubun: §b" + msg); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Audit(transName=\"editGroupConfirmation\", transType=\"editGroupOwner\", beforeLog=TRUE, afterLog=TRUE)\r\n\tpublic void editGroupConfirmation(){\r\n\t\twsrdModel.setErrorMsg(\"\");\r\n\t\twsrdModel.setDuplicateErrorMsg(\"\");\r\n\t\tif(checkMultipleEdit()){\r\n\t\t\twsrdModel.setErrorMsg(WsrdConstants.UNSAVED);\r\n\t\t}\r\n\t\telse{\r\n\r\n\t\t\tif(checkUnavaialble()){\r\n\t\t\t\twsrdModel.setErrorMsg(WsrdConstants.UNAVAILABLE);\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tString str=checkForAssociation();\r\n\t\t\t\tif(str.trim().equalsIgnoreCase(WsrdConstants.SELECTMSG)){\r\n\t\t\t\t\teditGroup();\r\n\t\t\t }\r\n\t\t\t\r\n\t\t\t\telse{\r\n\t\t\t\t\twsrdModel.setDuplicateErrorMsg(str);\r\n\t\t\t\t\twsrdModel.setErrorMsg(WsrdConstants.GROUP_CONFLICT);\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\r\n\t\t\t\r\n\t\t}\r\n\t}", "public void a(GroupEntity groupEntity) {\n ((b) ((b) ((b) ((b) ((b) new b(this).b(\"申请加群\")).a(\"确认加入该群?\").a(false)).b(false)).a((CharSequence) \"取消\", (OnClickListener) new d(this))).b((CharSequence) \"申请\", (OnClickListener) new e(this, groupEntity))).c();\n }", "@Override\n public void onClickGroupEvent(GroupEvent groupEvent) {\n QuickDirtyDataHolder.getInstance().notifySelectGEDialogObservers(groupEvent);\n }", "public void sendGroupCommand(CommandMessage command){\n\n\t\tMessageCreator mc = new MessageCreator(command);\n\n\t\tsendGroupMessage(mc.toXML());\n\n\t}", "private void sendActivationsToNecessaryGroups(DataGroupInfo group)\n {\n Set<String> activeGroupIds = getUserActivatedGroupIds();\n List<DataGroupInfo> toActivate = group.groupStream()\n .filter(g -> !g.activationProperty().isActivatingOrDeactivating() && activeGroupIds.contains(g.getId()))\n .collect(Collectors.toList());\n if (!toActivate.isEmpty())\n {\n if (LOGGER.isTraceEnabled())\n {\n StringBuilder sb = new StringBuilder(\"Sending Activations to Necessary Groups: \\n\");\n toActivate.stream().forEach(dgi -> sb.append(\" \").append(dgi.getId()).append('\\n'));\n LOGGER.trace(sb.toString());\n }\n try\n {\n new DefaultDataGroupActivator(myController.getToolbox().getEventManager()).setGroupsActive(toActivate, true);\n }\n catch (InterruptedException e)\n {\n LOGGER.error(e, e);\n }\n }\n }", "public void groupUpdated(IGroup group) throws RemoteException {\n\n\t\tlogger.create().block(\"groupUpdated\").info().level(1).msg(\n\t\t\t\t\"Adding updateGroup request to update queue for group: \" + group).send();\n\n\t\tupdateList.add(new GroupUpdatedNotification(group));\n\t}", "@Override\n\tpublic void onUpdateGroupAnonymitySuccess(String groupId,\n\t\t\tboolean isAnonymity) {\n\t\t\n\t}", "@Override\r\n\t\tpublic void buddyGroupAction(ItemAction arg0, BuddyGroup arg1) {\n\t\t\t\r\n\t\t}", "void syncGroup();", "@Override\n public void notifyPrivilege() {\n try {\n if (getClientInterface() != null)\n getClientInterface().notifyPrivilege();\n }\n catch (RemoteException e) {\n System.out.println(\"remote sending privilege error\");\n }\n }", "static void notifyClients(String groupAddress, int port) throws IOException {\n byte[] request = (\"151|\" + Reporting.getIpAddresses().get(0) + \"|\" + MeshFS.properties.getProperty(\"portNumber\") + \"|\" + Reporting.getMacAddress()).getBytes();\n\n MulticastSocket socket = new MulticastSocket(port);\n socket.setBroadcast(true);\n socket.send(new DatagramPacket(request, request.length, InetAddress.getByName(groupAddress), port));\n socket.close();\n }", "public void modifyGroup(String id) {\r\n //TODO\r\n System.out.println(\"conectado con model ---> metodo modifyGroup\");\r\n }", "public void setAction(GrouperActivemqPermissionAction action1) {\r\n this.action = action1;\r\n }", "void updateGroup(@Nonnull UserGroup group);", "public void notifyChangementCroyants();", "public interface GroupMessageObserver {\n public void onGroupMessage(IMMessage msg);\n public void onGroupMessageACK(int msgLocalID, long uid);\n public void onGroupMessageFailure(int msgLocalID, long uid);\n public void onGroupNotification(String notification);\n}", "protected void notifyUser()\n {\n }", "@Test\n public void testGroupModification() {\n app.getNavigationHelper().gotoGroupPage();\n\n if (! app.getGroupHelper().isThereAGroup()) {//якщо не існує ні одної групи\n app.getGroupHelper().createGroup(new CreateGroupData(\"Tol-AutoCreate\", \"Tol-AutoCreate\", null));\n }\n\n //int before = app.getGroupHelper().getGroupCount(); //count groups before test\n List<CreateGroupData> before = app.getGroupHelper().getGroupList(); // quantity of group before creation\n app.getGroupHelper().selectGroup(before.size() - 1);\n app.getGroupHelper().initGroupModification();\n CreateGroupData group = new CreateGroupData(before.get(before.size()-1).getId(),\"Change1-name\", \"Change2-header\", \"Change3-footer\");\n app.getGroupHelper().fillGroupData(group);\n app.getGroupHelper().submitGroupModification();\n app.getGroupHelper().returnToGroupPage();\n //int after = app.getGroupHelper().getGroupCount();\n List<CreateGroupData> after = app.getGroupHelper().getGroupList(); // quantity of group after creation\n //Assert.assertEquals(after, before);\n Assert.assertEquals(after.size(), before.size());\n\n before.remove(before.size() - 1);\n before.add(group); //add object to the list after creation/modification of a group\n Assert.assertEquals(new HashSet<>(before), new HashSet<>(after)); //compare two lists без учета порядка\n }", "@objid (\"7f47c8ab-1dec-11e2-8cad-001ec947c8cc\")\n public SimpleModeDeferredGroupCommand(GroupRequest req, EditPart sender) {\n this.req = req;\n this.gmComposite = (GmCompositeNode) sender.getModel();\n this.editPartRegistry = sender.getViewer().getEditPartRegistry();\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}", "@Test\n public void testRevokeAffectsWholeGroup_part2() throws Exception {\n assertEquals(PackageManager.PERMISSION_DENIED, getInstrumentation().getContext()\n .checkSelfPermission(Manifest.permission.READ_CALENDAR));\n assertEquals(PackageManager.PERMISSION_DENIED, getInstrumentation().getContext()\n .checkSelfPermission(Manifest.permission.WRITE_CALENDAR));\n }", "@Override\r\n\tpublic void sendGeneralNotification() {\n\t\t\r\n\t}", "void syncGroup(Context context);", "protected void confirmMessage(EventManagerInterface ei, int evtId, String m) {\n // Here we create the event.\n Event evt = new Event(evtId, m);\n\t// Here we send the event to the event manager.\n try {\n ei.sendEvent(evt);\n } // try\n catch (Exception e) {\n System.out.println(\"Error Confirming Message:: \" + e);\n } // catch\n }", "@Override\n public void onClick(View v) {\n Intent gintent = new Intent(\"custom-message\");\n Toast.makeText(context, \"Don't click me\", Toast.LENGTH_SHORT).show();\n gintent.putExtra(\"groupName\",groupTitle);\n LocalBroadcastManager.getInstance(context).sendBroadcast(gintent);\n\n }", "@Override\n public void onCheckedChanged(RadioGroup radioGroup, int i) {\n if(i == acceptButton.getId()){\n order.setStatus(Order.STATE_APPROVED);\n }\n //If deny Radio Button clicked\n if(i == denyButton.getId()){\n order.setStatus(Order.STATE_REJECTED);\n }\n //Updating order status in database\n changeOrderStatus(order);\n }", "@Override\n\tpublic void confirmAndSendMessage(String messageId) {\n\t\t\n\t}", "private void updateGroupInvitationNotification() {\n Set<String> keys = mGroupInvitationInfos.keySet();\n int size = keys.size();\n Logger.d(TAG,\n \"updateGroupInvitationNotification entry, with size: \"\n + size);\n if (size == SINGLE_GROUP_INVITATION) {\n String sessionId = keys.iterator().next();\n GroupInvitationInfo info = mGroupInvitationInfos\n .get(sessionId);\n if (info == null) {\n Logger.v(TAG,\n \"updateGroupInvitationNotification info is null\");\n return;\n }\n Context context = info.context;\n StringBuilder titleBuilder = new StringBuilder(\n info.notifyTitle);\n titleBuilder\n .append(context\n .getString(R.string.group_invitation_notify_title));\n titleBuilder.append(BLANK_SPACE);\n titleBuilder.append(info.sender);\n String notifyContent = info.notifyInfo;\n Intent intent = info.intent;\n if (intent != null) {\n intent.setClass(context, InvitationDialog.class);\n if (Logger.getIsIntegrationMode()) {\n intent.putExtra(\n InvitationDialog.KEY_STRATEGY,\n InvitationDialog.STRATEGY_IPMES_GROUP_INVITATION);\n } else {\n intent.putExtra(\n InvitationDialog.KEY_STRATEGY,\n InvitationDialog.STRATEGY_GROUP_INVITATION);\n }\n intent.putExtra(NOTIFY_TITLE, titleBuilder.toString());\n intent.putExtra(NOTIFY_CONTENT, notifyContent);\n }\n PendingIntent contentIntent = PendingIntent.getActivity(\n context, 0, intent,\n PendingIntent.FLAG_UPDATE_CURRENT);\n Notification.Builder builder = new Notification.Builder(\n context);\n builder.setContentTitle(titleBuilder.toString());\n builder.setContentText(notifyContent);\n builder.setContentIntent(contentIntent);\n builder.setSmallIcon(info.icon);\n builder.setWhen(System.currentTimeMillis());\n builder.setAutoCancel(false);\n Logger.v(\n TAG,\n \"updateGroupInvitationNotification notification checked: \"\n + SettingsFragment.IS_NOTIFICATION_CHECKED\n .get() + \" intent: \" + intent);\n if (SettingsFragment.IS_NOTIFICATION_CHECKED.get()) {\n Notification notification = builder.getNotification();\n NotificationManager groupInviteNotification = (NotificationManager) context\n .getSystemService(Context.NOTIFICATION_SERVICE);\n groupInviteNotification.notify(GROUP_INVITATION_TAG,\n NOTIFICATION_ID_CHAT, notification);\n }\n } else if (size > 1) {\n String sessionId = keys.iterator().next();\n GroupInvitationInfo info = mGroupInvitationInfos\n .get(sessionId);\n if (info == null) {\n Logger.v(TAG,\n \"updateGroupInvitationNotification info is null\");\n return;\n }\n Context context = info.context;\n StringBuilder titleBuilder = new StringBuilder();\n titleBuilder.append(size);\n titleBuilder.append(BLANK_SPACE);\n titleBuilder\n .append(context\n .getString(R.string.group_multi_invitation_title));\n String notifyTitle = titleBuilder.toString();\n String notifyContent = context\n .getString(R.string.group_multi_invitation_content);\n Intent intent = info.intent;\n if (intent != null) {\n intent.setClass(context, ChatMainActivity.class);\n intent.putExtra(NOTIFY_CONTENT, notifyContent);\n }\n PendingIntent contentIntent = PendingIntent.getActivity(\n context, 0, intent,\n PendingIntent.FLAG_UPDATE_CURRENT);\n Notification.Builder builder = new Notification.Builder(\n context);\n builder.setContentTitle(notifyTitle);\n builder.setContentText(notifyContent);\n builder.setContentIntent(contentIntent);\n builder.setSmallIcon(info.icon);\n builder.setWhen(System.currentTimeMillis());\n builder.setAutoCancel(false);\n Logger.v(\n TAG,\n \"updateGroupInvitationNotification notification checked: \"\n + SettingsFragment.IS_NOTIFICATION_CHECKED\n .get() + \" intent: \" + intent);\n if (SettingsFragment.IS_NOTIFICATION_CHECKED.get()) {\n Notification notification = builder.getNotification();\n NotificationManager groupInviteNotification = (NotificationManager) context\n .getSystemService(Context.NOTIFICATION_SERVICE);\n groupInviteNotification.notify(GROUP_INVITATION_TAG,\n NOTIFICATION_ID_CHAT, notification);\n }\n } else {\n cancelGroupInviteNotification();\n }\n Logger.v(TAG, \"updateGroupInvitationNotification exit\");\n }", "@Override public void onClick(View v) {\n Snackbar.make(groupViewHolder.itemView, \"Group was toggled\", Snackbar.LENGTH_SHORT).show();\n }", "@Override\n public boolean onActionItemClicked(ActionMode mode, MenuItem item) {\n @SuppressWarnings(\"unchecked\")\n Pair<Long, String> tag = (Pair<Long, String>) mode.getTag();\n final long groupId = tag.first;\n final String title = tag.second;\n \n\n switch (item.getItemId()) {\n case R.id.menu_edit:\n final EditText input = new EditText(getActivity());\n input.setSingleLine(true);\n input.setText(title);\n new AlertDialog.Builder(getActivity()) //\n .setTitle(R.string.edit_group_title) //\n .setView(input) //\n .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n new Thread() {\n @Override\n public void run() {\n String groupName = input.getText().toString();\n if (!groupName.isEmpty()) {\n ContentResolver cr = getActivity().getContentResolver();\n ContentValues values = new ContentValues();\n values.put(FeedColumns.NAME, groupName);\n if (cr.update(FeedColumns.CONTENT_URI(groupId), values, null, null) > 0) {\n cr.notifyChange(FeedColumns.GROUPS_CONTENT_URI, null);\n cr.notifyChange(FeedColumns.GROUPED_FEEDS_CONTENT_URI, null);\n }\n }\n }\n }.start();\n }\n }).setNegativeButton(android.R.string.cancel, null).show();\n\n mode.finish(); // Action picked, so close the CAB\n return true;\n case R.id.menu_delete:\n new AlertDialog.Builder(getActivity()) //\n .setIcon(android.R.drawable.ic_dialog_alert) //\n .setTitle(title) //\n .setMessage(R.string.question_delete_group) //\n .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which)\n {\n new Thread()\n {\n @Override\n public void run()\n {\n ContentResolver cr = getActivity().getContentResolver();\n if (cr.delete(FeedColumns.GROUPS_CONTENT_URI(groupId), null, null) > 0) {\n cr.notifyChange(EntryColumns.CONTENT_URI, null);\n cr.notifyChange(EntryColumns.FAVORITES_CONTENT_URI, null);\n cr.notifyChange(FeedColumns.GROUPED_FEEDS_CONTENT_URI, null);\n }\n }\n }.start();\n }\n }).setNegativeButton(android.R.string.no, null).show();\n\n mode.finish(); // Action picked, so close the CAB\n return true;\n default:\n return false;\n }\n }", "private void sendNotification() {\n }", "private void sendConfirmation(String message, DatagramPacket receivedPacket) {\r\n\t\tbyte[] data = receivedPacket.getData();\r\n\t\tint packetNumber = data[1];\r\n\t\tbyte[] confirmationPacketContent = createPacketData(Constants.ACK, packetNumber, data[1],\r\n\t\t\t\t(\"received \" + packetNumber).getBytes());\r\n\t\tDatagramPacket confirmation = new DatagramPacket(confirmationPacketContent, confirmationPacketContent.length);\r\n\t\tconfirmation.setSocketAddress(receivedPacket.getSocketAddress());\r\n\t\ttry {\r\n\t\t\tsocket.send(confirmation);\r\n\t\t} catch (IOException e) {\r\n\t\t\tSystem.out.println(\"Broker failed to send confirmation message.\");\r\n\t\t}\r\n\t}", "public void onGroupChanged(NotificationGroupManagerLegacy.NotificationGroup notificationGroup, NotificationEntry notificationEntry) {\n NotificationEntry notificationEntry2 = notificationGroup.summary;\n if (notificationEntry2 != null) {\n if (notificationGroup.suppressed || notificationGroup.alertOverride != null) {\n checkForForwardAlertTransfer(notificationEntry2, notificationEntry);\n return;\n }\n GroupAlertEntry groupAlertEntry = this.mGroupAlertEntries.get(this.mGroupManager.getGroupKey(notificationEntry2.getSbn()));\n if (groupAlertEntry.mAlertSummaryOnNextAddition) {\n if (!this.mHeadsUpManager.isAlerting(notificationGroup.summary.getKey())) {\n alertNotificationWhenPossible(notificationGroup.summary);\n }\n groupAlertEntry.mAlertSummaryOnNextAddition = false;\n return;\n }\n checkShouldTransferBack(groupAlertEntry);\n }\n }", "public void needconfirmstion(Pending_appoint_Owner pending_appoint_owner) {\n //TODO\n newOwners.put(pending_appoint_owner.grantee.getId(), pending_appoint_owner);\n user.add_msg(\"a new Owner is being appointed for store:\" + getStore().getName()\n + \"- required your confirmation - \" + pending_appoint_owner.grantee.getId());\n }", "private void confirmationAlert() {\n\t\tAlert confirm = new Alert( AlertType.CONFIRMATION, \"You Will Not Be Able To Change Your Name\\nAfter You Press 'OK'.\");\n\t\tconfirm.setHeaderText(\"Are You Sure?\");\n confirm.setTitle(\"Confirm Name\");\n confirm.showAndWait().ifPresent(response -> {\n if (response == ButtonType.OK) {\n \tbackground.remove( pointer );\n \tkeyStrokes = keyStrokes.replace(\" \", \"-\");\n\t\t\t\tinsertNewHiScore();\n\t\t\t\tnewHighScore = false;\n }\n });\n\t}", "protected void onConfirmation(int confirmationId, Object anObject) {\r\n\r\n\t}", "private void alertDialogeForAskingPermissions() {\n builder.setMessage(getResources().getString(R.string.app_name) + \" needs access to \" + permissions[0] + \", \" + permissions[1]).setTitle(R.string.permissions_required);\n\n //Setting message manually and performing action on button click\n //builder.setMessage(\"Do you want to close this application ?\")\n builder.setCancelable(false)\n .setPositiveButton(R.string.later, new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int id) {\n\n // Action for 'Later'\n //Saving later boolean value as true, also saving time of pressed later\n Date dateObj = new Date();\n long timeNow = dateObj.getTime();\n editor.putLong(getResources().getString(R.string.later_pressed_time), timeNow);\n editor.putBoolean(getResources().getString(R.string.later), true);\n editor.commit();\n dialog.cancel();\n }\n })\n .setNegativeButton(R.string.give_permissions, new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int id) {\n requestPermission();\n }\n });\n //Creating dialog box\n AlertDialog alert = builder.create();\n alert.show();\n }", "public abstract boolean confirm();", "@Override\n\tpublic void sendOrderConfirmationHtmlEmail(Order order) {\n\t\t\n\t}", "@Override\r\n public void onDialogPositiveConfirmation(int requestID) {\r\n switch (requestID) {\r\n case REQUEST_CONFIRMATION_DELETE_EVENT:\r\n deleteEvent();\r\n break;\r\n case REQUEST_CONFIRMATION_DELETE_PHOTO:\r\n deletePressedPhoto();\r\n break;\r\n case REQUEST_CONFIRMATION_DELETE_EVENT_CALENDAR_ENTRY:\r\n removeFromCalendar();\r\n break;\r\n case REQUEST_CONFIRMATION_ADD_EVENT_CALENDAR_ENTRY:\r\n addToCalendar();\r\n break;\r\n }\r\n }", "public void redo() {\n for (NoteGroupable noteGroupable : group.getNoteGroupables()) {\n compositionManager.deleteGroupable(noteGroupable);\n }\n compositionManager.addGroupable(group);\n }", "@Override\n public void onGroupStatusChanged(IClientContext context, IGuiElement.GroupState status, IGuiElement button) throws Exception\n {\n IUser user = context.getUser();\n if (!user.hasRole(Role.ADMIN.getName()))\n {\n button.setVisible(false);\n }\n }", "public final void rule__Affect__Group__1() throws RecognitionException {\n\n \t\tint stackSize = keepStackSize();\n \t\n try {\n // InternalWh.g:1021:1: ( rule__Affect__Group__1__Impl rule__Affect__Group__2 )\n // InternalWh.g:1022:2: rule__Affect__Group__1__Impl rule__Affect__Group__2\n {\n pushFollow(FOLLOW_15);\n rule__Affect__Group__1__Impl();\n\n state._fsp--;\n\n pushFollow(FOLLOW_2);\n rule__Affect__Group__2();\n\n state._fsp--;\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 clickOnNewGroupButton()\n\t{\n\t\twaitForElement(newGroupButton);\n\t\tclickOn(newGroupButton);\n\t}", "public void checkboxClickedSetDone(ActionEvent actionEvent) {\n // we will simply find the item within the group and use its setDone() method\n }", "void notify(Message m);", "public static void sendInvitationMail(String toMail, Group group){\n String invitationText = \"Hello!\\n\\n You have been invited to join a group on Household Manager. \" +\n \"Login to accept the invitation \\n\" +\n \"Invited to group: \"+group.getName()+ \"\\n Invited by: \"+group.getAdmin();\n sendMail(toMail,invitationText);\n }", "public String deleteProductGroupNew() {\n\t\tactionStartTime = new Date();\n\t\tresetToken(result);\n\t\ttry {\n\t\t\tProductGroup productGroupMua = promotionProgramMgr.getProductGroupById(groupMuaId);\n\t\t\tProductGroup productGroupKM = promotionProgramMgr.getProductGroupById(groupKMId);\n\t\t\tpromotionProgramMgr.deleteProductGroup(productGroupMua, getLogInfoVO());\n\t\t\tpromotionProgramMgr.deleteProductGroup(productGroupKM, getLogInfoVO());\n\t\t\tif (productGroupMua != null && productGroupMua.getPromotionProgram() != null) {\n\t\t\t\tpromotionProgramMgr.updateMD5ValidCode(productGroupMua.getPromotionProgram(), getLogInfoVO());\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\tLogUtility.logErrorStandard(e, R.getResource(\"web.log.message.error\", \"vnm.web.action.program.PromotionCatalogAction.deleteProductGroupNew\"), createLogErrorStandard(actionStartTime));\n\t\t\terrMsg = ValidateUtil.getErrorMsg(ConstantManager.ERR_SYSTEM);\n\t\t\tresult.put(\"errMsg\", errMsg);\n\t\t\tresult.put(ERROR, true);\n\t\t\treturn SUCCESS;\n\t\t}\n\t\treturn SUCCESS;\n\t}", "public void notifyDeleteRequestState (COPSPdpOSReqStateMan man);", "public void notify1();", "public static boolean updateStatusGroup(Long id, Long idGroup){\n\t\tRequirement req = reqDao.getRequirement(id);\r\n\t\tLong idOldGroup = req.getIdGroup();\r\n\t\tboolean flag = false;\r\n\t\t\r\n\t\t//change idGroup\r\n\t\tif (!idOldGroup.equals(idGroup)){\r\n\t\t\tflag = reqDao.updateStatusGroup(idOldGroup, Constant.GROUP_FREE_REQ);\r\n\t\t\t\r\n\t\t\t//success\r\n\t\t\tif (flag){\r\n\t\t\t\t\r\n\t\t\t\t//update status of new group = assignReq\r\n\t\t\t\tflag =\treqDao.updateStatusGroup(idGroup, Constant.GROUP_ASSIGN_REQ);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn flag;\r\n}", "public void resendConfirmationToken(RegistrationRequest request) {\n String requestEmail = request.getEmail();\n\n // delete old token and create new through user service\n // and get token UUID\n String token = applicationUserService.resendConfirmationToken(\n // convert request to client user\n convertRegistrationRequestToApplicationUser(request));\n\n // create confirmation link\n String host = \"localhost:8080\";\n String link = \"http://\" + host + \"/registration/confirm?token=\" + token;\n // send email with link to the user's email address\n emailSender.send(requestEmail,\n // build email message\n EmailMessageHelper.buildEmailMessage(request.getUsername(), link));\n\n }", "void confirm();", "void finalConfirm(ITransaction trans,boolean confirmation, String userId);", "public void setGroupPermission(TGroupPermission groupP) {\n\n\t\tthis.groupPermission = groupP;\n\t}", "public synchronized void updateGroup() {\n RaftGroup newGroup = getCurrentGroup();\n if (!newGroup.equals(mRaftGroup)) {\n LOG.info(\"Raft group updated: old {}, new {}\", mRaftGroup, newGroup);\n mRaftGroup = newGroup;\n }\n }", "@Test (description = \"Delete a contact group by click Delete on Context Menu and verify toast message\",\n\t\t\tgroups = { \"functional\" })\n\n\tpublic void DeleteContactGroup_02() throws HarnessException {\n\t\tContactGroupItem group = ContactGroupItem.createContactGroupItem(app.zGetActiveAccount());\n\n\t\t// Refresh\n\t\tapp.zPageContacts.zToolbarPressButton(Button.B_REFRESH);\n\n\t\t// Delete contact group by click Delete on Context menu\n\t\tapp.zPageContacts.zListItem(Action.A_RIGHTCLICK, Button.B_DELETE, group.getName());\n\n\t\t// Verifying the toaster message\n\t\tToaster toast = app.zPageMain.zGetToaster();\n\t\tString toastMessage = toast.zGetToastMessage();\n\t\tZAssert.assertStringContains(toastMessage, \"1 contact group moved to Trash\", \"Verify toast message: Contact group Moved to Trash\");\n\t}", "private void assignGroups(int numSupportedGroups) {\n if (mSendDeviceId == Device.DEVICE_ID_UNKNOWN)\n return;\n // Check the number of supported groups matches the number requested to be set.\n if (numSupportedGroups >= mNewGroups.size()) {\n\n mGroupAcksWaiting = 0;\n\n // Make a copy of existing groups for this device.\n mGroupsToSend = mDeviceStore.getSingleDevice(mSendDeviceId).getGroupMembershipValues();\n // Loop through existing groups.\n for (int i = 0; i < mGroupsToSend.size(); i++) {\n int groupId = mGroupsToSend.get(i);\n if (groupId != 0) {\n int foundIndex = mNewGroups.indexOf(groupId);\n if (foundIndex > -1) {\n // The device is already a member of this group so remove it from the list of groups to add.\n mNewGroups.remove(foundIndex);\n }\n else {\n // The device should no longer be a member of this group, so set that index to -1 to flag\n // that a message must be sent to update this index.\n mGroupsToSend.set(i, -1);\n }\n }\n }\n // Now loop through currentGroups, and for every index set to -1 or zero send a group update command for\n // that index with one of our new groups if one is available. If there are no new groups to set, then just\n // send a message for all indices set to -1, to set them to zero.\n boolean commandSent = false;\n for (int i = 0; i < mGroupsToSend.size(); i++) {\n int groupId = mGroupsToSend.get(i);\n if (groupId == -1 || groupId == 0) {\n if (mNewGroups.size() > 0) {\n int newGroup = mNewGroups.get(0);\n mNewGroups.remove(0);\n commandSent = true;\n sendGroupCommands(mSendDeviceId, i, newGroup);\n }\n else if (groupId == -1) {\n commandSent = true;\n sendGroupCommands(mSendDeviceId, i, 0);\n }\n }\n }\n if (!commandSent) {\n // There were no changes to the groups so no updates were sent. Just tell the listener\n // that the operation is complete.\n if (mGroupAckListener != null) {\n mGroupAckListener.groupsUpdated(mSendDeviceId, true, stActivity.getString(R.string.group_no_changes));\n }\n }\n }\n else {\n // Not enough groups supported on device.\n if (mGroupAckListener != null) {\n mGroupAckListener.groupsUpdated(mSendDeviceId, false,\n stActivity.getString(R.string.group_max_fail) + \" \" + numSupportedGroups + \" \" + stActivity.getString(R.string.groups));\n }\n }\n }", "public void setRequireGroup(Group requireGroup1) {\r\n this.requireGroup = requireGroup1;\r\n }", "@Override\r\n\tpublic void notificationVente(CommandeProduc c) {\n\t}", "private void confirmarGuardarEmpleado() {\n String pregunta = \"Esto seguro de realizar guardar la categoria?\";\n new AlertDialog.Builder(this)\n .setTitle(getResources().getString(R.string.msj_confirmacion))\n .setMessage(pregunta)\n .setNegativeButton(android.R.string.cancel, null)//sin listener\n .setPositiveButton(getResources().getString(R.string.lbl_aceptar),\n new DialogInterface.OnClickListener() {//un listener que al pulsar, solicite el WS de Transsaccion\n @Override\n public void onClick(DialogInterface dialog, int which){\n guardarEmpleado();\n }\n })\n .show();\n }", "protected abstract InGameServerCommand getCommandOnConfirm();", "public final void rule__Affectation__Group__1() throws RecognitionException {\n\n \t\tint stackSize = keepStackSize();\n \t\n try {\n // InternalBrowser.g:1379:1: ( rule__Affectation__Group__1__Impl rule__Affectation__Group__2 )\n // InternalBrowser.g:1380:2: rule__Affectation__Group__1__Impl rule__Affectation__Group__2\n {\n pushFollow(FOLLOW_8);\n rule__Affectation__Group__1__Impl();\n\n state._fsp--;\n\n pushFollow(FOLLOW_2);\n rule__Affectation__Group__2();\n\n state._fsp--;\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 final void rule__Affect__Group_1__0() throws RecognitionException {\n\n \t\tint stackSize = keepStackSize();\n \t\n try {\n // InternalWh.g:1129:1: ( rule__Affect__Group_1__0__Impl rule__Affect__Group_1__1 )\n // InternalWh.g:1130:2: rule__Affect__Group_1__0__Impl rule__Affect__Group_1__1\n {\n pushFollow(FOLLOW_7);\n rule__Affect__Group_1__0__Impl();\n\n state._fsp--;\n\n pushFollow(FOLLOW_2);\n rule__Affect__Group_1__1();\n\n state._fsp--;\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 }", "@Override\n\tpublic boolean response(Notification notification) {\n\t\tUser sender;\n\t\tif (!userManager.hasUser(notification.getSender())) {\n\t\t\tsender=utils.reinitializeUser(notification.getSender());\n\t\t\tif(sender==null)\n\t\t\t{\n\t\t\t\t//throw exception\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\tsender = userManager.getUser(notification.getSender());\n\t\tString receiverUserId = notification.getOwnerId();\n\t\t// Account account;\n\t\tAccount account = accountManager.getAccountByUserId(receiverUserId);\n\t\tif (account == null) {\n\t\t\ttry {\n\t\t\t\taccount = accountDao.getByUserId(receiverUserId);\n\t\t\t\tif (account == null)\n\t\t\t\t\treturn false;\n\t\t\t} catch (AccountNotFoundException e) {\n\t\t\t\tSystem.out.println(e.getMessage());\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t}\n\t\tsender.setAcceptanceStatus(account, notification.getAcceptanceStatus(),\n\t\t\t\tnotification.getSuggestionId());\n\t\tAccount receiverAccount = accountManager\n\t\t\t\t.getAccountByUserId(receiverUserId);\n\t\tif (receiverAccount == null) {\n\t\t\ttry {\n\t\t\t\treceiverAccount = accountDao.getByUserId(receiverUserId);\n\t\t\t\tif (receiverAccount == null)\n\t\t\t\t\treturn false;\n\t\t\t} catch (AccountNotFoundException e) {\n\t\t\t\tSystem.out.println(e.getMessage());\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t}\n\t\tUser receiver;// =userManager.getUser(receiverAccount);\n\t\tif (!userManager.hasUser(receiverAccount)) {\n\t\t\treceiver=utils.reinitializeUser(receiverAccount);\n\t\t\tif(receiver==null)\n\t\t\t{\n\t\t\t\t//throw exception\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treceiver = userManager.getUser(receiverAccount);\n\t\treceiver.deleteNotification(notification);\n\t\t// check for all the other status values(logic)\n\t\t// the statement below modifies the acceptanceStatus by the specific\n\t\t// ownerID\n\t\tboolean success = false;\n\t\ttry {\n\t\t\tsuccess = suggestionDao.modifySuggestionReceiver(notification,\n\t\t\t\t\t\"acceptanceStatus\");\n\t\t\tif (!success) {\n\t\t\t\tsuccess = suggestionDao.modifySuggestionReceiver(notification,\n\t\t\t\t\t\t\"acceptanceStatus\");\n\t\t\t\tif (!success) {\n\t\t\t\t\t// an exception should be thrown for transaction management\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (SuggestionNotFoundException e) {\n\t\t\tSystem.out.println(e.getMessage());\n\t\t\treturn false;\n\t\t}\n\t\treturn success;\n\t}", "public abstract void groupChatCreatedMessage(Message m);", "public void notifyAdmins(){\n \tfor(PlayerHandler player : players){\n \t\tif(player.isAdmin()){\n \t\t\tplayer.notify(1);\n \t\t}\n \t}\n }", "public final void rule__Affect__Group__2() throws RecognitionException {\n\n \t\tint stackSize = keepStackSize();\n \t\n try {\n // InternalWh.g:1048:1: ( rule__Affect__Group__2__Impl rule__Affect__Group__3 )\n // InternalWh.g:1049:2: rule__Affect__Group__2__Impl rule__Affect__Group__3\n {\n pushFollow(FOLLOW_16);\n rule__Affect__Group__2__Impl();\n\n state._fsp--;\n\n pushFollow(FOLLOW_2);\n rule__Affect__Group__3();\n\n state._fsp--;\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 confirmStudentUpdate(){\n\n String title =\"Confirm student information update\";\n String HeaderText = \"Confirm inserted data\";\n String ContentText = \"Are you sure you want to update this student's information?\";\n\n AlertHandler ah = new AlertHandler();\n\n if (ah.getConfirmation(title, HeaderText, ContentText) == ButtonType.OK) {\n System.out.println(\"Ok pressed\");\n updateStudent();\n } else {\n System.out.println(\"Cancel pressed\");\n }\n }", "public void setGroupId(String newValue);", "public void groupSelected (String iocId, String groupId);", "public final void rule__SendSignal__Group__1() throws RecognitionException {\r\n\r\n \t\tint stackSize = keepStackSize();\r\n \t\r\n try {\r\n // InternalDroneScript.g:4635:1: ( rule__SendSignal__Group__1__Impl rule__SendSignal__Group__2 )\r\n // InternalDroneScript.g:4636:2: rule__SendSignal__Group__1__Impl rule__SendSignal__Group__2\r\n {\r\n pushFollow(FOLLOW_21);\r\n rule__SendSignal__Group__1__Impl();\r\n\r\n state._fsp--;\r\n if (state.failed) return ;\r\n pushFollow(FOLLOW_2);\r\n rule__SendSignal__Group__2();\r\n\r\n state._fsp--;\r\n if (state.failed) return ;\r\n\r\n }\r\n\r\n }\r\n catch (RecognitionException re) {\r\n reportError(re);\r\n recover(input,re);\r\n }\r\n finally {\r\n\r\n \trestoreStackSize(stackSize);\r\n\r\n }\r\n return ;\r\n }", "public void notifyAgent(int agentId) {\t\t\r\n\t\tAgent a = this.getAgent(agentId);\r\n\t\ta.setStatus(AgentStatus.ACTIVE);\t\r\n\t\t//a.clearIntention();\r\n\t\t\r\n\t\t/*List<SubIntention> removeJobs = new ArrayList<SubIntention>();\r\n\t\tfor(SubIntention job: jobList) {\r\n\t\t\tif(job.getOwner() == agentId) {\r\n\t\t\t\tremoveJobs.add(job);\r\n\t\t\t}\r\n\t\t}\r\n\t\tjobList.removeAll(removeJobs);*/\r\n\t\t\r\n\t\t// Delete all jobs! They might be outdated!\r\n\t\twhile(!jobList.isEmpty()) {\r\n\t\t\tSubIntention si = jobList.get(0);\r\n\t\t\ta = this.getAgent(si.getOwner());\r\n\t\t\ta.setStatus(AgentStatus.ACTIVE);\r\n\t\t\tjobList.remove(0);\t\t\t\t\r\n\t\t}\r\n\t}", "public final void rule__SendSignal__Group__2() throws RecognitionException {\r\n\r\n \t\tint stackSize = keepStackSize();\r\n \t\r\n try {\r\n // InternalDroneScript.g:4662:1: ( rule__SendSignal__Group__2__Impl rule__SendSignal__Group__3 )\r\n // InternalDroneScript.g:4663:2: rule__SendSignal__Group__2__Impl rule__SendSignal__Group__3\r\n {\r\n pushFollow(FOLLOW_6);\r\n rule__SendSignal__Group__2__Impl();\r\n\r\n state._fsp--;\r\n if (state.failed) return ;\r\n pushFollow(FOLLOW_2);\r\n rule__SendSignal__Group__3();\r\n\r\n state._fsp--;\r\n if (state.failed) return ;\r\n\r\n }\r\n\r\n }\r\n catch (RecognitionException re) {\r\n reportError(re);\r\n recover(input,re);\r\n }\r\n finally {\r\n\r\n \trestoreStackSize(stackSize);\r\n\r\n }\r\n return ;\r\n }", "public void listGroup() {\r\n List<Group> groupList = groups;\r\n EventMessage evm = new EventMessage(\r\n EventMessage.EventAction.FIND_MULTIPLE,\r\n EventMessage.EventType.OK,\r\n EventMessage.EventTarget.GROUP,\r\n groupList);\r\n notifyObservers(evm);\r\n }", "public void setGroupcode(java.lang.Integer newGroup) {\n\tgroupcode = newGroup;\n}", "private void cancelGroupInviteNotification() {\n int size = mGroupInvitationInfos.size();\n Logger.d(TAG, \"cancelGroupInviteNotification() entry, size: \"\n + size);\n if (size == 0) {\n Context context = ApiManager.getInstance().getContext();\n Logger.e(TAG, \"cancelGroupInviteNotification() context: \"\n + context);\n if (context != null) {\n NotificationManager groupInviteNotification = (NotificationManager) context\n .getSystemService(Context.NOTIFICATION_SERVICE);\n groupInviteNotification.cancel(GROUP_INVITATION_TAG,\n NOTIFICATION_ID_CHAT);\n }\n }\n Logger.d(TAG, \"cancelGroupInviteNotification exit\");\n }", "Order sendNotificationNewOrder(Order order);", "public void groupAdded(long pid, IGroup group) throws RemoteException {\n\t\tlogger.create().block(\"groupAdded\").info().level(1).msg(\n\t\t\t\t\"Adding addGroup request to update queue for: pid: \" + pid + \", group: \" + group).send();\n\t\tupdateList.add(new GroupAddedNotification(pid, group));\n\t}", "public void toolGroupUpdated(ToolGroupEvent evt) {\n }", "final public void setAffectsGroup(boolean value) {\n affectsGroup = value;\n }", "public abstract Object notify(NotifyDescriptor descriptor);", "private void handlePluginGroupChatInvitation(Context context,\n Intent invitation, boolean autoAccept) {\n Logger.d(TAG, \"handlePluginGroupChatInvitation entry\");\n GroupChat chatSession = getGroupChatSession(invitation);\n UUID uuid = UUID.randomUUID();\n ParcelUuid parcelUuid = new ParcelUuid(uuid);\n if (chatSession == null) {\n Logger.d(TAG, \"by simple The chatSession is null\");\n return;\n }\n String sessionId = invitation.getStringExtra(SESSION_ID);\n String groupSubject = invitation\n .getStringExtra(GroupChatIntent.EXTRA_SUBJECT);\n Logger.v(TAG, \"handlePluginGroupChatInvitation() subject: \"\n + groupSubject);\n String chatId = invitation\n .getStringExtra(GroupChatIntent.EXTRA_CHAT_ID);\n GroupInvitationInfo info = buildNotificationInfo(context,\n invitation);\n if (info == null) {\n Logger.d(TAG, \"notification info is null\");\n return;\n }\n // Add mms db\n String contact = PluginGroupChatWindow\n .generateGroupChatInvitationContact(chatId);\n if (autoAccept) {\n contact = PluginGroupChatWindow.GROUP_CONTACT_STRING_BEGINNER\n + parcelUuid.toString();\n Logger.d(TAG, \"auto accept is true\");\n }\n invitation.putExtra(PluginGroupChatWindow.GROUP_CHAT_CONTACT,\n contact);\n int messageTag = PluginGroupChatWindow.GROUP_CHAT_INVITATION_IPMSG_ID;\n Logger.d(TAG, \"notify info is\" + info.notifyInfo + \"contact=\"\n + contact);\n // broadcast intent to mms plugin to insert into mms db\n Intent intent = new Intent();\n if (info != null) {\n intent.putExtra(\"notify\", info.notifyInfo);\n }\n intent.putExtra(\"contact\", contact);\n intent.putExtra(\"messageTag\", messageTag);\n intent.putExtra(\"subject\", groupSubject);\n intent.setAction(IpMessageConsts.JoynGroupInvite.ACTION_GROUP_IP_INVITATION);\n intent.putExtra(\"groupinvite\", 1);\n MediatekFactory.getApplicationContext().sendBroadcast(intent);\n /*\n * Long messageIdInMms = PluginUtils.insertDatabase(info.notifyInfo,\n * contact, messageTag, PluginUtils.INBOX_MESSAGE); if\n * (ThreadTranslater.tagExistInCache(contact)) { Logger.d(TAG,\n * \"plugingroupchatinvitation() Tag exists\" + contact); Long thread =\n * ThreadTranslater.translateTag(contact); insertThreadIDInDB(thread,\n * groupSubject); }\n */\n if (contact\n .startsWith(PluginGroupChatWindow.GROUP_CONTACT_STRING_BEGINNER)) {\n contact = contact.substring(4);\n }\n invitation.putExtra(ChatScreenActivity.KEY_CHAT_TAG,\n parcelUuid);\n invitation.putExtra(PluginGroupChatWindow.GROUP_CHAT_CONTACT,\n contact);\n Logger.d(TAG,\n \"handlePluginGroupChatInvitation parcelUuid is \"\n + parcelUuid.toString() + \"contact is\"\n + contact);\n }", "public void toggleGroup(DefaultMutableTreeNode node) {\n SortedTreeModel model = (SortedTreeModel)main.tree.getModel();\n SortedTreeModel othermodel =\n (model == main.skilltree ? main.otherskilltree : main.skilltree);\n model.removeNodeFromParent(node);\n setDirty(true);\n othermodel.insertNodeSorted\n (node, (DefaultMutableTreeNode) othermodel.getRoot());\n main.getState().toggleGroup(node.toString());\n }", "public final /* synthetic */ void a(GroupEntity groupEntity, DialogInterface dialogInterface, int i) {\n IMGroupManager.instance().reqApplyJoinGroup(groupEntity.peerId, groupEntity.creatorId, new Packetlistener() {\n public void onSuccess(Object obj) {\n l.a((CharSequence) \"已发出申请,等待群主审核\");\n BaseScanActivity.this.finish();\n }\n\n public void onFaild() {\n l.c(R.string.no_network_error_toast);\n if (BaseScanActivity.this.isActivated()) {\n BaseScanActivity.this.mZxingview.startSpot();\n }\n }\n\n public void onTimeout() {\n l.c(R.string.no_network_error_toast);\n if (BaseScanActivity.this.isActivated()) {\n BaseScanActivity.this.mZxingview.startSpot();\n }\n }\n });\n }", "@Test\n\tvoid synchGroups() {\n\t\tassumeWritable(c);\n\t\ttry (var u1 = c.update(GROUP_SYNC_MAKE_TEMP_TABLE)) {\n\t\t\tassertEquals(List.of(), u1.getParameters());\n\t\t\tc.transaction(() -> {\n\t\t\t\tu1.call();\n\t\t\t\ttry (var u2 = c.update(GROUP_SYNC_INSERT_TEMP_ROW);\n\t\t\t\t\t\tvar u3 = c.update(GROUP_SYNC_ADD_GROUPS);\n\t\t\t\t\t\tvar u4 = c.update(GROUP_SYNC_REMOVE_GROUPS);\n\t\t\t\t\t\tvar u5 = c.update(GROUP_SYNC_DROP_TEMP_TABLE)) {\n\t\t\t\t\tassertEquals(List.of(\"group_name\", \"group_type\"),\n\t\t\t\t\t\t\tu2.getParameters());\n\t\t\t\t\tassertEquals(0, u2.call(NO_NAME, INTERNAL));\n\t\t\t\t\tassertEquals(List.of(\"user_id\"), u3.getParameters());\n\t\t\t\t\tassertEquals(0, u3.call(NO_USER));\n\t\t\t\t\tassertEquals(List.of(\"user_id\"), u4.getParameters());\n\t\t\t\t\tassertEquals(0, u4.call(NO_USER));\n\t\t\t\t\tassertEquals(List.of(), u5.getParameters());\n\t\t\t\t\tu5.call();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}", "public static String specifyGroup() {\n return holder.format(\"specifyGroup\");\n }", "public void confirmRegistration(RegistrationData d) {}", "public void deleteGroup(Group group);", "public void notify(String userId);", "private void groupChatSend(UserLogic t) {\n if(((String) UI.getContacts().getSelectedValue()).equals( groupChat)){\r\n if (t != UserLogic.this && t != null) { //Sending to other users chat\r\n if(((String)t.UI.getContacts().getSelectedValue()).equals(groupChat)) {\r\n t.UI.getProperList().addElement(username + \"> \" + UI.getMessage().getText());\r\n t.UI.getContacts().setCellRenderer(clearNotification);\r\n }\r\n else{\r\n t.UI.getContacts().setCellRenderer(setNotification);\r\n }\r\n if(t.chats.containsKey(groupChat)){\r\n ArrayList<String> arrayList = t.chats.get(groupChat);\r\n arrayList.add(username + \"> \" + UI.getMessage().getText());\r\n t.chats.put(groupChat, arrayList);\r\n }\r\n else {\r\n ArrayList<String> arrayList = new ArrayList<>();\r\n arrayList.add(username + \"> \" + UI.getMessage().getText());\r\n t.chats.put(groupChat, arrayList);\r\n }\r\n }\r\n\r\n if(t == UserLogic.this && t!=null){ //Send to my screen\r\n UI.getProperList().addElement(\"Me> \" + UI.getMessage().getText());\r\n if(chats.containsKey(groupChat)){ //Database group chat exists\r\n ArrayList<String> arrayList = chats.get(groupChat);\r\n arrayList.add(\"Me> \" + UI.getMessage().getText());\r\n chats.put(groupChat, arrayList);\r\n }\r\n else {\r\n ArrayList<String> arrayList = new ArrayList<>();\r\n arrayList.add(\"Me> \" + UI.getMessage().getText());\r\n chats.put(groupChat, arrayList);\r\n }\r\n }\r\n }\r\n }", "public void groupDeleted(long gid) throws RemoteException {\n\n\t\tlogger.create().block(\"groupDeleted\").info().level(1).msg(\n\t\t\t\t\"Adding deleteGroup request to update queue for gid: \" + gid).send();\n\t}", "void notify(PushMessage m);", "@Override\n\tpublic void confirmOrders() {\n\t\t\n\t}", "@Override\n\tpublic void confirmOrders() {\n\t\t\n\t}", "@Override\n\tpublic void confirmOrders() {\n\t\t\n\t}", "public final void rule__Affectation__Group__2() throws RecognitionException {\n\n \t\tint stackSize = keepStackSize();\n \t\n try {\n // InternalBrowser.g:1406:1: ( rule__Affectation__Group__2__Impl rule__Affectation__Group__3 )\n // InternalBrowser.g:1407:2: rule__Affectation__Group__2__Impl rule__Affectation__Group__3\n {\n pushFollow(FOLLOW_6);\n rule__Affectation__Group__2__Impl();\n\n state._fsp--;\n\n pushFollow(FOLLOW_2);\n rule__Affectation__Group__3();\n\n state._fsp--;\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 }", "private void autoAcceptGroupChat(Context context,\n Intent invitation) {\n Logger.v(TAG, \"autoAcceptGroupChat entry\");\n ArrayList<ChatMessage> messages = new ArrayList<ChatMessage>();\n ChatMessage msg = invitation\n .getParcelableExtra(FIRST_MESSAGE);\n if (msg != null) {\n messages.add(msg);\n }\n invitation.putParcelableArrayListExtra(MESSAGES, messages);\n ModelImpl.getInstance().handleNewGroupInvitation(invitation,\n false);\n Logger.v(TAG, \"autoAcceptGroupChat exit\");\n }", "private static void updateSelectedRadioButtonInGroup(String actionCommand, ButtonGroup btnGroup) {\n for (Enumeration<AbstractButton> buttonIt = btnGroup.getElements(); buttonIt.hasMoreElements();) {\n AbstractButton button = buttonIt.nextElement();\n button.setSelected(button.getActionCommand().equals(actionCommand));\n }\n }", "static void masterDownInform(String groupAddress, int port) throws IOException {\n byte[] request = \"152\".getBytes();\n\n MulticastSocket socket = new MulticastSocket(port);\n socket.setBroadcast(true);\n socket.send(new DatagramPacket(request, request.length, InetAddress.getByName(groupAddress), port));\n socket.close();\n }" ]
[ "0.72457296", "0.5769485", "0.5665238", "0.5653394", "0.55118185", "0.54988337", "0.5452945", "0.5420367", "0.5358259", "0.53318614", "0.53240895", "0.531021", "0.52976644", "0.528478", "0.5265183", "0.5251021", "0.5233126", "0.5232094", "0.52240884", "0.52133745", "0.5198095", "0.5196199", "0.5188394", "0.51581985", "0.51295644", "0.51249623", "0.51197135", "0.5099561", "0.5081396", "0.5071396", "0.5068379", "0.50662804", "0.5064746", "0.5058263", "0.50539887", "0.5048995", "0.5048902", "0.5044009", "0.50349647", "0.50047547", "0.49860087", "0.49760816", "0.49454495", "0.4941974", "0.4938745", "0.49205813", "0.49162787", "0.49137962", "0.4913002", "0.49022356", "0.49010438", "0.48944527", "0.48915488", "0.48867247", "0.4880933", "0.4878274", "0.48733243", "0.4854203", "0.48531562", "0.48499188", "0.48335716", "0.48326162", "0.48182887", "0.48128995", "0.48104507", "0.4810185", "0.48059106", "0.47944206", "0.4793501", "0.47921568", "0.47907603", "0.47895533", "0.47850716", "0.47842452", "0.47835365", "0.47801945", "0.47777835", "0.47775224", "0.47729334", "0.4751166", "0.47490674", "0.47485772", "0.47457227", "0.47434774", "0.4742057", "0.47381568", "0.47377476", "0.47364503", "0.4735224", "0.47332484", "0.47307032", "0.47296342", "0.4727113", "0.4726622", "0.4726622", "0.4726622", "0.47233462", "0.47221753", "0.47123325", "0.47094357" ]
0.57001984
2
Load a List of players matching the name given. If none online, check Offline.
private List<String> validatePlayer(String playerName, CommandSender sender) { List<Player> players = new ArrayList<Player>(); List<String> match = new ArrayList<String>(); players = this.getServer().matchPlayer(playerName); if (players.isEmpty()) { // Check for an offline player (exact match). for (OfflinePlayer player : Bukkit.getOfflinePlayers()) { if (player.getName().equals(playerName)) { match.add(player.getUniqueId().toString()); } } /* if (Arrays.asList(this.getServer().getOfflinePlayers()).contains(Bukkit.getOfflinePlayer(playerName))) { match.add(Bukkit.getOfflinePlayer(playerName).getName()); //.getUniqueId().toString()); //match.add(Bukkit.getOfflinePlayer(Bukkit.getPlayer(playerName).getUniqueId()).getName()); //.getUniqueId().toString()); } else { // look for partial matches for (OfflinePlayer offline : this.getServer().getOfflinePlayers()) { if (offline.getName().toLowerCase().startsWith(playerName.toLowerCase())) match.add(offline.getName()); //.getUniqueId().toString()); } } */ } else { for (Player player : players) { match.add(player.getUniqueId().toString()); } } if (match.isEmpty()) { sender.sendMessage(ChatColor.RED + "Player not found!"); return null; } else if (match.size() > 1) { sender.sendMessage(ChatColor.RED + "Too many matches found! (" + match.toString() + ")"); return null; } return match; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Player getPlayerFromList(String name){\n for (Player player : players){\n if (player.getName().equals(name)){\n return player;\n }\n }\n return null; //This will never happen. Will always be found. Only called from the takeoverTerritory method\n }", "public void loadPlayers(ArrayList<String> playerNames)\r\n {\n \t\tfor(String s : playerNames){\r\n \t\t\t\r\n \t\t\tloadPlayer(s);\r\n \t\t}\r\n \t\t\r\n \t}", "@Override\r\n\tpublic ArrayList<PlayerPO> findPlayerByName(String name) {\n\t\treturn playerController.findPlayerByName(name);\r\n\t}", "private void getPlayerList(){\r\n\r\n PlayerDAO playerDAO = new PlayerDAO(Statistics.this);\r\n players = playerDAO.readListofPlayerNameswDefaultFirst();\r\n\r\n }", "private void loadPlayers() {\r\n this.passive_players.clear();\r\n this.clearRoster();\r\n //Map which holds the active and passive players' list\r\n Map<Boolean, List<PlayerFX>> m = ServiceHandler.getInstance().getDbService().getPlayersOfTeam(this.team.getID())\r\n .stream().map(PlayerFX::new)\r\n .collect(Collectors.partitioningBy(x -> x.isActive()));\r\n this.passive_players.addAll(m.get(false));\r\n m.get(true).stream().forEach(E -> {\r\n //System.out.println(\"positioning \"+E.toString());\r\n PlayerRosterPosition pos = this.getPlayerPosition(E.getCapnum());\r\n if (pos != null) {\r\n pos.setPlayer(E);\r\n }\r\n });\r\n }", "public Player getPlayerFromList(String name){\n for (BrPlayer p : playerList){\n if (p.getBukkitPlayer().getDisplayName().equalsIgnoreCase(name)){\n return p.getBukkitPlayer();\n }\n }\n return null;\n }", "List<Player> getPlayers();", "List<Player> listPlayers();", "static List<Player> getAllPlayers() {\n\t\treturn null;\r\n\t}", "public OfflinePlayer getPlayerByName(String name) {\n\t\ttry {\n\t\t\treturn mStore.getPlayerByName(name);\n\t\t} catch (UserNotFoundException e) {\n\t\t\treturn null;\n\t\t} catch (DataStoreException e) {\n\t\t\te.printStackTrace();\n\t\t\treturn null;\n\t\t}\n\t}", "public Player getPlayerByName(String name){\n for (Player player : players){\n if (name.equals(player.getName())){\n return player;\n }\n }\n return null;\n }", "ArrayList<Player> getAllPlayer();", "void updateOnlinePlayers(String skipone) { \r\n DynmapPlayer[] players = server.getOnlinePlayers();\r\n DynmapPlayer[] pl = new DynmapPlayer[players.length];\r\n System.arraycopy(players, 0, pl, 0, pl.length);\r\n if(skipone != null) {\r\n for(int i = 0; i < pl.length; i++)\r\n if(pl[i].getName().equals(skipone))\r\n pl[i] = null;\r\n }\r\n online = pl;\r\n }", "public User getPlayer(String name) {\n\t\tUser ret = null;\n\t\tList<User> searchResult = this.players.stream().filter(x->x.name.equals(name)).collect(Collectors.toList());\n\t\tif (!searchResult.isEmpty()) {\n\t\t\tret = searchResult.get(0);\n\t\t}\n\t\treturn ret;\n\t}", "public boolean live(String nom){\n\treturn players.get(nom);\n }", "public List<String> getAllPlayers() throws ServerProblem {\r\n\ttry (Connection connTDB = ConnectionManager.getInstance().getConnection()) {\r\n\t LOGGER.debug(\"Getting all players\");\r\n\t List<String> results = engine.getAllPlayers(connTDB);\r\n\t LOGGER.debug(\"Players found in the database: \" + results);\r\n\t return results;\r\n\t} catch (Exception ex) {\r\n\t String error = \"Problem encountered getting all players: \" + ex;\r\n\t LOGGER.error(error);\r\n\t throw new ServerProblem(error, ex);\r\n\t}\r\n }", "void showWaitingPlayerList(List<String> waitingPlayerUsernames);", "public boolean isOnline()\n\t{\n\t\treturn PlayerManager.getPlayer(name)!=null;\n\t}", "public boolean allPlayersReady() {\n // Si un jugador esta offline, lo ignora\n for (Player p : players) {\n if (p.isOnline() && !p.isReady())\n return false;\n }\n return true;\n }", "public static Collection<? extends Player> getOnlinePlayers() {\n return Bukkit.getServer().getOnlinePlayers();\n }", "public void getPlayerList() {\n if (connected == true) {\n try {\n write(\"get playerlist\");\n } catch (IOException e) {\n System.out.println(\"No connecting with server:ServerCommunication:getPlayerList()\");\n }\n }\n }", "public void loadList(String name){\n }", "public List<Player> loadAll() throws SQLException {\n\t\tfinal Connection connection = _database.getConnection();\n\t\tfinal String sql = \"SELECT * FROM \" + table_name + \" ORDER BY id ASC \";\n\t\tfinal List<Player> searchResults = listQuery(connection.prepareStatement(sql));\n\n\t\treturn searchResults;\n\t}", "List<Player> findAllPlayers();", "private List<String> receiveConnectedPlayers(@NotNull String data) {\n ConnectedPlayersDto result = GameGraphics.gson.fromJson(data, ConnectedPlayersDto.class);\n if (result.players != null) {\n players = result.players.stream()\n .filter(Objects::nonNull)\n .map(player -> player.name)\n .collect(Collectors.toList());\n return players;\n }\n return null;\n }", "public static List<String> getOnlinePlayerNames() {\n Iterable<User> onlineUsers = SlapPlugin.getInstance().getEssentials().getOnlineUsers();\n return StreamSupport.stream(onlineUsers.spliterator(), false)\n .map(user -> StringUtils.isEmpty(user.getNickname()) ? user.getName() : user.getNickname())\n .collect(Collectors.toList());\n }", "public boolean hasOnlinePlayers() {\n for (Player p : players) {\n if (p.isOnline())\n return true;\n }\n return false;\n }", "public List<Player> findAllPlayers(){\n\t\treturn playerRepository.findAll();\n\t}", "public List<LobbyPlayer> getPlayers(String code) throws NoDocumentException {\n return Firebase.requestDocument(\"lobbies/\" + code).toObject(LobbyDTO.class).toModel().getPlayers();\n }", "public Player getPlayerinTable(String name) {\r\n for (Player player : this.players) {\r\n if (player.getName().equals(name)) {\r\n return player;\r\n }\r\n }\r\n return null;\r\n }", "public static void updatePlayerCaches() {\n\t\tfor (Player player : getOnlinePlayers()) {\n\t\t\tPlayerCache cache = getCache(player);\n\n\t\t\tcache.reloadCache();\n\t\t}\n\t}", "public Player getPlayer(String userName,ArrayList<Player> list) {\r\n\t\tIterator<Player> aa = list.iterator();\r\n\t\twhile (aa.hasNext()) {\r\n\t\t\tPlayer in = aa.next();\r\n\t\t\tif(in.getUserName().equals(userName)){\r\n\t\t\t\tif(in.getID().equals(\"AI\"))\r\n\t\t\t\t\treturn (NimAIPlayer)in;\r\n\t\t\t\telse\r\n\t\t\t\t\treturn (NimPlayer)in;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\treturn null;\r\n\t\t}", "public void moveOnlinePlayer(String name, double x, double y) {\n Player player = (Player) players.get(name);\r\n if (player != null) {\r\n// System.out.println(\"Move online player \" + name + \" to \" + x + \" and \" + y);\r\n if (!inPlayer.getName().equals(name)) {\r\n player.move(x, y);\r\n }\r\n }\r\n }", "public ListResponse<PlayerResponse> getPlayers() {\n\t\tcheckProvided();\n\t\treturn players;\n\t}", "void refreshPlayerList(Map<String, IPlayerConfig> playerList) throws RpcException;", "public List<Player> list() throws Exception {\r\n this.players = new ArrayList<>();\r\n File folder = new File(filepath);\r\n File[] files = folder.listFiles();\r\n for (int i = 0 ; i<files.length ; i++){\r\n if (files[i].isFile()){\r\n players.add(i,get(filepath+\"\\\\\"+files[i].getName()));\r\n }\r\n }\r\n return players;\r\n }", "public abstract ArrayList<String> getPlayer(int gameId) throws SQLException;", "public static EntityPlayer getPlayer(String name) {\r\n\t\tfor (EntityPlayer player : getAll()) {\r\n\t\t\tif (player.getName().equals(name)) {\r\n\t\t\t\treturn player;\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn null;\r\n\t}", "public void loadCurrentPlayer() {\n\t\tScanner sc;\n\t\tFile file = new File(\"data/current_player\");\n\t\tif(file.exists()) {\n\t\t\ttry {\n\t\t\t\tsc = new Scanner(new File(\"data/current_player\"));\n\t\t\t\tif(sc.hasNextLine()) {\n\t\t\t\t\tString player = sc.nextLine();\n\t\t\t\t\t_currentPlayer= player;\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\t_currentPlayer = null;\n\t\t\t\t}\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tBashCmdUtil.bashCmdNoOutput(\"touch data/current_player\");\n\t\t\t_currentPlayer = null;\n\t\t}\n\t}", "@Override\r\n\tpublic List<Player> getAllPlayer(String email) {\n\t\treturn dao.getAllPlayer(email);\r\n\t}", "private void loadPlayersIntoQueueOfTurns() {\n if(roundNumber == 1) eventListener.addEventObject(new RoundEvent(EventNamesConstants.GameStarted));\n if(gameDescriptor.getPlayersList() != null) {\n playersTurns.addAll(gameDescriptor.getPlayersList());\n }\n else\n System.out.println(\"NULL\");\n }", "private void getPlayers() {\r\n\t\tSystem.out.println(\"How Many Players: \");\r\n\t\tpnum = getNumber(1, 3);\r\n\r\n\t\tfor(int i=0; i < pnum; i++){\r\n\t\t\tSystem.out.println(\"What is player \" + (i + 1) + \"'s name? \");\r\n\t\t\tString name = sc.next();\r\n\t\t\tboolean dupe = true;\r\n\t\t\twhile(dupe){\r\n\t\t\t\tint samecounter = 0;\r\n\t\t\t\tfor(Player p : players){\r\n\t\t\t\t\tif(name.equals(p.getName())){\r\n\t\t\t\t\t\tsamecounter += 1;\r\n\t\t\t\t\t\tSystem.out.println(\"Name is the same as another players. Please choose another name: \");\r\n\t\t\t\t\t\tname = sc.next();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tif(samecounter == 0){\r\n\t\t\t\t\tdupe = false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tplayers.add(new Player(name));\r\n\r\n\t\t}\r\n\t}", "public ArrayList<Player> importPlayerData() {\n \n try {\n //Try to access player.csv in the given directory\n\t\t\tFile file = new File(\"data\\\\player.csv\");\n Scanner fileIn = new Scanner(file);\n \n fileIn.skip(\"userName,fullName,password,gold,exp,noOfLand\");\n \n\t\t\t//Use comma as delimiter in extracting various player info\n\t\t\tfileIn.useDelimiter(\",|\\r\\n|\\n\");\n \n while (fileIn.hasNext()) {\n String userName = fileIn.next().trim();\n String fullName = fileIn.next().trim();\n String password = fileIn.next().trim();\n int gold = fileIn.nextInt();\n int exp = fileIn.nextInt();\n\t\t\t\tint noOfLand = fileIn.nextInt();\n\t\t\t\t\n\t\t\t\t//Create new players based on extracted info\n Player player = new Player(userName, fullName, password, gold, exp, noOfLand);\n\t\t\t\t\n\t\t\t\t//Add players to playerList\n playerList.add(player);\n }\n \n }\n \n catch (IOException e) {\n //Specify the location of IOException\n\t\t\te.printStackTrace();\n }\n\t\t\n\t\treturn playerList;\n\t}", "private Set<SteamUserNode> bindGames(Set<SteamUserNode> players) {\n\t\tString dest = \"http://api.steampowered.com/IPlayerService/GetOwnedGames/v0001/?\" +\r\n\t\t\t\t\"key=%s&steamid=%d&include_appinfo=1&include_played_free_games=1&format=json\";\r\n\t\tString response = \"\";\r\n\t\tfor (SteamUserNode p : players) {\r\n\t\t\ttry {\r\n\t\t\t\tthis.apiCalls += 1;\r\n\t\t\t\tString query = String.format(dest, key, p.getId());\r\n\t\t\t\tURL url = new URL(query);\r\n\t\t\t\tHttpURLConnection con = (HttpURLConnection) url.openConnection();\r\n\t\t\t\tcon.setRequestMethod(\"GET\");\r\n\t\t\t\tcon.setConnectTimeout(3000);\r\n\t\t\t\tcon.connect();\r\n\t\t\t\tint respCode = con.getResponseCode();\r\n\t\t\t\tif (respCode != 200)\r\n\t\t\t\t\tSystem.out.println(\"Status code: \" + respCode + \"\\nFor request: \" + query);\r\n\t\t\t\telse {\r\n\t\t\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream()));\r\n\t\t\t\t\tresponse = reader.lines().collect(Collectors.joining());\r\n\t\t\t\t\tint numGames = new JSONObject(response).getJSONObject(\"response\").getInt(\"game_count\");\r\n\t\t\t\t\tif (numGames > 0) {\r\n\t\t\t\t\t\tJSONArray ownedGames = new JSONObject(response).getJSONObject(\"response\").getJSONArray(\"games\");\r\n\t\t\t\t\t\tfor (int i=0;i<ownedGames.length();++i) {\r\n\t\t\t\t\t\t\tJSONObject g = ownedGames.getJSONObject(i);\r\n\t\t\t\t\t\t\tlong appId = g.getLong(\"appid\");\r\n\t\t\t\t\t\t\tString name = g.getString(\"name\");\r\n\t\t\t\t\t\t\tString logoHash = g.getString(\"img_logo_url\");\r\n\t\t\t\t\t\t\tint playForever = g.getInt(\"playtime_forever\");\r\n\t\t\t\t\t\t\tint play2Wks = g.has(\"playtime_2weeks\") ? g.getInt(\"playtime_2weeks\") : 0;\r\n\t\t\t\t\t\t\tPlayedGame game = new PlayedGame(appId, name, logoHash, play2Wks, playForever);\r\n\t\t\t\t\t\t\tp.addPlayedGame(game);\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\tif (!knownGames.contains(game)) {\r\n\t\t\t\t\t\t\t\tknownGames.add((SteamGame) game);\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif (localWrite) {\r\n\t\t\t\t\t\t\tjsonWriter.writeOwnedGames(response, p);\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} catch (JSONException jse) {\r\n\t\t\t\tSystem.err.println(jse.getMessage());\r\n\t\t\t\tSystem.out.println(response);\r\n\t\t\t} catch (MalformedURLException mue) {\r\n\t\t\t\t//once again, this better not happen...\r\n\t\t\t\tSystem.err.println(mue.getMessage());\r\n\t\t\t} catch (IOException ioe) {\r\n\t\t\t\tSystem.err.println(ioe.getMessage());\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\treturn players;\r\n\t}", "public List<Player> getAll() {\n PlayerDB pdb = new PlayerDB();\n return pdb.getAll();\n }", "@Override\n public ArrayList<Player> getPlayers() {return steadyPlayers;}", "public void getRecentNames() {\r\n try {\r\n URLConnection conn = new URL(\"http://example.com/recent?ssid=\" + session_slot_id).openConnection();\r\n conn.setConnectTimeout(5000);\r\n conn.setReadTimeout(5000);\r\n BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));\r\n String line;\r\n while ((line = in.readLine()) != null) {\r\n if (line.contains(\",\")) {\r\n names = line.split(\",\");\r\n }\r\n }\r\n in.close();\r\n } catch (MalformedURLException e) {\r\n System.out.println(\"MalformedURLException while fetching list\");\r\n } catch (SocketTimeoutException e) {\r\n System.out.println(\"SocketTimeoutException while fetching list\");\r\n } catch (IOException e) {\r\n System.out.println(\"IOException while fetching list\");\r\n e.printStackTrace();\r\n }\r\n }", "ArrayList<IPlayer> buildPlayerList();", "public List<PlayerItem> getAll();", "@Override\n public List<Player> getPlayers() {\n return new ArrayList<Player>(players);\n }", "protected ClientList getCurrentPlayers() {\r\n\t\treturn this.players;\r\n\t}", "@Override\n public List<Player> getPlayers() {\n return players;\n }", "public static ArrayList<Player> readPlayersFromFile() \r\n {\r\n //Inisialize Arraylist \r\n ArrayList<Player> players = new ArrayList<Player>();\r\n //Inisialize FileInputStream\r\n FileInputStream fileIn = null;\r\n\r\n try \r\n {\r\n //Establish connection to file \r\n fileIn = new FileInputStream(\"players.txt\");\r\n while (true) \r\n {\r\n //Create an ObjectOutputStream \r\n ObjectInputStream objectIn = new ObjectInputStream(fileIn);\r\n //Read a Player object from the file and add it to the ArrayList\r\n players.add((Player)objectIn.readObject());\r\n }//end while\r\n\r\n }\r\n catch (Exception e)\r\n {\r\n //System.out.println(e);\r\n }\r\n finally \r\n {\r\n usernamesTaken.clear();\r\n\r\n for(int i = 0; i < players.size(); i++)\r\n {\r\n usernamesTaken.add(players.get(i).getUsername());\r\n }//end for\r\n\r\n //Try to close the file and return the ArrayList\r\n try\r\n {\r\n //Check if the end of the file is reached\r\n if (fileIn != null)\r\n { \r\n //Close the file \r\n fileIn.close();\r\n //Return the ArrayList of players\r\n return players;\r\n }\r\n }\r\n catch (Exception e)\r\n {\r\n //System.out.println(e)\r\n }//end try \r\n\r\n //Return null if there is an excetion \r\n return null;\r\n }//end try \r\n }", "public void retrieveAllPlayersFromDatabase(String dbMemberName) {\n DatabaseReference dbReference = FirebaseDatabase.getInstance().getReference().child(dbMemberName);\n Log.d(\">>>>>\", \"Starting method\");\n isPlayersRetrieved = false;\n\n dbReference.addValueEventListener(new ValueEventListener() {\n @Override\n public void onDataChange(@NonNull DataSnapshot snapshot) {\n Log.d(\">>>>>\", \"On 1 st method\");\n playersList.clear();\n for (DataSnapshot postSnapshot : snapshot.getChildren()) {\n Log.d(\">>>>>\", \"On 2 nd method\");\n player = postSnapshot.getValue(Player.class);\n playersList.add(player);\n\n // here you can access to name property like university.name\n System.out.println(\">>>>> Retrieving player -> \" + player);\n\n if (!isPlayersRetrieved) {\n isPlayersRetrieved = true;\n }\n }\n }\n\n @Override\n public void onCancelled(@NonNull DatabaseError databaseError) {\n System.out.println(\"The read failed: \" + databaseError.getMessage());\n }\n });\n }", "public List<PlayerItem> getAllPlayerItemById(Player player);", "@Override\r\n\tpublic ArrayList<PlayerPO> getAllPlayers() {\n\t\treturn playerController.getAllPlayers();\r\n\t}", "private boolean isPlayerNameFreeToUse(String clientName){\n\t\tfor (Player p : getPlayerMap().values()) {\n\t\t\tif(p.getName().equals(clientName)){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}", "public boolean loadPlayer(P player){\n\n //Is the player already loaded?\n if(playerMap.containsKey(player)){\n System.out.println(\"Tried to load player \" + player.getName() + \"'s data, even though it's already loaded!\");\n return false;\n } else {\n\n if(data.getConfig().contains(player.getUniqueId().toString())){\n //Load player\n PlayerProfile playerProfile = new PlayerProfile(false, data, player);\n playerMap.put(player, playerProfile);\n\n return true;\n } else {\n //Create player profile\n PlayerProfile playerProfile = new PlayerProfile(true, data, player);\n playerMap.put(player, playerProfile);\n\n return true;\n }\n }\n }", "public static void addUserOnline(String name)\n {\n onList.add(name);\n }", "@RequestMapping(\"/players\")\n public List<Player> getAllPlayers() {\n return playerService.getPlayerList();\n }", "public int loadedPlayers(){\n return playerMap.size();\n }", "public List<String> listPlayerNames() {\n return this.playersNames;\n }", "private void doPlayersOnline(boolean playersOnline) {\n if (playersOnline) {\n // Set the last time players were online to current time, or in future if the number is larger\n setLastTimePlayersOnline(Math.max(System.currentTimeMillis(), getLastTimePlayersOnline()));\n\n // Server isn't frozen, set to false\n setPreviousCheckFailed(false);\n } else if (getLastTimePlayersOnline() + TimeUnit.MINUTES.toMillis(getSettings().getMinutesNoPlayers()) <\n System.currentTimeMillis()) {\n // If the last time players were online is 2 minutes in the past\n\n // If it can dump threads\n if (isTimeToDumpAgain()) {\n // Dump threads\n System.out.println(\n String.format(\"[ThreadDump] Server has been empty of players for %s minutes, dumping threads!\",\n getSettings().getMinutesNoPlayers()));\n dumpThreadsToFile();\n }\n }\n }", "public void loadPlayers(String filename) throws IOException {\r\n //TODO:4\r\n // 1. use try-with-resources syntax to ensure the file is closed\r\n // 2. read the number of players, then read an empty line\r\n // 3. for each player:\r\n // 3.1 read playerName, gold, sciencePoint, productionPoint, numCities and numMinisters separated by blank characters.\r\n // 3.2 create a player of corresponding values\r\n // 3.3 for (int i=1; i<numCities; i++):\r\n // read population, troops, cropYields\r\n // create a corresponding city object and add to the player's city list\r\n // 3.4 for (int i=1; i<numMinisters; i++):\r\n // read type, intelligence, experience, leadership\r\n // use switch-case to create a corresponding minister object and add to the player's minister list\r\n // check for invalid formats and throw custom exceptions.\r\n // (When there is any invalid minister type, throw InvalidMinisterTypeException.\r\n // Only \"WarGeneral\", \"Scientist\" and \"Economist\" are allowed.)\r\n // 3.5 add the player to the ArrayList<Player> players\r\n // Hint: use add() method of ArrayList.\r\n players = new ArrayList<>();\r\n File inputFile = new File(filename);\r\n try(\r\n Scanner reader = new Scanner(inputFile);\r\n ) {\r\n int numOfPlayers = reader.nextInt();\r\n String line = \"\";\r\n for (int i = 0; i < numOfPlayers; i++) {\r\n String name = reader.next();\r\n int gold = reader.nextInt();\r\n int sciencePoint = reader.nextInt();\r\n int productionPoint = reader.nextInt();\r\n Player newPlayer = new Player(name, gold, sciencePoint, productionPoint);\r\n this.players.add(newPlayer);\r\n\r\n int numOfCity = reader.nextInt();\r\n int numOfMin = reader.nextInt();\r\n\r\n for (int j = 0; j < numOfCity; j++) {\r\n int cityID = reader.nextInt();\r\n String cName = reader.next();\r\n int pop = reader.nextInt();\r\n int troops = reader.nextInt();\r\n int cropYields= reader.nextInt();\r\n\r\n City temp = new City(cityID, cName, pop, troops, cropYields);\r\n this.players.get(i).getCities().add(temp);\r\n }\r\n\r\n for (int j = 0; j < numOfMin; j++) {\r\n String mName = reader.next();\r\n int intel = reader.nextInt();\r\n int exp = reader.nextInt();\r\n int lead = reader.nextInt();\r\n\r\n if (mName.equals(\"Scientist\")) {\r\n Scientist temp = new Scientist(intel, exp, lead);\r\n this.players.get(i).getMinisters().add(temp);\r\n }\r\n else if (mName.equals(\"Economist\")) {\r\n Economist temp = new Economist(intel, exp, lead);\r\n this.players.get(i).getMinisters().add(temp);\r\n }\r\n else if (mName.equals(\"WarGeneral\")) {\r\n WarGeneral temp = new WarGeneral(intel, exp, lead);\r\n this.players.get(i).getMinisters().add(temp);\r\n }\r\n else {\r\n throw new InvalidMinisterTypeException(\"Only \\\"WarGeneral\\\", \\\"Scientist\\\" and \\\"Economist\\\" are allowed\");\r\n }\r\n }\r\n }\r\n }\r\n }", "public List<Player> getPlayerList(){\n return this.players;\n }", "public boolean allPlayersReady() {\r\n for (Player player : players) {\r\n if (!player.isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }", "public static boolean isOnlineAnywhere(String playerName)\n {\n if (haveBridge)\n {\n return bridge.isOnlineServerPlusClients(playerName);\n }\n else\n {\n return server.getOfflinePlayer(playerName).isOnline();\n }\n }", "public List<Player> getPlayers() {\r\n return players;\r\n }", "public List<Player> getPlayers() {\r\n return players;\r\n }", "Set<String> getPlayers();", "private void loadUserList()\n\t{\n\t\tfinal ProgressDialog dia = ProgressDialog.show(this, null,\n\t\t\t\tgetString(R.string.alert_loading));\n\t\tParseUser.getQuery().whereNotEqualTo(\"username\", user.getUsername())\n\t\t\t\t.findInBackground(new FindCallback<ParseUser>() {\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void done(List<ParseUser> li, ParseException e) {\n\t\t\t\t\t\tdia.dismiss();\n\t\t\t\t\t\tif (li != null) {\n\t\t\t\t\t\t\tif (li.size() == 0)\n\t\t\t\t\t\t\t\tToast.makeText(UserList.this,\n\t\t\t\t\t\t\t\t\t\tR.string.msg_no_user_found,\n\t\t\t\t\t\t\t\t\t\tToast.LENGTH_SHORT).show();\n\n\t\t\t\t\t\t\tuList = new ArrayList<ParseUser>(li);\n\t\t\t\t\t\t\tListView list = (ListView) findViewById(R.id.list);\n\t\t\t\t\t\t\tlist.setAdapter(new UserAdapter());\n\t\t\t\t\t\t\tlist.setOnItemClickListener(new OnItemClickListener() {\n\n\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\tpublic void onItemClick(AdapterView<?> arg0,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tView arg1, int pos, long arg3) {\n\t\t\t\t\t\t\t\t\tstartActivity(new Intent(UserList.this,\n\t\t\t\t\t\t\t\t\t\t\tChat.class).putExtra(\n\t\t\t\t\t\t\t\t\t\t\tConst.EXTRA_DATA, uList.get(pos)\n\t\t\t\t\t\t\t\t\t\t\t\t\t.getUsername()));\n\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\tUtils.showDialog(\n\t\t\t\t\t\t\t\t\tUserList.this,\n\t\t\t\t\t\t\t\t\tgetString(R.string.err_users) + \" \"\n\t\t\t\t\t\t\t\t\t\t\t+ e.getMessage());\n\t\t\t\t\t\t\te.printStackTrace();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\t}", "public void load()\n\t{\n\t\tfor(String s : playerData.getConfig().getKeys(false))\n\t\t{\n\t\t\tPlayerData pd = new PlayerData(playerData, s);\n\t\t\tpd.load();\n\t\t\tdataMap.put(s, pd);\n\t\t}\n\t}", "public List <FootballPlayer> getAllPlayersByTeamName(String name) {\n\t\treturn market.getAllPlayersByTeamName(name);\n\t}", "public static ArrayList<Player> getWinners(){return winners;}", "public static Map<String, PlayerConfig> getPlayers() {\n return players;\n }", "public static List<Player> getTrackablePlayers() {\n\t\tPlayer[] players = Bukkit.getOnlinePlayers();\n\t\tList<Player> players1 = new ArrayList<Player>();\n\t\tfor (int i = 0; i < players.length; i++) {\n\t\t\tif (!players[i].hasMetadata(\"invisible\")) {\n\t\t\t\tplayers1.add(players[i]);\n\t\t\t}\n\n\t\t}\n\t\treturn players1;\n\t}", "public List<Player> getPlayerList()\n\t{\n\t\treturn playerList;\n\t}", "public List<SkungeePlayer> getPlayers(String... usernames) throws TimeoutException, InterruptedException, ExecutionException {\n\t\tPlayersPacket packet = new PlayersPacket();\n\t\tpacket.setNames(usernames);\n\t\treturn japson.sendPacket(packet);\n\t}", "public Player getPlayer(String name){ \n\t\tif (players.containsKey(name)) return players.get(name);\n\t\tPlayer player = getModPlayer(name);\n\t\tif (player != null) {\n\t\t\tplayers.put(name, player);\n\t\t\treturn player;\n\t\t}\n\t\treturn player;\n\t}", "public ArrayList<Player> searchPlayer(String search){\r\n\t\tint rowId = 1;\r\n\t\tCursor cursor;\r\n\t\tcursor = this.getPlayer(rowId);\r\n\t\tArrayList<Player> playerList = new ArrayList<Player>();\r\n\t\twhile(cursor.getCount() != 0){\r\n\t\t\tif (cursor.getString(1).startsWith(search)) {\r\n\t\t\t\tPlayer p = new Player(cursor.getString(1),cursor.getString(2),cursor.getString(3),\r\n\t\t\t\t\t\tcursor.getString(4),cursor.getString(5),cursor.getInt(6),\r\n\t\t\t\t\t\tcursor.getString(7),cursor.getString(8),cursor.getString(9),\r\n\t\t\t\t\t\tcursor.getString(10));\r\n\t\t\t\tplayerList.add(p);\r\n\t\t\t}\r\n\t\t\trowId = rowId + 1;\r\n\t\t\tcursor = this.getPlayer(rowId); \t\r\n\t\t}\r\n\t\tcursor.close();\r\n\r\n\t\treturn playerList;\r\n\t}", "@Override\n\tpublic void loadPlayer() {\n\t\t\n\t}", "public boolean hasPlayLoad(Player player) {\n for (PayLoad payLoad : payLoadList) {\n if(payLoad.getPlayer().equals(player)){\n return true;\n }\n }\n return false;\n }", "public List<Player> getAllPlayers() {\r\n // TODO fix actual order of players in the List.\r\n\r\n List<Player> players = new ArrayList<>();\r\n players.addAll(teamRed.getPlayers());\r\n players.addAll(teamBlue.getPlayers());\r\n\r\n return players;\r\n }", "private void updatePlayerList() \n\t{\n\t\tplayerStatus.clear();\n\n\t\tfor(Player thisPlayer: players) // Add the status of each player to the default list model.\n\t\t{\n\t\t\tplayerStatus.addElement(thisPlayer.toString());\n\t\t}\n\n\t}", "public Optional<List<Pokemon>> findByName(String name);", "private int getOnlinePlayers()\n {\n return (int) Bukkit.getOnlinePlayers().stream().filter( p -> p != null && p.isOnline() ).count();\n }", "public List<String> getAllPlayerNames() {\n List<String> playerNames = new ArrayList<>(10);\n for (Player p : players) {\n playerNames.add(p.getName());\n }\n return playerNames;\n }", "@Override\n\tpublic List<Player> getPlayer() {\n\t\treturn ofy().load().type(Player.class).list();\n\t}", "public Player findPlayer(String p_PlayerName) {\n for (Player l_Player : d_PlayerList) {\n if (l_Player.getD_Name().equals(p_PlayerName))\n return l_Player;\n }\n if (d_NeutralPlayer.getD_Name().equals(p_PlayerName))\n return d_NeutralPlayer;\n return null;\n }", "private void loadClubList() {\n SharedPreferences sharedPreferences = getSharedPreferences(\"Shared Preferences\", MODE_PRIVATE);\n Gson gson = new Gson();\n String json = sharedPreferences.getString(\"Club List\", null);\n Type type = new TypeToken<ArrayList<Club>>() {}.getType();\n clubList = gson.fromJson(json, type);\n\n if(clubList == null) {\n clubList = new ArrayList<>();\n }\n }", "@Override\n public ArrayList<Player> getPlayers() throws RemoteException {\n return players;\n }", "public void initializePlayers(){\r\n allPlayers = new ArrayList<Player>();\r\n currentPlayerIndex = 0;\r\n Player redPlayer = new Player(1, new Location(2, 2), Color.RED);\r\n Player bluePlayer = new Player(2, new Location(4, 2), Color.BLUE);\r\n Player whitePlayer = new Player(3, new Location(2, 4), Color.WHITE);\r\n Player yellowPlayer = new Player(4, new Location(4, 4), Color.YELLOW);\r\n allPlayers.add(redPlayer);\r\n allPlayers.add(bluePlayer);\r\n allPlayers.add(whitePlayer);\r\n allPlayers.add(yellowPlayer);\r\n }", "public void setPlayers(ArrayList<Player> players) {\n this.players = players;\n }", "public static ArrayList<Player> getAccountOnlineUsers(String accountno) {\n\t\tArrayList<String> allUsers = getAccountUsers(accountno);\n\t\tArrayList<Player> onlineUsers = new ArrayList<Player>();\n\t\tif (!allUsers.isEmpty()) {\n\t\t\tfor (int i=0; i < allUsers.size(); i++) {\n\t\t\t\tPlayer player = GPP.server.getPlayerExact(allUsers.get(i));\n\t\t\t\tif (player!=null) onlineUsers.add(player);\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn onlineUsers;\n\t}", "@Override\n public void onDataAvailable(Object data) {\n try {\n\n Utility.gameName = Utility.game.getGameName();\n Log.e(\"show leader board\",\"game name ---> \" + Utility.game.getGameName());\n final List<Player> playersList = new ArrayList<Player>();\n\n\n JSONObject playersObject = new JSONObject(data.toString());\n JSONArray playersArray = playersObject.getJSONArray(\"players\");\n\n SharedPreferences useridpref = getSharedPreferences(\"userid\", MODE_PRIVATE);\n Integer userId = Integer.parseInt(useridpref.getString(\"userid\", \"0\"));\n\n for (int i = 0; i < playersArray.length(); i++) {\n Player player = new Player();\n player.jsonParser((JSONObject) playersArray.get(i));\n\n playersList.add(player);\n\n\n if (userId == (player.getUserId())) {\n\n setGamePoints(player.getGamepoints() + \"\");\n setUserNoOfPlays(player.getNoOfPlays() + \"\");\n //updating user lastgame details\n userObject.setLastGameCreator(Creator.getUserName());\n userObject.setUserRank(player.getWorldRank() + \"\");\n userObject.setLastGameName(Utility.game.getGameName());\n userObject.setLastGamePoints(player.getTotalPoints() + \"\");\n userObject.setLastGamePlays((Utility.game.getLength()) + \"\");\n\n Log.e(\"user game length\",userObject.getLastGamePlays()+\"\");\n Log.e(\"user plays left\",userObject.getTotalNoOfPlays()+\"\");\n Log.e(\"user plays game name\",userObject.getLastGameName()+\"\");\n\n\n// updating current player info\n currentGamePoints = player.getPointsRank();\n\n }\n }\n\n final List<Player> playersListtemp = playersList;\n // playersList;\n runOnUiThread(new Runnable() {\n @Override\n public void run() {\n\n //stuff that updates leaderboard\n PlayByPlay playByPlay = new PlayByPlay();\n gameleaderboardList.setAdapter(new GameScreenLeaderBoardList(GameScreenActivity.this, playersListtemp));\n gameleaderboardList.setDividerHeight(1);\n currentPlayerName.setText(Utility.user.getUserName());\n currentPlayerPoints.setText(getGamePoints());\n playerListSize.setText(\"(\" + playersList.size() + \")\");\n gsUserRank.setText(\"#\" + userObject.getUserRank());\n\n noOfPlaysInHeader.setText(getUserNoOfPlays() + \"\");\n noOfPlaysInAddPlays.setText(\"Balance: \" + getUserNoOfPlays() + \" plays\");\n\n }\n });\n\n\n\n\n } catch (Exception e) {\n // TODO Auto-generated catch block\n // Toast.makeText(getApplicationContext(),\"error data \" + data.toString(),Toast.LENGTH_LONG).show();\n\n\n e.printStackTrace();\n }\n\n }", "List<String> loadAllUserNames();", "public static GamePlayer getGamePlayer(String name) {\r\n\t\tfor (GamePlayer p : Game.players) {\r\n\t\t\tif (p.getPlayer().getName().equals(name)) {\r\n\t\t\t\treturn (p);\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn (null);\r\n\t}", "public List<ServerPlayerEntity> getPlayerList() {\n return this.players;\n }", "public Player getPlayer(String username){\n return this.players.get(username);\n }", "public List<Player> getAvailablePlayers(Round round) {\r\n\t\tList<Player> availablePlayers = playerLogic.createNew(round.getPlayers());\r\n\r\n\t\tfor (Match match : round.getMatches()) {\r\n\t\t\tavailablePlayers.removeAll(match.getHomeTeam());\r\n\t\t\tavailablePlayers.removeAll(match.getAwayTeam());\r\n\t\t}\r\n\t\treturn availablePlayers;\r\n\t}" ]
[ "0.6836304", "0.6726171", "0.65788114", "0.6567154", "0.65386343", "0.6480472", "0.6405696", "0.6332147", "0.6311117", "0.6234833", "0.6185296", "0.6183707", "0.611811", "0.6024173", "0.602168", "0.59861827", "0.5984602", "0.5956229", "0.5955702", "0.59494686", "0.5947753", "0.593976", "0.5939189", "0.5926856", "0.592325", "0.5888528", "0.5880332", "0.586212", "0.5842224", "0.5809469", "0.5798846", "0.57964975", "0.57851094", "0.5743402", "0.57217604", "0.57155526", "0.56721234", "0.5647301", "0.56332725", "0.56276995", "0.5619726", "0.5616387", "0.5600235", "0.5597097", "0.5593156", "0.55665183", "0.5556524", "0.555594", "0.5548143", "0.55459064", "0.55372846", "0.55323863", "0.5525253", "0.5520571", "0.55087614", "0.5508541", "0.5505047", "0.5486161", "0.54796726", "0.5478696", "0.54727125", "0.54702085", "0.5448216", "0.5433589", "0.54259545", "0.5417245", "0.5414609", "0.5412344", "0.5412344", "0.54087496", "0.5405802", "0.54040736", "0.5399403", "0.5392011", "0.5390967", "0.5389287", "0.5374081", "0.5372874", "0.5369532", "0.5365386", "0.53628844", "0.53476685", "0.5341247", "0.53369725", "0.5335346", "0.5332755", "0.53309697", "0.5328647", "0.5324531", "0.5323932", "0.5323009", "0.5319355", "0.53142196", "0.530817", "0.5306533", "0.5306425", "0.5303638", "0.53029627", "0.5302481", "0.5301081" ]
0.5478815
59
/ /Consistency checking methods /
@Override public boolean isConsistent(List<TraceLockEntry> seq) { for (TraceLockEntry te : seq) { TraceLockLocation tll = te.getLocation(); switch (te.getEntryType()) { case PREJOIN : location_set.add(tll); break; case NOJOIN : location_set.add(tll); break; case JOIN : location_set.add(tll); have_join = true; break; default : break; } } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n\tvoid checkConsistency()\n\t{\n\t\t\n\t}", "ConsistencyLevel consistency();", "public void checkConsistency(List inconsistencies);", "boolean consistencyCheck(){\n\n String jbbInstdir = (String)typeToDir.get(\"jbbinst\");\n String simInstdir = (String)typeToDir.get(\"siminst\");\n String jbbColldir = (String)typeToDir.get(\"jbbcoll\");\n String simColldir = (String)typeToDir.get(\"simcoll\");\n if(simInstdir != null){\n simInstdir += \"/p01\";\n }\n if(simColldir != null){\n simColldir += \"/p01\";\n }\n return readAndCompare(jbbInstdir,simInstdir,jbbColldir,simColldir);\n }", "public CheckConsistencyTResponse checkConsistency(String path, CheckConsistencyTOptions options) throws alluxio.thrift.AlluxioTException, org.apache.thrift.TException;", "@Override\n\tpublic void check() {\n\t\t\n\t}", "@Override\n\tpublic void check() {\n\t\t\n\t}", "public void check() {\r\n logger.info(\"ADIT monitor - Checking database and application.\");\r\n\r\n checkApplication();\r\n\r\n checkDBConnection();\r\n checkDBRead(this.getMonitorConfiguration().getTestDocumentId());\r\n }", "@Override\n\tpublic void check() throws Exception {\n\t}", "@Override\n protected Result check() throws Exception {\n\n try {\n mongoClient.getDB(\"system\").getStats();\n }catch(MongoClientException ex) {\n return Result.unhealthy(ex.getMessage());\n }\n\n\n return Result.healthy();\n }", "@Test\n public void fsckMetricsInconsistentFwdAndInconsistentRev() throws Exception {\n storage.addColumn(UID_TABLE, new byte[] {0, 0, 2}, NAME_FAMILY, \n METRICS, \"wtf\".getBytes(MockBase.ASCII()));\n storage.addColumn(UID_TABLE, \"wtf\".getBytes(MockBase.ASCII()), ID_FAMILY, \n METRICS, new byte[] {0, 0, 1});\n storage.addColumn(UID_TABLE, new byte[] {0, 0, 3}, NAME_FAMILY, \n METRICS, \"foo\".getBytes(MockBase.ASCII()));\n storage.addColumn(UID_TABLE, new byte[] { 0 }, ID_FAMILY, METRICS, Bytes.fromLong(3L));\n int errors = (Integer)fsck.invoke(null, client, \n UID_TABLE, false, false);\n assertEquals(6, errors);\n }", "@Test\n public void fsckMetricsInconsistentForward() throws Exception {\n storage.addColumn(UID_TABLE, \"wtf\".getBytes(MockBase.ASCII()), ID_FAMILY, \n METRICS, new byte[] {0, 0, 1});\n storage.addColumn(UID_TABLE, new byte[] { 0 }, ID_FAMILY, METRICS, Bytes.fromLong(3L));\n int errors = (Integer)fsck.invoke(null, client, \n UID_TABLE, false, false);\n assertEquals(2, errors);\n }", "private void checkDatabaseStructure(DatabaseUpdateType update) {\n }", "@Override\r\n\tpublic boolean CheckConditions() {\n\t\treturn true;\r\n\t}", "String getTerracottaConsistency();", "public abstract String check() throws Exception;", "void check();", "void check();", "public static void checkConsistency(){\n double[] aNormalW=new double[numberOfObjectives];\n double randomIndex=0;\n double sum=0;\n for (int row=0;row<numberOfObjectives;row++){\n for (int column=0;column<numberOfObjectives;column++){\n\n sum+=weights[column]*objectives[row][column];\n }\n df.setRoundingMode(RoundingMode.UP);\n aNormalW[row]= Double.valueOf(df.format(sum));\n sum=0;\n }\n double awtDividedByWt=0;\n for (int i=0;i<numberOfObjectives;i++){\n awtDividedByWt+=aNormalW[i]/weights[i];\n decimalFormat.setRoundingMode(RoundingMode.HALF_UP);\n Double.valueOf(decimalFormat.format(awtDividedByWt));\n }\n double reciprocalNumber=(double) 1/numberOfObjectives;\n decimalFormat.setRoundingMode(RoundingMode.UP);\n Double.valueOf(decimalFormat.format(reciprocalNumber));\n double step3=reciprocalNumber*awtDividedByWt;\n decimalFormat.setRoundingMode(RoundingMode.UP);\n double numerator=Double.valueOf(decimalFormat.format(step3))-numberOfObjectives;\n double denominator=numberOfObjectives-1;\n decimalFormat.setRoundingMode(RoundingMode.UP);\n double ci=Double.valueOf(decimalFormat.format(numerator)) /denominator;\n decimalFormat.setRoundingMode(RoundingMode.CEILING);\n System.out.println(\"Consistency Index (CI)= \"+Double.valueOf(decimalFormat.format(ci)));\n System.out.println();\n double ciDividedByRI=ci/table23(numberOfObjectives);\n decimalFormat.setRoundingMode(RoundingMode.UP);\n // Double.valueOf(df.format(ciDividedByRI));\n if (ciDividedByRI<0.10){\n randomIndex=ci/table23(numberOfObjectives);\n decimalFormat.setRoundingMode(RoundingMode.UP);\n System.out.println(\"Random Index (RI)= \"+Double.valueOf(decimalFormat.format(randomIndex)));\n System.out.println(\"degree of consistency is satisfactory !!\");\n }else {\n System.out.println(\"the AHP may not yield meaningful results !!\");\n }\n System.out.println();\n }", "@Test\n public void fsckMetricsInconsistentFwdNoDupes() throws Exception {\n storage.addColumn(UID_TABLE, new byte[] {0, 0, 2}, NAME_FAMILY, \n METRICS, \"wtf\".getBytes(MockBase.ASCII()));\n storage.addColumn(UID_TABLE, \"wtf\".getBytes(MockBase.ASCII()), ID_FAMILY, \n METRICS, new byte[] {0, 0, 3});\n storage.addColumn(UID_TABLE, new byte[] {0, 0, 3}, NAME_FAMILY, \n METRICS, \"wtf\".getBytes(MockBase.ASCII()));\n storage.addColumn(UID_TABLE, new byte[] { 0 }, ID_FAMILY, METRICS, Bytes.fromLong(3L));\n int errors = (Integer)fsck.invoke(null, client, \n UID_TABLE, false, false);\n assertEquals(3, errors);\n }", "@Test\n public void fsckMetricsInconsistentFwdAndDupeRev() throws Exception {\n storage.addColumn(UID_TABLE, new byte[] {0, 0, 2}, NAME_FAMILY, \n METRICS, \"wtf\".getBytes(MockBase.ASCII()));\n storage.addColumn(UID_TABLE, \"wtf\".getBytes(MockBase.ASCII()), ID_FAMILY, \n METRICS, new byte[] {0, 0, 1});\n storage.addColumn(UID_TABLE, new byte[] { 0 }, ID_FAMILY, METRICS, Bytes.fromLong(3L));\n int errors = (Integer)fsck.invoke(null, client, \n UID_TABLE, false, false);\n assertEquals(5, errors);\n }", "public void doChecking() {\n \tdoCheckingDump();\n \tdoCheckingMatl();\n }", "@Override\n\tpublic void checkMaintenanceStatus() {\n\t}", "protected boolean check(CrawlDatum datum) {\n if (datum.getStatus() != expectedDbStatus)\n return false;\n return true;\n }", "private boolean check() {\n if (!isBST()) System.out.println(\"Not in symmetric order\");\n if (!isSizeConsistent()) System.out.println(\"Subtree counts not consistent\");\n if (!isRankConsistent()) System.out.println(\"Ranks not consistent\");\n return isBST() && isSizeConsistent() && isRankConsistent();\n }", "public static Result makeConsistent() {\n\n\t\ttry {\n\t\t\tPromise<Boolean> p = Promise.promise(() -> ElasticReindexer.indexInconsistentDocs());\n\t\t} catch(Exception e) {\n\t\t\tlog.error(e.getMessage(), e);\n\t\t\treturn internalServerError(e.getMessage());\n\t\t}\n\n\t\treturn ok();\n\t}", "public static void ensure() {\n }", "void ensure();", "protected boolean checkCompatibility() {\n IDatabaseAdapter adapter = getDbAdapter(dbType, connectionPool);\n try (ITransaction tx = TransactionFactory.openTransaction(connectionPool)) {\n return adapter.checkCompatibility(this.adminSchemaName);\n }\n }", "@Override\n\t@NotDbField\n\tpublic void check() throws ApiRuleException {\n\t\t\n\t}", "@Override\n\t@NotDbField\n\tpublic void check() throws ApiRuleException {\n\t\t\n\t}", "@Override\n\t@NotDbField\n\tpublic void check() throws ApiRuleException {\n\t\t\n\t}", "@Override\n\t\tpublic void checkPreconditions() {\n\t\t}", "@Override\n public StabilityResult check() {\n boolean serviceStability = false;\n int count = 0;\n int count1 = 0;\n int count2 = 0;\n while (!serviceStability && count < attempts) {\n try {\n // We use the getAllServiceReferences method to ignore classloading issues. Anyway, we are not using\n // the service, just counting them.\n ServiceReference[] refs = context.getAllServiceReferences(null, null);\n count1 = refs.length;\n grace();\n refs = context.getAllServiceReferences(null, null);\n count2 = refs.length;\n serviceStability = count1 == count2;\n } catch (Exception e) {\n LOGGER.warn(\"An exception was thrown while checking the service stability\", e);\n serviceStability = false;\n // Nothing to do, while recheck the condition\n }\n count++;\n }\n\n if (count == attempts) {\n LOGGER.error(\"Service stability has not been reached after {} tries ({} != {})\", attempts, count1, count2);\n return StabilityResult.unstable(\"Cannot reach the service stability\");\n }\n return StabilityResult.stable();\n }", "@Test(expected = TimeoutException.class)\n public void testConsistencyTimeOut() throws Exception {\n service.setCallsToConsistency(10);\n backoff.setMaxTries(8);\n tableAdminClient.waitForReplication(TABLE_NAME, backoff);\n }", "@Override\n protected Result check() throws Exception { \n try {\n GetOSVersionRes res = this.service.getOSVersion(new GetOSVersionReq());\n // only return the OS name to avoid any potential\n // security problem if the version was exposed...\n return Result.healthy(res.getReturn().getOs().getOsName());\n } catch(Exception e) {\n return Result.unhealthy(e.getMessage());\n }\n }", "abstract boolean check(Env env);", "@Test\n public void testConsistencySlow() throws Exception {\n service.setCallsToConsistency(10);\n backoff.setMaxTries(9);\n tableAdminClient.waitForReplication(TABLE_NAME, backoff);\n Assert.assertEquals(9, backoff.getNumberOfTries());\n }", "void validateReadQuorum(ConsistencyLevel consistencyLevel, ResourceType childResourceType, boolean isBoundedStaleness) {\n }", "boolean verifyJobDatabase();", "public void checkCompatibility() {\n Utils.LOGGER.info(\"Checking compatibility...\");\n\n checkServerVersion();\n checkServerSoftware();\n\n if (incompatibilities.size() == 0) {\n Utils.LOGGER.info(\"Compatibility checks completed, no possible incompatibilities found.\");\n } else {\n Utils.LOGGER.warning(\"Compatibility checks completed, &b\" + incompatibilities.size() + \"&7 possible incompatibilities were found:\");\n incompatibilities.forEach(incompatibility -> Utils.LOGGER.warning(\"&8 - &b\" + incompatibility.getType().toString() + \"&7 check flagged: \" + incompatibility.getReason()));\n }\n }", "void checkConsistency() {\n for (String word : dictionary) {\n assertEquals(words.contains(word), trie.contains(word));\n }\n }", "@Override\n public void checkVersion() {\n }", "void checkValid();", "private void checkStructure() {\n for (DatabaseUpdateType updateType : DatabaseUpdateType.values()) {\n checkDatabaseStructure(updateType);\n }\n }", "void check() throws YangException;", "@Override\n\tpublic void checkTableVersion() {\n\n\t}", "@Override\n\tpublic boolean isConsistent() {\n\t\treturn true;\n\t}", "@Override\n\tpublic void checkUpdateClient() {\n\t}", "boolean checkVerification();", "public void checkData(){\n\n }", "private void performSanityCheck()\n\t{\n\t\tif (variableNames != null && domainSizes != null\n\t\t\t\t&& propositionNames != null)\n\t\t{\n\t\t\tcheckStateSizes();\n\t\t\tcheckDomainSizes();\n\t\t}\n\t}", "public int checkGoals() {\n\t\tupdateUnsupportedPreconditionInconsistencies(maxLevel);\n\t\tcountInconsistencies();\n\t\tgraphQuality = calculateQuality();\n\t\treturn this.inconsistencyCount;\n\t}", "@Override\n\tpublic void check() throws ApiRuleException {\n\t\t\n\t}", "@Test\n public void testWriteConsistencyLevel() {\n int levelsChecked = 0;\n // Test whether CassandraTransaction honors the write consistency level option\n for (CLevel writeLevel : CLevel.values()) {\n StandardBaseTransactionConfig.Builder b = new StandardBaseTransactionConfig.Builder();\n ModifiableConfiguration mc = GraphDatabaseConfiguration.buildGraphConfiguration();\n mc.set(AbstractCassandraStoreManager.CASSANDRA_WRITE_CONSISTENCY, writeLevel.name());\n b.customOptions(mc);\n b.timestampProvider(MICRO);\n CassandraTransaction ct = new CassandraTransaction(b.build());\n Assert.assertEquals(writeLevel, ct.getWriteConsistencyLevel());\n levelsChecked++;\n }\n // Sanity check: if CLevel.values was empty, something is wrong with the test\n Preconditions.checkState((0 < levelsChecked));\n }", "public void verifyBusinessRules(Coin Coin) throws Exception {\n\t}", "@Override\n public void checkConfiguration() {\n }", "void verifyConsistent(ImmutableClassesGiraphConfiguration conf);", "@Test\n public void testCanRun() {\n final int oldestSupported = AccumuloDataVersion.ROOT_TABLET_META_CHANGES;\n final int currentVersion = AccumuloDataVersion.get();\n IntConsumer shouldPass = ServerContext::ensureDataVersionCompatible;\n IntConsumer shouldFail = v -> assertThrows(IllegalStateException.class,\n () -> ServerContext.ensureDataVersionCompatible(v));\n IntStream.rangeClosed(oldestSupported, currentVersion).forEach(shouldPass);\n IntStream.of(oldestSupported - 1, currentVersion + 1).forEach(shouldFail);\n }", "@Test\n public void fsckMetricsInconsistentReverse() throws Exception {\n storage.addColumn(UID_TABLE, new byte[] {0, 0, 3}, NAME_FAMILY, \n METRICS, \"foo\".getBytes(MockBase.ASCII()));\n storage.addColumn(UID_TABLE, new byte[] { 0 }, ID_FAMILY, METRICS, Bytes.fromLong(3L));\n int errors = (Integer)fsck.invoke(null, client, \n UID_TABLE, false, false);\n assertEquals(1, errors);\n }", "@Override\n public void computeSatisfaction() {\n\n }", "@Test\n\tpublic void checkStatus() {\n\t\tclient.execute(\"1095C-16-111111\");\n\t}", "@Test\n\tpublic void testVersionCheck() throws Exception{\n\t}", "abstract protected boolean checkMethod();", "@Test\n public void fsckMetricsDuplicateForward() throws Exception {\n storage.addColumn(UID_TABLE, new byte[] {0, 0, 2}, NAME_FAMILY, \n METRICS, \"wtf\".getBytes(MockBase.ASCII()));\n int errors = (Integer)fsck.invoke(null, client, \n UID_TABLE, false, false);\n assertEquals(2, errors);\n }", "public abstract boolean isBalanced();", "public abstract void check(ArrayList<Connection> c_list) throws Exception ;", "public boolean isConsistent() throws OperationNotSupportedException, FMReasoningException {\n\t\tthrow new OperationNotSupportedException(\"Reasoning Operation Not Supported\");\n\t}", "void doCheckHealthy();", "public void checkForTransaction() throws SystemException;", "public void validate() throws org.apache.thrift.TException {\n if (cusPerBase != null) {\n cusPerBase.validate();\n }\n }", "private int checkStatus(Concept concept_1, Concept concept_2) throws\n Exception {\n int reviewed = 0;\n\n if (JekyllKit.getCoreDataClient().getRelationshipCount(concept_1) > 1000) {\n MEMEToolkit.notifyUser(\"There are more than 1000 relationships\"\n + \"\\nfor the cluster of concepts:\"\n + concept_1.getIdentifier().toString()\n + \" and \"\n +\n ( (concept_2 == null) ? \"0\" :\n concept_2.getIdentifier().toString())\n + \"\\nThe check whether cluster has been reviewed\"\n + \"\\nbefore will not be performed.\");\n return reviewed;\n }\n\n JekyllKit.getCoreDataClient().populateRelationships(concept_1);\n Relationship[] rels = concept_1.getRestrictedRelationships(new\n BySourceRestrictor(RelSemantics.getCurrentSAB_SL()));\n\n for (int i = 0; i < rels.length; i++) {\n if (rels[i].getRelatedConcept().equals(concept_2)) {\n if (rels[i].getTimestamp().after(worklist_creation_date)) {\n reviewed = 1;\n }\n }\n }\n\n return reviewed;\n }", "public checkConsistency_result(checkConsistency_result other) {\n if (other.isSetSuccess()) {\n this.success = new CheckConsistencyTResponse(other.success);\n }\n if (other.isSetE()) {\n this.e = new alluxio.thrift.AlluxioTException(other.e);\n }\n }", "@Test\n public void fsckMetricsMissingForward() throws Exception {\n // currently a warning, not an error\n storage.flushColumn(\"bar\".getBytes(MockBase.ASCII()), ID_FAMILY, \n METRICS);\n int errors = (Integer)fsck.invoke(null, client, \n UID_TABLE, false, false);\n assertEquals(0, errors);\n }", "@Test\n public void testHardClustersWithOverlappingPartitions()\n {\n check(hardClustersWithOverlappingPartitions(), 0.0, 1.0);\n }", "final void checkForComodification() {\n\t}", "@Test\n\tpublic void method1BC() {\n\t\tassertEquals(-2, FaultyClass.method1(-2));\n\t\tassertEquals(1, FaultyClass.method1(3));\n\t}", "public void checkData2019() {\n\n }", "private void validator() throws Exception {\n if (getDBTable() == null) throw new Exception(\"getDBTable missing\");\n if (getColumnsString() == null) throw new Exception(\"getColumnsString missing\");\n if (getColumnsType() == null || getColumnsType().size() <= 0) throw new Exception(\"getColumnsType missing\");\n if (getDuplicateUpdateColumnString() == null) {\n if (getColumnsString().split(\",\").length != getColumnsType().size())\n throw new Exception(\"mismatch for type and columns\");\n\n } else {\n if (getColumnsString().split(\",\").length +\n getDuplicateUpdateColumnString().split(\",\").length != getColumnsType().size())\n throw new Exception(\"mismatch for type and columns\");\n }\n }", "final void checkEnsure() {\r\n\t\t\r\n\t\ttry {\r\n\t\t\tif (this.conn == null || this.conn.isClosed()) {\r\n\t\t\t\tthis.conn = this.ci.createConnection();\r\n\t\t\t\tthis.databaseType = ConnectionHolder.DT_UNKNOWN;\r\n\t\t\t\tthis.loops = this.ci.connectionMaxLoops();\r\n\t\t\t\tthis.date = System.currentTimeMillis() + this.ci.connectionTimeToLive();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif (--this.loops < 0 || this.date < System.currentTimeMillis()) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tthis.conn.close();\r\n\t\t\t\t} catch (final Throwable t) {\r\n\t\t\t\t\t// ignore\r\n\t\t\t\t}\r\n\t\t\t\tthis.conn = this.ci.createConnection();\r\n\t\t\t\tthis.databaseType = ConnectionHolder.DT_UNKNOWN;\r\n\t\t\t\tthis.loops = this.ci.connectionMaxLoops();\r\n\t\t\t\tthis.date = System.currentTimeMillis() + this.ci.connectionTimeToLive();\r\n\t\t\t\treturn;\r\n\t\t\t}\r\n\t\t\tif (this.databaseType == ConnectionHolder.DT_UNKNOWN) {\r\n\t\t\t\tthis.databaseType = this.conn.getMetaData().getDatabaseProductName().toUpperCase().indexOf(\"ORACLE\") == -1\r\n\t\t\t\t\t? ConnectionHolder.DT_NORMAL\r\n\t\t\t\t\t: ConnectionHolder.DT_ORACLE;\r\n\t\t\t}\r\n\t\t\ttry (final Statement st = this.conn.createStatement()) {\r\n\t\t\t\t/** Do not use it here, may be unsupported? */\r\n\t\t\t\ttry {\r\n\t\t\t\t\tst.setQueryTimeout(10);\r\n\t\t\t\t} catch (final Throwable t) {\r\n\t\t\t\t\t// ignore\r\n\t\t\t\t}\r\n\t\t\t\tst.execute(\r\n\t\t\t\t\t\tthis.databaseType == ConnectionHolder.DT_ORACLE\r\n\t\t\t\t\t\t\t? \"SELECT 5 FROM DUAL\"\r\n\t\t\t\t\t\t\t: \"SELECT 5\");\r\n\t\t\t}\r\n\t\t} catch (final SQLException e) {\r\n\t\t\tif (this.conn != null) {\r\n\t\t\t\ttry {\r\n\t\t\t\t\tthis.conn.close();\r\n\t\t\t\t} catch (final Throwable t) {\r\n\t\t\t\t\t// ignore\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tthis.conn = this.ci.createConnection();\r\n\t\t\tthis.databaseType = ConnectionHolder.DT_UNKNOWN;\r\n\t\t\tthis.loops = this.ci.connectionMaxLoops();\r\n\t\t\tthis.date = System.currentTimeMillis() + this.ci.connectionTimeToLive();\r\n\t\t}\r\n\t}", "private boolean isSizeConsistent() { return isSizeConsistent(root); }", "private void checkConnectivity() throws NotConnected\n\t{\n\t\tif (!s_ctx.isConnected())\n\t\t{\n\t\t\tthrow new NotConnected(\"Cannot operate: not conected to context\");\n\t\t}\n\t}", "@Override\r\n\tpublic boolean isConsistent(List<Constraint> constraints)\r\n\t\t\tthrows DomainSizeException {\r\n\t\treturn QXKCTools.isConsistent(constraints, this.numberOfConstraints);\r\n\t}", "void check () {\r\n OzcError.setLineNumber (body.line_no);\r\n\r\n check_constructor:\r\n\r\n if (method.isNew () && !method.wasCalledSuper ()) {\r\n ClassType c = method.getDefinedClass ();\r\n ClassImplementation ci;\r\n if (c.isClassInterface ()) \r\n\tci = ((ClassInterface) c).getImplementation ();\r\n else \r\n\tci = (ClassImplementation) c;\r\n do {\r\n\tci = ci.getSuperClass ();\r\n\tif (ci == null || School.isSystem (ci)) break check_constructor;\r\n } while (!ci.hasConstructor ());\r\n\r\n OzcError.constructorMustCallSuper (method);\r\n }\r\n\r\n /* need return statement as last statement */\r\n try {\r\n body.check (this);\r\n } catch (Unreachable e) {\r\n Statement st = e.getStatement ();\r\n if (st != null) \r\n\tOzcError.unreachableSt (st);\r\n else if (method.isNew () && need_return)\r\n\tOzcError.unreachableLastSt (body.line_no);\r\n }\r\n }", "private void checkDB() {\n\t\tif (couchDB_ip == null) {\n\t\t\tsetCouchDB_ip();\n\t\t}\n\n\t\tif (!databaseExist) {\n\n\t\t\tsynchronized (databaseExist) {\n\n\t\t\t\tif (!databaseExist) {\n\n\t\t\t\t\tif (couchDB_USERNAME != null\n\t\t\t\t\t\t\t&& !couchDB_USERNAME.trim().isEmpty()\n\t\t\t\t\t\t\t&& couchDB_PASSWORD != null\n\t\t\t\t\t\t\t&& !couchDB_PASSWORD.trim().isEmpty()) {\n\t\t\t\t\t\tUsernamePasswordCredentials creds = new UsernamePasswordCredentials(\n\t\t\t\t\t\t\t\tcouchDB_USERNAME, couchDB_PASSWORD);\n\t\t\t\t\t\tauthentication = BasicScheme.authenticate(creds,\n\t\t\t\t\t\t\t\t\"US-ASCII\", false).toString();\n\t\t\t\t\t}\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (CouchDBUtil.checkDB(getCouchDB_ip(), couchDB_NAME,\n\t\t\t\t\t\t\t\tauthentication)) {\n\n\t\t\t\t\t\t\tdatabaseExist = true;\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\tCouchDBUtil.createDb(getCouchDB_ip(), couchDB_NAME,\n\t\t\t\t\t\t\t\t\tauthentication);\n\t\t\t\t\t\t\tdatabaseExist = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t} catch (MalformedURLException e) {\n\t\t\t\t\t\tlogger.info(\"Impossible to access CouchDB\", e);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "@Override\n\tprotected void check() throws SiDCException, Exception {\n\t\tif (entity == null) {\n\t\t\tthrow new SiDCException(APIStatus.ILLEGAL_ARGUMENT, \"illegal of request.\");\n\t\t}\n\t\tif (StringUtils.isBlank(entity.getStatus())) {\n\t\t\tthrow new SiDCException(APIStatus.ILLEGAL_ARGUMENT, \"illegal of status.\");\n\t\t}\n\t\tif (StringUtils.isBlank(entity.getLangcode())) {\n\t\t\tthrow new SiDCException(APIStatus.ILLEGAL_ARGUMENT, \"illegal of lang code.\");\n\t\t}\n\t}", "ch.crif_online.www.webservices.crifsoapservice.v1_00.ComplianceCheckResult getComplianceCheckResult();", "private void validCheck ()\n\t{\n\t\tassert allButLast != null || cachedFlatListOrMore != null;\n\t}", "private void getStatus() {\n\t\t\n\t}", "long invalidations();", "boolean checkValidity(int side1, int side2, int side3);", "void checkTapDbVersion() throws ConfigurationException;", "@Test\n public void consistencyCheckerDisabledTest() throws Exception {\n // 1. only one participant, consistency checker should be disabled\n AmbryServer server =\n new AmbryServer(new VerifiableProperties(props), clusterAgentsFactory, notificationSystem, time);\n server.startup();\n assertNull(\"The mismatch metric should not be created\", server.getServerMetrics().stoppedReplicasMismatchCount);\n server.shutdown();\n // 2. there are two participants but period of checker is zero, consistency checker should be disabled.\n props.setProperty(\"server.participants.consistency.checker.period.sec\", Long.toString(0L));\n List<ClusterParticipant> participants = new ArrayList<>();\n for (int i = 0; i < 2; ++i) {\n participants.add(\n new MockClusterParticipant(Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), null,\n null, null));\n }\n clusterAgentsFactory.setClusterParticipants(participants);\n server = new AmbryServer(new VerifiableProperties(props), clusterAgentsFactory, notificationSystem, time);\n server.startup();\n assertNull(\"The mismatch metric should not be created\", server.getServerMetrics().stoppedReplicasMismatchCount);\n server.shutdown();\n }", "public void checkAuthority() {\n }", "@Override\r\npublic void checkBalance() {\n\t\r\n}", "@Override\n public boolean hasValenceError() {\n String valenceCheck = atom.checkBadValence();\n//\n// System.out.println(\"valenceCheckBad \" + valenceCheck);\n// System.out.println(\"calling actual checkValence \" + atom.checkValence());\n// System.out.println(\"valenceCheckBad again \" + atom.checkBadValence());\n return !valenceCheck.isEmpty();\n }", "public void verifyBugerList()\n\t{\n\t\t\n\t}", "public abstract void selfCheck(MCTSConfig config);", "@Override\n\tpublic Consistency getDefaultConsistency() {\n\t\treturn Consistency.READ_YOUR_OWN_WRITES;\n\t}", "public void validate() throws org.apache.thrift.TException {\n\t}", "public void validate() throws org.apache.thrift.TException {\n\t}" ]
[ "0.88670427", "0.7850428", "0.7240613", "0.6474483", "0.63593113", "0.62092143", "0.62092143", "0.6207292", "0.6194051", "0.6186655", "0.61108714", "0.6078593", "0.6076769", "0.60331035", "0.6030524", "0.59210825", "0.58806413", "0.58806413", "0.5871354", "0.5816206", "0.5815775", "0.5805995", "0.5774514", "0.5768411", "0.57682306", "0.5753472", "0.5747525", "0.57454085", "0.5736188", "0.5701577", "0.5701577", "0.5701577", "0.56816417", "0.56740975", "0.56508946", "0.5640763", "0.56318444", "0.56163156", "0.56148964", "0.5610487", "0.5592148", "0.55844134", "0.5583099", "0.5582676", "0.55801064", "0.5579937", "0.5556542", "0.55516946", "0.5551435", "0.5547209", "0.5546428", "0.55395687", "0.55284166", "0.5522459", "0.5515958", "0.5509546", "0.55033", "0.5502292", "0.5491052", "0.5487277", "0.5459897", "0.54514843", "0.5449864", "0.54466337", "0.5434746", "0.5428596", "0.54207855", "0.54106295", "0.5398845", "0.5398439", "0.5397591", "0.53962755", "0.5395267", "0.53933096", "0.53888637", "0.5378259", "0.5371355", "0.5368456", "0.53532153", "0.53458947", "0.53352916", "0.53242445", "0.53236973", "0.5314345", "0.530397", "0.53025496", "0.53017545", "0.53015876", "0.52952623", "0.5275434", "0.5260014", "0.5247996", "0.5247976", "0.52466995", "0.5243684", "0.52368104", "0.5233788", "0.52261096", "0.52240247", "0.52224475", "0.52224475" ]
0.0
-1
/ /Validity testing methods /
@Override public boolean isValidated() { if (location_set.size() == 0 || !have_join) return false; return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "boolean checkValidity();", "void checkValid();", "public void validate() {}", "void validate();", "void validate();", "@Override\r\n\tpublic boolean checkValidity() {\n\t\treturn false;\r\n\t}", "@Test\n public void checkValidityTest1() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n assert (g.checkValidity(g.getDeck()));\n }", "@Test\n public void testCheckValidity_InvalidFields() throws Exception {\n expectCheckValidityFailure(msg -> msg.setSource(null));\n \n // null protocol\n expectCheckValidityFailure(msg -> msg.setProtocol(null));\n \n // null or empty topic\n expectCheckValidityFailure_NullOrEmpty((msg, value) -> msg.setTopic(value));\n \n // null payload\n expectCheckValidityFailure(msg -> msg.setPayload(null));\n \n // empty payload should NOT throw an exception\n Forward forward = makeValidMessage();\n forward.setPayload(\"\");\n forward.checkValidity();\n \n // null or empty requestId\n expectCheckValidityFailure_NullOrEmpty((msg, value) -> msg.setRequestId(value));\n \n // invalid hop count\n expectCheckValidityFailure(msg -> msg.setNumHops(-1));\n }", "@Test\n public void checkValidityTest2() {\n GenericStandardDeckGame g = new GenericStandardDeckGame();\n List<Card> deck = g.getDeck();\n deck.set(32, new Card(Card.number.four, Card.suit.club));\n assert (!g.checkValidity(deck));\n }", "public void validate () { throw new RuntimeException(); }", "@Test\n\tpublic void testValidInvalidEstimtes() {\n\t\tProject project = new Project();\n\t\tproject.setEstimates(-1);\n\t\tproject.setType(\"DOCSMANAGE\");\n\t\tSet<ConstraintViolation<Project>> constraintViolations = validator.validate(project);\n\t\tassertEquals(constraintViolations.size(), 1);\n\t}", "protected void checkValidity(Epml epml) {\n\t}", "protected void validate() {\n // no op\n }", "@Test\n\tpublic void testIsValid()\n\t{\n\t\tSystem.out.println(\"isValid\");\n\n\t\tUserTypeCode userTypeCode = new UserTypeCode();\n\t\tuserTypeCode.setCode(\"Test\");\n\t\tuserTypeCode.setDescription(\"Test\");\n\n\t\tValidationModel validateModel = new ValidationModel(userTypeCode);\n\t\tvalidateModel.setConsumeFieldsOnly(true);\n\n\t\tboolean expResult = true;\n\t\tboolean result = ValidationUtil.isValid(validateModel);\n\t\tassertEquals(expResult, result);\n\n\t\tvalidateModel = new ValidationModel(userTypeCode);\n\n\t\texpResult = false;\n\t\tresult = ValidationUtil.isValid(validateModel);\n\t\tassertEquals(expResult, result);\n\t}", "public void testInvalidNoType() { assertInvalid(\"a\"); }", "private void validateData() {\n }", "protected void updateValidity(){}", "@Test\n\tpublic void testValidInvalidEstimtesFib() {\n\t\tProject project = new Project();\n\t\tproject.setEstimates(10);\n\t\tproject.setType(\"DOCSMANAGE\");\n\t\tSet<ConstraintViolation<Project>> constraintViolations = validator.validate(project);\n\t\tassertEquals(constraintViolations.size(), 1);\n\t}", "public boolean getValidity();", "private void validateInputParameters(){\n\n }", "boolean checkVerification();", "protected abstract boolean isValid();", "protected void validate() {\n // no implementation.\n }", "@Test\n public void validForTest() {\n // TODO: test validFor\n }", "@Override\r\n\tpublic void validate() {\n\t\t\r\n\t}", "@Override\n\tpublic void validate()\n\t{\n\n\t}", "@Test\n @Disabled\n public void testValidateFormat() {\n assertTrue(RegExprMain.validateFormat(\"CC222CC\"));\n assertTrue(RegExprMain.validateFormat(\"DD333DD\"));\n assertTrue(RegExprMain.validateFormat(\"AA999AA\"));\n assertTrue(RegExprMain.validateFormat(\"VV555VV\"));\n assertTrue(RegExprMain.validateFormat(\"JJ777JJ\"));\n assertFalse(RegExprMain.validateFormat(\"J777JJ\"));\n assertFalse(RegExprMain.validateFormat(\"JJ777J\"));\n assertFalse(RegExprMain.validateFormat(\"JJ77JJ\"));\n assertFalse(RegExprMain.validateFormat(\"JJ777AA\"));\n assertFalse(RegExprMain.validateFormat(\"AA777JJ\"));\n \n\n }", "@Test\r\n\tpublic void testValidationSuccess() {\r\n\t\tAccountTransferRequest accountTransferRequest = new AccountTransferRequest();\r\n\t\taccountTransferRequest.setUsername(VALID_USERNAME);\r\n\t\taccountTransferRequest.setPassword(VALID_PASSWORD);\r\n\t\taccountTransferRequest.setSenderAccount(VALID_SENDER_ACCOUNT_NUMBER);\r\n\t\taccountTransferRequest.setReceiverAccount(VALID_RECEIVER_ACCOUNT_NUMBER);\r\n\t\taccountTransferRequest.setTransferAmount(400.0);\t\t\r\n\t\ttry {\r\n\t\t\ttransferValidationUnit.validate(accountTransferRequest);\r\n\t\t} catch (ValidationException e) {\r\n\t\t\tAssert.fail(\"Found_Exception\");\r\n\t\t}\r\n\t}", "public abstract boolean validate();", "public abstract boolean isValid();", "public abstract boolean isValid();", "public abstract boolean isValid();", "@Test\n public void isCorrectTest(){\n BuyCard cardErr = new BuyCard(12,0);\n\n thrown.expect(IllegalArgumentException.class);\n thrown.expectMessage(\"Row index out of bounds.\");\n cardErr.isCorrect();\n }", "@Test\n\tpublic void testValidInvalid() {\n\t\tProject project = new Project();\n\t\tproject.setEstimates(5);\n\t\tproject.setType(\"DOCSMANAGEYY\");\n\t\tSet<ConstraintViolation<Project>> constraintViolations = validator.validate(project);\n\t\tassertEquals(constraintViolations.size(), 1);\n\t}", "@Override\r\n public void validate() {\r\n }", "@Test\n public void testFirstNameMinLength() {\n owner.setFirstName(\"T\");\n assertInvalid(owner, \"firstName\", \"First name must be between 2 and 20 characters\", \"T\");\n }", "public void testValidStringPositiveTest()\n {\n form.setVerificationCode(\"123456\");\n validator.validate(form, errors);\n assertTrue(!errors.hasErrors());\n }", "long invalidations();", "public void validateRpd22s1()\n {\n // This guideline cannot be automatically tested.\n }", "private void assertValidity() {\n if (latitudes.size() != longitudes.size()) {\n throw new IllegalStateException(\"GIS location needs equal number of lat/lon points.\");\n }\n if (!(latitudes.size() == 1 || latitudes.size() >= 3)) {\n throw new IllegalStateException(\"GIS location needs either one point or more than two.\");\n }\n }", "@Override\n\tpublic void validate() {\n\t}", "@Test\n\tpublic void validObjectShouldValidate() {\n\t\tT validObject = buildValid();\n\t\tAssertions.assertThat(isValid(validObject))\n\t\t\t\t.as(invalidMessage(validObject))\n\t\t\t\t.isTrue();\n\t}", "abstract void fiscalCodeValidity();", "public TestResult validate(License license, ValidationParameters validationParameters);", "public void validateRpd22s9()\n {\n // This guideline cannot be automatically tested.\n }", "public boolean isValid();", "public boolean isValid();", "public boolean isValid();", "public boolean isValid();", "public boolean isValid();", "@Override\r\n\tprotected void validate() {\n\t}", "private void checkValid() {\n getSimType();\n getInitialConfig();\n getIsOutlined();\n getEdgePolicy();\n getNeighborPolicy();\n getCellShape();\n }", "boolean isValid();", "boolean isValid();", "boolean isValid();", "boolean isValid();", "boolean isValid();", "@Test\n\tpublic void testInvalidValidators() {\n\t\tProject project = new Project();\n\t\tproject.setEstimates(76);\n\t\tproject.setType(\"DOCSMANAGEYY\");\n\t\tSet<ConstraintViolation<Project>> constraintViolations = validator.validate(project);\n\t\tassertEquals(constraintViolations.size(), 2);\n\t}", "public void validateRpd22s5()\n {\n // This guideline cannot be automatically tested.\n }", "@Test\n\tpublic void testValidate()\n\t{\n\t\tSystem.out.println(\"validate\");\n\t\tUserTypeCode userTypeCode = new UserTypeCode();\n\t\tuserTypeCode.setCode(\"Test\");\n\t\tuserTypeCode.setDescription(\"Test\");\n\n\t\tValidationModel validateModel = new ValidationModel(userTypeCode);\n\t\tvalidateModel.setConsumeFieldsOnly(true);\n\n\t\tValidationResult result = ValidationUtil.validate(validateModel);\n\t\tSystem.out.println(\"Any Valid consume: \" + result.toString());\n\t\tif (result.valid() == false) {\n\t\t\tAssert.fail(\"Failed validation when it was expected to pass.\");\n\t\t}\n\t\tSystem.out.println(\"---------------------------\");\n\n\t\tvalidateModel = new ValidationModel(userTypeCode);\n\t\tresult = ValidationUtil.validate(validateModel);\n\t\tSystem.out.println(\"Faild: \" + result.toString());\n\t}", "@Test(priority=5)\n\tpublic void validatePleaseEnterTheValueErrorMsg1()\n\t{\n\t\tc.addButton.click();\n\t\tAssert.assertTrue(c.msg.getText().equalsIgnoreCase(\"Please Enter A Value.\"));\n\t}", "public void testNullOtac()\n {\n assertTrue(!errors.hasErrors());\n form.setVerificationCode(null);\n validator.validate(form, errors);\n assertTrue(errors.hasErrors());\n }", "@Value.Check\n default void checkPreconditions()\n {\n RangeCheck.checkIncludedInInteger(\n this.feedback(),\n \"Feedback\",\n RangeInclusiveI.of(0, 7),\n \"Valid feedback values\");\n\n RangeCheck.checkIncludedInInteger(\n this.transpose(),\n \"Transpose\",\n RangeInclusiveI.of(-24, 24),\n \"Valid transpose values\");\n\n RangeCheck.checkIncludedInInteger(\n this.pitchEnvelopeR1Level(),\n \"Pitch R1 Level\",\n RangeInclusiveI.of(0, 99),\n \"Valid levels\");\n\n RangeCheck.checkIncludedInInteger(\n this.pitchEnvelopeR1Rate(),\n \"Pitch R1 Rate\",\n RangeInclusiveI.of(0, 99),\n \"Valid rates\");\n\n RangeCheck.checkIncludedInInteger(\n this.pitchEnvelopeR2Level(),\n \"Pitch R2 Level\",\n RangeInclusiveI.of(0, 99),\n \"Valid levels\");\n\n RangeCheck.checkIncludedInInteger(\n this.pitchEnvelopeR2Rate(),\n \"Pitch R2 Rate\",\n RangeInclusiveI.of(0, 99),\n \"Valid rates\");\n\n RangeCheck.checkIncludedInInteger(\n this.pitchEnvelopeR3Level(),\n \"Pitch R3 Level\",\n RangeInclusiveI.of(0, 99),\n \"Valid levels\");\n\n RangeCheck.checkIncludedInInteger(\n this.pitchEnvelopeR3Rate(),\n \"Pitch R3 Rate\",\n RangeInclusiveI.of(0, 99),\n \"Valid rates\");\n\n RangeCheck.checkIncludedInInteger(\n this.pitchEnvelopeR4Level(),\n \"Pitch R4 Level\",\n RangeInclusiveI.of(0, 99),\n \"Valid levels\");\n\n RangeCheck.checkIncludedInInteger(\n this.pitchEnvelopeR4Rate(),\n \"Pitch R4 Rate\",\n RangeInclusiveI.of(0, 99),\n \"Valid rates\");\n\n RangeCheck.checkIncludedInInteger(\n this.lfoPitchModulationDepth(),\n \"LFO Pitch Modulation Depth\",\n RangeInclusiveI.of(0, 99),\n \"Valid pitch modulation depth values\");\n\n RangeCheck.checkIncludedInInteger(\n this.lfoPitchModulationSensitivity(),\n \"LFO Pitch Modulation Sensitivity\",\n RangeInclusiveI.of(0, 7),\n \"Valid pitch modulation sensitivity values\");\n\n RangeCheck.checkIncludedInInteger(\n this.lfoAmplitudeModulationDepth(),\n \"LFO Amplitude Modulation Depth\",\n RangeInclusiveI.of(0, 99),\n \"Valid amplitude modulation depth values\");\n\n RangeCheck.checkIncludedInInteger(\n this.lfoSpeed(),\n \"LFO Speed\",\n RangeInclusiveI.of(0, 99),\n \"Valid LFO speed values\");\n\n RangeCheck.checkIncludedInInteger(\n this.lfoDelay(),\n \"LFO Delay\",\n RangeInclusiveI.of(0, 99),\n \"Valid LFO delay values\");\n }", "public abstract boolean verifyInput();", "protected boolean isValid()\r\n {\r\n \treturn true;\r\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}", "public void validateRpd22s6()\n {\n // This guideline cannot be automatically tested.\n }", "public interface Validator\n{\n void assertEqual(Object expected, Object actual, String successMessage, String failureMessage) throws IOException;\n\n void assertNotEqual(Object expected, Object actual, String successMessage, String failureMessage) throws IOException;\n\n void assertNotEmpty(Collection collection, String successMessage, String failureMessage) throws IOException;\n\n void assertEmpty(Collection collection, String successMessage, String failureMessage) throws IOException;\n}", "@Test\n\tpublic void testValidatePrivacyState() {\n\t\ttry {\n\t\t\tfor(String emptyValue : ParameterSets.getEmptyValues()) {\n\t\t\t\tAssert.assertNull(SurveyResponseValidators.validatePrivacyState(emptyValue));\n\t\t\t}\n\t\t\t\n\t\t\ttry {\n\t\t\t\tSurveyResponseValidators.validatePrivacyState(\"Invalid value.\");\n\t\t\t\tfail(\"The privacy state was invalid.\");\n\t\t\t}\n\t\t\tcatch(ValidationException e) {\n\t\t\t\t// Passed.\n\t\t\t}\n\t\t\t\n\t\t\tfor(SurveyResponse.PrivacyState privacyState: SurveyResponse.PrivacyState.values()) {\n\t\t\t\tAssert.assertEquals(privacyState, SurveyResponseValidators.validatePrivacyState(privacyState.toString()));\n\t\t\t}\n\t\t}\n\t\tcatch(ValidationException e) {\n\t\t\tfail(\"A validation exception was thrown: \" + e.getMessage());\n\t\t}\n\t}", "@Test\n\tpublic void testValidors() throws ParseException {\n\t\tProject project = new Project();\n\t\tproject.setEstimates(5);\n\t\tSimpleDateFormat format = new SimpleDateFormat(\"yyyyMMdd\");\n\t\tDate parsed = format.parse(\"20110210\");\n\t\tjava.sql.Date sql = new java.sql.Date(parsed.getTime());\n\t\tproject.setdRequested(sql);\n\t\tproject.setdRequired(sql);\n\t\tproject.setCritical(true);\n\t\tproject.setType(\"DOCSMANAGE\");\n\t\tProjectKeyContacts contacts = new ProjectKeyContacts();\n\t\tcontacts.setEmail(\"assdasd.gmail.com\");\n\t\tcontacts.setFname(\"sdsd\");\n\t\tcontacts.setLname(\"asdasd\");\n\t\tcontacts.setPhone(\"asd\");\n\t\tcontacts.setRole(\"asda\");\n\t\tcontacts.setTeam(\"saad\");\n\t\tproject.setContacts(contacts);\n\t\tProjectDetails det = new ProjectDetails();\n\t\tdet.setDescription(\"asdsd\");\n\t\tdet.setName(\"asd\");\n\t\tdet.setName(\"asdad\");\n\t\tdet.setSummary(\"asdd\");\n\t\tproject.setProjectDetails(det);\n\t\tproject.setType(\"DOCSMANAGE\");\n\t\tSet<ConstraintViolation<Project>> constraintViolations = validator.validate(project);\n\t\tassertEquals(constraintViolations.size(), 0);\n\t}", "public void performValidation() {\n/* 623 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "@Test\n\tpublic void testValidate() {\n\t\tSystem.out.println(\"starting testValidate()\");\n\t\tPersonalData personalData = new PersonalData(\"Kelvin\", \"Huynh\", \"4081234567\", \"[email protected]\");\n\t\tassertTrue (\"address validates\", personalData.validatePersonalData());\n\t System.out.println(\"testValidate PASSED\");\n\t}", "boolean isValidForNow ();", "public boolean isValid() {\r\n/* */ try {\r\n/* 326 */ validate();\r\n/* 327 */ } catch (ValidationException vex) {\r\n/* 328 */ return false;\r\n/* */ } \r\n/* 330 */ return true;\r\n/* */ }", "public void testCannotBeEmpty()\n {\n form.setVerificationCode(\"\");\n validator.validate(form, errors);\n assertTrue(errors.hasErrors());\n }", "private boolean isInputValid() {\n return true;\n }", "public void validateRpd22s4()\n {\n // This guideline cannot be automatically tested.\n }", "@Test\n @Disabled\n public void testValidateMatriculaCoche() {\n assertFalse(RegExprMain.validateMatriculaCoche(\"543 JTD\"));\n assertTrue(RegExprMain.validateMatriculaCoche(\"5432 JTD\"));\n assertFalse(RegExprMain.validateMatriculaCoche(\"5433 JAD\"));\n assertFalse(RegExprMain.validateMatriculaCoche(\"54333 JTD\"));\n assertTrue(RegExprMain.validateMatriculaCoche(\"5432 JTD\"));\n assertTrue(RegExprMain.validateMatriculaCoche(\"6784 CLD\"));\n assertTrue(RegExprMain.validateMatriculaCoche(\"4563 BVB\"));\n assertTrue(RegExprMain.validateMatriculaCoche(\"6789 LMN\"));\n assertTrue(RegExprMain.validateMatriculaCoche(\"2435 JKD\"));\n assertTrue(RegExprMain.validateMatriculaCoche(\"4567 GJD\"));\n \n\n }", "@Test\n\tpublic void testCase2()\n\t{\n\t\tint numberOfCases=-1;\n\t\t\n\t\t//checking number of case is positive or not\n\t\tboolean valid=BillEstimation.numberOfCaseValidation(numberOfCases);\n\t\tassertFalse(valid);\n\t\t\n\t}", "public boolean validateInput() {\n/* 158 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "@Test\n public void isValidDeadline() {\n assertFalse(Deadline.isValidDeadline(INVALID_0_JAN_2018.toString()));\n assertFalse(Deadline.isValidDeadline(INVALID_1ST_0_2018.toString()));\n\n // Valid deadline -> returns true\n assertTrue(Deadline.isValidDeadline(VALID_1ST_JAN_2018.toString()));\n\n // Valid deadline for february -> returns true\n assertTrue(Deadline.isValidDeadline(VALID_28TH_FEB_2018.toString()));\n\n // Invalid deadline for february in common year -> returns false\n assertFalse(Deadline.isValidDeadline(INVALID_29TH_FEB_2018.toString()));\n\n // Valid deadline for february during leap year -> returns true\n assertTrue(Deadline.isValidDeadline(VALID_29TH_FEB_2020.toString()));\n\n // Invalid deadline for february during leap year -> returns false\n assertFalse(Deadline.isValidDeadline(INVALID_30TH_FEB_2020.toString()));\n\n // Valid deadline for months with 30 days -> returns true\n assertTrue(Deadline.isValidDeadline(VALID_30TH_APR_2018.toString()));\n\n // Invalid deadline for months with 30 days -> returns false\n assertFalse(Deadline.isValidDeadline(INVALID_31ST_APR_2018.toString()));\n\n // Valid deadline for months with 31 days -> returns true\n assertTrue(Deadline.isValidDeadline(VALID_31ST_JAN_2018.toString()));\n\n // Invalid deadline for months with 31 days -> returns false\n assertFalse(Deadline.isValidDeadline(INVALID_32ND_JAN_2018.toString()));\n\n // Invalid month -> returns false\n assertFalse(Deadline.isValidDeadline(INVALID_1ST_0_2018.toString()));\n assertFalse(Deadline.isValidDeadline(INVALID_1ST_13_2018.toString()));\n\n // Valid month -> returns true\n assertTrue(Deadline.isValidDeadline(VALID_1ST_APR_2018.toString()));\n\n // Valid year -> returns true\n assertTrue(Deadline.isValidDeadline(VALID_1ST_JAN_9999.toString()));\n\n // Invalid year -> returns false\n assertFalse(Deadline.isValidDeadline(INVALID_1ST_JAN_2017.toString()));\n assertFalse(Deadline.isValidDeadline(INVALID_1ST_JAN_10000.toString()));\n\n // Valid date without year -> returns true\n assertTrue(Deadline.isValidDeadline(VALID_1ST_JAN_WITHOUT_YEAR.toString()));\n\n // Invalid date without year -> returns false\n assertFalse(Deadline.isValidDeadline(INVALID_32ND_JAN_WITHOUT_YEAR.toString()));\n }", "public void testInvalid() {\n\t\tassertNotNull(\"Should have compiler available (for testing to be available)\", this.compiler);\n\t}", "public void validate() throws Exception {\n }", "@Test(priority=6)\n\tpublic void validatePleaseEnterTheValueErrorMsg2()\n\t{\n\t\tc.enterNiftyPriceField.sendKeys(\"gvd&$vdh\");\n\t\tc.addButton.click();\n\t\tAssert.assertTrue(c.msg.getText().equalsIgnoreCase(\"Please Enter A Value.\"));\n\t}", "@Test\n public void testValidationFailed() {\n fail();\n }", "boolean valid() {\n return true;\n }", "boolean valid() {\n return true;\n }", "boolean valid() {\n return true;\n }", "@Override\r\n public boolean validate() {\n return true;\r\n }", "@Test\r\n void B6007089_test_SemeterMustNotBeNull() {\r\n System.out.println(\"\\n=======================================\");\r\n System.out.println(\"\\nTest Time Must Not Be Null\");\r\n System.out.println(\"\\n=======================================\\n\");\r\n Section section = new Section();\r\n section.setSec(\"1\");\r\n section.setTime(null);\r\n\r\n\r\n Set<ConstraintViolation<Section>> result = validator.validate(section);\r\n assertEquals(1, result.size());\r\n\r\n ConstraintViolation<Section> v = result.iterator().next();\r\n assertEquals(\"must not be null\", v.getMessage());\r\n assertEquals(\"time\", v.getPropertyPath().toString());\r\n }", "void telephoneValidity(M person) {\n // Valid data\n assignValidData(person);\n assertDoesNotThrow(person::checkDataValidity);\n person.setTelephone(\"+391111111111\");\n assertDoesNotThrow(person::checkDataValidity);\n person.setTelephone(\"1111111111\");\n assertDoesNotThrow(person::checkDataValidity);\n person.setTelephone(\"111 1111111\");\n assertDoesNotThrow(person::checkDataValidity);\n\n // Invalid data\n person.setTelephone(\"AAA\");\n assertThrows(InvalidFieldException.class, person::checkDataValidity);\n }", "@Test\n public void testIsNotValidRoman() {\n FieldVerifier service = new FieldVerifier();\n boolean result = service.isValidRoman(\"S\");\n assertEquals(false, result);\n }", "private static void checkValidity(boolean valid) throws InvalidExpression\r\n {\r\n if(!valid)\r\n {\r\n throw new InvalidExpression(\"The expression entered is not valid\");\r\n }\r\n }", "public boolean isValidated() throws Exception\r\n {\n return false;\r\n }", "private boolean isValidInput() {\n\t\treturn true;\n\t}", "@Test(priority=1)\n\tpublic void testEmailValidity() {\n\t\tsignup.clearAllFields();\n\t\tsignup.enterId(\"123@abc\");\n\t\tsignup.clickSubmit();\n\t\tList<String> errors = signup.getErrors();\n\t\tAssert.assertTrue(TestHelper.isStringPresent(errors, \"Please enter a valid email address in the format [email protected].\"));\n\t}", "void addressValidity(M person) {\n // Valid data\n assignValidData(person);\n assertDoesNotThrow(person::checkDataValidity);\n }", "abstract void telephoneValidity();", "@Test\n public void testCantRegisterInvalidEmail() {\n enterValuesAndClick(\"\", \"invalidemail\", \"123456\", \"123456\");\n checkErrors(nameRequiredError, emailInvalidError, pwdNoError, pwdRepeatNoError);\n }", "public void validateRpd22s7()\n {\n // This guideline cannot be automatically tested.\n }", "@Override\r\n\tpublic boolean validate() {\n\t\treturn true;\r\n\t}" ]
[ "0.7364573", "0.7339447", "0.7186488", "0.70789456", "0.70789456", "0.7054853", "0.70267725", "0.69557023", "0.68827915", "0.6860148", "0.681845", "0.6795239", "0.67394537", "0.6735985", "0.66892403", "0.66828334", "0.6674702", "0.667121", "0.6669576", "0.66646814", "0.66065323", "0.65998226", "0.65737385", "0.65736496", "0.6560041", "0.6557805", "0.6548103", "0.6541097", "0.6512161", "0.65090376", "0.65090376", "0.65090376", "0.65086806", "0.6508063", "0.64960396", "0.6488323", "0.6487054", "0.6486273", "0.6483009", "0.6475814", "0.6467764", "0.64646304", "0.6458354", "0.6438933", "0.6428053", "0.6423693", "0.6423693", "0.6423693", "0.6423693", "0.6423693", "0.64183426", "0.64023924", "0.6390685", "0.6390685", "0.6390685", "0.6390685", "0.6390685", "0.63904345", "0.63891643", "0.6387409", "0.637285", "0.6372525", "0.6370759", "0.6370659", "0.6366073", "0.6364629", "0.63503355", "0.6348652", "0.63458675", "0.6344378", "0.6344091", "0.6343674", "0.6336712", "0.6334146", "0.63312316", "0.63273853", "0.6323094", "0.63195735", "0.63106287", "0.6295384", "0.62864405", "0.6277176", "0.62715006", "0.6270354", "0.62634754", "0.62592816", "0.62592816", "0.62592816", "0.62579846", "0.6256558", "0.6239511", "0.622192", "0.6221764", "0.6220652", "0.62194234", "0.62192166", "0.62084264", "0.62078214", "0.6202984", "0.62019247", "0.6198213" ]
0.0
-1
/ /Reporting methods /
@Override public void generateReport(IvyXmlWriter xw,DyviseDatabase db,List<TraceLockLocation> used) { if (xw != null) { xw.begin("TYPE"); xw.field("KIND","JOIN"); xw.field("ID",++item_counter); for (TraceLockLocation tll : location_set) { tll.outputXml(xw,false); } xw.end("TYPE"); } used.addAll(location_set); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void report() {\n\t\t\n\t}", "abstract public void report();", "@Override\r\n\tpublic void report() {\r\n\t}", "@Override\r\n\t\t\tpublic void reporte() {\n\r\n\t\t\t}", "void printReport();", "@Override\n\tpublic void report() throws Exception {\n\t\t\n\t}", "private void printReport() {\n\t\tSystem.out.println(getReport());\n\t}", "public void generateReport()\r\n {\r\n ProfilerGUI reportGUI = new ProfilerGUI(map,mapCountTracker);\r\n //reportGUI.\r\n }", "@Override\n public void reportSmartDashboard() {\n }", "private void printReport() {\n\t\t\tSystem.out.println(\"Processed \" + this.countItems + \" items:\");\n\t\t\tSystem.out.println(\" * Labels: \" + this.countLabels);\n\t\t\tSystem.out.println(\" * Descriptions: \" + this.countDescriptions);\n\t\t\tSystem.out.println(\" * Aliases: \" + this.countAliases);\n\t\t\tSystem.out.println(\" * Statements: \" + this.countStatements);\n\t\t\tSystem.out.println(\" * Site links: \" + this.countSiteLinks);\n\t\t}", "public void writereport() {\n\t\n}", "public interface Reporting {\n ////////////////////////////////////////////////////////////////////////////////////\n // methods specific to reporting\n public String getName();\n\n public Date getDate();\n\n public String productBreakdown();\n}", "@Override\r\n\tpublic String finalReport() {\r\n\t\tif (ETParser.getLogger() != null) {\r\n\t\t\tETParser.getLogger()\r\n\t\t\t\t\t.getLogger()\r\n\t\t\t\t\t.info((float) multiples.size() / totalObjectsInHeap\r\n\t\t\t\t\t\t\t* PERCENTAGE\r\n\t\t\t\t\t\t\t+ \" % objects were created more than once.\");\r\n\t\t}\r\n\t\treturn (float) multiples.size() / totalObjectsInHeap * PERCENTAGE\r\n\t\t\t\t+ \" % objects were created more than once\";\r\n\t}", "public static void showStatistics(){\n\n }", "public BeansReportWrittenExamination() {\n\t\tsuper();\n\t}", "public abstract void getReport(java.io.Writer writer);", "public void report(){\n outTime = ElevatorControl.getTick();\n Report.addToReport(this);\n }", "protected abstract String getStatistics();", "public static void generateReport() {\n PrintImpl printer = new PrintImpl(realtorLogImpl, propertyLogImpl);\n printer.generateReport(REQUESTS_FILE);\n }", "@Override\n public void reportScheduler() {\n }", "@Override\n public void report() {\n\n try {\n File mFile = new File(\"/usr/local/etc/flink-remote/bm_files/metrics_logs/metrics.txt\");\n File eFile = new File(\"/usr/local/etc/flink-remote/bm_files/metrics_logs/latency_throughput.txt\");\n if (!mFile.exists()) {\n mFile.createNewFile();\n }\n if (!eFile.exists()) {\n eFile.createNewFile();\n }\n\n FileOutputStream mFileOut = new FileOutputStream(mFile, true);\n FileOutputStream eFileOut = new FileOutputStream(eFile, true);\n\n StringBuilder builder = new StringBuilder((int) (this.previousSize * 1.1D));\n StringBuilder eBuilder = new StringBuilder((int) (this.previousSize * 1.1D));\n\n// Instant now = Instant.now();\n LocalDateTime now = LocalDateTime.now();\n\n builder.append(lineSeparator).append(lineSeparator).append(now).append(lineSeparator);\n eBuilder.append(lineSeparator).append(lineSeparator).append(now).append(lineSeparator);\n\n builder.append(lineSeparator).append(\"---------- Counters ----------\").append(lineSeparator);\n eBuilder.append(lineSeparator).append(\"---------- records counter ----------\").append(lineSeparator);\n for (Map.Entry metric : counters.entrySet()) {\n builder.append(metric.getValue()).append(\": \").append(((Counter) metric.getKey()).getCount()).append(lineSeparator);\n if (( (String)metric.getValue()).contains(\"numRecords\")) {\n eBuilder.append(metric.getValue()).append(\": \").append(((Counter) metric.getKey()).getCount()).append(lineSeparator);\n }\n }\n\n builder.append(lineSeparator).append(\"---------- Gauges ----------\").append(lineSeparator);\n for (Map.Entry metric : gauges.entrySet()) {\n builder.append(metric.getValue()).append(\": \").append(((Gauge) metric.getKey()).getValue()).append(lineSeparator);\n }\n\n builder.append(lineSeparator).append(\"---------- Meters ----------\").append(lineSeparator);\n eBuilder.append(lineSeparator).append(\"---------- throughput ----------\").append(lineSeparator);\n for (Map.Entry metric : meters.entrySet()) {\n builder.append(metric.getValue()).append(\": \").append(((Meter) metric.getKey()).getRate()).append(lineSeparator);\n if (((String) metric.getValue()).contains(\"numRecords\")) {\n eBuilder.append(metric.getValue()).append(\": \").append(((Meter) metric.getKey()).getRate()).append(lineSeparator);\n }\n }\n\n builder.append(lineSeparator).append(\"---------- Histograms ----------\").append(lineSeparator);\n eBuilder.append(lineSeparator).append(\"---------- lantency ----------\").append(lineSeparator);\n for (Map.Entry metric : histograms.entrySet()) {\n HistogramStatistics stats = ((Histogram) metric.getKey()).getStatistics();\n builder.append(metric.getValue()).append(\": mean=\").append(stats.getMean()).append(\", min=\").append(stats.getMin()).append(\", p5=\").append(stats.getQuantile(0.05D)).append(\", p10=\").append(stats.getQuantile(0.1D)).append(\", p20=\").append(stats.getQuantile(0.2D)).append(\", p25=\").append(stats.getQuantile(0.25D)).append(\", p30=\").append(stats.getQuantile(0.3D)).append(\", p40=\").append(stats.getQuantile(0.4D)).append(\", p50=\").append(stats.getQuantile(0.5D)).append(\", p60=\").append(stats.getQuantile(0.6D)).append(\", p70=\").append(stats.getQuantile(0.7D)).append(\", p75=\").append(stats.getQuantile(0.75D)).append(\", p80=\").append(stats.getQuantile(0.8D)).append(\", p90=\").append(stats.getQuantile(0.9D)).append(\", p95=\").append(stats.getQuantile(0.95D)).append(\", p98=\").append(stats.getQuantile(0.98D)).append(\", p99=\").append(stats.getQuantile(0.99D)).append(\", p999=\").append(stats.getQuantile(0.999D)).append(\", max=\").append(stats.getMax()).append(lineSeparator);\n eBuilder.append(metric.getValue()).append(\": mean=\").append(stats.getMean()).append(\", min=\").append(stats.getMin()).append(\", p5=\").append(stats.getQuantile(0.05D)).append(\", p10=\").append(stats.getQuantile(0.1D)).append(\", p20=\").append(stats.getQuantile(0.2D)).append(\", p25=\").append(stats.getQuantile(0.25D)).append(\", p30=\").append(stats.getQuantile(0.3D)).append(\", p40=\").append(stats.getQuantile(0.4D)).append(\", p50=\").append(stats.getQuantile(0.5D)).append(\", p60=\").append(stats.getQuantile(0.6D)).append(\", p70=\").append(stats.getQuantile(0.7D)).append(\", p75=\").append(stats.getQuantile(0.75D)).append(\", p80=\").append(stats.getQuantile(0.8D)).append(\", p90=\").append(stats.getQuantile(0.9D)).append(\", p95=\").append(stats.getQuantile(0.95D)).append(\", p98=\").append(stats.getQuantile(0.98D)).append(\", p99=\").append(stats.getQuantile(0.99D)).append(\", p999=\").append(stats.getQuantile(0.999D)).append(\", max=\").append(stats.getMax()).append(lineSeparator);\n }\n\n mFileOut.write(builder.toString().getBytes());\n eFileOut.write(eBuilder.toString().getBytes());\n mFileOut.flush();\n eFileOut.flush();\n mFileOut.close();\n eFileOut.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n }", "@Test (priority=2)\n\tpublic void ReportingTest()\n\t{\n\t\tReportingPOM ReportPOM = new ReportingPOM(driver);\t\n\t\tReportPOM.clickReporting();\n\t\tWait = properties.getProperty(\"implicitWait\");\n\t\tReportPOM.clickFollowedStudents();\n\t\tscreenShot.captureScreenShot(\"17\");\t\n\t\t//Enter student name in keyword\t\n\t\tReportPOM.keyword(\"Kritika\");\n\t\t//Click on search button\t\n\t\tReportPOM.clicksearchbutton();\t\n\t\tscreenShot.captureScreenShot(\"18\");\n\t\t//Click on >> icon of the student name\n\t\tReportPOM.ClickArrow(); \t\n\t\tscreenShot.captureScreenShot(\"19\");\n\t\t//Click on course >> icon\n\t\tReportPOM.Clickcoursearrow();\n\t\tscreenShot.captureScreenShot(\"20\");\t\n\t\t// Click on quiz icon\n\t\tReportPOM.Clickquizicon(); \n\t\tscreenShot.captureScreenShot(\"21\");\n\t\t//Click on send email\n\t\tReportPOM.Clicknotification(); \n\t\t// Click on correct test\n\t\tReportPOM.Clickcorrecttest(); \n\t\tscreenShot.captureScreenShot(\"22\");\n\t\t//Click on course link \n\t\tReportPOM.ClickCourseName(); \n\t\tscreenShot.captureScreenShot(\"23\");\n\n\t}", "public GenerateReport() {\n initComponents();\n displayLogs();\n }", "void printReport(Object unit);", "void createReport() {\n\n // report about purple flowers\n println(\"\\nPurple flower distribution: \");\n for (int i = 0; i < 6; i++) {\n println(i + (i==5?\"+\":\"\") + \": \" + numPurpleFlowers[i]);\n }\n // report about missing treasures\n println(\"Missing treasure count: \" + missingTreasureCount);\n\n println(\"\\nGenerated \" + caveGenCount + \" sublevels.\");\n println(\"Total run time: \" + (System.currentTimeMillis()-startTime)/1000.0 + \"s\");\n\n out.close();\n }", "private void generateReports() {\r\n\t\tLOGGER.debug(\"Report generation trigerred\");\r\n\t\tgenerateIncomingReport();\r\n\t\tgenerateOutgoingReport();\r\n\t\tgenerateIncomingRankingReport();\r\n\t\tgenerateOutgoingRankingReport();\r\n\t\tLOGGER.debug(\"Report generation completed\");\r\n\t}", "public void makeReport()\n\t{\n\t\tif (currentStage[currentSlice-1] > 1)\n\t\t{\n\t\t\tResultsTable rt = new ResultsTable();\n\t\t\tfor (int j=0;j<popSequence.N;j++)\n\t\t\t{\n\t\t\t\tpop = popSequence.PopList[j];\n\t\t\t\tint N = pop.N;\n\t\t\t\tfor (int i=0;i<N;i++)\n\t\t\t\t{\n\t\t\t\t\trt.incrementCounter();\n\t\t\t\t\tBalloon bal;\n\t\t\t\t\tbal = (Balloon)(pop.BallList.get(i));\n\t\t\t\t\tbal.mass_geometry();\n\t\t\t\t\trt.addValue(\"X\",bal.x0);\n\t\t\t\t\trt.addValue(\"Y\",bal.y0);\n\t\t\t\t\trt.addValue(\"Z\",j);\n\t\t\t\t\trt.addValue(\"ID\",bal.id);\n\t\t\t\t\trt.addValue(\"AREA\",bal.area);\n\t\t\t\t\trt.addValue(\"Ixx\",bal.Ixx);\n\t\t\t\t\trt.addValue(\"Iyy\",bal.Iyy);\n\t\t\t\t\trt.addValue(\"Ixy\",bal.Ixy);\n\t\t\t\t\trt.addValue(\"Lx\",bal.lx);\n\t\t\t\t\trt.addValue(\"Ly\",bal.ly);\n\t\t\t\t}\n\t\t\t}\n\t\t\trt.show(\"Report\");\n\t\t\tcurrentSlice = i1.getCurrentSlice();\n\t\t\tipWallSegment = (i1.getStack()).getProcessor(i1.getCurrentSlice());\n\t\t\tpop = popSequence.PopList[currentSlice-1];\n\t\t}\n\t}", "Report createReport();", "void statistics();", "@Postprocess\n public void getReport() {\n try {\n BufferedWriter bufferWriter = new BufferedWriter(new FileWriter(logfile, false));\n if (!results.isEmpty()) {\n bufferWriter.write(\"===========================================================\\n\");\n bufferWriter.write(\"sys_milli,\\t\\tdb_micro,\\t\\ttime_diff\\n\");\n Collections.sort(results);\n for (MysqlheartbeatBean mhb : results) {\n bufferWriter.write(String.valueOf(mhb.getSysMilli()) + \",\\t\\t\"\n + String.valueOf(mhb.getDbMicro()) + \",\\t\\t\"\n + String.valueOf(mhb.getDbMicro() - mhb.getSysMilli()) + \"\\n\");\n }\n bufferWriter.flush();\n }\n bufferWriter.close();\n } catch (IOException ex) {\n logger.log(Level.SEVERE, \"{0}: {1}\", new Object[]{toolName, ex.getMessage()});\n }\n }", "public abstract void parseReport();", "private void getDateForAnalysisReport() {\n \tArrayList<Object> answer = new ArrayList<>();\n\t\tanswer.add(\"performingAnActivityTracking\");\n\t\tanswer.add(\"/getActivityData\");\n\t\tString star = reportStartDate.getValue().toString();\n\t\tString end = reportEndDate.getValue().toString();\n\t\tanswer.add(star);\n\t\tanswer.add(end);\n\t\t\n\t\tchs.client.handleMessageFromClientUI(answer);\n\t}", "public void reportStats() {\n System.out.println(\"Number of requests: \" + (requestCount - warmUpRequests));\n System.out.println(\"Number of hits: \" + hitCount);\n System.out.println(\"hit ratio: \" + (double) hitCount / (requestCount - warmUpRequests));\n System.out.println(\"Average hit cost: \" + (double) hitCost / hitCount);\n }", "public abstract void report(String string);", "void startReportingTask();", "boolean generateReport();", "private void SummaryReport()\n {\n System.out.println(\"\\n\\n***********************************************************************\");\n System.out.println(\"* CodeScanner Summary Report\");\n System.out.println(\"*\");\n System.out.println(\"* Run Date: \" + new SimpleDateFormat(\"yyyy.MM.dd HH:mm:ss\").format(new Date()));\n System.out.println(\"* Yaml File: \" + confFileName);\n System.out.println(\"* Code Path: \" + startPath);\n System.out.println(\"*\");\n System.out.println(\"* Dir include pattern: \" + dirIncludePattern.toString());\n System.out.println(\"* Dir exclude pattern: \" + dirExcludePattern.toString());\n System.out.println(\"* Directories scanned: \" + dirCount);\n System.out.println(\"* Directories matched: \" + dirMatchCount);\n System.out.println(\"* Dir Line matched: \" + dirLineMatchCount);\n System.out.println(\"*\");\n System.out.println(\"* File include pattern: \" + fileIncludePattern.toString());\n System.out.println(\"* File exclude pattern: \" + fileExcludePattern.toString());\n System.out.println(\"* Files scanned: \" + fileCount);\n System.out.println(\"* Files matched: \" + fileMatchCount);\n System.out.println(\"* Files Line matched: \" + fileLineMatchCount);\n System.out.println(\"*\");\n System.out.println(\"* Line replace pattern: \" + lineFindReplace.toString());\n System.out.println(\"* Line include pattern: \" + lineIncludePattern.toString());\n System.out.println(\"* Line exclude pattern: \" + lineExcludePattern.toString());\n System.out.println(\"* Lines replaced: \" + totalReplaceCount);\n System.out.println(\"* Lines scanned: \" + totalLineCount);\n System.out.println(\"* Lines matched: \" + lineMatchCount);\n System.out.println(\"*\");\n System.out.println(\"* Distinct Matching URLs Found\");\n\n for (String url : distinctURLs.values())\n {\n String ipAddress = \"\";\n try\n {\n InetAddress address = InetAddress.getByName(new URL(\"https://\" + url).getHost());\n ipAddress = address.getHostAddress();\n\n }\n catch(Exception ex)\n {\n ipAddress = \"not found\";\n }\n\n System.out.println(\"* \" + url + \" (\" + ipAddress + \")\");\n }\n\n System.out.println(\"*\");\n System.out.println(\"***********************************************************************\");\n }", "abstract protected void reportResult(Result result);", "protected abstract void handleReport (Message msg);", "public Report getReport();", "private void getStatus() {\n\t\t\n\t}", "public void report() \r\n\t{\r\n\t\tSystem.out.println(\"continuous counter\\n\");\r\n\t\tsuper.report();\r\n\t\tSystem.out.println(\"interval length: \" + (lastSampleTime - firstSampleTime));\r\n\t}", "protected Report()\n {\n super();\n }", "public void report() {\n\t\tfor (Plant p : plants) {\r\n\t\t\tp.list();\r\n\t\t}\r\n\t\tfor (Fish f: fishes) {\r\n\t\t\tf.list();\r\n\t\t}\r\n\t}", "public void tracking_Report()\n {\n\t boolean trackingpresent =trackingreport.size()>0;\n\t if(trackingpresent)\n\t {\n\t\t //System.out.println(\"Tracking report is PRESENT\");\n\t }\n\t else\n\t {\n\t\t System.out.println(\"Tracking report is not present\");\n\t }\n }", "public void logData(){\n }", "public String generateReport() {\n throw new UnsupportedOperationException(\"ERROR: generateReport() Not yet implemented.\");\n }", "public void summaryReport() {\r\n\r\n\t\tString strTimeStamp = new SimpleDateFormat(\"yyyy-MM-dd-HH-mm-ss\").format(new Date());\r\n\t\tString reportPath = new File(\"Report\").getAbsolutePath();\r\n\t\tint stepPassed = 0;\r\n\t\tint stepFailed = 0;\r\n\t\tString cssData = \"\";\r\n\r\n\t\ttry {\r\n\t\t\tString cssPath = new File(\"Report\\\\Style\\\\style.css\").getAbsolutePath();\r\n\t\t\tbufferedReader = new BufferedReader(new FileReader(cssPath));\r\n\r\n\t\t\tStringBuilder stringBuilder = new StringBuilder();\r\n\t\t\tString line = bufferedReader.readLine();\r\n\t\t\twhile (line != null) {\r\n\t\t\t\tstringBuilder.append(line);\r\n\t\t\t\tstringBuilder.append(System.lineSeparator());\r\n\t\t\t\tline = bufferedReader.readLine();\r\n\t\t\t}\r\n\t\t\tcssData = stringBuilder.toString();\r\n\t\t} catch (Exception ex) {\r\n\t\t\tLog.error(\"Exception occure in reading file\" + ex.getMessage());\r\n\t\t\tex.printStackTrace();\r\n\t\t} finally {\r\n\t\t\ttry {\r\n\t\t\t\tbufferedReader.close();\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\tLog.error(\"Exception occure in reading file\");\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t\tFile HTMLDir = new File(reportPath + \"\\\\HTMLReport\");\r\n\t\tif (!HTMLDir.exists()) {\r\n\t\t\ttry {\r\n\t\t\t\tHTMLDir.mkdir();\r\n\t\t\t} catch (SecurityException ex) {\r\n\t\t\t\tLog.error(\"Error in creating HTMLReport directory\" + ex.getMessage());\r\n\t\t\t\t// log.error(\"Error in creating Detail directory\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tString htmlname = HTMLDir + \"\\\\\" + strTimeStamp + \".html\";\r\n\t\tString logoPath = new File(\"Report\\\\Style\\\\logo.png\").getAbsolutePath();\r\n\t\tfor (ReportBean reportValue : GlobalVariables.getReportList()) {\r\n\t\t\tif (reportValue.getStatus().equalsIgnoreCase(\"Failed\")) {\r\n\t\t\t\tstepFailed++;\r\n\t\t\t} else if (reportValue.getStatus().equalsIgnoreCase(\"Passed\")) {\r\n\t\t\t\tstepPassed++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tstrBufferReportAppend = new StringBuffer();\r\n\t\ttry {\r\n\t\t\tbufferedWriter = new BufferedWriter(new FileWriter(htmlname));\r\n\t\t} catch (IOException e) {\r\n\t\t\tLog.error(\"Error in wrinting the file\" + e.getMessage());\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\tstrBufferReportAppend.append(\r\n\t\t\t\t\"<html><head><script type=\\\"text/javascript\\\" src=\\\"https://www.gstatic.com/charts/loader.js\\\"></script>\");\r\n\t\tstrBufferReportAppend.append(\"<script src=\\\"https://www.google.com/jsapi\\\"></script>\");\r\n\t\tstrBufferReportAppend.append(\"<style>\" + cssData);\r\n\t\tstrBufferReportAppend.append(\"</style>\");\r\n\t\tstrBufferReportAppend.append(\"</head><body>\");\r\n\t\tstrBufferReportAppend.append(\"<table class=\\\"width100\\\">\");\r\n\t\tstrBufferReportAppend.append(\"<tr><td>\");\r\n\t\tstrBufferReportAppend.append(\"<table class=\\\"width100\\\">\");\r\n\t\tstrBufferReportAppend.append(\"<tr><td><img src=file:\\\\\\\\\" + logoPath + \"></td>\" + \"<td class=\\\"headertext\\\">\"\r\n\t\t\t\t+ reportHeader + \"</td>\");\r\n\r\n\t\tstrBufferReportAppend.append(\"</tr></table><hr></hr>\");\r\n\t\tstrBufferReportAppend.append(\"</td></tr>\");\r\n\t\tstrBufferReportAppend.append(\"<tr><td>\");\r\n\t\tstrBufferReportAppend.append(\"<table class=\\\"width100\\\">\");\r\n\t\tstrBufferReportAppend.append(\"<tr><td class=\\\"width50\\\">\");\r\n\t\tstrBufferReportAppend.append(\"<table cellpadding=3 cellspacing=1>\");\r\n\t\tstrBufferReportAppend\r\n\t\t.append(\"<tr><td class=\\\"width50 bold\\\">Execution Start Time</td><td class=\\\"width50 bold\\\">\"\r\n\t\t\t\t+ GlobalVariables.getStrStartTime() + \"</td></tr>\");\r\n\t\tstrBufferReportAppend\r\n\t\t.append(\"<tr><td class=\\\"width50 bold\\\">Execution End Time</td><td class=\\\"width50 bold\\\">\"\r\n\t\t\t\t+ GlobalVariables.getStrEndTime() + \"</td></tr>\");\r\n\t\tstrBufferReportAppend\r\n\t\t\t\t.append(\"<tr><td class=\\\"width50 bold\\\">Total TestSteps Executed</td><td class=\\\"width50 bold\\\">\"\r\n\t\t\t\t\t\t+ (stepFailed + stepPassed) + \"</td></tr>\");\r\n\t\tstrBufferReportAppend.append(\r\n\t\t\t\t\"<tr><td class=\\\"width50 green\\\">Passed</td><td class=\\\"width50 green\\\">\" + stepPassed + \"</td></tr>\");\r\n\t\tstrBufferReportAppend.append(\r\n\t\t\t\t\"<tr><td class=\\\"width50 red\\\">Failed</td><td class=\\\"width50 red\\\">\" + stepFailed + \"</td></tr>\");\r\n\t\tstrBufferReportAppend.append(\"</table></td>\");\r\n\t\tstrBufferReportAppend.append(\"<td class=\\\"width50\\\">\");\r\n\t\tstrBufferReportAppend.append(\"<table>\");\r\n\t\tstrBufferReportAppend.append(\"<tr><td class=\\\"width25\\\">\");\r\n\t\tstrBufferReportAppend.append(\"</td>\");\r\n\t\tstrBufferReportAppend.append(\"<td class=\\\"width25\\\">\");\r\n\t\tstrBufferReportAppend.append(\"<script type=\\\"text/javascript\\\">\");\r\n\t\tstrBufferReportAppend.append(\"google.charts.load('current', {'packages':['corechart']});\");\r\n\t\tstrBufferReportAppend.append(\"google.charts.setOnLoadCallback(drawDetailsChart);\");\r\n\t\tstrBufferReportAppend.append(\"function drawDetailsChart() {\");\r\n\t\tstrBufferReportAppend.append(\"var data = new google.visualization.DataTable();\");\r\n\t\tstrBufferReportAppend.append(\"data.addColumn('string', 'Test Execution Detail Graph');\");\r\n\t\tstrBufferReportAppend.append(\"data.addColumn('number', 'Count');\");\r\n\t\tstrBufferReportAppend.append(\"data.addRows([\");\r\n\t\tstrBufferReportAppend.append(\"['Passed',\" + stepPassed + \"],\");\r\n\t\tstrBufferReportAppend.append(\"['Failed',\" + stepFailed + \"]]);\");\r\n\t\tstrBufferReportAppend\r\n\t\t\t\t.append(\"var options = {'title':'Test Step Details Graph',colors: ['#12C909', '#C3100A'],pieHole: 0.3,\");\r\n\t\tstrBufferReportAppend.append(\"'width':300,\");\r\n\t\tstrBufferReportAppend.append(\"'height':170};\");\r\n\t\tstrBufferReportAppend\r\n\t\t\t\t.append(\"var chart = new google.visualization.PieChart(document.getElementById('detailsChart_div'));\");\r\n\t\tstrBufferReportAppend.append(\"chart.draw(data, options); } </script>\");\r\n\t\tstrBufferReportAppend.append(\"<div id=\\\"detailsChart_div\\\"></div>\");\r\n\t\tstrBufferReportAppend.append(\"</td></tr></table>\");\r\n\t\tstrBufferReportAppend.append(\"</td></tr></table><hr></hr></td></tr>\");\r\n\t}", "public String generalReport() throws Exception{\r\n\t\tForm16MisReportModel model = new Form16MisReportModel();\r\n\t\tmodel.initiate(context, session);\r\n\t\tmodel.generateReport(request, response, bulkForm16);\r\n\t\tmodel.terminate();\r\n\t\treturn null;\r\n\t}", "public void detailReport() {\r\n\t\tint testStepId = 1;\r\n\t\tstrBufferReportAppend.append(\r\n\t\t\t\t\"<tr><td><table class=\\\"width100\\\"><tr><td><div class=\\\"headertext1 bold\\\">Test Execution Detail Report</div></td></tr>\");\r\n\t\tstrBufferReportAppend.append(\r\n\t\t\t\t\"<tr><td><div class=\\\"headertext1 bold\\\">Execution Browser Name: \"+ GlobalVariables.getBrowserName() + \"</div></td></tr>\");\r\n\t\tstrBufferReportAppend.append(\r\n\t\t\t\t\"<tr><td><div class=\\\"headertext1 bold\\\">Test Case Name: \"+ GlobalVariables.getTestCaseName() + \"</div></td></tr>\");\r\n\t\t\r\n\t\t\r\n\t\tstrBufferReportAppend.append(\"<tr><td>\");\r\n\t\tstrBufferReportAppend\r\n\t\t\t\t.append(\"<table colspan=3 border=0 cellpadding=3 cellspacing=1 class=\\\"reporttable width100\\\">\");\r\n\t\tstrBufferReportAppend.append(\"<tr><th class=\\\"auto-style1\\\">Test Step No</th>\" + \"<th class=\\\"auto-style2\\\">Action</th>\"\r\n\t\t\t\t+ \"<th class=\\\"auto-style3\\\">Actual Result</th>\" + \"<th class=\\\"auto-style4\\\">Status</th></tr>\");\r\n\t\tfor (ReportBean reportValue : GlobalVariables.getReportList()) {\r\n\r\n\t\t\tif (reportValue.getStatus().equalsIgnoreCase(\"Passed\")) {\r\n\r\n\t\t\t\tstrBufferReportAppend.append(\"<tr>\" + \"<td class=\\\"auto-style1 blue\\\">\" + testStepId++ + \"</td>\"// teststepid\r\n\t\t\t\t\t\t+ \"<td class=\\\"auto-style2 blue\\\">\" + reportValue.getStrAction() + \"</td>\"\r\n\t\t\t\t\t\t+ \"<td class=\\\"auto-style3 blue\\\">\" + reportValue.getResult() + \"</td>\"\r\n\t\t\t\t\t\t+ \"<td class=\\\"auto-style4 green\\\">\" + reportValue.getStatus() + \"</td></tr>\");\r\n\t\t\t} else if (reportValue.getStatus().equalsIgnoreCase(\"Failed\")) {\r\n\t\t\t\tstrBufferReportAppend.append(\"<tr>\" + \"<td class=\\\"auto-style1 blue\\\">\" + testStepId++ + \"</td>\"// teststepid\r\n\t\t\t\t\t\t+ \"<td class=\\\"auto-style2 blue\\\">\" + reportValue.getStrAction() + \"</td>\"\r\n\t\t\t\t\t\t+ \"<td class=\\\"auto-style3 blue\\\">\" + reportValue.getResult() + \"</td>\"\r\n\t\t\t\t\t\t+ \"<td class=\\\"auto-style4 red\\\">\" + reportValue.getStatus() + \"</td></tr>\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tstrBufferReportAppend.append(\"</table>\");\r\n\t\tstrBufferReportAppend.append(\"</td></tr>\");\r\n\t\tstrBufferReportAppend.append(\"</table></td></tr></table></body></html>\");\r\n\t}", "public static void main(String[] args) { \n processDataFile();\n realtorLogImpl.traverseDisplay();\n System.out.println();\n propertyLogImpl.traverseDisplay();\n System.out.println();\n generateReport();\n }", "public final void report() {\n double err = classError();\n assert _valid : \"Trying to report status of invalid CM!\";\n\n SpeeDRFModel model = UKV.get(_SpeeDRFModelKey);\n String s =\n \" Type of random forest: classification\\n\"\n + \" Number of trees: \" + model.size() + \"\\n\"\n + \"No of variables tried at each split: \" + model.mtry + \"\\n\"\n + \" Estimate of err. rate: \" + Math.round(err * 10000) / 100 + \"% (\" + err + \")\\n\"\n + \" OOBEE: \" + (_computedOOB ? \"YES (sampling rate: \"+model.sample*100+\"%)\" : \"NO\")+ \"\\n\"\n + \" Confusion matrix:\\n\"\n + toString() + \"\\n\"\n + \" CM domain: \" + Arrays.toString(_domain) + \"\\n\"\n + \" Avg tree depth (min, max): \" + model.depth() + \"\\n\"\n + \" Avg tree leaves (min, max): \" + model.leaves() + \"\\n\"\n + \" Validated on (rows): \" + rows() + \"\\n\"\n + \" Rows skipped during validation: \" + skippedRows() + \"\\n\"\n + \" Mispredictions per tree (in rows): \" + Arrays.toString(_errorsPerTree)+\"\\n\";\n Log.info(Sys.RANDF,s);\n }", "public void autoDetails() {\n\t\t\r\n\t}", "private String printData() {\n reportStar += \"Total insert Stars: \" + insertStarStatus + \".\\n\";\n reportStar += \"Duplicates Stars found: \" + duplicatesStar + \". \\n\";\n return reportStar;\n }", "@VisibleForTesting\n void reportOnce() {\n additionalAttributes = additionalAttributesSupplier.get();\n if (additionalAttributes == null) {\n additionalAttributes = Collections.emptyMap();\n }\n\n metricRegistry.getGauges().forEach(this::reportGauge);\n\n metricRegistry.getCounters().forEach(this::reportCounter);\n\n metricRegistry.getMeters().forEach(this::reportMeter);\n\n metricRegistry.getHistograms().forEach(this::reportHistogram);\n\n metricRegistry.getTimers().forEach(this::reportTimer);\n }", "public static void generateReport()\n\t{\n\t\tlong time=System.currentTimeMillis();\n\t\tString reportPath=System.getProperty(\"user.dir\")+\"//automationReport//Report\"+time+\".html\";\n\t\t\n\t\thtmlreporter=new ExtentHtmlReporter(reportPath);\n\t\textent=new ExtentReports();\n\t\textent.attachReporter(htmlreporter);\n\t\t\n\t\tString username=System.getProperty(\"user.name\");\n\t\tString osname=System.getProperty(\"os.name\");\n\t\tString browsername=CommonFunction.readPropertyFile(\"Browser\");\n\t\tString env=CommonFunction.readPropertyFile(\"Enviornment\");\n\t\t\n\t\t\n\t\textent.setSystemInfo(\"User Name\", username);\n\t\textent.setSystemInfo(\"OS Name\", osname);\n\t\textent.setSystemInfo(\"Browser Name\", browsername);\n\t\textent.setSystemInfo(\"Enviornment\", env);\n\t\t\n\t\t\n\t\thtmlreporter.config().setDocumentTitle(\"Automation Report\");\n\t\thtmlreporter.config().setTheme(Theme.STANDARD);\n\t\thtmlreporter.config().setChartVisibilityOnOpen(true);\n \n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t}", "public void finish() {\n printReport();\n printGlobalOpsPerSec();\n }", "@SuppressWarnings(\"unused\")\n private void generateInfo()\n {\n }", "public Report() {\n\t\tsuper();\n\t}", "public abstract void generateReport(Date from, Date to, String objectCode);", "public static void Report() {\n\t\tfor (int i = 0; i < array.size(); i++) {\r\n\t\t\tSystem.out.println(array.get(i).getDetails());\t\t\t//Steps through the array and prints the details\r\n\t\t}\r\n\t\tAdmin.menuChoice();\r\n\t}", "@Test\n\tpublic void testBasicReportExecution() \n\t{\n\t\tString testTeam = \"USA\";\n\t\t\n\t\ttry \n\t\t{\n\t\t\tReportParameters rp = new ReportParameters();\n\t\t\t\n\t\t\trp.addSupportedParameter(ParameterInfo.START_DATE_PARAM);\n\t\t\trp.addSupportedParameter(ParameterInfo.END_DATE_PARAM);\n\t\t\trp.addSupportedParameter(ParameterInfo.AGENT_NAMES_PARAM);\n\t\t\trp.addSupportedParameter(ParameterInfo.TEAM_NAMES_PARAM);\n\t\t\trp.addSupportedParameter(ParameterInfo.USER_GRAIN_PARAM);\n\t\t\trp.addSupportedParameter(ParameterInfo.TIME_GRAIN_PARAM);\n\t\t\trp.addSupportedParameter(ParameterInfo.NUM_DRIVERS_PARAM);\n\t\t\trp.addSupportedParameter(ParameterInfo.REPORT_TYPE_PARAM);\n\t\t\trp.addSupportedParameter(ParameterInfo.SOURCE_PARAM);\n\t\t\t\n\t\t\tassertTrue(\"Set stack report\", rp.setReportType(ReportTypes.STACK_REPORT));\n\t\t\t//assertTrue(\"Add agent to report\", rp.addAgentName(testAgent));\n\t\t\tassertTrue(\"Add team to report\", rp.addTeamName(testTeam));\n\t\t\tassertTrue(\"Set report start date\", rp.setStartDate(\"2014-01-01 00:00:00\"));\n\t\t\tassertTrue(\"Set report end date\", rp.setEndDate(\"2014-03-01 23:59:59\"));\n\t\t\tassertTrue(\"Set user granularity for stack report\", rp.setUserGrain(UserGrains.TEAM_GRANULARITY));\n\t\t\tassertTrue(\"Set report source\", rp.setSource(\"JUnit\"));\n\t\t\t\n\t\t\t//report needs roster members\n\t\t\tReport report = proc.startReport(testReportClassName, rp);\n\t\t\tArrayList<String[]> actualResults = report.getData();\n\t\t\t\n\t\t\tassertNotNull(\"Non-null result set\", actualResults);\n\t\t\tassertTrue(\"Check that result set is non zero size\", actualResults.size() > 0);\n\t\t\tassertTrue(\"Check that result set is expected size\", actualResults.size() == 1);\n\t\t\t\n\t\t\tassertEquals(\"Correct team membership\", testTeam, actualResults.get(0)[0]);\n\t\t} \n\t\tcatch (ClassNotFoundException e) \n\t\t{\n\t\t\te.printStackTrace();\n\t\t\tassertFalse(\"Exception executing report\", true);\n\t\t}\n\t}", "private ReportGenerationUtil() {\n\t\t\n\t}", "void displayReport ()\n {\n\tStatFrame statTable;\n String winTitle = new String (\"Statistical Results Window\");\n\n\tif (use_xml) {\n\t try {\n\t\tVector data = new Vector (); data.add (modelReport);\n\t\tString xmlStr = XMLSerializer.serialize (data);\n\t\tstatTable = new StatFrame (winTitle, xmlStr);\n\t } catch (Exception e) {\n\t\ttrc.tell (\"displayReport\", e.getMessage ());\n\t\te.printStackTrace ();\n\t\treturn;\n\t }\n\t} else {\n statTable = new StatFrame (winTitle, modelReport);\n\t}; // if\n\n statTable.showWin ();\n\n }", "private static void showsExtendAndQueryParameters() {\n\n\t\tQuery<BugReport> queryNoneAssigned = Ebean.createQuery(BugReport.class,\n\t\t\t\"assignedStatusCount\");\n\t\tqueryNoneAssigned.setParameter(\"status\", \"NEW\");\n\t\tqueryNoneAssigned.setParameter(\"count\", 0);\n\t\tqueryNoneAssigned.where().isNotNull(\"assigned.id\");\n\n\t\tList<BugReport> newBugsAssigned = queryNoneAssigned.findList();\n\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(\"\");\n\t\tSystem.out.println(\"\");\n\n\t\tfor (BugReport bugReport : newBugsAssigned) {\n\t\t\tInteger userId = bugReport.getAssigned().getId();\n\t\t\tint count = bugReport.getCount();\n\t\t\tString status = bugReport.getStatus().getCode();\n\n\t\t\tSystem.out.println(\" new bugs assigned: \" + count + \" to \" + userId + \" as \" + status);\n\t\t}\n\t}", "void dumpStats() {\n long wallTimeNanos = totalStopwatch.elapsed(TimeUnit.NANOSECONDS);\n long dbtime = 0;\n for (String name : methodCalls.keySet()) {\n long calls = methodCalls.get(name);\n long time = methodTotalTime.get(name);\n dbtime += time;\n long average = time / calls;\n double proportion = (time + 0.0) / (wallTimeNanos + 0.0);\n log.info(name + \" c:\" + calls + \" r:\" + time + \" a:\" + average + \" p:\" + String.format(\"%.2f\", proportion));\n }\n double dbproportion = (dbtime + 0.0) / (wallTimeNanos + 0.0);\n double hitrate = (hit + 0.0) / (hit + miss + 0.0);\n log.info(\"Cache size:\" + utxoCache.size() + \" hit:\" + hit + \" miss:\" + miss + \" rate:\"\n + String.format(\"%.2f\", hitrate));\n bloom.printStat();\n log.info(\"hasTxOut call:\" + hasCall + \" True:\" + hasTrue + \" False:\" + hasFalse);\n log.info(\"Wall:\" + totalStopwatch + \" percent:\" + String.format(\"%.2f\", dbproportion));\n String stats = db.getProperty(\"leveldb.stats\");\n System.out.println(stats);\n\n }", "private static void reportStatistics() {\n SmartDashboard.putNumber(\"Speed value\", speed);\n SmartDashboard.putNumber(\"Desired RPM\", kVelocitySetpoint);\n SmartDashboard.putNumber(\"Error\", error);\n SmartDashboard.putNumber(\"ErrorSum\", errorSum);\n SmartDashboard.putNumber(\"Flywheel Velocity (Master)\", -flywheelMaster.getSelectedSensorVelocity());\n\n if(d >= kMinThreePoint && d <= kMaxThreePoint) { //If we are in the range for a 3-point shot\n threePointDistanceEntry.setBoolean(true); //Alert operator\n } else { //If we are not in the range for a 3-point shot\n threePointDistanceEntry.setBoolean(false); //Alert operator\n }\n\n if(d >= kMinViableRange && d <= kMaxViableRange) { //If we are in the viable range for any power port shot\n viableDistanceEntry.setBoolean(true); //Alert operator\n } else { //If we cannot make a shot into the power port\n viableDistanceEntry.setBoolean(false); //Alert operator\n }\n }", "protected void thoroughInspection() {}", "public void contactScheduleReport() {\n reportLabel.setText(\"\");\n reportLabel1.setText(\"\");\n reportLabel2.setText(\"\");\n reportLabel3.setText(\"\");\n reportsList = DBReports.getContactSchedule();\n StringBuilder sb = new StringBuilder();\n sb.append(\"Appointments Schedule By Contact Report: \\n\");\n int id = 0;\n for (Reports r : reportsList) {\n if (r.getContactId() != id) {\n sb.append(\"\\n\" + r.getContactName().toUpperCase() + \"\\n\");\n sb.append(\"Appt. ID: \" + r.getAppointmentId() + \" \\t Title: \" + r.getTitle() + \" \\t Type: \" +\n r.getType() + \" \\t Desc: \" + r.getDescription() + \" \\t Start: \" +\n dateTimeFormatter.format(r.getStart().toLocalDateTime()) + \" \\t End: \" +\n dateTimeFormatter.format(r.getEnd().toLocalDateTime()) + \" \\t Customer ID: \" +\n r.getCustomerId() + \"\\n\");\n id = r.getContactId();\n } else {\n sb.append(\"Appt. ID: \" + r.getAppointmentId() + \" \\t Title: \" + r.getTitle() + \" \\t Type: \" +\n r.getType() + \" \\t Desc: \" + r.getDescription() + \" \\t Start: \" +\n dateTimeFormatter.format(r.getStart().toLocalDateTime()) + \" \\t End: \" +\n dateTimeFormatter.format(r.getEnd().toLocalDateTime()) + \" \\t Customer ID: \" +\n r.getCustomerId() + \"\\n\");\n }\n }\n reportLabel.setText(sb.toString());\n }", "private void reportAggregatingAccess() {\n delegate.forEach(this::reportKeyAndValue);\n }", "public ActionReport getActionReport();", "public void summary (java.io.PrintStream out) { throw new RuntimeException(); }", "private void writeFinalReports() {\n\t\tSystem.out.println(\"Printing data to output files ...\");\n\t\twritePropertyData();\n\t\twriteClassData();\n\t\tSystem.out.println(\"Finished printing data.\");\n\t}", "public void viewLogs() {\n\t}", "private void printStatistics() {\n\t\t\r\n\t\tSystem.out.println(\"End of simulation report\\n\");\r\n\t\tSystem.out.println(\"\\t# total arrival customers \t\t\t: \" + customerIDCounter);\r\n\t\tSystem.out.println(\"\\t# customers turned-away \t\t: \" + numTurnedAway);\r\n\t\tSystem.out.println(\"\\t# customers served \t\t\t: \" + numServed + \"\\n\");\r\n\t\tSystem.out.println(\"\\t*** Current Tellers Info ***\\n\\n\");\r\n\t\tservicearea.printStatistics();\r\n\t\tSystem.out.println(\"\\n\\n\\tTotal waiting time \t\t\t\t: \" + totalWaitingTime);\r\n\t\tSystem.out.println(\"\\tAverage waiting time \t\t\t: \"\r\n\t\t\t\t+ (double) totalWaitingTime / (customerIDCounter - numTurnedAway));\r\n\t\tSystem.out.println(\"\\n\\n\\tBusy Tellers (\" + servicearea.numBusyTellers() + \") Info\\n\\n\");\r\n\t\tfor (int i = 0; i < servicearea.numBusyTellers();) {\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// loops through busyTellerQ\r\n\t\t\tTeller nextBusyTeller = servicearea.removeBusyTellerQ();\t\t\t\t\t\t\t\t\t\t\t\t\t\t// empties queue and prints\r\n\t\t\tnextBusyTeller.printStatistics();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// teller statistics\r\n\t\t}\r\n\t\tSystem.out.println(\"\\n\\tFree Tellers (\" + servicearea.numFreeTellers() + \") Info\\n\\n\");\r\n\t\tfor (int i = 0; i < servicearea.numFreeTellers();) {\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// loops through freeTellerQ\r\n\t\t\tTeller nextFreeTeller = servicearea.removeFreeTellerQ();\t\t\t\t\t\t\t\t\t\t\t\t\t\t// empties queue and prints\r\n\t\t\tnextFreeTeller.printStatistics();\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// teller statistics\r\n\t\t\tSystem.out.println(\"\\n\");\r\n\t\t}\r\n\t}", "void generateMgiCrisprAlleleReport();", "private void userReport() {\n reportText.appendText(\"Report of appointments per User\\n\\n\");\n for (User user: Data.getUsers()) {\n reportText.appendText(\"\\n\\nUser: \" + user.getUsername() + \"\\n\");\n for (Appointment appointment: Data.getAppointments()) {\n if (appointment.getUser() == user.getId()) {\n reportText.appendText(\"Appointment ID: \" + appointment.getId() +\n \" \\tTitle: \" + appointment.getTitle() +\n \"\\tType: \" + appointment.getType() +\n \"\\tDescription: \" + appointment.getDescription() +\n \"\\tStart: \" + appointment.getStart() +\n \"\\tEnd: \" + appointment.getEnd() +\n \"\\tCustomer: \" + appointment.getCustomer() + \"\\n\");\n }\n System.out.println(\"\\n\\n\");\n }\n }\n\n }", "private void contactReport() {\n reportText.appendText(\"Report of appointments per Contact\\n\\n\");\n for (Contact contact: Data.getContacts()) {\n\n reportText.appendText(\"\\n\\nContact:\" + contact.getContactName() + \"\\n\\n\");\n for (Appointment appointment: Data.getAppointments()) {\n if (appointment.getContact() == contact.getContactID()) {\n reportText.appendText(\"Appointment ID: \" + appointment.getId() +\n \" \\tTitle: \" + appointment.getTitle() +\n \"\\tType: \" + appointment.getType() +\n \"\\tDescription: \" + appointment.getDescription() +\n \"\\tStart: \" + appointment.getStart() +\n \"\\tEnd: \" + appointment.getEnd() +\n \"\\tCustomer: \" + appointment.getCustomer() + \"\\n\");\n }\n System.out.println(\"\\n\\n\");\n }\n }\n }", "void printStats();", "@Override\n\t//Start, end, headache count, average severity, duration\n\tpublic String buildReport() {\n\t\tsetHeadacheInfo(); \n\t\tStringBuilder hsReport = new StringBuilder(); \n\t\thsReport.append(\"\\nReport Start Date: \"); \n\t\thsReport.append(getStartDate().toString() + \"\\n\"); \n\t\thsReport.append(\"Report End Date: \"); \n\t\thsReport.append(getEndDate().toString() + \"\\n\"); \n\t\thsReport.append(\"Headache Count: \"); \n\t\thsReport.append(getHeadacheList().size() + \"\\n\"); \n\t\thsReport.append(\"Average Severty: \"); \n\t\thsReport.append(getAverageSeverity() + \"\\n\"); \n\t\thsReport.append(\"Average Duration (hours): \"); \n\t\thsReport.append(getAverageDuration() + \"\\n\"); \n\t\treturn hsReport.toString(); \n\t}", "void results() {\n Time t = new Time(System.currentTimeMillis());\n endTime = t;\n\n float t1gpslog, t2gpslog, t3gpslog, bhgpslog, mhgpslog, fhgpslog, nfgpslog,\n t1dtnlog, t2dtnlog, t3dtnlog, bhdtnlog, mhdtnlog, fhdtnlog, nfdtnlog;\n float t1logpercentage, t2logpercentage, t3logpercentage, bhlogpercentage,\n mhlogpercentage, fhlogpercentage, nflogpercentage;\n\n t1gpslog = t2gpslog = t3gpslog = bhgpslog = mhgpslog = fhgpslog = nfgpslog\n = t1dtnlog = t2dtnlog = t3dtnlog = bhdtnlog = mhdtnlog = fhdtnlog = nfdtnlog = 0;\n int xval, yval;\n\n for (int rbucklocationx = 0; rbucklocationx < MAX_X_GRID; rbucklocationx++) {\n for (int rbucklocationy = 0; rbucklocationy < MAX_Y_GRID; rbucklocationy++) {\n if (t1_grazecoordinate[rbucklocationx][rbucklocationy] == 1) {\n t1GPSLog.add(new GPSLog(rbucklocationx, rbucklocationy));\n t1gpslog++;\n }\n\n if (t2_grazecoordinate[rbucklocationx][rbucklocationy] == 1) {\n t2GPSLog.add(new GPSLog(rbucklocationx, rbucklocationy));\n t2gpslog++;\n }\n\n if (t3_grazecoordinate[rbucklocationx][rbucklocationy] == 1) {\n t3GPSLog.add(new GPSLog(rbucklocationx, rbucklocationy));\n t3gpslog++;\n }\n if (bh_grazecoordinate[rbucklocationx][rbucklocationy] == 1) {\n bhGPSLog.add(new GPSLog(rbucklocationx, rbucklocationy));\n bhgpslog++;\n }\n if (mh_grazecoordinate[rbucklocationx][rbucklocationy] == 1) {\n mhGPSLog.add(new GPSLog(rbucklocationx, rbucklocationy));\n mhgpslog++;\n }\n if (fh_grazecoordinate[rbucklocationx][rbucklocationy] == 1) {\n fhGPSLog.add(new GPSLog(rbucklocationx, rbucklocationy));\n fhgpslog++;\n }\n if (nf_grazecoordinate[rbucklocationx][rbucklocationy] == 1) {\n nfgGPSLog.add(new GPSLog(rbucklocationx, rbucklocationy));\n nfgpslog++;\n }\n }\n }\n\n for (int resultloop = 0; resultloop < DATA_MAX_PACKETS; resultloop++)\n {\n if (d1_message[resultloop] != 0) {\n if ((d1_message[resultloop] >> 11) == t1_agentid) {\n xval = ((d1_message[resultloop] >> 6) & 31);\n yval = (d1_message[resultloop] & 63);\n t1DTNLog.add(new GPSLog(xval, yval));\n t1dtnlog++;\n }\n if ((d1_message[resultloop] >> 11) == t2_agentid) {\n xval = ((d1_message[resultloop] >> 6) & 31);\n yval = (d1_message[resultloop] & 63);\n t2DTNLog.add(new GPSLog(xval, yval));\n t2dtnlog++;\n }\n if ((d1_message[resultloop] >> 11) == t3_agentid) {\n xval = ((d1_message[resultloop] >> 6) & 31);\n yval = (d1_message[resultloop] & 63);\n t3DTNLog.add(new GPSLog(xval, yval));\n t3dtnlog++;\n }\n if ((d1_message[resultloop] >> 11) == bh_agentid) {\n xval = ((d1_message[resultloop] >> 6) & 31);\n yval = (d1_message[resultloop] & 63);\n bhDTNLog.add(new GPSLog(xval, yval));\n bhdtnlog++;\n }\n if ((d1_message[resultloop] >> 11) == mh_agentid) {\n xval = ((d1_message[resultloop] >> 6) & 31);\n yval = (d1_message[resultloop] & 63);\n mhDTNLog.add(new GPSLog(xval, yval));\n mhdtnlog++;\n }\n if ((d1_message[resultloop] >> 11) == fh_agentid) {\n xval = ((d1_message[resultloop] >> 6) & 31);\n yval = (d1_message[resultloop] & 63);\n fhDTNLog.add(new GPSLog(xval, yval));\n fhdtnlog++;\n }\n if ((d1_message[resultloop] >> 11) == nf_agentid) {\n xval = ((d1_message[resultloop] >> 6) & 31);\n yval = (d1_message[resultloop] & 63);\n nfgDTNLog.add(new GPSLog(xval, yval));\n nfdtnlog++;\n }\n }\n }\n\n if (t1gpslog != 0) {\n t1logpercentage = (t1dtnlog / t1gpslog) * 100;\n percentageLog.add(\"t1percentage is \" + t1logpercentage);\n Platform.runLater(()-> {\n tps.getData().add(new XYChart.Data(\"T1\", t1logpercentage));\n tpslc.getData().add(new XYChart.Data(\"T1\", t1logpercentage));\n });\n t1tp = t1logpercentage;\n }\n\n if (t2gpslog != 0) {\n t2logpercentage = (t2dtnlog / t2gpslog) * 100;\n percentageLog.add(\"t2percentage is \" + t2logpercentage);\n Platform.runLater(()-> {\n tps.getData().add(new XYChart.Data(\"T2\", t2logpercentage));\n tpslc.getData().add(new XYChart.Data(\"T2\", t2logpercentage));\n });\n t2tp = t2logpercentage;\n }\n\n if (t3gpslog != 0) {\n t3logpercentage = (t3dtnlog / t3gpslog) * 100;\n percentageLog.add(\"t3percentage is \" + t3logpercentage);\n Platform.runLater(()-> {\n tps.getData().add(new XYChart.Data(\"T3\", t3logpercentage));\n tpslc.getData().add(new XYChart.Data(\"T3\", t3logpercentage));\n });\n t3tp = t3logpercentage;\n }\n\n if (bhgpslog != 0) {\n bhlogpercentage = (bhdtnlog / bhgpslog) * 100;\n percentageLog.add(\"bhpercentage is \" + bhlogpercentage);\n Platform.runLater(()-> {\n tps.getData().add(new XYChart.Data(\"BH\", bhlogpercentage));\n tpslc.getData().add(new XYChart.Data(\"BH\", bhlogpercentage));\n });\n bhtp = bhlogpercentage;\n }\n\n if (mhgpslog != 0) {\n mhlogpercentage = (mhdtnlog / mhgpslog) * 100;\n percentageLog.add(\"mhpercentage is \" + mhlogpercentage);\n Platform.runLater(()-> {\n tps.getData().add(new XYChart.Data(\"MH\", mhlogpercentage));\n tpslc.getData().add(new XYChart.Data(\"MH\", mhlogpercentage));\n });\n mhtp = mhlogpercentage;\n }\n\n if (fhgpslog != 0) {\n fhlogpercentage = (fhdtnlog / fhgpslog) * 100;\n percentageLog.add(\"fhpercentage is \" + fhlogpercentage);\n Platform.runLater(()-> {\n tps.getData().add(new XYChart.Data(\"FH\", fhlogpercentage));\n tpslc.getData().add(new XYChart.Data(\"FH\", fhlogpercentage));\n });\n fhtp = fhlogpercentage;\n }\n\n if (nfgpslog != 0) {\n nflogpercentage = (nfdtnlog / nfgpslog) * 100;\n percentageLog.add(\"nfpercentage is \" + nflogpercentage);\n Platform.runLater(()-> {\n tps.getData().add(new XYChart.Data(\"NF\", nflogpercentage));\n tpslc.getData().add(new XYChart.Data(\"NF\", nflogpercentage));\n });\n nftp = nflogpercentage;\n }\n\n float gpslogSum = t1gpslog + t2gpslog + t3gpslog + bhgpslog + mhgpslog + fhgpslog + nfgpslog;\n float dtnlogSum = t1dtnlog + t2dtnlog + t3dtnlog + bhdtnlog + mhdtnlog + fhdtnlog + nfdtnlog;\n\n \n if (gpslogSum > 0)\n {\n float collectiveThroughput = ((dtnlogSum) / (gpslogSum)) * 100;\n Platform.runLater(()-> {\n tps.getData().add(new XYChart.Data(\"CT\", collectiveThroughput));\n tpslc.getData().add(new XYChart.Data(\"CT\", collectiveThroughput));\n });\n ct = collectiveThroughput;\n }\n\n //Add the Radio Contact Ratio value to the series\n \n if (dtnlogSum > 0)\n {\n rcratio = radioContactLog.size()/dtnlogSum;\n }\n else\n {\n rcratio = 0;\n }\n Platform.runLater(()-> {\n rcrSeries.setYValue(rcratio);\n });\n updateGPSLogSeries();\n updateDataCenterSeries();\n\n //Update the binding properties \n Platform.runLater(()-> {\n simStarted.set(false);\n simInProgress.set(false);\n simCompleted.set(true);\n simNotInProgress.set(true);\n simPaused.set(false);\n simNotStarted.set(true);\n });\n packetModels.clear();\n packetModels.add(new PacktTallyModel(t1gpslog));\n packetModels.add(new PacktTallyModel(t2gpslog));\n packetModels.add(new PacktTallyModel(t3gpslog));\n packetModels.add(new PacktTallyModel(bhgpslog));\n packetModels.add(new PacktTallyModel(mhgpslog));\n packetModels.add(new PacktTallyModel(fhgpslog));\n packetModels.add(new PacktTallyModel(nfgpslog));\n packetModels.add(new PacktTallyModel(gpslogSum));\n packetModels.add(new PacktTallyModel(t1dtnlog));\n packetModels.add(new PacktTallyModel(t2dtnlog));\n packetModels.add(new PacktTallyModel(t3dtnlog));\n packetModels.add(new PacktTallyModel(bhdtnlog));\n packetModels.add(new PacktTallyModel(mhdtnlog));\n packetModels.add(new PacktTallyModel(fhdtnlog));\n packetModels.add(new PacktTallyModel(nfdtnlog));\n packetModels.add(new PacktTallyModel(dtnlogSum));\n packetModels.add(new PacktTallyModel(ct));\n packetModels.add(new PacktTallyModel(radioContactLog.size()));\n packetModels.add(new PacktTallyModel(rcratio));\n \n }", "public String toString() {\n return report;\n }", "@Test(priority = 1, groups= {\"regression\",\"smoke\"})\r\n\tpublic void PrintHospitals()\r\n\t{\r\n\t\tlogger= report.createTest(\"Printing Hospitals as per requirement\");\r\n\t\tDisplayHospitalNames hp=Base.nextPage1();\r\n\t\thp.selectLocation();\r\n\t\thp.selectHospital();\r\n\t\thp.applyFilters();\r\n\t\thp.hospitals();\r\n\t\thp.Back();\r\n\t}", "@Override\r\n\tpublic void doWorkFlowAnalysis() {\n\t\t\r\n\t}", "public void writeReport()\n {\n // System.out.println(getClass().getName()+\":: writeReport \");\n\n switch (protocol)\n {\n case ProtocolPush:\n synchronized (circularBuffer)\n {\n if (reset /* && pendingWriteReport */)\n return;\n circularBuffer.writeReport();\n }\n getInputConnector().getModule()\n .connectorPushed(getInputConnector());\n return;\n case ProtocolSafe:\n synchronized (circularBuffer)\n {\n if (reset)\n return;\n circularBuffer.writeReport();\n circularBuffer.notifyAll();\n return;\n }\n default:\n throw new RuntimeException();\n }\n\n }", "abstract protected void _log(TrackingActivity activity) throws Exception;", "public abstract void logTraceTime();", "private void divertLog() {\n wr = new StringWriter(1000);\n LogTarget[] lt = { new WriterTarget(wr, fmt) };\n SampleResult.log.setLogTargets(lt);\n }", "public void record() {\n stats.record();\n }", "public void generateReport(ReportGenerationData data)throws ChangeApplicationException;", "public void displayReport() {\n\t\treport = new ReportFrame(fitnessProg);\n\t\treport.buildReport();\n\t\treport.setVisible(true);\n\t}", "public void showMetrics() {\n }", "public static void _generateStatistics() {\n\t\ttry {\n\t\t\t// Setup info\n\t\t\tPrintStream stats = new PrintStream(new File (_statLogFileName + \".txt\"));\n\n\t\t\tScanner scan = new Scanner(new File(_logFileName+\".txt\"));\n\t\t\twhile (scan.hasNext(SETUP.toString())) {\n\t\t\t\t// Append setup info\n\t\t\t\tstats.append(scan.nextLine()+\"\\n\");\n\t\t\t}\n\t\t\tstats.append(\"\\n\");\n\n\t\t\twhile (scan.hasNext(DETAILS.toString()) || scan.hasNext(RUN.toString())) {\n\t\t\t\t// Throw detailed info away\n\t\t\t\tscan.nextLine();\n\t\t\t}\n\n\t\t\twhile (scan.hasNext()) {\n\t\t\t\t// Append post-run info\n\t\t\t\tstats.append(scan.nextLine()+\"\\n\");\n\t\t\t}\n\t\t\tscan.close();\n\t\t\tstats.append(\"\\n\");\n\n\t\t\t// Perf4J info\n\t\t\tReader reader = new FileReader(_logFileName+\".txt\");\n\t\t\tLogParser parser = new LogParser(reader, stats, null, 10800000, true, new GroupedTimingStatisticsTextFormatter());\n\t\t\tparser.parseLog();\n\t\t\tstats.close();\n\t\t}\n\t\tcatch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "@Override\n public void logs() {\n \n }", "public void printReport() {\n System.out.println(\"=== Product Report ===\");\n productNames.keySet().forEach(k -> {\n System.out.println(\"Name: \" + k + \"\\t\\tCount: \" + productCountMap.get(productNames.get(k)));\n });\n\n }", "public void printReport(){\n\t\tSystem.out.println(\"This is \" + name + \", UPENN \" + graduationYear);\n\t\tSystem.out.println(\"Their GPA is \" + GPA);\n\t\tString numCoursesString = \"\";\n\t\tif (numCoursesCompleted == 1){\n\t\t\tnumCoursesString=\"course\";\t//if the student has only taken one course, just print course\n\t\t}\n\t\telse{\n\t\t\tnumCoursesString=\"courses\"; //if the student has taken more than one course, print courses when called\n\t\t}\n\t\tSystem.out.println(\"They have taken \" + numCoursesCompleted + \" \" + numCoursesString); \n\t}", "public void SLA_Report()\n {\n\t boolean SLApresent =SLAreport.size()>0;\n\t if(SLApresent)\n\t {\n\t\t // System.out.println(\"SLA report is PRESENT\");\n\t }\n\t else\n\t {\n\t\t System.out.println(\"SLA report is not present\");\n\t }\n }", "public void m36045a() {\n this.f29981a.showReportDialog();\n }", "public void checkForAlerts() {\n }", "public void printInfo(){\n\t}", "public void printInfo(){\n\t}" ]
[ "0.7818932", "0.73734266", "0.7360116", "0.72084045", "0.69908774", "0.67500657", "0.66486824", "0.66392857", "0.66282135", "0.66275084", "0.6479638", "0.646037", "0.6391679", "0.6362752", "0.6323649", "0.6305884", "0.6256285", "0.62504715", "0.6246911", "0.62358135", "0.6225735", "0.6224878", "0.6223776", "0.6220079", "0.6217628", "0.6214384", "0.6209638", "0.61781996", "0.6105506", "0.6081211", "0.6071815", "0.6071183", "0.6067522", "0.6015378", "0.60034007", "0.5982571", "0.59819055", "0.59813863", "0.59782267", "0.5962818", "0.59592384", "0.5951145", "0.59408236", "0.5925798", "0.5905539", "0.5871278", "0.5869198", "0.5860677", "0.585222", "0.5845489", "0.5841691", "0.58346045", "0.58205956", "0.58172953", "0.58087593", "0.5800471", "0.57913774", "0.5787577", "0.577487", "0.5774555", "0.5771352", "0.5767531", "0.57589346", "0.57585466", "0.575451", "0.5750995", "0.5747289", "0.57465947", "0.5737627", "0.5730122", "0.57238865", "0.5712449", "0.57061464", "0.57020956", "0.56962615", "0.5692252", "0.5686684", "0.5668801", "0.56671613", "0.5666927", "0.5660698", "0.56602585", "0.56565726", "0.56457883", "0.5641522", "0.563575", "0.56265014", "0.56254894", "0.5623661", "0.56233436", "0.56195617", "0.56154454", "0.56132555", "0.56075627", "0.560484", "0.5601344", "0.5600653", "0.55874294", "0.5584694", "0.5583787", "0.5583787" ]
0.0
-1
/ /Debugging methods /
@Override public String toString() { return "JOIN"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void debug() {\n\n }", "public static void debugInfo() { throw Extensions.todo(); }", "@Override\r\n\t\t\tpublic void debug(String arg) {\n\t\t\t\t\r\n\t\t\t}", "public void debug()\r\n {\n \t\treload();\r\n }", "private static void debug()\r\n\t{\r\n\t\tSystem.out.println(\"Keywords:\");\r\n\t\tfor(String word : keywords)\r\n\t\t{\r\n\t\t\tSystem.out.println(word);\r\n\t\t}\r\n\t\t\r\n\t\tSystem.out.println(\"-----------------\");\r\n\t\tSystem.out.println();\r\n\t\tSharedLink.debugLinks();\r\n\t\t\r\n\t\tSystem.out.println(\"-----------------\");\r\n\t\tSystem.out.println();\r\n\t\tSharedPage.debugPages();\r\n\t\t\r\n\t\tSystem.out.println();\r\n\t}", "private static void printDebug(String s)\n {\n }", "protected abstract void debug(String msg);", "public static void ClearDebugInfo() { throw Extensions.todo(); }", "private void debug(String str) {\n }", "public void debug(String comment);", "public boolean isDebug();", "boolean isDebug();", "boolean isDebug();", "public abstract void debug(RobocodeFileOutputStream output);", "void debug (String msg) throws RootException;", "public void debug(String msg);", "private void debug(String post) {\n if (GameLauncher.isDebugging()) {\n System.out.println(post);\n }\n }", "@Override\n\tpublic void debug(Object message) {\n\n\t}", "static void debug() {\n ProcessRunnerImpl.setGlobalDebug(true);\n }", "private static void debug(String s) {\n if (System.getProperty(\"javafind.debug\") != null)\n System.out.println(\"debug in GnuNativeFind: \" + s);\n }", "protected void thoroughInspection() {}", "@Override\n\tpublic void debug(Message msg) {\n\n\t}", "private void debug(String s) {\r\n\t\tif (debug)\r\n\t\t\tSystem.out.println(s);\r\n\t}", "@Override\n\tpublic void debug(Marker marker, String message, Object p0) {\n\n\t}", "public void debug() {\n\n\t\t// Establecemos el estado\n\t\tsetEstado(Estado.DEBUG);\n\n\t\t// Obtenemos la proxima tarea\n\t\ttarea = planificador.obtenerProximaTarea();\n\t}", "private static void checkDebug() {\n try {\n if (Boolean.getBoolean(\"gfAgentDebug\")) {\n mx4j.log.Log.setDefaultPriority(mx4j.log.Logger.TRACE); // .DEBUG\n }\n } catch (VirtualMachineError err) {\n SystemFailure.initiateFailure(err);\n // If this ever returns, rethrow the error. We're poisoned\n // now, so don't let this thread continue.\n throw err;\n } catch (Throwable t) {\n // Whenever you catch Error or Throwable, you must also\n // catch VirtualMachineError (see above). However, there is\n // _still_ a possibility that you are dealing with a cascading\n // error condition, so you also need to check to see if the JVM\n // is still usable:\n SystemFailure.checkFailure();\n /* ignore */\n }\n }", "@Override\n\tpublic void debug(Marker marker, MessageSupplier msgSupplier) {\n\n\t}", "public boolean isDebugEnabled();", "@Override\n\tpublic void debug(Marker marker, Message msg, Throwable t) {\n\n\t}", "@Override\n\tpublic void debug(Marker marker, Message msg) {\n\n\t}", "void debug(String a, String b) {\n\t\t}", "@Override\n\tpublic void debug(Marker marker, String message) {\n\n\t}", "public java.lang.String toDebugString () { throw new RuntimeException(); }", "@Override\n\tpublic void debug(Object message, Throwable t) {\n\n\t}", "@Override\n\tpublic void debug(Marker marker, Object message, Throwable t) {\n\n\t}", "@Override\n\tpublic void debug(String message, Object p0) {\n\n\t}", "public void continueDebugStep() {\n \tthis.continueDebug = true;\n }", "public static final boolean isDebugInfo() { return true; }", "@Override\n\tpublic void debug(Marker marker, String message, Object... params) {\n\n\t}", "public abstract void debug(PrintStream console);", "@Override\n\tpublic void debug(Marker marker, String message, Throwable t) {\n\n\t}", "@Override\n protected boolean isDebugEnable() {\n return false;\n }", "@Override\n\tpublic void debug(Marker marker, Object message) {\n\n\t}", "LabyDebugger getLabyDebugger();", "public void debug(String message);", "public static void enableDebugging(){\n DEBUG = true;\n }", "@Override\n\tpublic void debug(Message msg, Throwable t) {\n\n\t}", "@Override\n\tpublic void debug(String message, Throwable t) {\n\n\t}", "@Override\n\tpublic void debug(String message, Object... params) {\n\n\t}", "@Override\n\tpublic void debug(Marker marker, String message, Object p0, Object p1) {\n\n\t}", "public void trace(Object message)\n/* */ {\n/* 95 */ debug(message);\n/* */ }", "@Override\n\tpublic void debug(CharSequence message, Throwable t) {\n\n\t}", "public abstract int trace();", "private void debug(final String msg) {\n \t\tif (debug) System.out.println(msg);\n \t}", "public static void normalDebug(){\n enableVerbos = false;\n }", "@Override\n\tpublic void debug(Marker marker, CharSequence message, Throwable t) {\n\n\t}", "public void testDebugNoModifications() throws Exception {\n startTest();\n openFile(\"debug.html\", LineDebuggerTest.current_project);\n EditorOperator eo = new EditorOperator(\"debug.html\");\n setLineBreakpoint(eo, \"window.console.log(a);\");\n\n openFile(\"linebp.js\", LineDebuggerTest.current_project);\n eo = new EditorOperator(\"linebp.js\");\n setLineBreakpoint(eo, \"console.log(\\\"start\\\");\");\n setLineBreakpoint(eo, \"if (action === \\\"build\\\") {\");\n setLineBreakpoint(eo, \"var d = new Date();\");\n eo.close();\n runFile(LineDebuggerTest.current_project, \"debug.html\");\n evt.waitNoEvent(GeneralHTMLProject.RUN_WAIT_TIMEOUT);\n EditorOperator currentFile = EditorWindowOperator.getEditor();\n VariablesOperator vo = new VariablesOperator(\"Variables\");\n\n assertEquals(\"Unexpected file opened at breakpoint\", \"debug.html\", currentFile.getName());\n assertEquals(\"Debugger stopped at wrong line\", 14, currentFile.getLineNumber());\n evt.waitNoEvent(1000);\n waitForVariable(\"step\");\n assertEquals(\"Step variable is unexpected\", \"1\", ((Map<String, Variable>) vo.getVariables()).get(\"step\").value);\n\n new ContinueAction().performMenu();\n evt.waitNoEvent(1000);\n currentFile = EditorWindowOperator.getEditor();\n vo = new VariablesOperator(\"Variables\");\n evt.waitNoEvent(1000);\n waitForVariable(\"step\");\n assertEquals(\"Unexpected file opened at breakpoint\", \"linebp.js\", currentFile.getName());\n assertEquals(\"Debugger stopped at wrong line\", 4, currentFile.getLineNumber());\n assertEquals(\"Step variable is unexpected\", \"2\", ((Map<String, Variable>) vo.getVariables()).get(\"step\").value);\n\n new StepOverAction().performMenu();\n new StepOverAction().performMenu();\n new StepOverAction().performMenu();\n evt.waitNoEvent(500);\n currentFile = EditorWindowOperator.getEditor();\n vo = new VariablesOperator(\"Variables\");\n evt.waitNoEvent(1000);\n assertEquals(\"Debugger stopped at wrong line\", 7, currentFile.getLineNumber());\n waitForVariable(\"step\");\n assertEquals(\"Step variable is unexpected\", \"3\", ((Map<String, Variable>) vo.getVariables()).get(\"step\").value);\n\n new ContinueAction().performMenu();\n evt.waitNoEvent(1000);\n currentFile = EditorWindowOperator.getEditor();\n vo = new VariablesOperator(\"Variables\");\n assertEquals(\"Debugger stopped at wrong line\", 15, currentFile.getLineNumber());\n evt.waitNoEvent(1000);\n waitForVariable(\"step\");\n assertEquals(\"Step variable is unexpected\", \"4\", ((Map<String, Variable>) vo.getVariables()).get(\"step\").value);\n\n new StepOverAction().performMenu();\n new StepOverAction().performMenu();\n evt.waitNoEvent(1000);\n currentFile = EditorWindowOperator.getEditor();\n vo = new VariablesOperator(\"Variables\");\n assertEquals(\"Debugger stopped at wrong line\", 17, currentFile.getLineNumber());\n evt.waitNoEvent(1000);\n waitForVariable(\"step\");\n assertEquals(\"Step variable is unexpected\", \"5\", ((Map<String, Variable>) vo.getVariables()).get(\"step\").value);\n\n new StepIntoAction().performMenu();\n new StepIntoAction().performMenu();\n evt.waitNoEvent(1000);\n vo = new VariablesOperator(\"Variables\");\n evt.waitNoEvent(1000);\n waitForVariable(\"step\");\n if(GeneralHTMLProject.inEmbeddedBrowser){ // embedded browser stops on line with function(){\n assertEquals(\"Step variable is unexpected\", \"5\", ((Map<String, Variable>) vo.getVariables()).get(\"step\").value);\n }else{\n assertEquals(\"Step variable is unexpected\", \"6\", ((Map<String, Variable>) vo.getVariables()).get(\"step\").value); \n }\n\n endTest();\n }", "void dumpIR_debug(CodeGenEnv cenv){\n try {\n\n System.out.println(\"--- dump \" + class_.name.str + \"--- IR ----\");\n System.out.println(\"struct_typeRef: \");Thread.sleep(10);\n cenv.DumpIR( struct_typeRef );\n\n\n\n System.out.println(\"\\n---constructor: \");Thread.sleep(10);\n cenv.DumpIR(constructorFun);\n\n System.out.println(\"constructor initializer: \");Thread.sleep(10);\n cenv.DumpIR(constructor_initval_fun);\n\n System.out.println(\"\\n----class method: \");\n for (var i:classMethod.members){\n System.out.println(\"method: \" + i.funSymbol.str);Thread.sleep(10);\n cenv.DumpIR(i.funRef);\n }\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }", "boolean isDebugEnabled();", "@Override\n\tpublic void debug(MessageSupplier msgSupplier) {\n\n\t}", "@Override\n\tpublic void debug(Marker marker, CharSequence message) {\n\n\t}", "public boolean supportsDebugArgument();", "@Override\n\tpublic void debug(CharSequence message) {\n\n\t}", "private int debug(Integer parameterIndex) throws ExceptionMalformedInput\n {\n this.debug = parseParameter(args, parameterIndex+1);\n Debug.INSTANCE = new DebugLoud();\n Debug.INSTANCE.initLogFlag(this.debug);\n return parameterIndex + 1;\n }", "@Override\n\tpublic void debug(String message, Object p0, Object p1) {\n\n\t}", "void debug() {\n\t\tfor( int i = 0; i < N; i++ ) {\t\n\t\t\tSystem.out.print(i+\" \");\n\t\t\tfor( int j = 0; j < N; j++ )\n\t\t\t\tSystem.out.print(j+\":\"+(defined[i][j]?\"T\":\"F\")+\" \"+\n\t\t\t\t\t\tc[i][j]+\" p=\"+path[i][j]+\" f=\"+f[i][j]+\"; \");\n\t\t\tSystem.out.println();\n\t\t}\n\t}", "@SuppressWarnings(\"unchecked\")\n\tpublic List getDebugInfo();", "@Override\n\tpublic void debug(Marker marker, Supplier<?> msgSupplier) {\n\n\t}", "@Override\n\tpublic void debug(Marker marker, String message, Object p0, Object p1, Object p2) {\n\n\t}", "@Override\n\tpublic void debug(Marker marker, MessageSupplier msgSupplier, Throwable t) {\n\n\t}", "void debug(String msg)\n {\n if (yydebug)\n System.out.println(msg);\n }", "@Override\n\tpublic void debug(String message, Object p0, Object p1, Object p2) {\n\n\t}", "public static boolean debugging()\n {\n return info;\n }", "private static void printFunctionCalls() {\n dvm.printFunctionCalls();\n }", "void debug(String msg)\n{\n if (yydebug)\n System.out.println(msg);\n}", "void debug(String msg)\n{\n if (yydebug)\n System.out.println(msg);\n}", "public void enableDebug() {\n this.debug = true;\n }", "protected void brkt() {\n println(breakPoints.toString());\n }", "public void testDebugging() throws Throwable {\n // Status bar tracer\n MainWindowOperator.StatusTextTracer stt = MainWindowOperator.getDefault().getStatusTextTracer();\n SourcePackagesNode sourcePackagesNode = new SourcePackagesNode(SAMPLE_PROJECT_NAME);\n JavaNode sampleClass1Node = new JavaNode(sourcePackagesNode, SAMPLE1_PACKAGE_NAME + \"|\" + SAMPLE1_FILE_NAME);\n // flag to stop debugger in finally\n boolean debuggerStarted = false;\n try {\n // find sample file in Editor\n EditorOperator eo = new EditorOperator(SAMPLE1_FILE_NAME);\n eo.setCaretPosition(\"public static void main\", true);\n final int insertLine = eo.getLineNumber() + 2;\n\n // if file not contains brpText from previous test cases, insert it\n String brpText = \"System.out.println(\\\"Hello\\\");\"; // NOI18N\n if (!eo.contains(brpText)) {\n eo.insert(brpText + \"\\n\", insertLine, 1);\n }\n eo.select(brpText);\n\n ToggleBreakpointAction toggleBreakpointAction = new ToggleBreakpointAction();\n try {\n // toggle breakpoint via Shift+F8\n toggleBreakpointAction.performShortcut(eo);\n waitBreakpoint(eo, insertLine);\n } catch (TimeoutExpiredException e) {\n // need to be realiable test => repeat action once more to be sure it is problem in IDE\n // this time use events instead of Robot\n MainWindowOperator.getDefault().pushKey(\n toggleBreakpointAction.getKeyStrokes()[0].getKeyCode(),\n toggleBreakpointAction.getKeyStrokes()[0].getModifiers());\n waitBreakpoint(eo, insertLine);\n }\n\n // if file not contains second brpText from previous test cases, insert it\n brpText = \"System.out.println(\\\"Good bye\\\");\"; // NOI18N\n if (!eo.contains(brpText)) {\n eo.insert(brpText + \"\\n\", insertLine + 1, 1);\n }\n eo.select(brpText);\n // toggle breakpoint via pop-up menu\n // clickForPopup(0, 0) used in the past sometimes caused that menu\n // was opened outside editor area because editor roll up after \n // text was selected\n toggleBreakpointAction.perform(eo.txtEditorPane());\n // wait second breakpoint established\n waitBreakpoint(eo, insertLine + 1);\n // start to track Main Window status bar\n stt.start();\n debuggerStarted = true;\n // start debugging\n new DebugJavaFileAction().performMenu(sampleClass1Node);\n // check the first breakpoint reached\n // wait status text \"Thread main stopped at SampleClass1.java:\"\n // increase timeout to 60 seconds\n MainWindowOperator.getDefault().getTimeouts().setTimeout(\"Waiter.WaitingTime\", 60000);\n String labelLine = Bundle.getString(\"org.netbeans.modules.debugger.jpda.ui.Bundle\",\n \"CTL_Thread_stopped\",\n new String[]{\"main\", SAMPLE1_FILE_NAME, null, String.valueOf(insertLine)}); // NOI18N\n stt.waitText(labelLine);\n // continue debugging\n new ContinueAction().perform();\n // check the second breakpoint reached\n // wait status text \"Thread main stopped at SampleClass1.java:\"\n String labelLine1 = Bundle.getString(\"org.netbeans.modules.debugger.jpda.ui.Bundle\",\n \"CTL_Thread_stopped\",\n new String[]{\"main\", SAMPLE1_FILE_NAME, null, String.valueOf(insertLine)}); // NOI18N\n stt.waitText(labelLine1);\n // check \"Hello\" was printed out in Output\n OutputTabOperator oto = new OutputTabOperator(\"debug-single\"); // NOI18N\n // wait until text Hello is not written in to the Output\n oto.waitText(\"Hello\"); // NOI18N\n } catch (Throwable th) {\n try {\n // capture screen before cleanup in finally clause is completed\n PNGEncoder.captureScreen(getWorkDir().getAbsolutePath() + File.separator + \"screenBeforeCleanup.png\");\n } catch (Exception e1) {\n // ignore it\n }\n th.printStackTrace(getLog());\n throw th;\n } finally {\n if (debuggerStarted) {\n // finish debugging\n new FinishDebuggerAction().perform();\n // check status line\n // \"SampleProject (debug-single)\"\n String outputTarget = Bundle.getString(\n \"org.apache.tools.ant.module.run.Bundle\",\n \"TITLE_output_target\",\n new Object[]{SAMPLE_PROJECT_NAME, null, \"debug-single\"}); // NOI18N\n // \"Finished building SampleProject (debug-single)\"\n String finishedMessage = Bundle.getString(\n \"org.apache.tools.ant.module.run.Bundle\",\n \"FMT_finished_target_status\",\n new Object[]{outputTarget});\n stt.waitText(finishedMessage);\n }\n stt.stop();\n // delete sample class\n sampleClass1Node.delete();\n String confirmTitle = Bundle.getString(\"org.netbeans.modules.refactoring.java.ui.Bundle\", \"LBL_SafeDel_Delete\"); // NOI18N\n String confirmButton = UIManager.getDefaults().get(\"OptionPane.okButtonText\").toString(); // NOI18N\n // \"Confirm Object Deletion\"\n new JButtonOperator(new NbDialogOperator(confirmTitle), confirmButton).push();\n }\n }", "@Override\n\tpublic void debug(Marker marker, Supplier<?> msgSupplier, Throwable t) {\n\n\t}", "@Override\n\tpublic void setDebugMode(boolean debug) {\n\n\t}", "private static void dbg(Object... objects) {\n\t\tSystem.out.println(Arrays.deepToString(objects));\r\n\t}", "protected void doDebug(HttpServletRequest httpServletRequest)\n\t{\n log.debug(\"context: \" + httpServletRequest.getContextPath());\n log.debug(\"path info: \" + httpServletRequest.getPathInfo());\n log.debug(\"translated: \" + httpServletRequest.getPathTranslated());\n log.debug(\"scheme: \" + httpServletRequest.getScheme());\n log.debug(\"server name: \" + httpServletRequest.getServerName());\n log.debug(\"server port: \" + httpServletRequest.getServerPort());\n log.debug(\"uri: \" + httpServletRequest.getRequestURI());\n log.debug(\"url: \" + httpServletRequest.getRequestURL().toString());\n log.debug(\"query string: \" + httpServletRequest.getQueryString());\n\t\tEnumeration headerNames = httpServletRequest.getHeaderNames();\n\t\tString headerName;\n log.debug(\"---------- headers ----------\");\n\t\twhile (headerNames.hasMoreElements())\n\t\t{\n\t\t\theaderName = (String)headerNames.nextElement();\n log.debug(\" \" + headerName + \": \" + httpServletRequest.getHeader(headerName));\n\t\t}\n\t\tEnumeration parameterNames = httpServletRequest.getParameterNames();\n\t\tString parameterName;\n log.debug(\"---------- parameters ---------\");\n\t\twhile (parameterNames.hasMoreElements())\n\t\t{\n\t\t\tparameterName = (String)parameterNames.nextElement();\n log.debug(\" \" + parameterName + \": \" + httpServletRequest.getParameter(parameterName));\n\t\t}\n log.debug(\"------------------------------\");\n\t}", "@Override\n\tpublic void debug(Marker marker, String message, Object p0, Object p1, Object p2, Object p3,\n\t\t\tObject p4, Object p5, Object p6, Object p7, Object p8, Object p9) {\n\n\t}", "public void print_DEBUG() {\n\t\tSystem.out.println(\"Direction\");\n\t\tSystem.out.println(\"ID: \" + ID);\n\t\tSystem.out.println(\"FROM: \" + from.name() );\n\t\tSystem.out.println(\"TO: \" + to.name() );\n\t\tSystem.out.println(\"dir: \" + dir);\n\t\tSystem.out.println(\"Locked: \" + locked);\n\t\tSystem.out.println(\"LockPattern: \" + lockPattern);\n\t}", "public native void debugStateCapture();", "public void breaker() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void debug(String message, Object p0, Object p1, Object p2, Object p3, Object p4) {\n\n\t}", "@Override\n\tpublic void debug(Marker marker, String message, Object p0, Object p1, Object p2, Object p3) {\n\n\t}", "@Override\n public void debug(\n Object obj\n )\n {\n mLogger.fine( obj.toString() );\n }", "public void logDebugData() {\n SmartDashboard.putNumber(\"Ele Pos\", getPosition());\n SmartDashboard.putBoolean(\"Ele Switch\", bottomSwitchValue());\n SmartDashboard.putNumber(\"Ele Current\", getCurrent());\n SmartDashboard.putNumber(\"Ele Out %\", elevatorSpark.getAppliedOutput());\n }", "private ElementDebugger() {\r\n\t\t/* PROTECTED REGION ID(java.constructor._17_0_5_12d203c6_1363681638138_829588_2092) ENABLED START */\r\n\t\t// :)\r\n\t\t/* PROTECTED REGION END */\r\n\t}", "@Override\n\tpublic void debug(String message, Object p0, Object p1, Object p2, Object p3, Object p4,\n\t\t\tObject p5, Object p6, Object p7, Object p8, Object p9) {\n\n\t}", "private void report() {\n\t\t\n\t}", "@Override\n\tpublic void debug(String message, Object p0, Object p1, Object p2, Object p3) {\n\n\t}", "private static void showCurrentBreakPoints() {\n System.out.print(\"Current BreakPoints: \");\n for (int i=1;i<=dvm.getSourceCodeLength();i++)\n if (dvm.isLineABreakPoint(i)) System.out.print(i + \" \");\n System.out.print(\"\\n\");\n }", "@Override\n\tpublic void debug(Marker marker, String message, Object p0, Object p1, Object p2, Object p3,\n\t\t\tObject p4, Object p5, Object p6, Object p7) {\n\n\t}", "@Override\n\tpublic void setDebug(boolean isDebug) {\n\t\t\n\t}", "private void brewCoffeeGrinds() {\r\n LOG.debug( \"Brewing coffee grinds\" );\r\n }", "public static void printInfo(){\n }", "@Override\n\tpublic boolean isDebugEnabled(Marker marker) {\n\t\treturn false;\n\t}" ]
[ "0.7813157", "0.75207394", "0.71197295", "0.68726313", "0.6819712", "0.6772815", "0.6735241", "0.6713811", "0.6683939", "0.6626977", "0.6539158", "0.6527071", "0.6527071", "0.65190095", "0.65184623", "0.64967483", "0.649057", "0.64650553", "0.6464404", "0.6451148", "0.64322174", "0.6430642", "0.64264405", "0.6393664", "0.6391974", "0.63535815", "0.63323474", "0.6331591", "0.6331579", "0.63179463", "0.6305011", "0.6290597", "0.62843585", "0.6278553", "0.6263441", "0.62543076", "0.6221123", "0.62119293", "0.6210099", "0.6205481", "0.62050915", "0.6203425", "0.62009764", "0.61991584", "0.6195234", "0.61939317", "0.61913216", "0.6188459", "0.61797225", "0.6177395", "0.61716944", "0.6159342", "0.6158042", "0.6153448", "0.6152855", "0.61391264", "0.6129309", "0.6111054", "0.6110058", "0.61058277", "0.6104995", "0.6102274", "0.61008507", "0.609718", "0.60947526", "0.60874456", "0.60821265", "0.608208", "0.6078935", "0.6076453", "0.60418594", "0.6031688", "0.60306287", "0.6028967", "0.6016678", "0.6016678", "0.601579", "0.5997782", "0.59959584", "0.59949964", "0.5993825", "0.5989701", "0.59857446", "0.5984142", "0.5978332", "0.597474", "0.59746003", "0.59741086", "0.59685224", "0.59680605", "0.5962066", "0.5961327", "0.59600574", "0.5953738", "0.59536713", "0.5949537", "0.5936173", "0.5932773", "0.59311706", "0.5931043", "0.59302455" ]
0.0
-1
Read in the JSON from the example resources
@Test public void testOrderBookAdapter() throws IOException { InputStream is = CryptopiaAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/cryptopia/dto/marketdata/example-full-depth-data.json"); // Use Jackson to parse it ObjectMapper mapper = new ObjectMapper(); CryptopiaBaseResponse<CryptopiaOrderBook> cryptopiaOrderBook = mapper.readValue(is, CryptopiaBaseResponseCryptopiaOrderBook.class); is.close(); OrderBook orderBook = CryptopiaAdapters.adaptOrderBook(cryptopiaOrderBook.getData(), CurrencyPair.ETH_BTC); assertThat(orderBook).isNotNull(); assertThat(orderBook.getBids().size()).isEqualTo(93); // Verify all fields filled assertThat(orderBook.getBids().get(0).getLimitPrice().toString()).isEqualTo("0.07849890"); assertThat(orderBook.getBids().get(0).getType()).isEqualTo(Order.OrderType.BID); assertThat(orderBook.getBids().get(0).getOriginalAmount()) .isEqualTo(new BigDecimal("1.27390320")); assertThat(orderBook.getBids().get(0).getCurrencyPair()).isEqualTo(CurrencyPair.ETH_BTC); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n\tpublic void readJSONFromFile() {\n\t\t\n\t\tJsonPath jsonFile = new JsonPath(new File (\"C:\\\\Users\\\\cmlzd\\\\Desktop\\\\employees.json\"));\n\t\t\n\t\tSystem.out.println(jsonFile.getString(\"items.email\"));\n\t\t\n\t\t\n\t}", "private static JsonReader readJSONFromAsset(Context context) throws IOException {\n AssetManager assetManager = context.getAssets();\n JsonReader reader;\n try {\n reader = new JsonReader(new InputStreamReader(assetManager.open(\"questionlist.json\")));\n } finally {\n\n }\n return reader;\n }", "public static Books readJSON(){\n Gson gson = new GsonBuilder().create();\n Books books = new Books();\n try {\n books = gson.fromJson(new JsonReader(new FileReader(\"books.json\")), Books.class);\n } catch (IOException e){\n e.printStackTrace();\n }\n return books;\n }", "protected JSONArray readJsonFromLocalResources(InputStream resources) {\n\n InputStream is = resources;\n ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n\n if (is != null) {\n\n int ctr;\n try {\n ctr = is.read();\n while (ctr != -1) {\n byteArrayOutputStream.write(ctr);\n ctr = is.read();\n }\n\n if (byteArrayOutputStream.size() > 0) {\n Logger.d(\"JSON= \" + byteArrayOutputStream.toString());\n return new JSONArray(byteArrayOutputStream.toString());\n }\n\n } catch (IOException e) {\n Logger.e(\"Could not read the json file, IOException\" + e);\n } catch (JSONException ex) {\n Logger.e(\"Could not parse into json object, JSONException\" + ex);\n } finally {\n\n try {\n is.close();\n } catch (IOException ex) {\n Logger.e(\"Could not close InputStream, IOException\" + ex);\n }\n }\n }\n\n Logger.d(\"Could not return json object\"); //Let's hope not to hit this line\n return null;\n }", "public String loadJSONFromAsset() {\n String json;\n String file = \"assets/words.json\";\n\n try {\n InputStream is = this.getClass().getClassLoader().getResourceAsStream(file);\n int size = is.available();\n byte[] buffer = new byte[size];\n is.read(buffer);\n is.close();\n json = new String(buffer, \"UTF-8\");\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n }", "private Demo doReadDemo() throws IOException {\n // create a resource loader\n final URL defaultRoot = ResourceUtil.getURL(\"demo/\");\n final URLClassLoader resourceLoader = new URLClassLoader(\n new URL[] { defaultRoot }, null);\n return doReadDemo(resourceLoader);\n }", "public static void loadPracticeListFromFile() {\n JSONParser jsonParser = new JSONParser();\n\n try (FileReader reader = new FileReader(\"src/practiceList.json\")) {\n // Read JSON file\n Object object = jsonParser.parse(reader);\n\n //Iterate over word list array\n JSONArray wordList = (JSONArray) object;\n for (Object o : wordList) {\n\n JSONObject next = (JSONObject) o;\n String extra = \"\";\n\n if (((String) next.get(\"wordType\")).equalsIgnoreCase(\"verb\")) {\n extra = \"to \";\n }\n\n Word loadedWord = new Word(extra + next.get(\"english\"), (String) next.get(\"welsh\"), (String) next.get(\"wordType\"));\n\n addIntoPracticedWords(loadedWord);\n }\n\n } catch (ParseException | IOException e) {\n System.out.println(\"PracticeList file not found, will be created on exit.\");\n }\n }", "public Integer loadJSONFile()\n {\n JSONParser parser = new JSONParser();\n try{\n\n Object obj = parser.parse(new FileReader(\"/Users/rnuka/Desktop/sample.json\"));\n JSONObject jsonObj = (JSONObject)obj;\n\n Long age = (Long)jsonObj.get(\"age\");\n System.out.println(\"age:\"+age);\n\n String name = (String)jsonObj.get(\"name\");\n System.out.println(\"name:\" + name);\n\n JSONArray address = (JSONArray)jsonObj.get(\"address\");\n\n for(Object str : address){\n System.out.println(str);\n }\n\n\n\n }catch(Exception e){\n e.printStackTrace();\n }\n return 1;\n }", "private void read() {\n\n\t\t\t\tString road=getActivity().getFilesDir().getAbsolutePath()+\"product\"+\".txt\";\n\n\t\t\t\ttry {\n\t\t\t\t\tFile file = new File(road); \n\t\t\t\t\tFileInputStream fis = new FileInputStream(file); \n\t\t\t\t\tint length = fis.available(); \n\t\t\t\t\tbyte [] buffer = new byte[length]; \n\t\t\t\t\tfis.read(buffer); \n\t\t\t\t\tString res1 = EncodingUtils.getString(buffer, \"UTF-8\"); \n\t\t\t\t\tfis.close(); \n\t\t\t\t\tjson(res1.toString());\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} \n\t\t\t}", "public String loadJSONFromAsset(Context context) {\n String json = null;\n try {\n InputStream is;\n int id = context.getResources().getIdentifier(\"sentiment\", \"raw\", context.getPackageName());\n is = context.getResources().openRawResource(id);\n\n int size = is.available();\n\n byte[] buffer = new byte[size];\n\n is.read(buffer);\n\n is.close();\n\n json = new String(buffer, \"UTF-8\");\n\n\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n\n }", "@GetMapping(\"/getJson\")\r\n\tpublic HashMap<String, Object> getJsonValue() throws IOException {\n\r\n\t\tHashMap<String, Object> globalVariable = null;\r\n\t\tObjectMapper mapper = new ObjectMapper();\r\n\t\tString path = \"rules/backUp.json\";\r\n\r\n\t\tResourceLoader resource = new DefaultResourceLoader();\r\n\t\torg.springframework.core.io.Resource resource2 = resource.getResource(\"classpath:\" + path);\r\n\r\n\t\tReader reader = new InputStreamReader(resource2.getInputStream());\r\n\t\tSystem.out.println(\"reader ouput \" + reader.toString());\r\n\t\tString fileData = FileCopyUtils.copyToString(reader);\r\n\t\tSystem.out.println(\" filedate is \" + fileData);\r\n\r\n\t\tTypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() {\r\n\t\t};\r\n\t\tHashMap<String, Object> readValue = mapper.readValue(fileData, typeRef);\r\n\t\treturn readValue;\r\n\t}", "@GetMapping(\"/getThingsDescription\")\n public ResponseEntity<?> getThingsDescription() {\n log.info(\"Thing Description from TechUnit ... \");\n\n ClassLoader cl = getClass().getClassLoader();\n\n String thingsDescription = \"\";\n try {\n thingsDescription = IOUtils\n .toString(cl.getResourceAsStream(\"things-wearhealth.json\"));\n } catch (Exception ex) {\n log.error(\"Unable to load Things Description...\");\n ex.printStackTrace();\n }\n return new ResponseEntity<>(thingsDescription, HttpStatus.OK);\n }", "public void ReadJson() {\n System.out.println(\"Read Json Method in the Mother Class\");\n }", "public void readInventoryMainJsonFile() throws IOException, ParseException {\n\n\t\t// Providing read-only access to JSON data.\n\t\tJSONParser parser = new JSONParser();\n\n\t\t// Reading the external JSON file.\n\t\tFileReader reader = new FileReader(\".\\\\resources\\\\InventoryMain.json\");\n\n\t\t// Creating main object to store JSONParser, JSONObject and JSONArray.\n\t\tObject inventoryMain = parser.parse(reader);\n\n\t\t// Parsing object to JSONObject from InventoryMain.json file.\n\t\tJSONObject inventoryObj = (JSONObject) inventoryMain;\n\n\t\t// Getting the arrays of JSON file.\n\t\tJSONArray riceArray = (JSONArray) inventoryObj.get(\"Rice\");\n\t\tJSONArray pulseArray = (JSONArray) inventoryObj.get(\"Pulses\");\n\t\tJSONArray wheatArray = (JSONArray) inventoryObj.get(\"Wheat\");\n\n\t\t// Getting details of rice.\n\t\tSystem.out.println(\"Details of Rice are: \");\n\t\tfor (int i = 0; i < riceArray.size(); i++) {\n\t\t\tJSONObject riceDetails = (JSONObject) riceArray.get(i);\n\n\t\t\tString name = (String) riceDetails.get(\"name\");\n\t\t\tlong weight = (long) riceDetails.get(\"weight\");\n\t\t\tlong price = (long) riceDetails.get(\"price\");\n\n\t\t\tSystem.out.println(\"\\nName: \" + name);\n\t\t\tSystem.out.println(\"Weight: \" + weight);\n\t\t\tSystem.out.println(\"Price per KG is: \" + price);\n\n\t\t\t// Calculating price of different types of rice.\n\t\t\tlong ricePrice = weight * price;\n\t\t\tSystem.out.println(\"\\nTotal price of \" + riceDetails.get(\"name\") + \" is \" + ricePrice);\n\n\t\t}\n\n\t\t// Getting details of Pulse.\n\t\tSystem.out.println(\"\\nDetails of Pulse are: \");\n\t\tfor (int j = 0; j < pulseArray.size(); j++) {\n\t\t\tJSONObject pulseDetails = (JSONObject) pulseArray.get(j);\n\n\t\t\tString name = (String) pulseDetails.get(\"name\");\n\t\t\tlong weight = (long) pulseDetails.get(\"weight\");\n\t\t\tlong price = (long) pulseDetails.get(\"price\");\n\n\t\t\tSystem.out.println(\"\\nName: \" + name);\n\t\t\tSystem.out.println(\"Weight: \" + weight);\n\t\t\tSystem.out.println(\"Price per KG is: \" + price);\n\n\t\t\t// Calculating price of different types of Pulses.\n\t\t\tlong pulsePrice = weight * price;\n\t\t\tSystem.out.println(\"\\nTotal price of \" + pulseDetails.get(\"name\") + \" is \" + pulsePrice);\n\n\t\t}\n\t\t// Getting details of Wheat.\n\t\tSystem.out.println(\"\\nDetails of Wheat are: \");\n\t\tfor (int i = 0; i < wheatArray.size(); i++) {\n\t\t\tJSONObject wheatDetails = (JSONObject) wheatArray.get(i);\n\n\t\t\tString name = (String) wheatDetails.get(\"name\");\n\t\t\tlong weight = (long) wheatDetails.get(\"weight\");\n\t\t\tlong price = (long) wheatDetails.get(\"price\");\n\n\t\t\tSystem.out.println(\"\\nName: \" + name);\n\t\t\tSystem.out.println(\"Weight: \" + weight);\n\t\t\tSystem.out.println(\"Price per KG is: \" + price);\n\t\t\t// Calculating price of different types of Wheat.\n\t\t\tlong wheatPrice = weight * price;\n\t\t\tSystem.out.println(\"\\nTotal price of \" + wheatDetails.get(\"name\") + \" is \" + wheatPrice);\n\n\t\t}\n\n\t}", "public static void main(String[] args) throws IOException\n {\n File file = new File(\"D:\\\\work\\\\incoming\\\\F&D\\\\enrichment API\\\\context_test_record.jsonld\");\n\n Model m = ModelFactory.createDefaultModel();\n \n try {\n m.read(new FileInputStream(file), null, \"JSONLD\");\n }\n catch (Exception e) {\n e.printStackTrace(System.err);\n return;\n }\n\n// URL url = new URL(\"file:///C:/Users/Hugo/Google%20Drive/Europeana/EDM/jsonld/context.jsonld\");\n URL url = new URL(\"file:///D:/work/incoming/F&D/enrichment%20API/context.jsonld\");\n new JsonLdWriter(url).write(m, new OutputStreamWriter(System.out));\n }", "public void init() {\n\n mJokes = new ArrayList<>();\n\n StringBuilder sBuilder = new StringBuilder();\n\n try {\n\n InputStream in = getClass().getResourceAsStream(\"/jokes.json\");\n BufferedReader reader = new BufferedReader(new InputStreamReader(in));\n\n String mLine = reader.readLine();\n while (mLine != null) {\n //process line\n sBuilder.append(mLine);\n mLine = reader.readLine();\n }\n\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n\n String jsonString = sBuilder.toString();\n\n if( jsonString != null ){\n\n JsonParser parser = new JsonParser();\n JsonObject jsonObject = parser.parse(jsonString).getAsJsonObject();\n\n JsonArray jokesArray = jsonObject.getAsJsonArray(\"jokes\");\n\n for (JsonElement element : jokesArray) {\n String joke = element.getAsJsonObject().get(\"joke\").getAsString();\n mJokes.add(joke);\n }\n }\n\n }", "private JSONObject getJsonObject(Resource resource) {\n JSONParser parser = new JSONParser();\n JSONObject obj = null;\n try {\n obj = (JSONObject) parser.parse(new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8));\n } catch (Exception e) {\n e.printStackTrace();\n }\n return obj;\n }", "private Demo doReadDemo(final FileSystem fileSystem) throws IOException {\n // create a resource loader\n final URL[] demoRoot = new URL[] {\n fileSystem.getRoot().toURI().toURL() \n };\n final URLClassLoader resourceLoader = new URLClassLoader(demoRoot, null);\n return doReadDemo(resourceLoader);\n }", "public void loadToDoList() {\n try {\n toDoList = jsonReader.read();\n System.out.println(\"Loaded \" + toDoList.getName() + \" from \" + JSON_STORE);\n } catch (IOException e) {\n System.out.println(\"Unable to read from file: \" + JSON_STORE);\n }\n }", "public String loadJSONFile(int resourceIdentifier) {\n if (resourceIdentifier != 0) {\n InputStream input = getResources().openRawResource(resourceIdentifier);\n java.util.Scanner s = new java.util.Scanner(input).useDelimiter(\"\\\\A\");\n return s.hasNext() ? s.next() : null;\n } else {\n return null;\n }\n }", "public App read() throws IOException {\n String jsonData = readFile(source);\n JSONObject jsonObject = new JSONObject(jsonData);\n return parseApp(jsonObject);\n }", "private static JSONObject fileReader(String path) throws Exception{\r\n return (JSONObject) jsonParser.parse(new String(Files.readAllBytes(Paths.get(path))));\r\n }", "public Tamagotchi read() throws IOException {\n String jsonData = readFile(source);\n JSONObject jsonObject = new JSONObject(jsonData);\n return tamagotchiToJson(jsonObject);\n }", "public void retrieveData(){\n\t\tloaderImage.loadingStart();\n\t\tJsonClient js = new JsonClient();\n\t\tjs.retrieveData(JSON_URL, this);\n\t}", "public JSONObject getJSONFromFile() throws IOException\n\t{\n\t\tInputStream is = context.getResources().openRawResource(R.raw.schedule);\n\t\tWriter writer = new StringWriter();\n\t\tchar[] buffer = new char[1024];\n\t\ttry {\n\t\t Reader reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\n\t\t int n;\n\t\t while ((n = reader.read(buffer)) != -1) {\n\t\t writer.write(buffer, 0, n);\n\t\t }\n\t\t} finally {\n\t\t is.close();\n\t\t}\n\n\t\tString jsonString = writer.toString();\n\t\tJSONObject jObj=null;\n\t\t\n\t\t// try parse the string to a JSON object\n\t\ttry {\n\t\t\tjObj = new JSONObject(jsonString);\n\t\t} catch (JSONException e) {\n\t\t\tLog.e(\"JSON Parser\", \"Error parsing data \" + e.toString());\n\t\t}\n\t\t\t\n\t\treturn jObj;\n\t\t// return JSON String\n\n\t}", "@Test\n public void testFromJSON() {\n System.out.println(\"fromJSON\");\n String json = \"\";\n Resource expResult = null;\n Resource result = Resource.fromJSON(json);\n assertEquals(expResult, result);\n // TODO review the generated test code and remove the default call to fail.\n fail(\"The test case is a prototype.\");\n }", "public static List<DataItem> importFromJSON(Context context){\n FileReader reader = null;\n File file = new File(Environment.getExternalStorageDirectory(), FILE_NAME);\n\n try {\n //Instantiate FileReader with file\n reader = new FileReader(file);\n //Populate DataItems class and return result\n Gson gson = new Gson();\n DataItems dataItems = gson.fromJson(reader, DataItems.class);\n return dataItems.getDataItems();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }finally {\n if (reader != null) {\n try {\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n return null;\n }", "@Override\n \tpublic Representation getResource() throws Exception {\n \t\tJsonRepresentation result = null;\n \t\t// Rcupre l'identifiant unique de la ressource demande.\n \t\tString interId = (String) this.getRequestAttributes().get(\"interId\");\n \t\tString srcId = (String) this.getRequestAttributes().get(\"sourceId\");\n \t\tSystem.out.println(srcId);\n \t\t// Rcupration des sources de l'intervention\n \t\tList<Source> sources = Interventions.getInstance().getIntervention(interId).getSources();\n \n \t\tSource source = null;\n \t\t\n \t\t// Si on demande un source prcis\n \t\tif (srcId != null) {\n \t\t\t// Recherche du source demand\n \t\t\tfor (int i = 0; i < sources.size(); i++) {\n \t\t\t\tif (sources.get(i).getUniqueID().equals(srcId)) {\n \t\t\t\t\tsource = sources.get(i);\n \t\t\t\t}\n \t\t\t}\n \t\t\t// Si le source n'est pas trouv\n \t\t\tif (source == null) {\n \t\t\t\tresult = null;\n \t\t\t\tgetResponse().setStatus(Status.CLIENT_ERROR_NOT_ACCEPTABLE);\n \t\t\t} else {\n \t\t\t\tresult = new JsonRepresentation(source.toJSON());\n \t\t\t}\n \t\t// Si on veut tous les sources\n \t\t} else if (srcId == null) {\n \t\t\t\n \t\t\tJSONArray jsonAr = new JSONArray(); //Cration d'une liste Json\n \t\t\tfor(int i=0; i< sources.size();i++){\n\t\t\t\tjsonAr.put(sources.get(i).toJSON()); // On ajoute un jsonObject contenant le source dans le jsonArray\n \t\t\t}\n \t\t\t\n \t\t\tresult = new JsonRepresentation(jsonAr); // On cre la reprsentation de la liste\n \t\t}\n \n \t\t// Retourne la reprsentation, le code status indique au client si elle est valide\n \t\treturn result;\n \t}", "public String loadJSONFromAsset(Context context) {\n json = null;\n try {\n InputStream is = getApplicationContext().getAssets().open(\"techdrop.json\");\n int size = is.available();\n byte[] buffer = new byte[size];\n is.read(buffer);\n is.close();\n json = new String(buffer, \"UTF-8\");\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n }", "public static List<DataItem> importFromResource(Context context){\n InputStreamReader reader = null;\n InputStream inputStream = null;\n\n try {\n //Instantiate InputStream with static raw file the assign it to InputStreamReader\n inputStream = context.getResources().openRawResource(R.raw.menuitems);\n reader = new InputStreamReader(inputStream);\n //Populate DataItems class and return result\n Gson gson = new Gson();\n DataItems dataItems = gson.fromJson(reader, DataItems.class);\n return dataItems.getDataItems();\n }finally {\n //close both classes\n if (reader != null) {\n try {\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n if (inputStream != null) {\n try {\n inputStream.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n }\n }", "@Test\r\n public void testRevision() {\r\n InputStream inputstream = getClass().getClassLoader().getResourceAsStream(\"sample.json\");\r\n assert inputstream != null;\r\n Reader reader = new InputStreamReader(inputstream);\r\n JsonParser parser = new JsonParser();\r\n JsonElement rootElement = parser.parse(reader);\r\n\r\n RevisionParser revisionParser = new RevisionParser();\r\n List<Revision> revisionList = revisionParser.parse(rootElement);\r\n\r\n for (Revision r: revisionList) {\r\n System.out.println(r);\r\n }\r\n Assert.assertEquals(revisionList.get(0).toString(), \"Name: Monkbot\tTimeStamp: Fri Sep 13 11:10:41 EDT 2019\");\r\n }", "@Override\n public Object loadFromJson(Context context) {\n Gson gson = new Gson();\n String json = FileManager.getInstance().loadFromFile(getFileName(), context);\n if(json.equals(\"\")) {\n return null;\n }\n\n return gson.fromJson(json, MatchStorage.class);\n\n }", "public String generateJsonFileFromParsedTextFileInApp() {\n\t\treturn generateJsonFileFromParsedTextFile(TEXTSAMPLEFILE);\n\t}", "static JsonResource forClasspath( ClassLoader classLoader, String name ) {\n final ClassLoader loader = classLoader == null ? Thread.currentThread().getContextClassLoader() : classLoader;\n return new JsonResource() {\n @Override\n public <T> T readFrom( ReadMethod<T> consumer ) throws IOException {\n InputStream stream = loader.getResourceAsStream(name);\n if ( stream == null )\n throw new FileNotFoundException(\"Resource \" + name + \" not found\");\n try {\n return consumer.read( stream );\n } finally {\n stream.close();\n }\n }\n };\n }", "private static JsonObject readJSON(String path) {\n\n\t\tString fileContents = \"\";\n\t\tBufferedReader reader = null;\n\n\t\ttry {\n\t\t\treader = new BufferedReader(new FileReader(path));\n\t\t} catch (FileNotFoundException e) {\n\t\t\tfail(ErrorMessage.inputFileNotFoundError);\n\t\t}\n\n\t\tString line;\n\n\t\ttry {\n\t\t\twhile ((line = reader.readLine()) != null) {\n\t\t\t\tfileContents += line;\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\tfail(ErrorMessage.readFileError);\n\t\t}\n\n\t\ttry {\n\t\t\treader.close();\n\t\t} catch (IOException e) {\n\t\t\tfail(ErrorMessage.closeFileError);\n\t\t}\n\n\t\tJsonObject jsonLicense = Json.createReader(new StringReader(fileContents)).readObject();\n\n\t\treturn jsonLicense;\n\t}", "static JsonResource forFile( File file ) {\n return new JsonResource() {\n @Override\n public <T> T readFrom( ReadMethod<T> consumer ) throws IOException {\n try ( FileInputStream stream = new FileInputStream(file) ) {\n return consumer.read(stream);\n }\n }\n };\n }", "private JSONObject readJSONFile(Path path) throws ExtensionManagementException {\n\n if (Files.exists(path) && Files.isRegularFile(path)) {\n try {\n String jsonString = FileUtils.readFileToString(path.toFile(), UTF8);\n return new JSONObject(jsonString);\n } catch (JSONException e) {\n throw new ExtensionManagementException(\"Error while parsing JSON file: \" + path, e);\n } catch (IOException e) {\n throw new ExtensionManagementException(\"Error while reading JSON file: \" + path, e);\n }\n } else {\n throw new ExtensionManagementException(\"JSON file not found: \" + path);\n }\n }", "public static JsonObject getTestVectors(String filename) throws \n IOException {\n InputStream is = JsonUtil.class.getClassLoader().getResourceAsStream(filename);\n JsonReader reader = new JsonReader(new InputStreamReader(is, UTF_8));\n JsonElement elem = JsonParser.parseReader(reader);\n return elem.getAsJsonObject();\n }", "private static String readJsonFile (String fileName) {\n if (!fileName.endsWith(\".json\")){\n throw new IllegalArgumentException(\"Invalid file name\");\n }\n String jsonStr = \"\";\n try{\n isFileExistOrCreatIt(fileName);\n File jsonFile = new File(\"src//main//resources\"+\"//\"+fileName);\n Reader reader = new InputStreamReader(new FileInputStream(jsonFile),\"utf-8\");\n int ch = 0;\n StringBuffer sb = new StringBuffer();\n while((ch = reader.read())!=-1){\n sb.append((char) ch);\n }\n reader.close();\n jsonStr = sb.toString();\n return jsonStr;\n\n } catch (IOException e) {\n e.printStackTrace();\n return null;\n }\n }", "public static void main(String[] args) throws FileNotFoundException {\r\n\t\tJsonParser parser = Json.createParser(new FileReader(JSON_FILE_NAME));\r\n\t\t\r\n\t\t// parse the file\r\n\t\twhile (parser.hasNext()) {\r\n\t\t\tJsonParser.Event event = parser.next();\r\n\t\t\tif (event.equals(JsonParser.Event.KEY_NAME)) {\r\n\t\t\t\tString key = parser.getString();\r\n\t\t\t\tparser.next();\r\n\t\t\t\tString value = parser.getString();\r\n\t\t\t\tSystem.out.printf(\">> %s: %s\\n\", key, value);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}", "public static void main(String[] args) {\n Client client = Client.create();\n WebResource resource = client.resource(\"http://localhost:8080/rest/resource/strings\");\n String strings = resource.get(String.class);\n System.out.println(strings);\n }", "public static JSONObject loadJSONObjectFromAsset(Context context) {\n String jsonStr = null;\n JSONObject jsonObject = null;\n try {\n //here we need context to access ASSETS --> ANDROID TUTORIAL / codeBlock - Patterns / Application.java\n InputStream is = context.getAssets().open(\"listHomeItem.json\");\n int size = is.available();\n byte[] buffer = new byte[size];\n is.read(buffer);\n is.close();\n jsonStr = new String(buffer, \"UTF-8\");\n\n jsonObject = new JSONObject(jsonStr);\n\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n\n } catch (JSONException e) {\n e.printStackTrace();\n return null;\n }\n return jsonObject;\n }", "String readSampleJsonDoc(String file) {\n\t\tStringBuffer sb = new StringBuffer();\n\t\tBufferedReader br = null;\n\n\t\ttry {\n\t\t\tbr = new BufferedReader(new FileReader(new File(file)));\n\t\t\tString line;\n\t\t\twhile ((line = br.readLine()) != null) {\n\t\t\t\tsb.append(line + NEWLINE);\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (br != null) {\n\t\t\t\t\tbr.close();\n\t\t\t\t}\n\t\t\t} catch (IOException e) {\n\t\t\t}\n\t\t}\n\t\treturn sb.toString();\n\t}", "public void load(){\n // Recover docIDs\n try(Reader reader = new FileReader(\"postings/docIDs.json\")){\n this.docIDs = (new Gson()).fromJson(reader,\n new TypeToken<Map<String, String>>(){}.getType());\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n try(Reader reader = new FileReader(\"postings/docLengths.json\")){\n this.docLengths = (new Gson()).fromJson(reader,\n new TypeToken<Map<String, Integer>>(){}.getType());\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n try(Reader reader = new FileReader(\"postings/titleToNumber.json\")){\n this.titleToNumber = (new Gson()).fromJson(reader,\n new TypeToken<Map<String, Integer>>(){}.getType());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "static ArrayList<Integer> getAllQuestionIDs(Context context){\n JsonReader reader;\n ArrayList<Integer> questionIDs = new ArrayList<>();\n try {\n reader = readJSONFromAsset(context);\n reader.beginArray();\n while (reader.hasNext()) {\n questionIDs.add(readQuestion(reader).getQuestionID());\n }\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return questionIDs;\n }", "public static void main(String[] args) throws IOException {\n String path = \"D:\\\\data\\\\code\\\\github-workspace\\\\tiny\\\\app\\\\web\\\\home\\\\src\\\\test\\\\resources\\\\table-result-3.json\";\n String jsonStr = FileUtils.readFileToString(new File(path));\n// Object obj = parseLayoutResult2(jsonStr);\n Object obj = parseContentResult2(jsonStr);\n System.out.println(obj);\n\n }", "private MoodsCreator(Resources resources){\n\n String result;\n try {\n InputStream inputStream = resources.openRawResource(R.raw.moods);\n\n StringBuffer buffer = new StringBuffer();\n BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));\n\n String line;\n while ((line = reader.readLine()) != null) {\n\n buffer.append(line + \"\\n\");\n }\n result = buffer.toString();\n Log.d(\"MOODS\", result);\n\n JSONObject moodsJson = new JSONObject(result);\n JSONArray moodsJsonArray = new JSONArray(moodsJson.get(\"moods\").toString());\n\n for(int i =0;i<moodsJsonArray.length();++i){\n JSONObject moodfromJson = moodsJsonArray.getJSONObject(i);\n Mood mood = new Mood(moodfromJson.get(\"name\").toString(),moodfromJson.getInt(\"red\"),moodfromJson.getInt(\"green\"), moodfromJson.getInt(\"blue\"), moodfromJson.getInt(\"alpha\"));\n\n Log.d(\"MOOD\",mood.name + \" \"+mood.alpha + \" \"+ mood.red);\n moods.put(moodfromJson.get(\"name\").toString(),mood);\n }\n\n Log.d(\"moodsMap\",moods.toString());\n }\n catch(Exception e){\n\n }\n\n }", "public static JsonNode getLibraryMetadata(Object resource, List<String> desc) throws Exception {\n\t\tfinal ObjectMapper mapper = BeanTemplateUtils.configureMapper(Optional.empty());\t\t\n\t\tfinal JsonNode v1_bean = \n\t\t\t\t((ObjectNode) mapper.readTree(resource.getClass().getResourceAsStream(\"test_v1_sync_sample_share.json\")))\n\t\t\t\t.put(\"description\", desc.stream().collect(Collectors.joining(\"\\n\")));\n\t\t\t\t\n\t\treturn v1_bean;\n\t}", "String getJSON();", "private void loadWorld() {\n try {\n world = jsonReader.read();\n System.out.println(\"Loaded world from \" + JSON_STORE);\n } catch (IOException | InvalidDataException e) {\n System.out.println(\"Unable to read from file: \" + JSON_STORE);\n }\n }", "private JSONObject loadTemplate(Path extensionResourcePath) throws ExtensionManagementException {\n\n Path templatePath = extensionResourcePath.resolve(TEMPLATE_FILE_NAME);\n if (Files.exists(templatePath) && Files.isRegularFile(templatePath)) {\n return readJSONFile(templatePath);\n }\n return null;\n }", "private String loadJSONFromAsset() {\n String json = null;\n try {\n //AssetManager assetManager = getAssets();\n InputStream is = getAssets().open(\"sa.json\");\n //InputStream is = getResources().openRawResource(\"sa.json\");\n int size = is.available();\n\n byte[] buffer = new byte[size];\n\n is.read(buffer);\n\n is.close();\n\n json = new String(buffer, \"UTF-8\");\n Log.i(\"Json\",json);\n\n\n } catch (Exception ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n\n }", "protected void loadMockData() {\n\n int ctr;\n InputStream inputStream = getResources().openRawResource(R.raw.song_list);\n ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n\n try {\n ctr = inputStream.read();\n while (ctr != -1) {\n byteArrayOutputStream.write(ctr);\n ctr = inputStream.read();\n }\n inputStream.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n // Parse the data.\n try {\n JSONObject jObject = new JSONObject(byteArrayOutputStream.toString());\n\n String status_code = jObject.getString(\"statusCode\");\n\n if (status_code.equalsIgnoreCase(\"200\")) {\n JSONArray jArray = jObject.getJSONArray(\"data\");\n\n audioList = new ArrayList<>();\n\n for (int i = 0; i < jArray.length(); i++) {\n JSONObject song = jArray.getJSONObject(i);\n\n String genre = song.getString(\"genre\");\n String album = song.getString(\"album\");\n String author = song.getString(\"author\");\n String title = song.getString(\"title\");\n String url = song.getString(\"url\");\n String imgUrl = song.getString(\"img\");\n\n Audio audio = new Audio(genre, album, author, title, url, imgUrl);\n\n // Save to audioList.\n audioList.add(audio);\n }\n }\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }", "private void readFromJSON(String filename) {\n JSONParser parser = new JSONParser();\n\n try\n {\n Object obj = parser.parse(new FileReader(filename));\n JSONObject jsonObject = (JSONObject) obj;\n Menu drinks = getMenu(jsonObject, \"Drink\");\n Menu types = getMenu(jsonObject, \"Type\");\n Menu toppings = getMenu(jsonObject, \"Toppings\");\n Menu sizes = getMenu(jsonObject, \"Size\");\n menuMap.put(\"Drink\", drinks);\n menuMap.put(\"Size\", sizes);\n menuMap.put(\"Toppings\", toppings);\n menuMap.put(\"Type\", types);\n\n } catch (FileNotFoundException e) {\n System.out.println(\"Not found menu.json, exit now.\");\n System.exit(1);\n } catch (IOException e) {\n e.printStackTrace();\n } catch (ParseException e) {\n e.printStackTrace();\n }\n\n }", "@GET\n\t@Path(\"/helloJSONList\")\n\t/**\n\t * Here is an example of a simple REST get request that returns a String.\n\t * We also illustrate here how we can convert Java objects to JSON strings.\n\t * @return - List of words as JSON\n\t * @throws IOException\n\t */\n\tpublic String helloJSONList() throws IOException {\n\n\t\tList<String> listOfWords = new ArrayList<String>();\n\t\tlistOfWords.add(\"Hello\");\n\t\tlistOfWords.add(\"World!\");\n\n\t\t// We can turn arbatory Java objects directly into JSON strings using\n\t\t// Jackson seralization, assuming that the Java objects are not too complex.\n\t\tString listAsJSONString = oWriter.writeValueAsString(listOfWords);\n\n\t\treturn listAsJSONString;\n\t}", "static JsonResource forString( String contents ) {\n return new JsonResource() {\n @Override\n public <T> T readFrom( ReadMethod<T> consumer ) throws IOException {\n try ( ByteArrayInputStream stream = new ByteArrayInputStream(contents.getBytes(Json.getDefaultConfig().getCharset())) ) {\n return consumer.read(stream);\n }\n }\n };\n }", "private void downloadJSON() {\n new downloadJsonAsync().execute(Urls.GET_TAGS, Urls.GET_REST);\n }", "public JSONObject SourceResource() {\n JSONObject source = jsonParent.getJSONObject(\"sourceResource\");\n return source;\n }", "@Test\r\n public void testParseConnection() throws MalformedURLException {\r\n JsonArray array = null;\r\n JsonParser parser = new JsonParser();\r\n URL url = new URL(\"https://en.wikipedia.org/w/api.php?action=query&format=json&prop=revisions&titles=\\\" + \\\"Ball State\\\" + \\\"&rvprop=timestamp|user&rvlimit=24&redirects\");\r\n InputStream inputstream = getClass().getClassLoader().getResourceAsStream(\"sample.json\");\r\n assert inputstream != null;\r\n Reader reader = new InputStreamReader(inputstream);\r\n JsonElement rootElement = parser.parse(reader);\r\n JsonObject rootObject = rootElement.getAsJsonObject();\r\n JsonObject pages = rootObject.getAsJsonObject(\"query\").getAsJsonObject(\"pages\");\r\n for (Map.Entry<String, JsonElement> entry : pages.entrySet()) {\r\n JsonObject entryObject = entry.getValue().getAsJsonObject();\r\n array = entryObject.getAsJsonArray(\"revisions\");\r\n }\r\n System.out.println(array);\r\n System.out.println(url);\r\n }", "@VisibleForTesting\n interface JsonReader {\n /**\n * Returns the contents of the JSON file that is pointed to by the given {@code resId} as\n * a string.\n *\n * @param context The current Context.\n * @param resId The resource id of the JSON file.\n * @return A string representation of the file or {@code null} if an error occurred.\n */\n @Nullable\n String jsonFileToString(Context context, @RawRes int resId);\n }", "@Override\n public Map<String, Object> getResource() {\n List<Customer> customerList = customerRepository.findAllByName(\"toto\");\n Map<String,Object> model = new HashMap<String,Object>();\n model.put(\"id\", UUID.randomUUID().toString());\n model.put(\"content\", \"Hello World\");\n return model;\n }", "@Test\r\n public void testRevisionParser() {\r\n JsonParser parser = new JsonParser();\r\n InputStream inputstream = getClass().getClassLoader().getResourceAsStream(\"sample.json\");\r\n assert inputstream != null;\r\n Reader reader = new InputStreamReader(inputstream);\r\n JsonElement rootElement = parser.parse(reader);\r\n JsonObject rootObject = rootElement.getAsJsonObject();\r\n JsonObject pages = rootObject.getAsJsonObject(\"query\").getAsJsonObject(\"pages\");\r\n JsonArray array = null;\r\n for (Map.Entry<String, JsonElement> entry : pages.entrySet()) {\r\n JsonObject entryObject = entry.getValue().getAsJsonObject();\r\n array = entryObject.getAsJsonArray(\"revisions\");\r\n Assert.assertNotNull(array);\r\n }\r\n System.out.println(array);\r\n\r\n }", "public static List<String> mainReadFile(String[] args) throws IOException, URISyntaxException {\n List<String> exmp = new ArrayList<>();\n File initialFile = resolveFileFromResources(args[0]);\n // System.out.println(initialFile);\n ObjectMapper obM = getObjectMapper();\n Trades[] exmpTrade = obM.readValue(initialFile, Trades[].class);\n for (Trades trade : exmpTrade) {\n exmp.add(trade.getSymbol());\n }\n printJsonObject(exmp);\n //return Collections.emptyList();\n return exmp;\n }", "private void loadJSON() throws FileNotFoundException\n\t{\n\n\t\tGsonBuilder builder= new GsonBuilder();\n\t\tGson gson = builder.create();\n\t\t\t\t\n\t\t//get a list of folders in the data directory\n\t\t\n\t\tFile[] directories = new File(\"data\").listFiles();\n\n\t\t//Loop through folders in data directory\n\t\tfor(File folder : directories)\n\t\t\t{\n\t\t\t\t//get a list of files inside the folder\n\t\t\t\tFile[] jsonItems = new File(folder.toString()).listFiles();\n\t\t\t\t\n\t\t\t\t//Loop through files inside the folder \n\t\t\t\tfor(File file : jsonItems)\n\t\t\t\t{\n\t\t\t\t\t//Store in directory map... substring to remove the \"data/\" portion... placed by filename to foldername\n\t\t\t\t\tString dir = file.toString().substring(5);\n\t\t\t\t\t\n\t\t\t\t\t//Generate player data from gson\n\t\t\t\t\tJsonReader reader = new JsonReader(new FileReader(file));\n\t\t\t\t\tPlayer player = gson.fromJson(reader, Player.class);\n\t\t\t\t\t\n\t\t\t\t\t//Store it in the map tied to it's directory\n\t\t\t\t\tplayerData.put(dir, player);\n\t\t\t\t}\n\t\t\t}\n\t\t}", "private JsonObject loadJSONFile(String jsonFilePath) throws IOException {\r\n\tInputStream is = new FileInputStream(jsonFilePath);\r\n\tJsonReader jsonReader = Json.createReader(is);\r\n\tJsonObject json = jsonReader.readObject();\r\n\tjsonReader.close();\r\n\tis.close();\r\n\treturn json;\r\n }", "private JSONObject loadMetadata(Path extensionResourcePath) throws ExtensionManagementException {\n\n Path metadataPath = extensionResourcePath.resolve(METADATA_FILE_NAME);\n if (Files.exists(metadataPath) && Files.isRegularFile(metadataPath)) {\n return readJSONFile(metadataPath);\n }\n return null;\n }", "public void loadFromSource(Object aSrc)\n{\n WebURL url = WebURL.getURL(aSrc);\n String jsonText = url.getText();\n loadFromString(jsonText);\n}", "public JSONArray readFromJSON(){\n\n JSONArray jsonArray=null;\n\n try {\n InputStream inputStream =context.getResources().getAssets().open(FILE_NAME);\n int size = inputStream.available();\n byte[] data = new byte[size];\n inputStream.read(data);\n inputStream.close();\n String json = new String(data, \"UTF-8\");\n jsonArray = new JSONArray(json);\n } catch (IOException e) {\n e.printStackTrace();\n } catch (JSONException e) {\n e.printStackTrace();\n }\n return jsonArray;\n }", "private TabulatorItems[] getJsonArrayOfItems(Resource resource) {\n ObjectMapper mapper = new ObjectMapper();\n TabulatorItems[] items = null;\n try {\n items = mapper.readValue(new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8), TabulatorItems[].class);\n } catch (IOException ex) {\n Logger.getLogger(CollectionApiUIImpl.class.getName()).log(Level.SEVERE, null, ex);\n }\n return items;\n }", "public void load() throws IOException {\r\n\t\tFile file = new File(projectDir, TERN_PROJECT);\r\n\t\tif (file.exists()) {\r\n\t\t\tJSONParser parser = new JSONParser();\r\n\t\t\ttry {\r\n\t\t\t\tJSONObject result = (JSONObject) parser.parse(new FileReader(\r\n\t\t\t\t\t\tfile));\r\n\t\t\t\tsuper.putAll(result);\r\n\t\t\t} catch (ParseException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private String loadJSONFromAsset(){\n String json = null;\n AssetManager assetManager = getAssets();\n try{\n InputStream IS = assetManager.open(\"datosFases.json\");\n int size = IS.available();\n byte[] buffer = new byte[size];\n IS.read(buffer);\n IS.close();\n json = new String(buffer,\"UTF-8\");\n\n } catch (IOException ex){\n ex.printStackTrace();\n return null;\n }\n\n return json;\n }", "public void testImportJSONFromRequestParam() throws IOException, JsonException {\n final String testPath = TEST_BASE_PATH;\n Map<String, String> props = new HashMap<String, String>();\n String testNode = testClient.createNode(HTTP_BASE_URL + testPath, props);\n urlsToDelete.add(testNode);\n\n props.clear();\n props.put(SlingPostConstants.RP_OPERATION,\n \t\tSlingPostConstants.OPERATION_IMPORT);\n\n String testNodeName = \"testNode_\" + String.valueOf(random.nextInt());\n props.put(SlingPostConstants.RP_NODE_NAME_HINT, testNodeName);\n String jsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/testimport.json\"));\n props.put(SlingPostConstants.RP_CONTENT, jsonContent);\n props.put(SlingPostConstants.RP_CONTENT_TYPE, \"json\");\n props.put(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + \"/*\");\n String importedNodeUrl = testClient.createNode(HTTP_BASE_URL + testPath, props);\n\n // assert content at new location\n String content = getContent(importedNodeUrl + \".3.json\", CONTENT_TYPE_JSON);\n\n\t\tJsonObject jsonObj = JsonUtil.parseObject(content);\n\t\tassertNotNull(jsonObj);\n\n\t\t//assert the imported content is there.\n String expectedJsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/importresults.json\"));\n\t\tassertExpectedJSON(JsonUtil.parseObject(expectedJsonContent), jsonObj);\n }", "private JSONObject getAssetJson(String filename) {\n return new JSONObject(\n resourceHandler.getResourceFileAsString(ResourceHandler.VALORANT_BASE_PATH + \"Data/\" + filename)\n );\n }", "public static void main(String[] args)\n\t\t\tthrows IOException, MalformedURLException, FileNotFoundException, IOException {\n\t\tString string = \"\";\n\n\t\tInputStream input = new FileInputStream(\"C:\\\\Users\\\\siva_\\\\workspace\\\\RESTfulExample1\\\\json.txt\");\n\n\t\tInputStreamReader reader = new InputStreamReader(input);\n\t\tBufferedReader bReader = new BufferedReader(reader);\n\t\tString line = null;\n\n\t\twhile ((line = bReader.readLine()) != null) {\n\t\t\tstring += line + \"\\n\";\n\t\t}\n\t\tbReader.close();\n\t\tJSONObject jsonObj = new JSONObject(string);\n\t\tSystem.out.println(\"The JSON File contents are:\");\n\t\tSystem.out.println(jsonObj.toString());\n\n\t\tURL url = new URL(\"http://localhost:8080/RESTfulExample1/api/JSONProcessorService\");\n\t\tSystem.out.println(\"connection opened at \" + url.getHost());\n\t\tURLConnection connection = url.openConnection();\n\n\t\tconnection.setDoOutput(true);\n\t\tconnection.setRequestProperty(\"Content-type\", \"application/json\");\n\t\tconnection.setConnectTimeout(5000);\n\t\tconnection.setReadTimeout(5000);\n\n\t\tOutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream());\n\t\tout.write(jsonObj.toString());\n\t\tout.close();\n\t\t\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n\n\t\tif (br.readLine() == null) {\n\t\t\tSystem.out.println(\"Read nothing terminating.....\");\n\t\t\treturn;\n\t\t}\n\n\t\tSystem.out.println(\"Webservice invoked successfully\");\n\n\t}", "public static void readJSON() throws IOException {\n\t\tBufferedReader br = new BufferedReader(new FileReader(f));\n\t\tString line;\n\t\tif((line = br.readLine()) != null) {\n\t\t\tString [] flightStates = parseJSON(line);\n\t\t\tfor(String state : flightStates) {\n\t\t\t\tFlightState fs = new FlightState(state);\n\t\t\t\tsendToKafka(fs);\n\t\t\t}\n\t\t}\n\t\tbr.close();\n\t}", "@GET\n @Path(\"location/Arovince\")\n @Produces(\"application/json\")\n public String getJson() throws IOException {\n FileWriter file = new FileWriter(\"/home/component/NetBeansProjects/ArovinceAndSchool/web/api/Arovince.json\");\n JSONObject jsonArray = null;\n\n try {\n URL url = new URL(\"https://opend.data.go.th/get-ckan/datastore_search?resource_id=df922923-e009-4dee-92fc-d963a86ce4b8\"); \n HttpURLConnection httpURLConnection = (HttpURLConnection)url.openConnection();\n httpURLConnection.setRequestMethod(\"GET\");\n httpURLConnection.setRequestProperty(\"api-key\", \"XOe9aVTolOhCbyTU103IqAKTNNNPX8b5\");\n String line = \"\";\n InputStreamReader inputStreamReader = new InputStreamReader(httpURLConnection.getInputStream());\n BufferedReader bufferedReader = new BufferedReader(inputStreamReader);\n StringBuilder response = new StringBuilder();\n\n try {\n while((line = bufferedReader.readLine()) != null) {\n file.write(line);\n response.append(line);\n }\n } catch (IOException var10) {\n }\n\n file.close();\n bufferedReader.close();\n jsonArray = new JSONObject(response.toString());\n return jsonArray.toString(4);\n } catch (Exception var11) {\n return \"\" + var11;\n }\n }", "@Test\n public void toAndFromJsonTestWithFollowUpQuestions() throws IOException {\n Question bonusQuestion = new Question(\"BonusQ1\", \"This is a followupCounts to a followupCounts question!\", \"Plane\", \"Nice!\", Arrays.asList(\"Nice!\", \"Sweet!\", \"Cool!\"), \"../static/images/equine02.jpg\");\n Question attach1 = new Question(\"AttachQ1\", \"Which attachment is this?\", \"Attachment\",\n \"Type1\", Arrays.asList(\"Type1\", \"Type2\", \"Type3\"), \"../static/images/equine02.jpg\");\n Question attach2 = new Question(\"AttachQ2\", \"Which attachment is this?\", \"Attachment\",\n \"Type3\", Arrays.asList(\"Type1\", \"Type2\", \"Type3\"), \"../static/images/equine02.jpg\");\n Question attach3 = new Question(\"AttachQ1\", \"Which attachment is this?\", \"Attachment\",\n \"Type2\", Arrays.asList(\"Type1\", \"Type2\", \"Type3\"), \"../static/images/equine02.jpg\", Arrays.asList(bonusQuestion));\n List<Question> attachmentQuestions = Arrays.asList(attach1, attach2, attach3);\n Question myQ = new Question(\"StructureQ1\", \"What kind of structure is this?\", EquineQuestionTypes.structure.toString(), \"Structure1\", Arrays.asList(\"Structure1\", \"Structure2\", \"Structure3\"), \"../static/images/equine02.jpg\", attachmentQuestions);\n Question myQ2 = new Question(\"PlaneQ1\", \"What plane is this?\", EquineQuestionTypes.plane.toString(), \"Transverse\", Arrays.asList(\"Transverse\", \"Longitudinal\"), \"../static/images/equine02.jpg\");\n List<Question> hardcodedQuestions = Arrays.asList(myQ, myQ2);\n\n //Write to file\n JsonUtil.toJsonFile(\"src/test/resources/autoGenerated/questionsWithFollowup.json\", hardcodedQuestions);\n\n //Load back in\n List<Question> questionsFromFile = JsonUtil.listFromJsonFile(\"src/test/resources/autoGenerated/questionsWithFollowup.json\", Question.class);\n\n assertEquals(2, questionsFromFile.size());\n Question questionWithFollowups = questionsFromFile.get(0);\n assertEquals(3, questionWithFollowups.getFollowupQuestions().size());\n Question questionWithoutFollowups = questionsFromFile.get(1);\n assertEquals(0, questionWithoutFollowups.getFollowupQuestions().size());\n\n }", "public String loadJSONFromAsset() {\n String json = null;\n try {\n InputStream is = getAssets().open(\"election-county-2012.json\");\n int size = is.available();\n byte[] buffer = new byte[size];\n is.read(buffer);\n is.close();\n json = new String(buffer, \"UTF-8\");\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n }", "private void loadHelpContent() {\n\t\tGson gson = new GsonBuilder().setPrettyPrinting().create();\n\t\tBufferedReader br;\n\t\ttry {\n\t\t\tbr = new BufferedReader(\n\t\t\t\t\tnew UnicodeReader(new FileInputStream(new File(getHelpContentFilePath())), \"UTF-8\"));\n\t\t\tsx3ConfigurationHelp = gson.fromJson(br, SX3ConfiguartionHelp.class);\n\t\t\tSX3Manager.getInstance().setSx3ConfiguartionHelp(sx3ConfigurationHelp);\n\t\t} catch (FileNotFoundException e) {\n\t\t\tsx3ConfigurationHelp = new SX3ConfiguartionHelp();\n\t\t\tSX3Manager.getInstance().addLog(\"<span style='color:red;'>\" + e.getMessage() + \".</span><br>\");\n\n\t\t}\n\t}", "String getJson();", "String getJson();", "String getJson();", "private ArrayList<Book> loadBooks(InputStream is) throws IOException{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(is));\r\n\t\tStringBuilder jsonFileContent = new StringBuilder();\r\n\t\t//read line by line from file\r\n\t\tString nextLine = null;\r\n\t\twhile ((nextLine = br.readLine()) != null){\r\n\t\t\tjsonFileContent.append(nextLine);\r\n\t\t}\r\n\r\n\t\tGson gson = new Gson();\r\n\t\t//this is a require type definition by the Gson utility so Gson will \r\n\t\t//understand what kind of object representation should the json file match\r\n\t\tType type = new TypeToken<ArrayList<Book>>(){}.getType();\r\n\t\tArrayList<Book> books = gson.fromJson(jsonFileContent.toString(), type);\r\n\t\t//close\r\n\t\tbr.close();\t\r\n\t\treturn books;\r\n\t}", "public String readJsonFile(String fileName)\n {\n FileInputStream fileInputStream = null;\n String text;\n StringBuilder stringBuilder = new StringBuilder();\n\n try\n {\n fileInputStream = mainContext.openFileInput(fileName);\n InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream);\n BufferedReader bufferedReader = new BufferedReader(inputStreamReader);\n\n while((text = bufferedReader.readLine()) != null)\n {\n stringBuilder.append(text).append(\"\\n\");\n }\n }\n catch (IOException e)\n {\n System.out.println(e.getMessage());\n }\n\n return stringBuilder.toString();\n }", "@Test\n\tpublic void testWithJsonPath() {\n\t\t\t\t\n\t\tResponse response = given().accept(ContentType.JSON)\n\t\t.and().pathParam(\"id\", 110)\n\t\t.when().get(ConfigurationReader.getProperty(\"hrapp.baseurl\")+\"/employees/{id}\");\n\t\t\n\t\tJsonPath json = response.jsonPath(); //get json body and assign to jsonPath object\n\t\t//we are assiging whole response to json object so we can easyly reach and use it \n\t\t\n\t\tSystem.out.println(json.getInt(\"employee_id\"));\n\t\tSystem.out.println(json.getString(\"first_name\"));\n\t\tSystem.out.println(json.getString(\"job_id\"));\n\t\tSystem.out.println(json.getInt(\"salary\"));\n\t\tSystem.out.println(json.getString(\"links[0].href\")); //get specific element from array \n\t \n\t\t//assign all hrefs into a list of strings \n\t\tList<String> hrefs = json.getList(\"links.href\");\n\t\t\n\t\t//everything in arraylist \n\t System.out.println(hrefs);\n\t \n\t //one by one \n\t\tfor(String href:hrefs) {\n\t\t\tSystem.out.println(href);\n\t\t}\n\t}", "public void testImportJSONFromFile() throws IOException, JsonException {\n final String testPath = TEST_BASE_PATH;\n Map<String, String> props = new HashMap<String, String>();\n String testNode = testClient.createNode(HTTP_BASE_URL + testPath, props);\n urlsToDelete.add(testNode);\n\n props.clear();\n props.put(SlingPostConstants.RP_OPERATION,\n \t\tSlingPostConstants.OPERATION_IMPORT);\n\n String testNodeName = \"testNode_\" + String.valueOf(random.nextInt());\n props.put(SlingPostConstants.RP_NODE_NAME_HINT, testNodeName);\n testFile = getTestFile(getClass().getResourceAsStream(\"/integration-test/servlets/post/testimport.json\"));\n props.put(SlingPostConstants.RP_CONTENT_TYPE, \"json\");\n props.put(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + \"/*\");\n String importedNodeUrl = testClient.createNode(HTTP_BASE_URL + testPath, new NameValuePairList(props), null, true,\n \t\ttestFile, SlingPostConstants.RP_CONTENT_FILE, null);\n\n // assert content at new location\n String content = getContent(importedNodeUrl + \".3.json\", CONTENT_TYPE_JSON);\n\n\t\tJsonObject jsonObj = JsonUtil.parseObject(content);\n\t\tassertNotNull(jsonObj);\n\n\t\t//assert the imported content is there.\n String expectedJsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/importresults.json\"));\n\t\tassertExpectedJSON(JsonUtil.parseObject(expectedJsonContent), jsonObj);\n }", "private Demo doReadDemo(final ClassLoader demoResourceLoader) throws IOException {\n final Demo demo = new Demo();\n\n final URL demoConfiguration = demoResourceLoader.getResource(CONFIGURATION_NAME);\n\n if (null == demoConfiguration) {\n logger.logWarning(\"No {0} found in demo root. Please configure the demo properly.\",\n CONFIGURATION_NAME);\n } else {\n // load demo configuration\n final Properties configuration = new Properties();\n final InputStream demoConfigurationStream = demoConfiguration.openStream();\n try {\n configuration.load(demoConfiguration.openStream());\n } finally {\n demoConfigurationStream.close();\n }\n demo.setConfiguration(configuration);\n \n final String environment = demo.getProperty(\"environment\");\n if(null == environment) {\n logger.logWarning(\"Demo environment has not been configured.\");\n } else {\n final String scenarios = demo.getProperty(\"scenarios\");\n if (null == scenarios) {\n logger.logWarning(\"Demo scenarios have not been configured.\");\n }\n final StringTokenizer tokenizer = new StringTokenizer(scenarios, \",\");\n while (tokenizer.hasMoreTokens()) {\n configureScenario(demo, tokenizer.nextToken(), demoResourceLoader);\n }\n }\n }\n return demo;\n }", "public void testImportJSONFromRequestParamWithoutOptionalName() throws IOException, JsonException {\n final String testPath = TEST_BASE_PATH;\n Map<String, String> props = new HashMap<String, String>();\n String testNode = testClient.createNode(HTTP_BASE_URL + testPath, props);\n urlsToDelete.add(testNode);\n\n props.clear();\n props.put(SlingPostConstants.RP_OPERATION,\n \t\tSlingPostConstants.OPERATION_IMPORT);\n\n String jsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/testimport2.json\"));\n props.put(SlingPostConstants.RP_CONTENT, jsonContent);\n props.put(SlingPostConstants.RP_CONTENT_TYPE, \"json\");\n props.put(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + \"/*\");\n String importedNodeUrl = testClient.createNode(HTTP_BASE_URL + testPath, props);\n\n //make sure the name is what was inside the file.\n assertTrue(importedNodeUrl.endsWith(\"/nodeName\"));\n\n // assert content at new location\n String content = getContent(importedNodeUrl + \".3.json\", CONTENT_TYPE_JSON);\n\n\t\tJsonObject jsonObj = JsonUtil.parseObject(content);\n\t\tassertNotNull(jsonObj);\n\n\t\t//assert the imported content is there.\n String expectedJsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/importresults.json\"));\n\t\tassertExpectedJSON(JsonUtil.parseObject(expectedJsonContent), jsonObj);\n }", "private SpecificationByExample loadSpecificationFromResource(Resource resource) throws IOException {\r\n Specification specification= specificationReader.readSpecification(resource);\r\n\r\n SpecificationByExample specificationByExample;\r\n if (specification instanceof SpecificationByExample) {\r\n specificationByExample = (SpecificationByExample) specification;\r\n } else {\r\n specificationByExample = new SpecificationToSpecificationByExampleAdaptor(specification);\r\n }\r\n specificationByExample.setFixtureClass(fixture);\r\n return specificationByExample;\r\n }", "public String loadJSONFromAsset() {\n String json = null;\n try {\n json = new String(buffer, \"UTF-8\");\n } catch (UnsupportedEncodingException e1) {\n e1.printStackTrace();\n }\n\n return json;\n }", "@Test\n\tpublic void testJsonPath() {\n\tString responseAsString=\n\t\twhen().\n\t\t\tget(\"http://jsonplaceholder.typicode.com/photos\").\n\t\tthen().\n\t\textract().asString();\n\t\t\n\tList<Integer> albumIds = from(responseAsString).get(\"id\");\n\tSystem.out.println(albumIds.size());\n\t}", "private static void readWineListFromFile() {\n\t\tJSONParser parser = new JSONParser();\n\n\t\ttry (Reader reader = new FileReader(\"wines.json\")) {\n\n\t\t\tJSONArray wineListJSON = (JSONArray) parser.parse(reader);\n\n\t\t\tfor (int i = 0 ; i < wineListJSON.size(); i++) {\n\t\t\t\tJSONObject wine = (JSONObject) wineListJSON.get(i);\n\t\t\t\tString name = (String) wine.get(\"name\");\n\t\t\t\tint year = Integer.valueOf(wine.get(\"year\").toString());\n\t\t\t\tString description = (String) wine.get(\"description\");\n\t\t\t\tString vine = (String) wine.get(\"vine\");\n\t\t\t\tint quantity = Integer.valueOf(wine.get(\"quantity\").toString());\n\t\t\t\tdouble price = (double) wine.get(\"price\");\n\n\t\t\t\t// Add the JSON object to the wine list\n\t\t\t\tMain.wineList.add(new Wine(name, year, description, vine, quantity, price));\n\n\t\t\t}\n\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (ParseException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "List<Resource> resources();", "public JSONObject read(InputStream uploadedInputStream);", "public String loadJSONFromAsset() {\n String json;\n try {\n InputStream is = getAssets().open(\"track_v0649.json\");\n int size = is.available();\n byte[] buffer = new byte[size];\n\n is.read(buffer);\n is.close();\n json = new String(buffer, \"UTF-8\");\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n }", "public void testImportJSONFromFileWithoutOptionalName() throws IOException, JsonException {\n final String testPath = TEST_BASE_PATH;\n Map<String, String> props = new HashMap<String, String>();\n String testNode = testClient.createNode(HTTP_BASE_URL + testPath, props);\n urlsToDelete.add(testNode);\n\n props.clear();\n props.put(SlingPostConstants.RP_OPERATION,\n \t\tSlingPostConstants.OPERATION_IMPORT);\n\n testFile = getTestFile(getClass().getResourceAsStream(\"/integration-test/servlets/post/testimport2.json\"));\n props.put(SlingPostConstants.RP_CONTENT_TYPE, \"json\");\n props.put(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + \"/*\");\n String importedNodeUrl = testClient.createNode(HTTP_BASE_URL + testPath, new NameValuePairList(props), null, true,\n \t\ttestFile, SlingPostConstants.RP_CONTENT_FILE, null);\n\n //make sure the name is what was inside the file.\n assertTrue(importedNodeUrl.endsWith(\"/nodeName\"));\n\n // assert content at new location\n String content = getContent(importedNodeUrl + \".3.json\", CONTENT_TYPE_JSON);\n\n\t\tJsonObject jsonObj = JsonUtil.parseObject(content);\n\t\tassertNotNull(jsonObj);\n\n\t\t//assert the imported content is there.\n String expectedJsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/importresults.json\"));\n\t\tassertExpectedJSON(JsonUtil.parseObject(expectedJsonContent), jsonObj);\n }", "public void ready(final YuiContext Y) {\n\t\tJsArr data_in = JsArr.create(\n\t\t\tJsObject.one(\"make\", \"Chevrolet\")._(\"model\", \"Bel Air\")._(\"year\", 1957),\n\t\t\tJsObject.one(\"make\", \"Dodge\")._(\"model\", \"Dart\")._(\"year\", 1964),\n\t\t\tJsObject.one(\"make\", \"Ford\")._(\"model\", \"Mustang\")._(\"year\", 1968) \n\t\t); \n\t\tSchema schema = Schema.create().resultFields(new Field[]{\n\t\t\tField.create().key(\"model\"), Field.create().key(\"year\") \n\t\t}); \n\t\tDataSchemaResult data_out = Y.DataSchemaArray().apply(schema, data_in);\n\t\tWindow.alert(Y.dump(data_out.results())); //data_out.results().length()+\" - \"+JsUtil.dumpObj(data_out, true));\n\t\t\n\t\t\n\t\t//another little test, this time reading a json string contained mixed formed data\n\t\tString data_in2 = \"[\\n\"+\n\t\t\" {make:\\\"Chevrolet\\\",model:\\\"Bel Air\\\",year:1957},\\n\"+\n\t\t\" [\\\"Dodge\\\", \\\"Dart\\\", 1964],\\n\"+\n\t\t\" \\\"1968 Ford Mustang\\\"\\n\"+\n\t\t\"]\"; \n\t\t\n\t\tSchema schema2 = Schema.create().resultFields(new Field[]{\n\t\t\t\tField.create().key(\"make\"), Field.create().key(\"model\"), Field.create().key(\"year\") \n\t\t}); \n\t\tDataSchemaResult data_out2 = Y.DataSchemaArray().apply(schema2, JsonUtils.unsafeEval(data_in2));\n\t\tWindow.alert(Y.dump(data_out2.results())); \n\t}", "public JsonArray getJsonFromService(\n String myQuestion, //\n String endpoint, //\n float minimumConfidence, //\n RestTemplate restTemplate, //\n CacheOfRestTemplateResponse myCacheOfResponses //\n ) throws URISyntaxException, DBpediaSpotlightJsonParsingNotPossible {\n URI uri = createRequestUriWithParameters(myQuestion, endpoint, minimumConfidence);\n JsonObject response = fetchNamedEntitiesFromWebService(restTemplate, myCacheOfResponses, uri);\n JsonArray resources = getResourcesOfResponse(response, myQuestion);\n\n return resources;\n }", "@Override\n public String toString() {return \"Json-File Reader\";}", "public static void main(String[] args) throws IOException {\n\t\t// TODO Auto-generated method stub\n\t\tJsonFileParser parser = new JsonFileParser();\n\t\tparser.parseJsonFile(args);\n\t\tList<String> labelset = parser.getLset();\n\t\tfor(String label : labelset){\n\t\t\tSystem.out.println(label);\n\t\t}\n\t\tList<String> corpus = parser.getCorpus();\n\t\tfor(String doc : corpus){\n\t\t\tSystem.out.println(doc);\n\t\t}\n\t\tList<String> labels = parser.getLabels();\n\t\tfor(String label : labels){\n\t\t\tSystem.out.println(label);\n\t\t}\n\t\tList<String> headerInforList = parser.getPmids();\n\t\tfor(String pmid : headerInforList){\n\t\t\tSystem.out.println(pmid);\n\t\t}\n\t}", "public static void initialize() {\r\n\t\tjson = new JSONFile(filePath);\t\r\n\t}" ]
[ "0.65106744", "0.64942837", "0.621569", "0.6097948", "0.605114", "0.5976828", "0.59634453", "0.58937454", "0.5882496", "0.5728595", "0.5726738", "0.5716714", "0.5703193", "0.56933194", "0.56922007", "0.5684327", "0.5670406", "0.5665765", "0.5579029", "0.55726236", "0.5563291", "0.5542161", "0.5523732", "0.55018896", "0.54970455", "0.548195", "0.5474336", "0.54640186", "0.5443245", "0.54425824", "0.54421663", "0.5433782", "0.541568", "0.54123783", "0.54122406", "0.5405062", "0.5385872", "0.53744465", "0.5371214", "0.537099", "0.5369813", "0.5364451", "0.53542566", "0.5348374", "0.5348107", "0.5345096", "0.53292155", "0.5319196", "0.531579", "0.5307478", "0.53013295", "0.5296883", "0.5295683", "0.52945685", "0.5293875", "0.5287224", "0.52865434", "0.52824074", "0.5256617", "0.52546346", "0.52443564", "0.5238204", "0.5237661", "0.52361053", "0.5231939", "0.5221327", "0.5211724", "0.52102137", "0.5208383", "0.5208335", "0.5205505", "0.520267", "0.52007747", "0.5197523", "0.51931566", "0.5183759", "0.5158344", "0.5151503", "0.51513517", "0.51432705", "0.51432705", "0.51432705", "0.5140156", "0.5139785", "0.51395804", "0.51303816", "0.51262987", "0.5117251", "0.511516", "0.5113012", "0.5111478", "0.51105314", "0.51083374", "0.51013047", "0.50988775", "0.5087814", "0.5081152", "0.5077141", "0.507294", "0.50719947", "0.5064289" ]
0.0
-1
Read in the JSON from the example resources
@Test public void testTickerAdapter() throws IOException { InputStream is = CryptopiaAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/cryptopia/dto/marketdata/example-ticker-data.json"); // Use Jackson to parse it ObjectMapper mapper = new ObjectMapper(); CryptopiaBaseResponse<CryptopiaTicker> cryptopiaTicker = mapper.readValue(is, CryptopiaBaseResponseCryptopiaTicker.class); is.close(); Ticker ticker = CryptopiaAdapters.adaptTicker(cryptopiaTicker.getData(), CurrencyPair.ETH_BTC); assertThat(ticker).isNotNull(); assertThat(ticker.getLast().toString()).isEqualTo("0.07963205"); assertThat(ticker.getBid().toString()).isEqualTo("0.07963206"); assertThat(ticker.getAsk().toString()).isEqualTo("0.08003570"); assertThat(ticker.getVolume()).isEqualTo(new BigDecimal("361.93509400")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n\tpublic void readJSONFromFile() {\n\t\t\n\t\tJsonPath jsonFile = new JsonPath(new File (\"C:\\\\Users\\\\cmlzd\\\\Desktop\\\\employees.json\"));\n\t\t\n\t\tSystem.out.println(jsonFile.getString(\"items.email\"));\n\t\t\n\t\t\n\t}", "private static JsonReader readJSONFromAsset(Context context) throws IOException {\n AssetManager assetManager = context.getAssets();\n JsonReader reader;\n try {\n reader = new JsonReader(new InputStreamReader(assetManager.open(\"questionlist.json\")));\n } finally {\n\n }\n return reader;\n }", "public static Books readJSON(){\n Gson gson = new GsonBuilder().create();\n Books books = new Books();\n try {\n books = gson.fromJson(new JsonReader(new FileReader(\"books.json\")), Books.class);\n } catch (IOException e){\n e.printStackTrace();\n }\n return books;\n }", "protected JSONArray readJsonFromLocalResources(InputStream resources) {\n\n InputStream is = resources;\n ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n\n if (is != null) {\n\n int ctr;\n try {\n ctr = is.read();\n while (ctr != -1) {\n byteArrayOutputStream.write(ctr);\n ctr = is.read();\n }\n\n if (byteArrayOutputStream.size() > 0) {\n Logger.d(\"JSON= \" + byteArrayOutputStream.toString());\n return new JSONArray(byteArrayOutputStream.toString());\n }\n\n } catch (IOException e) {\n Logger.e(\"Could not read the json file, IOException\" + e);\n } catch (JSONException ex) {\n Logger.e(\"Could not parse into json object, JSONException\" + ex);\n } finally {\n\n try {\n is.close();\n } catch (IOException ex) {\n Logger.e(\"Could not close InputStream, IOException\" + ex);\n }\n }\n }\n\n Logger.d(\"Could not return json object\"); //Let's hope not to hit this line\n return null;\n }", "public String loadJSONFromAsset() {\n String json;\n String file = \"assets/words.json\";\n\n try {\n InputStream is = this.getClass().getClassLoader().getResourceAsStream(file);\n int size = is.available();\n byte[] buffer = new byte[size];\n is.read(buffer);\n is.close();\n json = new String(buffer, \"UTF-8\");\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n }", "private Demo doReadDemo() throws IOException {\n // create a resource loader\n final URL defaultRoot = ResourceUtil.getURL(\"demo/\");\n final URLClassLoader resourceLoader = new URLClassLoader(\n new URL[] { defaultRoot }, null);\n return doReadDemo(resourceLoader);\n }", "public static void loadPracticeListFromFile() {\n JSONParser jsonParser = new JSONParser();\n\n try (FileReader reader = new FileReader(\"src/practiceList.json\")) {\n // Read JSON file\n Object object = jsonParser.parse(reader);\n\n //Iterate over word list array\n JSONArray wordList = (JSONArray) object;\n for (Object o : wordList) {\n\n JSONObject next = (JSONObject) o;\n String extra = \"\";\n\n if (((String) next.get(\"wordType\")).equalsIgnoreCase(\"verb\")) {\n extra = \"to \";\n }\n\n Word loadedWord = new Word(extra + next.get(\"english\"), (String) next.get(\"welsh\"), (String) next.get(\"wordType\"));\n\n addIntoPracticedWords(loadedWord);\n }\n\n } catch (ParseException | IOException e) {\n System.out.println(\"PracticeList file not found, will be created on exit.\");\n }\n }", "public Integer loadJSONFile()\n {\n JSONParser parser = new JSONParser();\n try{\n\n Object obj = parser.parse(new FileReader(\"/Users/rnuka/Desktop/sample.json\"));\n JSONObject jsonObj = (JSONObject)obj;\n\n Long age = (Long)jsonObj.get(\"age\");\n System.out.println(\"age:\"+age);\n\n String name = (String)jsonObj.get(\"name\");\n System.out.println(\"name:\" + name);\n\n JSONArray address = (JSONArray)jsonObj.get(\"address\");\n\n for(Object str : address){\n System.out.println(str);\n }\n\n\n\n }catch(Exception e){\n e.printStackTrace();\n }\n return 1;\n }", "private void read() {\n\n\t\t\t\tString road=getActivity().getFilesDir().getAbsolutePath()+\"product\"+\".txt\";\n\n\t\t\t\ttry {\n\t\t\t\t\tFile file = new File(road); \n\t\t\t\t\tFileInputStream fis = new FileInputStream(file); \n\t\t\t\t\tint length = fis.available(); \n\t\t\t\t\tbyte [] buffer = new byte[length]; \n\t\t\t\t\tfis.read(buffer); \n\t\t\t\t\tString res1 = EncodingUtils.getString(buffer, \"UTF-8\"); \n\t\t\t\t\tfis.close(); \n\t\t\t\t\tjson(res1.toString());\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} \n\t\t\t}", "public String loadJSONFromAsset(Context context) {\n String json = null;\n try {\n InputStream is;\n int id = context.getResources().getIdentifier(\"sentiment\", \"raw\", context.getPackageName());\n is = context.getResources().openRawResource(id);\n\n int size = is.available();\n\n byte[] buffer = new byte[size];\n\n is.read(buffer);\n\n is.close();\n\n json = new String(buffer, \"UTF-8\");\n\n\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n\n }", "@GetMapping(\"/getJson\")\r\n\tpublic HashMap<String, Object> getJsonValue() throws IOException {\n\r\n\t\tHashMap<String, Object> globalVariable = null;\r\n\t\tObjectMapper mapper = new ObjectMapper();\r\n\t\tString path = \"rules/backUp.json\";\r\n\r\n\t\tResourceLoader resource = new DefaultResourceLoader();\r\n\t\torg.springframework.core.io.Resource resource2 = resource.getResource(\"classpath:\" + path);\r\n\r\n\t\tReader reader = new InputStreamReader(resource2.getInputStream());\r\n\t\tSystem.out.println(\"reader ouput \" + reader.toString());\r\n\t\tString fileData = FileCopyUtils.copyToString(reader);\r\n\t\tSystem.out.println(\" filedate is \" + fileData);\r\n\r\n\t\tTypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() {\r\n\t\t};\r\n\t\tHashMap<String, Object> readValue = mapper.readValue(fileData, typeRef);\r\n\t\treturn readValue;\r\n\t}", "@GetMapping(\"/getThingsDescription\")\n public ResponseEntity<?> getThingsDescription() {\n log.info(\"Thing Description from TechUnit ... \");\n\n ClassLoader cl = getClass().getClassLoader();\n\n String thingsDescription = \"\";\n try {\n thingsDescription = IOUtils\n .toString(cl.getResourceAsStream(\"things-wearhealth.json\"));\n } catch (Exception ex) {\n log.error(\"Unable to load Things Description...\");\n ex.printStackTrace();\n }\n return new ResponseEntity<>(thingsDescription, HttpStatus.OK);\n }", "public void ReadJson() {\n System.out.println(\"Read Json Method in the Mother Class\");\n }", "public void readInventoryMainJsonFile() throws IOException, ParseException {\n\n\t\t// Providing read-only access to JSON data.\n\t\tJSONParser parser = new JSONParser();\n\n\t\t// Reading the external JSON file.\n\t\tFileReader reader = new FileReader(\".\\\\resources\\\\InventoryMain.json\");\n\n\t\t// Creating main object to store JSONParser, JSONObject and JSONArray.\n\t\tObject inventoryMain = parser.parse(reader);\n\n\t\t// Parsing object to JSONObject from InventoryMain.json file.\n\t\tJSONObject inventoryObj = (JSONObject) inventoryMain;\n\n\t\t// Getting the arrays of JSON file.\n\t\tJSONArray riceArray = (JSONArray) inventoryObj.get(\"Rice\");\n\t\tJSONArray pulseArray = (JSONArray) inventoryObj.get(\"Pulses\");\n\t\tJSONArray wheatArray = (JSONArray) inventoryObj.get(\"Wheat\");\n\n\t\t// Getting details of rice.\n\t\tSystem.out.println(\"Details of Rice are: \");\n\t\tfor (int i = 0; i < riceArray.size(); i++) {\n\t\t\tJSONObject riceDetails = (JSONObject) riceArray.get(i);\n\n\t\t\tString name = (String) riceDetails.get(\"name\");\n\t\t\tlong weight = (long) riceDetails.get(\"weight\");\n\t\t\tlong price = (long) riceDetails.get(\"price\");\n\n\t\t\tSystem.out.println(\"\\nName: \" + name);\n\t\t\tSystem.out.println(\"Weight: \" + weight);\n\t\t\tSystem.out.println(\"Price per KG is: \" + price);\n\n\t\t\t// Calculating price of different types of rice.\n\t\t\tlong ricePrice = weight * price;\n\t\t\tSystem.out.println(\"\\nTotal price of \" + riceDetails.get(\"name\") + \" is \" + ricePrice);\n\n\t\t}\n\n\t\t// Getting details of Pulse.\n\t\tSystem.out.println(\"\\nDetails of Pulse are: \");\n\t\tfor (int j = 0; j < pulseArray.size(); j++) {\n\t\t\tJSONObject pulseDetails = (JSONObject) pulseArray.get(j);\n\n\t\t\tString name = (String) pulseDetails.get(\"name\");\n\t\t\tlong weight = (long) pulseDetails.get(\"weight\");\n\t\t\tlong price = (long) pulseDetails.get(\"price\");\n\n\t\t\tSystem.out.println(\"\\nName: \" + name);\n\t\t\tSystem.out.println(\"Weight: \" + weight);\n\t\t\tSystem.out.println(\"Price per KG is: \" + price);\n\n\t\t\t// Calculating price of different types of Pulses.\n\t\t\tlong pulsePrice = weight * price;\n\t\t\tSystem.out.println(\"\\nTotal price of \" + pulseDetails.get(\"name\") + \" is \" + pulsePrice);\n\n\t\t}\n\t\t// Getting details of Wheat.\n\t\tSystem.out.println(\"\\nDetails of Wheat are: \");\n\t\tfor (int i = 0; i < wheatArray.size(); i++) {\n\t\t\tJSONObject wheatDetails = (JSONObject) wheatArray.get(i);\n\n\t\t\tString name = (String) wheatDetails.get(\"name\");\n\t\t\tlong weight = (long) wheatDetails.get(\"weight\");\n\t\t\tlong price = (long) wheatDetails.get(\"price\");\n\n\t\t\tSystem.out.println(\"\\nName: \" + name);\n\t\t\tSystem.out.println(\"Weight: \" + weight);\n\t\t\tSystem.out.println(\"Price per KG is: \" + price);\n\t\t\t// Calculating price of different types of Wheat.\n\t\t\tlong wheatPrice = weight * price;\n\t\t\tSystem.out.println(\"\\nTotal price of \" + wheatDetails.get(\"name\") + \" is \" + wheatPrice);\n\n\t\t}\n\n\t}", "public static void main(String[] args) throws IOException\n {\n File file = new File(\"D:\\\\work\\\\incoming\\\\F&D\\\\enrichment API\\\\context_test_record.jsonld\");\n\n Model m = ModelFactory.createDefaultModel();\n \n try {\n m.read(new FileInputStream(file), null, \"JSONLD\");\n }\n catch (Exception e) {\n e.printStackTrace(System.err);\n return;\n }\n\n// URL url = new URL(\"file:///C:/Users/Hugo/Google%20Drive/Europeana/EDM/jsonld/context.jsonld\");\n URL url = new URL(\"file:///D:/work/incoming/F&D/enrichment%20API/context.jsonld\");\n new JsonLdWriter(url).write(m, new OutputStreamWriter(System.out));\n }", "public void init() {\n\n mJokes = new ArrayList<>();\n\n StringBuilder sBuilder = new StringBuilder();\n\n try {\n\n InputStream in = getClass().getResourceAsStream(\"/jokes.json\");\n BufferedReader reader = new BufferedReader(new InputStreamReader(in));\n\n String mLine = reader.readLine();\n while (mLine != null) {\n //process line\n sBuilder.append(mLine);\n mLine = reader.readLine();\n }\n\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n\n String jsonString = sBuilder.toString();\n\n if( jsonString != null ){\n\n JsonParser parser = new JsonParser();\n JsonObject jsonObject = parser.parse(jsonString).getAsJsonObject();\n\n JsonArray jokesArray = jsonObject.getAsJsonArray(\"jokes\");\n\n for (JsonElement element : jokesArray) {\n String joke = element.getAsJsonObject().get(\"joke\").getAsString();\n mJokes.add(joke);\n }\n }\n\n }", "private JSONObject getJsonObject(Resource resource) {\n JSONParser parser = new JSONParser();\n JSONObject obj = null;\n try {\n obj = (JSONObject) parser.parse(new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8));\n } catch (Exception e) {\n e.printStackTrace();\n }\n return obj;\n }", "private Demo doReadDemo(final FileSystem fileSystem) throws IOException {\n // create a resource loader\n final URL[] demoRoot = new URL[] {\n fileSystem.getRoot().toURI().toURL() \n };\n final URLClassLoader resourceLoader = new URLClassLoader(demoRoot, null);\n return doReadDemo(resourceLoader);\n }", "public void loadToDoList() {\n try {\n toDoList = jsonReader.read();\n System.out.println(\"Loaded \" + toDoList.getName() + \" from \" + JSON_STORE);\n } catch (IOException e) {\n System.out.println(\"Unable to read from file: \" + JSON_STORE);\n }\n }", "public String loadJSONFile(int resourceIdentifier) {\n if (resourceIdentifier != 0) {\n InputStream input = getResources().openRawResource(resourceIdentifier);\n java.util.Scanner s = new java.util.Scanner(input).useDelimiter(\"\\\\A\");\n return s.hasNext() ? s.next() : null;\n } else {\n return null;\n }\n }", "public App read() throws IOException {\n String jsonData = readFile(source);\n JSONObject jsonObject = new JSONObject(jsonData);\n return parseApp(jsonObject);\n }", "private static JSONObject fileReader(String path) throws Exception{\r\n return (JSONObject) jsonParser.parse(new String(Files.readAllBytes(Paths.get(path))));\r\n }", "public Tamagotchi read() throws IOException {\n String jsonData = readFile(source);\n JSONObject jsonObject = new JSONObject(jsonData);\n return tamagotchiToJson(jsonObject);\n }", "public void retrieveData(){\n\t\tloaderImage.loadingStart();\n\t\tJsonClient js = new JsonClient();\n\t\tjs.retrieveData(JSON_URL, this);\n\t}", "public JSONObject getJSONFromFile() throws IOException\n\t{\n\t\tInputStream is = context.getResources().openRawResource(R.raw.schedule);\n\t\tWriter writer = new StringWriter();\n\t\tchar[] buffer = new char[1024];\n\t\ttry {\n\t\t Reader reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\n\t\t int n;\n\t\t while ((n = reader.read(buffer)) != -1) {\n\t\t writer.write(buffer, 0, n);\n\t\t }\n\t\t} finally {\n\t\t is.close();\n\t\t}\n\n\t\tString jsonString = writer.toString();\n\t\tJSONObject jObj=null;\n\t\t\n\t\t// try parse the string to a JSON object\n\t\ttry {\n\t\t\tjObj = new JSONObject(jsonString);\n\t\t} catch (JSONException e) {\n\t\t\tLog.e(\"JSON Parser\", \"Error parsing data \" + e.toString());\n\t\t}\n\t\t\t\n\t\treturn jObj;\n\t\t// return JSON String\n\n\t}", "@Test\n public void testFromJSON() {\n System.out.println(\"fromJSON\");\n String json = \"\";\n Resource expResult = null;\n Resource result = Resource.fromJSON(json);\n assertEquals(expResult, result);\n // TODO review the generated test code and remove the default call to fail.\n fail(\"The test case is a prototype.\");\n }", "public static List<DataItem> importFromJSON(Context context){\n FileReader reader = null;\n File file = new File(Environment.getExternalStorageDirectory(), FILE_NAME);\n\n try {\n //Instantiate FileReader with file\n reader = new FileReader(file);\n //Populate DataItems class and return result\n Gson gson = new Gson();\n DataItems dataItems = gson.fromJson(reader, DataItems.class);\n return dataItems.getDataItems();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }finally {\n if (reader != null) {\n try {\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n return null;\n }", "@Override\n \tpublic Representation getResource() throws Exception {\n \t\tJsonRepresentation result = null;\n \t\t// Rcupre l'identifiant unique de la ressource demande.\n \t\tString interId = (String) this.getRequestAttributes().get(\"interId\");\n \t\tString srcId = (String) this.getRequestAttributes().get(\"sourceId\");\n \t\tSystem.out.println(srcId);\n \t\t// Rcupration des sources de l'intervention\n \t\tList<Source> sources = Interventions.getInstance().getIntervention(interId).getSources();\n \n \t\tSource source = null;\n \t\t\n \t\t// Si on demande un source prcis\n \t\tif (srcId != null) {\n \t\t\t// Recherche du source demand\n \t\t\tfor (int i = 0; i < sources.size(); i++) {\n \t\t\t\tif (sources.get(i).getUniqueID().equals(srcId)) {\n \t\t\t\t\tsource = sources.get(i);\n \t\t\t\t}\n \t\t\t}\n \t\t\t// Si le source n'est pas trouv\n \t\t\tif (source == null) {\n \t\t\t\tresult = null;\n \t\t\t\tgetResponse().setStatus(Status.CLIENT_ERROR_NOT_ACCEPTABLE);\n \t\t\t} else {\n \t\t\t\tresult = new JsonRepresentation(source.toJSON());\n \t\t\t}\n \t\t// Si on veut tous les sources\n \t\t} else if (srcId == null) {\n \t\t\t\n \t\t\tJSONArray jsonAr = new JSONArray(); //Cration d'une liste Json\n \t\t\tfor(int i=0; i< sources.size();i++){\n\t\t\t\tjsonAr.put(sources.get(i).toJSON()); // On ajoute un jsonObject contenant le source dans le jsonArray\n \t\t\t}\n \t\t\t\n \t\t\tresult = new JsonRepresentation(jsonAr); // On cre la reprsentation de la liste\n \t\t}\n \n \t\t// Retourne la reprsentation, le code status indique au client si elle est valide\n \t\treturn result;\n \t}", "public String loadJSONFromAsset(Context context) {\n json = null;\n try {\n InputStream is = getApplicationContext().getAssets().open(\"techdrop.json\");\n int size = is.available();\n byte[] buffer = new byte[size];\n is.read(buffer);\n is.close();\n json = new String(buffer, \"UTF-8\");\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n }", "public static List<DataItem> importFromResource(Context context){\n InputStreamReader reader = null;\n InputStream inputStream = null;\n\n try {\n //Instantiate InputStream with static raw file the assign it to InputStreamReader\n inputStream = context.getResources().openRawResource(R.raw.menuitems);\n reader = new InputStreamReader(inputStream);\n //Populate DataItems class and return result\n Gson gson = new Gson();\n DataItems dataItems = gson.fromJson(reader, DataItems.class);\n return dataItems.getDataItems();\n }finally {\n //close both classes\n if (reader != null) {\n try {\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n if (inputStream != null) {\n try {\n inputStream.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n }\n }", "@Test\r\n public void testRevision() {\r\n InputStream inputstream = getClass().getClassLoader().getResourceAsStream(\"sample.json\");\r\n assert inputstream != null;\r\n Reader reader = new InputStreamReader(inputstream);\r\n JsonParser parser = new JsonParser();\r\n JsonElement rootElement = parser.parse(reader);\r\n\r\n RevisionParser revisionParser = new RevisionParser();\r\n List<Revision> revisionList = revisionParser.parse(rootElement);\r\n\r\n for (Revision r: revisionList) {\r\n System.out.println(r);\r\n }\r\n Assert.assertEquals(revisionList.get(0).toString(), \"Name: Monkbot\tTimeStamp: Fri Sep 13 11:10:41 EDT 2019\");\r\n }", "@Override\n public Object loadFromJson(Context context) {\n Gson gson = new Gson();\n String json = FileManager.getInstance().loadFromFile(getFileName(), context);\n if(json.equals(\"\")) {\n return null;\n }\n\n return gson.fromJson(json, MatchStorage.class);\n\n }", "public String generateJsonFileFromParsedTextFileInApp() {\n\t\treturn generateJsonFileFromParsedTextFile(TEXTSAMPLEFILE);\n\t}", "static JsonResource forClasspath( ClassLoader classLoader, String name ) {\n final ClassLoader loader = classLoader == null ? Thread.currentThread().getContextClassLoader() : classLoader;\n return new JsonResource() {\n @Override\n public <T> T readFrom( ReadMethod<T> consumer ) throws IOException {\n InputStream stream = loader.getResourceAsStream(name);\n if ( stream == null )\n throw new FileNotFoundException(\"Resource \" + name + \" not found\");\n try {\n return consumer.read( stream );\n } finally {\n stream.close();\n }\n }\n };\n }", "private static JsonObject readJSON(String path) {\n\n\t\tString fileContents = \"\";\n\t\tBufferedReader reader = null;\n\n\t\ttry {\n\t\t\treader = new BufferedReader(new FileReader(path));\n\t\t} catch (FileNotFoundException e) {\n\t\t\tfail(ErrorMessage.inputFileNotFoundError);\n\t\t}\n\n\t\tString line;\n\n\t\ttry {\n\t\t\twhile ((line = reader.readLine()) != null) {\n\t\t\t\tfileContents += line;\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\tfail(ErrorMessage.readFileError);\n\t\t}\n\n\t\ttry {\n\t\t\treader.close();\n\t\t} catch (IOException e) {\n\t\t\tfail(ErrorMessage.closeFileError);\n\t\t}\n\n\t\tJsonObject jsonLicense = Json.createReader(new StringReader(fileContents)).readObject();\n\n\t\treturn jsonLicense;\n\t}", "static JsonResource forFile( File file ) {\n return new JsonResource() {\n @Override\n public <T> T readFrom( ReadMethod<T> consumer ) throws IOException {\n try ( FileInputStream stream = new FileInputStream(file) ) {\n return consumer.read(stream);\n }\n }\n };\n }", "private JSONObject readJSONFile(Path path) throws ExtensionManagementException {\n\n if (Files.exists(path) && Files.isRegularFile(path)) {\n try {\n String jsonString = FileUtils.readFileToString(path.toFile(), UTF8);\n return new JSONObject(jsonString);\n } catch (JSONException e) {\n throw new ExtensionManagementException(\"Error while parsing JSON file: \" + path, e);\n } catch (IOException e) {\n throw new ExtensionManagementException(\"Error while reading JSON file: \" + path, e);\n }\n } else {\n throw new ExtensionManagementException(\"JSON file not found: \" + path);\n }\n }", "public static JsonObject getTestVectors(String filename) throws \n IOException {\n InputStream is = JsonUtil.class.getClassLoader().getResourceAsStream(filename);\n JsonReader reader = new JsonReader(new InputStreamReader(is, UTF_8));\n JsonElement elem = JsonParser.parseReader(reader);\n return elem.getAsJsonObject();\n }", "private static String readJsonFile (String fileName) {\n if (!fileName.endsWith(\".json\")){\n throw new IllegalArgumentException(\"Invalid file name\");\n }\n String jsonStr = \"\";\n try{\n isFileExistOrCreatIt(fileName);\n File jsonFile = new File(\"src//main//resources\"+\"//\"+fileName);\n Reader reader = new InputStreamReader(new FileInputStream(jsonFile),\"utf-8\");\n int ch = 0;\n StringBuffer sb = new StringBuffer();\n while((ch = reader.read())!=-1){\n sb.append((char) ch);\n }\n reader.close();\n jsonStr = sb.toString();\n return jsonStr;\n\n } catch (IOException e) {\n e.printStackTrace();\n return null;\n }\n }", "public static void main(String[] args) throws FileNotFoundException {\r\n\t\tJsonParser parser = Json.createParser(new FileReader(JSON_FILE_NAME));\r\n\t\t\r\n\t\t// parse the file\r\n\t\twhile (parser.hasNext()) {\r\n\t\t\tJsonParser.Event event = parser.next();\r\n\t\t\tif (event.equals(JsonParser.Event.KEY_NAME)) {\r\n\t\t\t\tString key = parser.getString();\r\n\t\t\t\tparser.next();\r\n\t\t\t\tString value = parser.getString();\r\n\t\t\t\tSystem.out.printf(\">> %s: %s\\n\", key, value);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}", "public static void main(String[] args) {\n Client client = Client.create();\n WebResource resource = client.resource(\"http://localhost:8080/rest/resource/strings\");\n String strings = resource.get(String.class);\n System.out.println(strings);\n }", "public static JSONObject loadJSONObjectFromAsset(Context context) {\n String jsonStr = null;\n JSONObject jsonObject = null;\n try {\n //here we need context to access ASSETS --> ANDROID TUTORIAL / codeBlock - Patterns / Application.java\n InputStream is = context.getAssets().open(\"listHomeItem.json\");\n int size = is.available();\n byte[] buffer = new byte[size];\n is.read(buffer);\n is.close();\n jsonStr = new String(buffer, \"UTF-8\");\n\n jsonObject = new JSONObject(jsonStr);\n\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n\n } catch (JSONException e) {\n e.printStackTrace();\n return null;\n }\n return jsonObject;\n }", "String readSampleJsonDoc(String file) {\n\t\tStringBuffer sb = new StringBuffer();\n\t\tBufferedReader br = null;\n\n\t\ttry {\n\t\t\tbr = new BufferedReader(new FileReader(new File(file)));\n\t\t\tString line;\n\t\t\twhile ((line = br.readLine()) != null) {\n\t\t\t\tsb.append(line + NEWLINE);\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (br != null) {\n\t\t\t\t\tbr.close();\n\t\t\t\t}\n\t\t\t} catch (IOException e) {\n\t\t\t}\n\t\t}\n\t\treturn sb.toString();\n\t}", "public void load(){\n // Recover docIDs\n try(Reader reader = new FileReader(\"postings/docIDs.json\")){\n this.docIDs = (new Gson()).fromJson(reader,\n new TypeToken<Map<String, String>>(){}.getType());\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n try(Reader reader = new FileReader(\"postings/docLengths.json\")){\n this.docLengths = (new Gson()).fromJson(reader,\n new TypeToken<Map<String, Integer>>(){}.getType());\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n try(Reader reader = new FileReader(\"postings/titleToNumber.json\")){\n this.titleToNumber = (new Gson()).fromJson(reader,\n new TypeToken<Map<String, Integer>>(){}.getType());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "static ArrayList<Integer> getAllQuestionIDs(Context context){\n JsonReader reader;\n ArrayList<Integer> questionIDs = new ArrayList<>();\n try {\n reader = readJSONFromAsset(context);\n reader.beginArray();\n while (reader.hasNext()) {\n questionIDs.add(readQuestion(reader).getQuestionID());\n }\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return questionIDs;\n }", "public static void main(String[] args) throws IOException {\n String path = \"D:\\\\data\\\\code\\\\github-workspace\\\\tiny\\\\app\\\\web\\\\home\\\\src\\\\test\\\\resources\\\\table-result-3.json\";\n String jsonStr = FileUtils.readFileToString(new File(path));\n// Object obj = parseLayoutResult2(jsonStr);\n Object obj = parseContentResult2(jsonStr);\n System.out.println(obj);\n\n }", "private MoodsCreator(Resources resources){\n\n String result;\n try {\n InputStream inputStream = resources.openRawResource(R.raw.moods);\n\n StringBuffer buffer = new StringBuffer();\n BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));\n\n String line;\n while ((line = reader.readLine()) != null) {\n\n buffer.append(line + \"\\n\");\n }\n result = buffer.toString();\n Log.d(\"MOODS\", result);\n\n JSONObject moodsJson = new JSONObject(result);\n JSONArray moodsJsonArray = new JSONArray(moodsJson.get(\"moods\").toString());\n\n for(int i =0;i<moodsJsonArray.length();++i){\n JSONObject moodfromJson = moodsJsonArray.getJSONObject(i);\n Mood mood = new Mood(moodfromJson.get(\"name\").toString(),moodfromJson.getInt(\"red\"),moodfromJson.getInt(\"green\"), moodfromJson.getInt(\"blue\"), moodfromJson.getInt(\"alpha\"));\n\n Log.d(\"MOOD\",mood.name + \" \"+mood.alpha + \" \"+ mood.red);\n moods.put(moodfromJson.get(\"name\").toString(),mood);\n }\n\n Log.d(\"moodsMap\",moods.toString());\n }\n catch(Exception e){\n\n }\n\n }", "public static JsonNode getLibraryMetadata(Object resource, List<String> desc) throws Exception {\n\t\tfinal ObjectMapper mapper = BeanTemplateUtils.configureMapper(Optional.empty());\t\t\n\t\tfinal JsonNode v1_bean = \n\t\t\t\t((ObjectNode) mapper.readTree(resource.getClass().getResourceAsStream(\"test_v1_sync_sample_share.json\")))\n\t\t\t\t.put(\"description\", desc.stream().collect(Collectors.joining(\"\\n\")));\n\t\t\t\t\n\t\treturn v1_bean;\n\t}", "String getJSON();", "private void loadWorld() {\n try {\n world = jsonReader.read();\n System.out.println(\"Loaded world from \" + JSON_STORE);\n } catch (IOException | InvalidDataException e) {\n System.out.println(\"Unable to read from file: \" + JSON_STORE);\n }\n }", "private JSONObject loadTemplate(Path extensionResourcePath) throws ExtensionManagementException {\n\n Path templatePath = extensionResourcePath.resolve(TEMPLATE_FILE_NAME);\n if (Files.exists(templatePath) && Files.isRegularFile(templatePath)) {\n return readJSONFile(templatePath);\n }\n return null;\n }", "private String loadJSONFromAsset() {\n String json = null;\n try {\n //AssetManager assetManager = getAssets();\n InputStream is = getAssets().open(\"sa.json\");\n //InputStream is = getResources().openRawResource(\"sa.json\");\n int size = is.available();\n\n byte[] buffer = new byte[size];\n\n is.read(buffer);\n\n is.close();\n\n json = new String(buffer, \"UTF-8\");\n Log.i(\"Json\",json);\n\n\n } catch (Exception ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n\n }", "protected void loadMockData() {\n\n int ctr;\n InputStream inputStream = getResources().openRawResource(R.raw.song_list);\n ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n\n try {\n ctr = inputStream.read();\n while (ctr != -1) {\n byteArrayOutputStream.write(ctr);\n ctr = inputStream.read();\n }\n inputStream.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n // Parse the data.\n try {\n JSONObject jObject = new JSONObject(byteArrayOutputStream.toString());\n\n String status_code = jObject.getString(\"statusCode\");\n\n if (status_code.equalsIgnoreCase(\"200\")) {\n JSONArray jArray = jObject.getJSONArray(\"data\");\n\n audioList = new ArrayList<>();\n\n for (int i = 0; i < jArray.length(); i++) {\n JSONObject song = jArray.getJSONObject(i);\n\n String genre = song.getString(\"genre\");\n String album = song.getString(\"album\");\n String author = song.getString(\"author\");\n String title = song.getString(\"title\");\n String url = song.getString(\"url\");\n String imgUrl = song.getString(\"img\");\n\n Audio audio = new Audio(genre, album, author, title, url, imgUrl);\n\n // Save to audioList.\n audioList.add(audio);\n }\n }\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }", "private void readFromJSON(String filename) {\n JSONParser parser = new JSONParser();\n\n try\n {\n Object obj = parser.parse(new FileReader(filename));\n JSONObject jsonObject = (JSONObject) obj;\n Menu drinks = getMenu(jsonObject, \"Drink\");\n Menu types = getMenu(jsonObject, \"Type\");\n Menu toppings = getMenu(jsonObject, \"Toppings\");\n Menu sizes = getMenu(jsonObject, \"Size\");\n menuMap.put(\"Drink\", drinks);\n menuMap.put(\"Size\", sizes);\n menuMap.put(\"Toppings\", toppings);\n menuMap.put(\"Type\", types);\n\n } catch (FileNotFoundException e) {\n System.out.println(\"Not found menu.json, exit now.\");\n System.exit(1);\n } catch (IOException e) {\n e.printStackTrace();\n } catch (ParseException e) {\n e.printStackTrace();\n }\n\n }", "@GET\n\t@Path(\"/helloJSONList\")\n\t/**\n\t * Here is an example of a simple REST get request that returns a String.\n\t * We also illustrate here how we can convert Java objects to JSON strings.\n\t * @return - List of words as JSON\n\t * @throws IOException\n\t */\n\tpublic String helloJSONList() throws IOException {\n\n\t\tList<String> listOfWords = new ArrayList<String>();\n\t\tlistOfWords.add(\"Hello\");\n\t\tlistOfWords.add(\"World!\");\n\n\t\t// We can turn arbatory Java objects directly into JSON strings using\n\t\t// Jackson seralization, assuming that the Java objects are not too complex.\n\t\tString listAsJSONString = oWriter.writeValueAsString(listOfWords);\n\n\t\treturn listAsJSONString;\n\t}", "static JsonResource forString( String contents ) {\n return new JsonResource() {\n @Override\n public <T> T readFrom( ReadMethod<T> consumer ) throws IOException {\n try ( ByteArrayInputStream stream = new ByteArrayInputStream(contents.getBytes(Json.getDefaultConfig().getCharset())) ) {\n return consumer.read(stream);\n }\n }\n };\n }", "private void downloadJSON() {\n new downloadJsonAsync().execute(Urls.GET_TAGS, Urls.GET_REST);\n }", "public JSONObject SourceResource() {\n JSONObject source = jsonParent.getJSONObject(\"sourceResource\");\n return source;\n }", "@Test\r\n public void testParseConnection() throws MalformedURLException {\r\n JsonArray array = null;\r\n JsonParser parser = new JsonParser();\r\n URL url = new URL(\"https://en.wikipedia.org/w/api.php?action=query&format=json&prop=revisions&titles=\\\" + \\\"Ball State\\\" + \\\"&rvprop=timestamp|user&rvlimit=24&redirects\");\r\n InputStream inputstream = getClass().getClassLoader().getResourceAsStream(\"sample.json\");\r\n assert inputstream != null;\r\n Reader reader = new InputStreamReader(inputstream);\r\n JsonElement rootElement = parser.parse(reader);\r\n JsonObject rootObject = rootElement.getAsJsonObject();\r\n JsonObject pages = rootObject.getAsJsonObject(\"query\").getAsJsonObject(\"pages\");\r\n for (Map.Entry<String, JsonElement> entry : pages.entrySet()) {\r\n JsonObject entryObject = entry.getValue().getAsJsonObject();\r\n array = entryObject.getAsJsonArray(\"revisions\");\r\n }\r\n System.out.println(array);\r\n System.out.println(url);\r\n }", "@VisibleForTesting\n interface JsonReader {\n /**\n * Returns the contents of the JSON file that is pointed to by the given {@code resId} as\n * a string.\n *\n * @param context The current Context.\n * @param resId The resource id of the JSON file.\n * @return A string representation of the file or {@code null} if an error occurred.\n */\n @Nullable\n String jsonFileToString(Context context, @RawRes int resId);\n }", "@Override\n public Map<String, Object> getResource() {\n List<Customer> customerList = customerRepository.findAllByName(\"toto\");\n Map<String,Object> model = new HashMap<String,Object>();\n model.put(\"id\", UUID.randomUUID().toString());\n model.put(\"content\", \"Hello World\");\n return model;\n }", "@Test\r\n public void testRevisionParser() {\r\n JsonParser parser = new JsonParser();\r\n InputStream inputstream = getClass().getClassLoader().getResourceAsStream(\"sample.json\");\r\n assert inputstream != null;\r\n Reader reader = new InputStreamReader(inputstream);\r\n JsonElement rootElement = parser.parse(reader);\r\n JsonObject rootObject = rootElement.getAsJsonObject();\r\n JsonObject pages = rootObject.getAsJsonObject(\"query\").getAsJsonObject(\"pages\");\r\n JsonArray array = null;\r\n for (Map.Entry<String, JsonElement> entry : pages.entrySet()) {\r\n JsonObject entryObject = entry.getValue().getAsJsonObject();\r\n array = entryObject.getAsJsonArray(\"revisions\");\r\n Assert.assertNotNull(array);\r\n }\r\n System.out.println(array);\r\n\r\n }", "public static List<String> mainReadFile(String[] args) throws IOException, URISyntaxException {\n List<String> exmp = new ArrayList<>();\n File initialFile = resolveFileFromResources(args[0]);\n // System.out.println(initialFile);\n ObjectMapper obM = getObjectMapper();\n Trades[] exmpTrade = obM.readValue(initialFile, Trades[].class);\n for (Trades trade : exmpTrade) {\n exmp.add(trade.getSymbol());\n }\n printJsonObject(exmp);\n //return Collections.emptyList();\n return exmp;\n }", "private void loadJSON() throws FileNotFoundException\n\t{\n\n\t\tGsonBuilder builder= new GsonBuilder();\n\t\tGson gson = builder.create();\n\t\t\t\t\n\t\t//get a list of folders in the data directory\n\t\t\n\t\tFile[] directories = new File(\"data\").listFiles();\n\n\t\t//Loop through folders in data directory\n\t\tfor(File folder : directories)\n\t\t\t{\n\t\t\t\t//get a list of files inside the folder\n\t\t\t\tFile[] jsonItems = new File(folder.toString()).listFiles();\n\t\t\t\t\n\t\t\t\t//Loop through files inside the folder \n\t\t\t\tfor(File file : jsonItems)\n\t\t\t\t{\n\t\t\t\t\t//Store in directory map... substring to remove the \"data/\" portion... placed by filename to foldername\n\t\t\t\t\tString dir = file.toString().substring(5);\n\t\t\t\t\t\n\t\t\t\t\t//Generate player data from gson\n\t\t\t\t\tJsonReader reader = new JsonReader(new FileReader(file));\n\t\t\t\t\tPlayer player = gson.fromJson(reader, Player.class);\n\t\t\t\t\t\n\t\t\t\t\t//Store it in the map tied to it's directory\n\t\t\t\t\tplayerData.put(dir, player);\n\t\t\t\t}\n\t\t\t}\n\t\t}", "private JsonObject loadJSONFile(String jsonFilePath) throws IOException {\r\n\tInputStream is = new FileInputStream(jsonFilePath);\r\n\tJsonReader jsonReader = Json.createReader(is);\r\n\tJsonObject json = jsonReader.readObject();\r\n\tjsonReader.close();\r\n\tis.close();\r\n\treturn json;\r\n }", "private JSONObject loadMetadata(Path extensionResourcePath) throws ExtensionManagementException {\n\n Path metadataPath = extensionResourcePath.resolve(METADATA_FILE_NAME);\n if (Files.exists(metadataPath) && Files.isRegularFile(metadataPath)) {\n return readJSONFile(metadataPath);\n }\n return null;\n }", "public void loadFromSource(Object aSrc)\n{\n WebURL url = WebURL.getURL(aSrc);\n String jsonText = url.getText();\n loadFromString(jsonText);\n}", "public JSONArray readFromJSON(){\n\n JSONArray jsonArray=null;\n\n try {\n InputStream inputStream =context.getResources().getAssets().open(FILE_NAME);\n int size = inputStream.available();\n byte[] data = new byte[size];\n inputStream.read(data);\n inputStream.close();\n String json = new String(data, \"UTF-8\");\n jsonArray = new JSONArray(json);\n } catch (IOException e) {\n e.printStackTrace();\n } catch (JSONException e) {\n e.printStackTrace();\n }\n return jsonArray;\n }", "private TabulatorItems[] getJsonArrayOfItems(Resource resource) {\n ObjectMapper mapper = new ObjectMapper();\n TabulatorItems[] items = null;\n try {\n items = mapper.readValue(new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8), TabulatorItems[].class);\n } catch (IOException ex) {\n Logger.getLogger(CollectionApiUIImpl.class.getName()).log(Level.SEVERE, null, ex);\n }\n return items;\n }", "public void load() throws IOException {\r\n\t\tFile file = new File(projectDir, TERN_PROJECT);\r\n\t\tif (file.exists()) {\r\n\t\t\tJSONParser parser = new JSONParser();\r\n\t\t\ttry {\r\n\t\t\t\tJSONObject result = (JSONObject) parser.parse(new FileReader(\r\n\t\t\t\t\t\tfile));\r\n\t\t\t\tsuper.putAll(result);\r\n\t\t\t} catch (ParseException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private String loadJSONFromAsset(){\n String json = null;\n AssetManager assetManager = getAssets();\n try{\n InputStream IS = assetManager.open(\"datosFases.json\");\n int size = IS.available();\n byte[] buffer = new byte[size];\n IS.read(buffer);\n IS.close();\n json = new String(buffer,\"UTF-8\");\n\n } catch (IOException ex){\n ex.printStackTrace();\n return null;\n }\n\n return json;\n }", "public void testImportJSONFromRequestParam() throws IOException, JsonException {\n final String testPath = TEST_BASE_PATH;\n Map<String, String> props = new HashMap<String, String>();\n String testNode = testClient.createNode(HTTP_BASE_URL + testPath, props);\n urlsToDelete.add(testNode);\n\n props.clear();\n props.put(SlingPostConstants.RP_OPERATION,\n \t\tSlingPostConstants.OPERATION_IMPORT);\n\n String testNodeName = \"testNode_\" + String.valueOf(random.nextInt());\n props.put(SlingPostConstants.RP_NODE_NAME_HINT, testNodeName);\n String jsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/testimport.json\"));\n props.put(SlingPostConstants.RP_CONTENT, jsonContent);\n props.put(SlingPostConstants.RP_CONTENT_TYPE, \"json\");\n props.put(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + \"/*\");\n String importedNodeUrl = testClient.createNode(HTTP_BASE_URL + testPath, props);\n\n // assert content at new location\n String content = getContent(importedNodeUrl + \".3.json\", CONTENT_TYPE_JSON);\n\n\t\tJsonObject jsonObj = JsonUtil.parseObject(content);\n\t\tassertNotNull(jsonObj);\n\n\t\t//assert the imported content is there.\n String expectedJsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/importresults.json\"));\n\t\tassertExpectedJSON(JsonUtil.parseObject(expectedJsonContent), jsonObj);\n }", "private JSONObject getAssetJson(String filename) {\n return new JSONObject(\n resourceHandler.getResourceFileAsString(ResourceHandler.VALORANT_BASE_PATH + \"Data/\" + filename)\n );\n }", "public static void main(String[] args)\n\t\t\tthrows IOException, MalformedURLException, FileNotFoundException, IOException {\n\t\tString string = \"\";\n\n\t\tInputStream input = new FileInputStream(\"C:\\\\Users\\\\siva_\\\\workspace\\\\RESTfulExample1\\\\json.txt\");\n\n\t\tInputStreamReader reader = new InputStreamReader(input);\n\t\tBufferedReader bReader = new BufferedReader(reader);\n\t\tString line = null;\n\n\t\twhile ((line = bReader.readLine()) != null) {\n\t\t\tstring += line + \"\\n\";\n\t\t}\n\t\tbReader.close();\n\t\tJSONObject jsonObj = new JSONObject(string);\n\t\tSystem.out.println(\"The JSON File contents are:\");\n\t\tSystem.out.println(jsonObj.toString());\n\n\t\tURL url = new URL(\"http://localhost:8080/RESTfulExample1/api/JSONProcessorService\");\n\t\tSystem.out.println(\"connection opened at \" + url.getHost());\n\t\tURLConnection connection = url.openConnection();\n\n\t\tconnection.setDoOutput(true);\n\t\tconnection.setRequestProperty(\"Content-type\", \"application/json\");\n\t\tconnection.setConnectTimeout(5000);\n\t\tconnection.setReadTimeout(5000);\n\n\t\tOutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream());\n\t\tout.write(jsonObj.toString());\n\t\tout.close();\n\t\t\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n\n\t\tif (br.readLine() == null) {\n\t\t\tSystem.out.println(\"Read nothing terminating.....\");\n\t\t\treturn;\n\t\t}\n\n\t\tSystem.out.println(\"Webservice invoked successfully\");\n\n\t}", "public static void readJSON() throws IOException {\n\t\tBufferedReader br = new BufferedReader(new FileReader(f));\n\t\tString line;\n\t\tif((line = br.readLine()) != null) {\n\t\t\tString [] flightStates = parseJSON(line);\n\t\t\tfor(String state : flightStates) {\n\t\t\t\tFlightState fs = new FlightState(state);\n\t\t\t\tsendToKafka(fs);\n\t\t\t}\n\t\t}\n\t\tbr.close();\n\t}", "@GET\n @Path(\"location/Arovince\")\n @Produces(\"application/json\")\n public String getJson() throws IOException {\n FileWriter file = new FileWriter(\"/home/component/NetBeansProjects/ArovinceAndSchool/web/api/Arovince.json\");\n JSONObject jsonArray = null;\n\n try {\n URL url = new URL(\"https://opend.data.go.th/get-ckan/datastore_search?resource_id=df922923-e009-4dee-92fc-d963a86ce4b8\"); \n HttpURLConnection httpURLConnection = (HttpURLConnection)url.openConnection();\n httpURLConnection.setRequestMethod(\"GET\");\n httpURLConnection.setRequestProperty(\"api-key\", \"XOe9aVTolOhCbyTU103IqAKTNNNPX8b5\");\n String line = \"\";\n InputStreamReader inputStreamReader = new InputStreamReader(httpURLConnection.getInputStream());\n BufferedReader bufferedReader = new BufferedReader(inputStreamReader);\n StringBuilder response = new StringBuilder();\n\n try {\n while((line = bufferedReader.readLine()) != null) {\n file.write(line);\n response.append(line);\n }\n } catch (IOException var10) {\n }\n\n file.close();\n bufferedReader.close();\n jsonArray = new JSONObject(response.toString());\n return jsonArray.toString(4);\n } catch (Exception var11) {\n return \"\" + var11;\n }\n }", "@Test\n public void toAndFromJsonTestWithFollowUpQuestions() throws IOException {\n Question bonusQuestion = new Question(\"BonusQ1\", \"This is a followupCounts to a followupCounts question!\", \"Plane\", \"Nice!\", Arrays.asList(\"Nice!\", \"Sweet!\", \"Cool!\"), \"../static/images/equine02.jpg\");\n Question attach1 = new Question(\"AttachQ1\", \"Which attachment is this?\", \"Attachment\",\n \"Type1\", Arrays.asList(\"Type1\", \"Type2\", \"Type3\"), \"../static/images/equine02.jpg\");\n Question attach2 = new Question(\"AttachQ2\", \"Which attachment is this?\", \"Attachment\",\n \"Type3\", Arrays.asList(\"Type1\", \"Type2\", \"Type3\"), \"../static/images/equine02.jpg\");\n Question attach3 = new Question(\"AttachQ1\", \"Which attachment is this?\", \"Attachment\",\n \"Type2\", Arrays.asList(\"Type1\", \"Type2\", \"Type3\"), \"../static/images/equine02.jpg\", Arrays.asList(bonusQuestion));\n List<Question> attachmentQuestions = Arrays.asList(attach1, attach2, attach3);\n Question myQ = new Question(\"StructureQ1\", \"What kind of structure is this?\", EquineQuestionTypes.structure.toString(), \"Structure1\", Arrays.asList(\"Structure1\", \"Structure2\", \"Structure3\"), \"../static/images/equine02.jpg\", attachmentQuestions);\n Question myQ2 = new Question(\"PlaneQ1\", \"What plane is this?\", EquineQuestionTypes.plane.toString(), \"Transverse\", Arrays.asList(\"Transverse\", \"Longitudinal\"), \"../static/images/equine02.jpg\");\n List<Question> hardcodedQuestions = Arrays.asList(myQ, myQ2);\n\n //Write to file\n JsonUtil.toJsonFile(\"src/test/resources/autoGenerated/questionsWithFollowup.json\", hardcodedQuestions);\n\n //Load back in\n List<Question> questionsFromFile = JsonUtil.listFromJsonFile(\"src/test/resources/autoGenerated/questionsWithFollowup.json\", Question.class);\n\n assertEquals(2, questionsFromFile.size());\n Question questionWithFollowups = questionsFromFile.get(0);\n assertEquals(3, questionWithFollowups.getFollowupQuestions().size());\n Question questionWithoutFollowups = questionsFromFile.get(1);\n assertEquals(0, questionWithoutFollowups.getFollowupQuestions().size());\n\n }", "public String loadJSONFromAsset() {\n String json = null;\n try {\n InputStream is = getAssets().open(\"election-county-2012.json\");\n int size = is.available();\n byte[] buffer = new byte[size];\n is.read(buffer);\n is.close();\n json = new String(buffer, \"UTF-8\");\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n }", "private void loadHelpContent() {\n\t\tGson gson = new GsonBuilder().setPrettyPrinting().create();\n\t\tBufferedReader br;\n\t\ttry {\n\t\t\tbr = new BufferedReader(\n\t\t\t\t\tnew UnicodeReader(new FileInputStream(new File(getHelpContentFilePath())), \"UTF-8\"));\n\t\t\tsx3ConfigurationHelp = gson.fromJson(br, SX3ConfiguartionHelp.class);\n\t\t\tSX3Manager.getInstance().setSx3ConfiguartionHelp(sx3ConfigurationHelp);\n\t\t} catch (FileNotFoundException e) {\n\t\t\tsx3ConfigurationHelp = new SX3ConfiguartionHelp();\n\t\t\tSX3Manager.getInstance().addLog(\"<span style='color:red;'>\" + e.getMessage() + \".</span><br>\");\n\n\t\t}\n\t}", "String getJson();", "String getJson();", "String getJson();", "private ArrayList<Book> loadBooks(InputStream is) throws IOException{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(is));\r\n\t\tStringBuilder jsonFileContent = new StringBuilder();\r\n\t\t//read line by line from file\r\n\t\tString nextLine = null;\r\n\t\twhile ((nextLine = br.readLine()) != null){\r\n\t\t\tjsonFileContent.append(nextLine);\r\n\t\t}\r\n\r\n\t\tGson gson = new Gson();\r\n\t\t//this is a require type definition by the Gson utility so Gson will \r\n\t\t//understand what kind of object representation should the json file match\r\n\t\tType type = new TypeToken<ArrayList<Book>>(){}.getType();\r\n\t\tArrayList<Book> books = gson.fromJson(jsonFileContent.toString(), type);\r\n\t\t//close\r\n\t\tbr.close();\t\r\n\t\treturn books;\r\n\t}", "public String readJsonFile(String fileName)\n {\n FileInputStream fileInputStream = null;\n String text;\n StringBuilder stringBuilder = new StringBuilder();\n\n try\n {\n fileInputStream = mainContext.openFileInput(fileName);\n InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream);\n BufferedReader bufferedReader = new BufferedReader(inputStreamReader);\n\n while((text = bufferedReader.readLine()) != null)\n {\n stringBuilder.append(text).append(\"\\n\");\n }\n }\n catch (IOException e)\n {\n System.out.println(e.getMessage());\n }\n\n return stringBuilder.toString();\n }", "@Test\n\tpublic void testWithJsonPath() {\n\t\t\t\t\n\t\tResponse response = given().accept(ContentType.JSON)\n\t\t.and().pathParam(\"id\", 110)\n\t\t.when().get(ConfigurationReader.getProperty(\"hrapp.baseurl\")+\"/employees/{id}\");\n\t\t\n\t\tJsonPath json = response.jsonPath(); //get json body and assign to jsonPath object\n\t\t//we are assiging whole response to json object so we can easyly reach and use it \n\t\t\n\t\tSystem.out.println(json.getInt(\"employee_id\"));\n\t\tSystem.out.println(json.getString(\"first_name\"));\n\t\tSystem.out.println(json.getString(\"job_id\"));\n\t\tSystem.out.println(json.getInt(\"salary\"));\n\t\tSystem.out.println(json.getString(\"links[0].href\")); //get specific element from array \n\t \n\t\t//assign all hrefs into a list of strings \n\t\tList<String> hrefs = json.getList(\"links.href\");\n\t\t\n\t\t//everything in arraylist \n\t System.out.println(hrefs);\n\t \n\t //one by one \n\t\tfor(String href:hrefs) {\n\t\t\tSystem.out.println(href);\n\t\t}\n\t}", "public void testImportJSONFromFile() throws IOException, JsonException {\n final String testPath = TEST_BASE_PATH;\n Map<String, String> props = new HashMap<String, String>();\n String testNode = testClient.createNode(HTTP_BASE_URL + testPath, props);\n urlsToDelete.add(testNode);\n\n props.clear();\n props.put(SlingPostConstants.RP_OPERATION,\n \t\tSlingPostConstants.OPERATION_IMPORT);\n\n String testNodeName = \"testNode_\" + String.valueOf(random.nextInt());\n props.put(SlingPostConstants.RP_NODE_NAME_HINT, testNodeName);\n testFile = getTestFile(getClass().getResourceAsStream(\"/integration-test/servlets/post/testimport.json\"));\n props.put(SlingPostConstants.RP_CONTENT_TYPE, \"json\");\n props.put(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + \"/*\");\n String importedNodeUrl = testClient.createNode(HTTP_BASE_URL + testPath, new NameValuePairList(props), null, true,\n \t\ttestFile, SlingPostConstants.RP_CONTENT_FILE, null);\n\n // assert content at new location\n String content = getContent(importedNodeUrl + \".3.json\", CONTENT_TYPE_JSON);\n\n\t\tJsonObject jsonObj = JsonUtil.parseObject(content);\n\t\tassertNotNull(jsonObj);\n\n\t\t//assert the imported content is there.\n String expectedJsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/importresults.json\"));\n\t\tassertExpectedJSON(JsonUtil.parseObject(expectedJsonContent), jsonObj);\n }", "private Demo doReadDemo(final ClassLoader demoResourceLoader) throws IOException {\n final Demo demo = new Demo();\n\n final URL demoConfiguration = demoResourceLoader.getResource(CONFIGURATION_NAME);\n\n if (null == demoConfiguration) {\n logger.logWarning(\"No {0} found in demo root. Please configure the demo properly.\",\n CONFIGURATION_NAME);\n } else {\n // load demo configuration\n final Properties configuration = new Properties();\n final InputStream demoConfigurationStream = demoConfiguration.openStream();\n try {\n configuration.load(demoConfiguration.openStream());\n } finally {\n demoConfigurationStream.close();\n }\n demo.setConfiguration(configuration);\n \n final String environment = demo.getProperty(\"environment\");\n if(null == environment) {\n logger.logWarning(\"Demo environment has not been configured.\");\n } else {\n final String scenarios = demo.getProperty(\"scenarios\");\n if (null == scenarios) {\n logger.logWarning(\"Demo scenarios have not been configured.\");\n }\n final StringTokenizer tokenizer = new StringTokenizer(scenarios, \",\");\n while (tokenizer.hasMoreTokens()) {\n configureScenario(demo, tokenizer.nextToken(), demoResourceLoader);\n }\n }\n }\n return demo;\n }", "public void testImportJSONFromRequestParamWithoutOptionalName() throws IOException, JsonException {\n final String testPath = TEST_BASE_PATH;\n Map<String, String> props = new HashMap<String, String>();\n String testNode = testClient.createNode(HTTP_BASE_URL + testPath, props);\n urlsToDelete.add(testNode);\n\n props.clear();\n props.put(SlingPostConstants.RP_OPERATION,\n \t\tSlingPostConstants.OPERATION_IMPORT);\n\n String jsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/testimport2.json\"));\n props.put(SlingPostConstants.RP_CONTENT, jsonContent);\n props.put(SlingPostConstants.RP_CONTENT_TYPE, \"json\");\n props.put(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + \"/*\");\n String importedNodeUrl = testClient.createNode(HTTP_BASE_URL + testPath, props);\n\n //make sure the name is what was inside the file.\n assertTrue(importedNodeUrl.endsWith(\"/nodeName\"));\n\n // assert content at new location\n String content = getContent(importedNodeUrl + \".3.json\", CONTENT_TYPE_JSON);\n\n\t\tJsonObject jsonObj = JsonUtil.parseObject(content);\n\t\tassertNotNull(jsonObj);\n\n\t\t//assert the imported content is there.\n String expectedJsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/importresults.json\"));\n\t\tassertExpectedJSON(JsonUtil.parseObject(expectedJsonContent), jsonObj);\n }", "private SpecificationByExample loadSpecificationFromResource(Resource resource) throws IOException {\r\n Specification specification= specificationReader.readSpecification(resource);\r\n\r\n SpecificationByExample specificationByExample;\r\n if (specification instanceof SpecificationByExample) {\r\n specificationByExample = (SpecificationByExample) specification;\r\n } else {\r\n specificationByExample = new SpecificationToSpecificationByExampleAdaptor(specification);\r\n }\r\n specificationByExample.setFixtureClass(fixture);\r\n return specificationByExample;\r\n }", "public String loadJSONFromAsset() {\n String json = null;\n try {\n json = new String(buffer, \"UTF-8\");\n } catch (UnsupportedEncodingException e1) {\n e1.printStackTrace();\n }\n\n return json;\n }", "@Test\n\tpublic void testJsonPath() {\n\tString responseAsString=\n\t\twhen().\n\t\t\tget(\"http://jsonplaceholder.typicode.com/photos\").\n\t\tthen().\n\t\textract().asString();\n\t\t\n\tList<Integer> albumIds = from(responseAsString).get(\"id\");\n\tSystem.out.println(albumIds.size());\n\t}", "private static void readWineListFromFile() {\n\t\tJSONParser parser = new JSONParser();\n\n\t\ttry (Reader reader = new FileReader(\"wines.json\")) {\n\n\t\t\tJSONArray wineListJSON = (JSONArray) parser.parse(reader);\n\n\t\t\tfor (int i = 0 ; i < wineListJSON.size(); i++) {\n\t\t\t\tJSONObject wine = (JSONObject) wineListJSON.get(i);\n\t\t\t\tString name = (String) wine.get(\"name\");\n\t\t\t\tint year = Integer.valueOf(wine.get(\"year\").toString());\n\t\t\t\tString description = (String) wine.get(\"description\");\n\t\t\t\tString vine = (String) wine.get(\"vine\");\n\t\t\t\tint quantity = Integer.valueOf(wine.get(\"quantity\").toString());\n\t\t\t\tdouble price = (double) wine.get(\"price\");\n\n\t\t\t\t// Add the JSON object to the wine list\n\t\t\t\tMain.wineList.add(new Wine(name, year, description, vine, quantity, price));\n\n\t\t\t}\n\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (ParseException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "List<Resource> resources();", "public JSONObject read(InputStream uploadedInputStream);", "public String loadJSONFromAsset() {\n String json;\n try {\n InputStream is = getAssets().open(\"track_v0649.json\");\n int size = is.available();\n byte[] buffer = new byte[size];\n\n is.read(buffer);\n is.close();\n json = new String(buffer, \"UTF-8\");\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n }", "public void testImportJSONFromFileWithoutOptionalName() throws IOException, JsonException {\n final String testPath = TEST_BASE_PATH;\n Map<String, String> props = new HashMap<String, String>();\n String testNode = testClient.createNode(HTTP_BASE_URL + testPath, props);\n urlsToDelete.add(testNode);\n\n props.clear();\n props.put(SlingPostConstants.RP_OPERATION,\n \t\tSlingPostConstants.OPERATION_IMPORT);\n\n testFile = getTestFile(getClass().getResourceAsStream(\"/integration-test/servlets/post/testimport2.json\"));\n props.put(SlingPostConstants.RP_CONTENT_TYPE, \"json\");\n props.put(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + \"/*\");\n String importedNodeUrl = testClient.createNode(HTTP_BASE_URL + testPath, new NameValuePairList(props), null, true,\n \t\ttestFile, SlingPostConstants.RP_CONTENT_FILE, null);\n\n //make sure the name is what was inside the file.\n assertTrue(importedNodeUrl.endsWith(\"/nodeName\"));\n\n // assert content at new location\n String content = getContent(importedNodeUrl + \".3.json\", CONTENT_TYPE_JSON);\n\n\t\tJsonObject jsonObj = JsonUtil.parseObject(content);\n\t\tassertNotNull(jsonObj);\n\n\t\t//assert the imported content is there.\n String expectedJsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/importresults.json\"));\n\t\tassertExpectedJSON(JsonUtil.parseObject(expectedJsonContent), jsonObj);\n }", "public void ready(final YuiContext Y) {\n\t\tJsArr data_in = JsArr.create(\n\t\t\tJsObject.one(\"make\", \"Chevrolet\")._(\"model\", \"Bel Air\")._(\"year\", 1957),\n\t\t\tJsObject.one(\"make\", \"Dodge\")._(\"model\", \"Dart\")._(\"year\", 1964),\n\t\t\tJsObject.one(\"make\", \"Ford\")._(\"model\", \"Mustang\")._(\"year\", 1968) \n\t\t); \n\t\tSchema schema = Schema.create().resultFields(new Field[]{\n\t\t\tField.create().key(\"model\"), Field.create().key(\"year\") \n\t\t}); \n\t\tDataSchemaResult data_out = Y.DataSchemaArray().apply(schema, data_in);\n\t\tWindow.alert(Y.dump(data_out.results())); //data_out.results().length()+\" - \"+JsUtil.dumpObj(data_out, true));\n\t\t\n\t\t\n\t\t//another little test, this time reading a json string contained mixed formed data\n\t\tString data_in2 = \"[\\n\"+\n\t\t\" {make:\\\"Chevrolet\\\",model:\\\"Bel Air\\\",year:1957},\\n\"+\n\t\t\" [\\\"Dodge\\\", \\\"Dart\\\", 1964],\\n\"+\n\t\t\" \\\"1968 Ford Mustang\\\"\\n\"+\n\t\t\"]\"; \n\t\t\n\t\tSchema schema2 = Schema.create().resultFields(new Field[]{\n\t\t\t\tField.create().key(\"make\"), Field.create().key(\"model\"), Field.create().key(\"year\") \n\t\t}); \n\t\tDataSchemaResult data_out2 = Y.DataSchemaArray().apply(schema2, JsonUtils.unsafeEval(data_in2));\n\t\tWindow.alert(Y.dump(data_out2.results())); \n\t}", "public JsonArray getJsonFromService(\n String myQuestion, //\n String endpoint, //\n float minimumConfidence, //\n RestTemplate restTemplate, //\n CacheOfRestTemplateResponse myCacheOfResponses //\n ) throws URISyntaxException, DBpediaSpotlightJsonParsingNotPossible {\n URI uri = createRequestUriWithParameters(myQuestion, endpoint, minimumConfidence);\n JsonObject response = fetchNamedEntitiesFromWebService(restTemplate, myCacheOfResponses, uri);\n JsonArray resources = getResourcesOfResponse(response, myQuestion);\n\n return resources;\n }", "@Override\n public String toString() {return \"Json-File Reader\";}", "public static void main(String[] args) throws IOException {\n\t\t// TODO Auto-generated method stub\n\t\tJsonFileParser parser = new JsonFileParser();\n\t\tparser.parseJsonFile(args);\n\t\tList<String> labelset = parser.getLset();\n\t\tfor(String label : labelset){\n\t\t\tSystem.out.println(label);\n\t\t}\n\t\tList<String> corpus = parser.getCorpus();\n\t\tfor(String doc : corpus){\n\t\t\tSystem.out.println(doc);\n\t\t}\n\t\tList<String> labels = parser.getLabels();\n\t\tfor(String label : labels){\n\t\t\tSystem.out.println(label);\n\t\t}\n\t\tList<String> headerInforList = parser.getPmids();\n\t\tfor(String pmid : headerInforList){\n\t\t\tSystem.out.println(pmid);\n\t\t}\n\t}", "public static void initialize() {\r\n\t\tjson = new JSONFile(filePath);\t\r\n\t}" ]
[ "0.65106744", "0.64942837", "0.621569", "0.6097948", "0.605114", "0.5976828", "0.59634453", "0.58937454", "0.5882496", "0.5728595", "0.5726738", "0.5716714", "0.5703193", "0.56933194", "0.56922007", "0.5684327", "0.5670406", "0.5665765", "0.5579029", "0.55726236", "0.5563291", "0.5542161", "0.5523732", "0.55018896", "0.54970455", "0.548195", "0.5474336", "0.54640186", "0.5443245", "0.54425824", "0.54421663", "0.5433782", "0.541568", "0.54123783", "0.54122406", "0.5405062", "0.5385872", "0.53744465", "0.5371214", "0.537099", "0.5369813", "0.5364451", "0.53542566", "0.5348374", "0.5348107", "0.5345096", "0.53292155", "0.5319196", "0.531579", "0.5307478", "0.53013295", "0.5296883", "0.5295683", "0.52945685", "0.5293875", "0.5287224", "0.52865434", "0.52824074", "0.5256617", "0.52546346", "0.52443564", "0.5238204", "0.5237661", "0.52361053", "0.5231939", "0.5221327", "0.5211724", "0.52102137", "0.5208383", "0.5208335", "0.5205505", "0.520267", "0.52007747", "0.5197523", "0.51931566", "0.5183759", "0.5158344", "0.5151503", "0.51513517", "0.51432705", "0.51432705", "0.51432705", "0.5140156", "0.5139785", "0.51395804", "0.51303816", "0.51262987", "0.5117251", "0.511516", "0.5113012", "0.5111478", "0.51105314", "0.51083374", "0.51013047", "0.50988775", "0.5087814", "0.5081152", "0.5077141", "0.507294", "0.50719947", "0.5064289" ]
0.0
-1
Read in the JSON from the example resources
@Test public void testExchangeMetaDataAdapter() throws IOException { InputStream is = CryptopiaAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/cryptopia/dto/marketdata/example-currencies.json"); // Use Jackson to parse it ObjectMapper mapper = new ObjectMapper(); CryptopiaBaseResponse<List<CryptopiaCurrency>> cryptopiaCurrencies = mapper.readValue(is, CryptopiaBaseResponseCryptopiaCurrency.class); is.close(); assertThat(cryptopiaCurrencies).isNotNull(); is = CryptopiaAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/cryptopia/dto/marketdata/example-trade-pairs.json"); CryptopiaBaseResponse<List<CryptopiaTradePair>> cryptopiaTradePairs = mapper.readValue(is, CryptopiaBaseResponseCryptopiaTradePair.class); is.close(); assertThat(cryptopiaTradePairs).isNotNull(); ExchangeMetaData exchangeMetaData = CryptopiaAdapters.adaptToExchangeMetaData( cryptopiaCurrencies.getData(), cryptopiaTradePairs.getData()); assertThat(exchangeMetaData).isNotNull(); assertThat(exchangeMetaData.getCurrencies()).containsKey(Currency.ETH); assertThat(exchangeMetaData.getCurrencies().get(Currency.ETH).getScale()).isEqualTo(8); assertThat(exchangeMetaData.getCurrencyPairs()).containsKey(CurrencyPair.ETH_BTC); assertThat( exchangeMetaData .getCurrencyPairs() .get(CurrencyPair.ETH_BTC) .getTradingFee() .toString()) .isEqualTo("0.20000000"); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n\tpublic void readJSONFromFile() {\n\t\t\n\t\tJsonPath jsonFile = new JsonPath(new File (\"C:\\\\Users\\\\cmlzd\\\\Desktop\\\\employees.json\"));\n\t\t\n\t\tSystem.out.println(jsonFile.getString(\"items.email\"));\n\t\t\n\t\t\n\t}", "private static JsonReader readJSONFromAsset(Context context) throws IOException {\n AssetManager assetManager = context.getAssets();\n JsonReader reader;\n try {\n reader = new JsonReader(new InputStreamReader(assetManager.open(\"questionlist.json\")));\n } finally {\n\n }\n return reader;\n }", "public static Books readJSON(){\n Gson gson = new GsonBuilder().create();\n Books books = new Books();\n try {\n books = gson.fromJson(new JsonReader(new FileReader(\"books.json\")), Books.class);\n } catch (IOException e){\n e.printStackTrace();\n }\n return books;\n }", "protected JSONArray readJsonFromLocalResources(InputStream resources) {\n\n InputStream is = resources;\n ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n\n if (is != null) {\n\n int ctr;\n try {\n ctr = is.read();\n while (ctr != -1) {\n byteArrayOutputStream.write(ctr);\n ctr = is.read();\n }\n\n if (byteArrayOutputStream.size() > 0) {\n Logger.d(\"JSON= \" + byteArrayOutputStream.toString());\n return new JSONArray(byteArrayOutputStream.toString());\n }\n\n } catch (IOException e) {\n Logger.e(\"Could not read the json file, IOException\" + e);\n } catch (JSONException ex) {\n Logger.e(\"Could not parse into json object, JSONException\" + ex);\n } finally {\n\n try {\n is.close();\n } catch (IOException ex) {\n Logger.e(\"Could not close InputStream, IOException\" + ex);\n }\n }\n }\n\n Logger.d(\"Could not return json object\"); //Let's hope not to hit this line\n return null;\n }", "public String loadJSONFromAsset() {\n String json;\n String file = \"assets/words.json\";\n\n try {\n InputStream is = this.getClass().getClassLoader().getResourceAsStream(file);\n int size = is.available();\n byte[] buffer = new byte[size];\n is.read(buffer);\n is.close();\n json = new String(buffer, \"UTF-8\");\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n }", "private Demo doReadDemo() throws IOException {\n // create a resource loader\n final URL defaultRoot = ResourceUtil.getURL(\"demo/\");\n final URLClassLoader resourceLoader = new URLClassLoader(\n new URL[] { defaultRoot }, null);\n return doReadDemo(resourceLoader);\n }", "public static void loadPracticeListFromFile() {\n JSONParser jsonParser = new JSONParser();\n\n try (FileReader reader = new FileReader(\"src/practiceList.json\")) {\n // Read JSON file\n Object object = jsonParser.parse(reader);\n\n //Iterate over word list array\n JSONArray wordList = (JSONArray) object;\n for (Object o : wordList) {\n\n JSONObject next = (JSONObject) o;\n String extra = \"\";\n\n if (((String) next.get(\"wordType\")).equalsIgnoreCase(\"verb\")) {\n extra = \"to \";\n }\n\n Word loadedWord = new Word(extra + next.get(\"english\"), (String) next.get(\"welsh\"), (String) next.get(\"wordType\"));\n\n addIntoPracticedWords(loadedWord);\n }\n\n } catch (ParseException | IOException e) {\n System.out.println(\"PracticeList file not found, will be created on exit.\");\n }\n }", "public Integer loadJSONFile()\n {\n JSONParser parser = new JSONParser();\n try{\n\n Object obj = parser.parse(new FileReader(\"/Users/rnuka/Desktop/sample.json\"));\n JSONObject jsonObj = (JSONObject)obj;\n\n Long age = (Long)jsonObj.get(\"age\");\n System.out.println(\"age:\"+age);\n\n String name = (String)jsonObj.get(\"name\");\n System.out.println(\"name:\" + name);\n\n JSONArray address = (JSONArray)jsonObj.get(\"address\");\n\n for(Object str : address){\n System.out.println(str);\n }\n\n\n\n }catch(Exception e){\n e.printStackTrace();\n }\n return 1;\n }", "private void read() {\n\n\t\t\t\tString road=getActivity().getFilesDir().getAbsolutePath()+\"product\"+\".txt\";\n\n\t\t\t\ttry {\n\t\t\t\t\tFile file = new File(road); \n\t\t\t\t\tFileInputStream fis = new FileInputStream(file); \n\t\t\t\t\tint length = fis.available(); \n\t\t\t\t\tbyte [] buffer = new byte[length]; \n\t\t\t\t\tfis.read(buffer); \n\t\t\t\t\tString res1 = EncodingUtils.getString(buffer, \"UTF-8\"); \n\t\t\t\t\tfis.close(); \n\t\t\t\t\tjson(res1.toString());\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} \n\t\t\t}", "public String loadJSONFromAsset(Context context) {\n String json = null;\n try {\n InputStream is;\n int id = context.getResources().getIdentifier(\"sentiment\", \"raw\", context.getPackageName());\n is = context.getResources().openRawResource(id);\n\n int size = is.available();\n\n byte[] buffer = new byte[size];\n\n is.read(buffer);\n\n is.close();\n\n json = new String(buffer, \"UTF-8\");\n\n\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n\n }", "@GetMapping(\"/getJson\")\r\n\tpublic HashMap<String, Object> getJsonValue() throws IOException {\n\r\n\t\tHashMap<String, Object> globalVariable = null;\r\n\t\tObjectMapper mapper = new ObjectMapper();\r\n\t\tString path = \"rules/backUp.json\";\r\n\r\n\t\tResourceLoader resource = new DefaultResourceLoader();\r\n\t\torg.springframework.core.io.Resource resource2 = resource.getResource(\"classpath:\" + path);\r\n\r\n\t\tReader reader = new InputStreamReader(resource2.getInputStream());\r\n\t\tSystem.out.println(\"reader ouput \" + reader.toString());\r\n\t\tString fileData = FileCopyUtils.copyToString(reader);\r\n\t\tSystem.out.println(\" filedate is \" + fileData);\r\n\r\n\t\tTypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() {\r\n\t\t};\r\n\t\tHashMap<String, Object> readValue = mapper.readValue(fileData, typeRef);\r\n\t\treturn readValue;\r\n\t}", "@GetMapping(\"/getThingsDescription\")\n public ResponseEntity<?> getThingsDescription() {\n log.info(\"Thing Description from TechUnit ... \");\n\n ClassLoader cl = getClass().getClassLoader();\n\n String thingsDescription = \"\";\n try {\n thingsDescription = IOUtils\n .toString(cl.getResourceAsStream(\"things-wearhealth.json\"));\n } catch (Exception ex) {\n log.error(\"Unable to load Things Description...\");\n ex.printStackTrace();\n }\n return new ResponseEntity<>(thingsDescription, HttpStatus.OK);\n }", "public void ReadJson() {\n System.out.println(\"Read Json Method in the Mother Class\");\n }", "public void readInventoryMainJsonFile() throws IOException, ParseException {\n\n\t\t// Providing read-only access to JSON data.\n\t\tJSONParser parser = new JSONParser();\n\n\t\t// Reading the external JSON file.\n\t\tFileReader reader = new FileReader(\".\\\\resources\\\\InventoryMain.json\");\n\n\t\t// Creating main object to store JSONParser, JSONObject and JSONArray.\n\t\tObject inventoryMain = parser.parse(reader);\n\n\t\t// Parsing object to JSONObject from InventoryMain.json file.\n\t\tJSONObject inventoryObj = (JSONObject) inventoryMain;\n\n\t\t// Getting the arrays of JSON file.\n\t\tJSONArray riceArray = (JSONArray) inventoryObj.get(\"Rice\");\n\t\tJSONArray pulseArray = (JSONArray) inventoryObj.get(\"Pulses\");\n\t\tJSONArray wheatArray = (JSONArray) inventoryObj.get(\"Wheat\");\n\n\t\t// Getting details of rice.\n\t\tSystem.out.println(\"Details of Rice are: \");\n\t\tfor (int i = 0; i < riceArray.size(); i++) {\n\t\t\tJSONObject riceDetails = (JSONObject) riceArray.get(i);\n\n\t\t\tString name = (String) riceDetails.get(\"name\");\n\t\t\tlong weight = (long) riceDetails.get(\"weight\");\n\t\t\tlong price = (long) riceDetails.get(\"price\");\n\n\t\t\tSystem.out.println(\"\\nName: \" + name);\n\t\t\tSystem.out.println(\"Weight: \" + weight);\n\t\t\tSystem.out.println(\"Price per KG is: \" + price);\n\n\t\t\t// Calculating price of different types of rice.\n\t\t\tlong ricePrice = weight * price;\n\t\t\tSystem.out.println(\"\\nTotal price of \" + riceDetails.get(\"name\") + \" is \" + ricePrice);\n\n\t\t}\n\n\t\t// Getting details of Pulse.\n\t\tSystem.out.println(\"\\nDetails of Pulse are: \");\n\t\tfor (int j = 0; j < pulseArray.size(); j++) {\n\t\t\tJSONObject pulseDetails = (JSONObject) pulseArray.get(j);\n\n\t\t\tString name = (String) pulseDetails.get(\"name\");\n\t\t\tlong weight = (long) pulseDetails.get(\"weight\");\n\t\t\tlong price = (long) pulseDetails.get(\"price\");\n\n\t\t\tSystem.out.println(\"\\nName: \" + name);\n\t\t\tSystem.out.println(\"Weight: \" + weight);\n\t\t\tSystem.out.println(\"Price per KG is: \" + price);\n\n\t\t\t// Calculating price of different types of Pulses.\n\t\t\tlong pulsePrice = weight * price;\n\t\t\tSystem.out.println(\"\\nTotal price of \" + pulseDetails.get(\"name\") + \" is \" + pulsePrice);\n\n\t\t}\n\t\t// Getting details of Wheat.\n\t\tSystem.out.println(\"\\nDetails of Wheat are: \");\n\t\tfor (int i = 0; i < wheatArray.size(); i++) {\n\t\t\tJSONObject wheatDetails = (JSONObject) wheatArray.get(i);\n\n\t\t\tString name = (String) wheatDetails.get(\"name\");\n\t\t\tlong weight = (long) wheatDetails.get(\"weight\");\n\t\t\tlong price = (long) wheatDetails.get(\"price\");\n\n\t\t\tSystem.out.println(\"\\nName: \" + name);\n\t\t\tSystem.out.println(\"Weight: \" + weight);\n\t\t\tSystem.out.println(\"Price per KG is: \" + price);\n\t\t\t// Calculating price of different types of Wheat.\n\t\t\tlong wheatPrice = weight * price;\n\t\t\tSystem.out.println(\"\\nTotal price of \" + wheatDetails.get(\"name\") + \" is \" + wheatPrice);\n\n\t\t}\n\n\t}", "public static void main(String[] args) throws IOException\n {\n File file = new File(\"D:\\\\work\\\\incoming\\\\F&D\\\\enrichment API\\\\context_test_record.jsonld\");\n\n Model m = ModelFactory.createDefaultModel();\n \n try {\n m.read(new FileInputStream(file), null, \"JSONLD\");\n }\n catch (Exception e) {\n e.printStackTrace(System.err);\n return;\n }\n\n// URL url = new URL(\"file:///C:/Users/Hugo/Google%20Drive/Europeana/EDM/jsonld/context.jsonld\");\n URL url = new URL(\"file:///D:/work/incoming/F&D/enrichment%20API/context.jsonld\");\n new JsonLdWriter(url).write(m, new OutputStreamWriter(System.out));\n }", "public void init() {\n\n mJokes = new ArrayList<>();\n\n StringBuilder sBuilder = new StringBuilder();\n\n try {\n\n InputStream in = getClass().getResourceAsStream(\"/jokes.json\");\n BufferedReader reader = new BufferedReader(new InputStreamReader(in));\n\n String mLine = reader.readLine();\n while (mLine != null) {\n //process line\n sBuilder.append(mLine);\n mLine = reader.readLine();\n }\n\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n\n String jsonString = sBuilder.toString();\n\n if( jsonString != null ){\n\n JsonParser parser = new JsonParser();\n JsonObject jsonObject = parser.parse(jsonString).getAsJsonObject();\n\n JsonArray jokesArray = jsonObject.getAsJsonArray(\"jokes\");\n\n for (JsonElement element : jokesArray) {\n String joke = element.getAsJsonObject().get(\"joke\").getAsString();\n mJokes.add(joke);\n }\n }\n\n }", "private JSONObject getJsonObject(Resource resource) {\n JSONParser parser = new JSONParser();\n JSONObject obj = null;\n try {\n obj = (JSONObject) parser.parse(new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8));\n } catch (Exception e) {\n e.printStackTrace();\n }\n return obj;\n }", "private Demo doReadDemo(final FileSystem fileSystem) throws IOException {\n // create a resource loader\n final URL[] demoRoot = new URL[] {\n fileSystem.getRoot().toURI().toURL() \n };\n final URLClassLoader resourceLoader = new URLClassLoader(demoRoot, null);\n return doReadDemo(resourceLoader);\n }", "public void loadToDoList() {\n try {\n toDoList = jsonReader.read();\n System.out.println(\"Loaded \" + toDoList.getName() + \" from \" + JSON_STORE);\n } catch (IOException e) {\n System.out.println(\"Unable to read from file: \" + JSON_STORE);\n }\n }", "public String loadJSONFile(int resourceIdentifier) {\n if (resourceIdentifier != 0) {\n InputStream input = getResources().openRawResource(resourceIdentifier);\n java.util.Scanner s = new java.util.Scanner(input).useDelimiter(\"\\\\A\");\n return s.hasNext() ? s.next() : null;\n } else {\n return null;\n }\n }", "public App read() throws IOException {\n String jsonData = readFile(source);\n JSONObject jsonObject = new JSONObject(jsonData);\n return parseApp(jsonObject);\n }", "private static JSONObject fileReader(String path) throws Exception{\r\n return (JSONObject) jsonParser.parse(new String(Files.readAllBytes(Paths.get(path))));\r\n }", "public Tamagotchi read() throws IOException {\n String jsonData = readFile(source);\n JSONObject jsonObject = new JSONObject(jsonData);\n return tamagotchiToJson(jsonObject);\n }", "public void retrieveData(){\n\t\tloaderImage.loadingStart();\n\t\tJsonClient js = new JsonClient();\n\t\tjs.retrieveData(JSON_URL, this);\n\t}", "public JSONObject getJSONFromFile() throws IOException\n\t{\n\t\tInputStream is = context.getResources().openRawResource(R.raw.schedule);\n\t\tWriter writer = new StringWriter();\n\t\tchar[] buffer = new char[1024];\n\t\ttry {\n\t\t Reader reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\n\t\t int n;\n\t\t while ((n = reader.read(buffer)) != -1) {\n\t\t writer.write(buffer, 0, n);\n\t\t }\n\t\t} finally {\n\t\t is.close();\n\t\t}\n\n\t\tString jsonString = writer.toString();\n\t\tJSONObject jObj=null;\n\t\t\n\t\t// try parse the string to a JSON object\n\t\ttry {\n\t\t\tjObj = new JSONObject(jsonString);\n\t\t} catch (JSONException e) {\n\t\t\tLog.e(\"JSON Parser\", \"Error parsing data \" + e.toString());\n\t\t}\n\t\t\t\n\t\treturn jObj;\n\t\t// return JSON String\n\n\t}", "@Test\n public void testFromJSON() {\n System.out.println(\"fromJSON\");\n String json = \"\";\n Resource expResult = null;\n Resource result = Resource.fromJSON(json);\n assertEquals(expResult, result);\n // TODO review the generated test code and remove the default call to fail.\n fail(\"The test case is a prototype.\");\n }", "public static List<DataItem> importFromJSON(Context context){\n FileReader reader = null;\n File file = new File(Environment.getExternalStorageDirectory(), FILE_NAME);\n\n try {\n //Instantiate FileReader with file\n reader = new FileReader(file);\n //Populate DataItems class and return result\n Gson gson = new Gson();\n DataItems dataItems = gson.fromJson(reader, DataItems.class);\n return dataItems.getDataItems();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }finally {\n if (reader != null) {\n try {\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n return null;\n }", "@Override\n \tpublic Representation getResource() throws Exception {\n \t\tJsonRepresentation result = null;\n \t\t// Rcupre l'identifiant unique de la ressource demande.\n \t\tString interId = (String) this.getRequestAttributes().get(\"interId\");\n \t\tString srcId = (String) this.getRequestAttributes().get(\"sourceId\");\n \t\tSystem.out.println(srcId);\n \t\t// Rcupration des sources de l'intervention\n \t\tList<Source> sources = Interventions.getInstance().getIntervention(interId).getSources();\n \n \t\tSource source = null;\n \t\t\n \t\t// Si on demande un source prcis\n \t\tif (srcId != null) {\n \t\t\t// Recherche du source demand\n \t\t\tfor (int i = 0; i < sources.size(); i++) {\n \t\t\t\tif (sources.get(i).getUniqueID().equals(srcId)) {\n \t\t\t\t\tsource = sources.get(i);\n \t\t\t\t}\n \t\t\t}\n \t\t\t// Si le source n'est pas trouv\n \t\t\tif (source == null) {\n \t\t\t\tresult = null;\n \t\t\t\tgetResponse().setStatus(Status.CLIENT_ERROR_NOT_ACCEPTABLE);\n \t\t\t} else {\n \t\t\t\tresult = new JsonRepresentation(source.toJSON());\n \t\t\t}\n \t\t// Si on veut tous les sources\n \t\t} else if (srcId == null) {\n \t\t\t\n \t\t\tJSONArray jsonAr = new JSONArray(); //Cration d'une liste Json\n \t\t\tfor(int i=0; i< sources.size();i++){\n\t\t\t\tjsonAr.put(sources.get(i).toJSON()); // On ajoute un jsonObject contenant le source dans le jsonArray\n \t\t\t}\n \t\t\t\n \t\t\tresult = new JsonRepresentation(jsonAr); // On cre la reprsentation de la liste\n \t\t}\n \n \t\t// Retourne la reprsentation, le code status indique au client si elle est valide\n \t\treturn result;\n \t}", "public String loadJSONFromAsset(Context context) {\n json = null;\n try {\n InputStream is = getApplicationContext().getAssets().open(\"techdrop.json\");\n int size = is.available();\n byte[] buffer = new byte[size];\n is.read(buffer);\n is.close();\n json = new String(buffer, \"UTF-8\");\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n }", "public static List<DataItem> importFromResource(Context context){\n InputStreamReader reader = null;\n InputStream inputStream = null;\n\n try {\n //Instantiate InputStream with static raw file the assign it to InputStreamReader\n inputStream = context.getResources().openRawResource(R.raw.menuitems);\n reader = new InputStreamReader(inputStream);\n //Populate DataItems class and return result\n Gson gson = new Gson();\n DataItems dataItems = gson.fromJson(reader, DataItems.class);\n return dataItems.getDataItems();\n }finally {\n //close both classes\n if (reader != null) {\n try {\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n if (inputStream != null) {\n try {\n inputStream.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n }\n }", "@Test\r\n public void testRevision() {\r\n InputStream inputstream = getClass().getClassLoader().getResourceAsStream(\"sample.json\");\r\n assert inputstream != null;\r\n Reader reader = new InputStreamReader(inputstream);\r\n JsonParser parser = new JsonParser();\r\n JsonElement rootElement = parser.parse(reader);\r\n\r\n RevisionParser revisionParser = new RevisionParser();\r\n List<Revision> revisionList = revisionParser.parse(rootElement);\r\n\r\n for (Revision r: revisionList) {\r\n System.out.println(r);\r\n }\r\n Assert.assertEquals(revisionList.get(0).toString(), \"Name: Monkbot\tTimeStamp: Fri Sep 13 11:10:41 EDT 2019\");\r\n }", "@Override\n public Object loadFromJson(Context context) {\n Gson gson = new Gson();\n String json = FileManager.getInstance().loadFromFile(getFileName(), context);\n if(json.equals(\"\")) {\n return null;\n }\n\n return gson.fromJson(json, MatchStorage.class);\n\n }", "public String generateJsonFileFromParsedTextFileInApp() {\n\t\treturn generateJsonFileFromParsedTextFile(TEXTSAMPLEFILE);\n\t}", "static JsonResource forClasspath( ClassLoader classLoader, String name ) {\n final ClassLoader loader = classLoader == null ? Thread.currentThread().getContextClassLoader() : classLoader;\n return new JsonResource() {\n @Override\n public <T> T readFrom( ReadMethod<T> consumer ) throws IOException {\n InputStream stream = loader.getResourceAsStream(name);\n if ( stream == null )\n throw new FileNotFoundException(\"Resource \" + name + \" not found\");\n try {\n return consumer.read( stream );\n } finally {\n stream.close();\n }\n }\n };\n }", "private static JsonObject readJSON(String path) {\n\n\t\tString fileContents = \"\";\n\t\tBufferedReader reader = null;\n\n\t\ttry {\n\t\t\treader = new BufferedReader(new FileReader(path));\n\t\t} catch (FileNotFoundException e) {\n\t\t\tfail(ErrorMessage.inputFileNotFoundError);\n\t\t}\n\n\t\tString line;\n\n\t\ttry {\n\t\t\twhile ((line = reader.readLine()) != null) {\n\t\t\t\tfileContents += line;\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\tfail(ErrorMessage.readFileError);\n\t\t}\n\n\t\ttry {\n\t\t\treader.close();\n\t\t} catch (IOException e) {\n\t\t\tfail(ErrorMessage.closeFileError);\n\t\t}\n\n\t\tJsonObject jsonLicense = Json.createReader(new StringReader(fileContents)).readObject();\n\n\t\treturn jsonLicense;\n\t}", "static JsonResource forFile( File file ) {\n return new JsonResource() {\n @Override\n public <T> T readFrom( ReadMethod<T> consumer ) throws IOException {\n try ( FileInputStream stream = new FileInputStream(file) ) {\n return consumer.read(stream);\n }\n }\n };\n }", "private JSONObject readJSONFile(Path path) throws ExtensionManagementException {\n\n if (Files.exists(path) && Files.isRegularFile(path)) {\n try {\n String jsonString = FileUtils.readFileToString(path.toFile(), UTF8);\n return new JSONObject(jsonString);\n } catch (JSONException e) {\n throw new ExtensionManagementException(\"Error while parsing JSON file: \" + path, e);\n } catch (IOException e) {\n throw new ExtensionManagementException(\"Error while reading JSON file: \" + path, e);\n }\n } else {\n throw new ExtensionManagementException(\"JSON file not found: \" + path);\n }\n }", "public static JsonObject getTestVectors(String filename) throws \n IOException {\n InputStream is = JsonUtil.class.getClassLoader().getResourceAsStream(filename);\n JsonReader reader = new JsonReader(new InputStreamReader(is, UTF_8));\n JsonElement elem = JsonParser.parseReader(reader);\n return elem.getAsJsonObject();\n }", "private static String readJsonFile (String fileName) {\n if (!fileName.endsWith(\".json\")){\n throw new IllegalArgumentException(\"Invalid file name\");\n }\n String jsonStr = \"\";\n try{\n isFileExistOrCreatIt(fileName);\n File jsonFile = new File(\"src//main//resources\"+\"//\"+fileName);\n Reader reader = new InputStreamReader(new FileInputStream(jsonFile),\"utf-8\");\n int ch = 0;\n StringBuffer sb = new StringBuffer();\n while((ch = reader.read())!=-1){\n sb.append((char) ch);\n }\n reader.close();\n jsonStr = sb.toString();\n return jsonStr;\n\n } catch (IOException e) {\n e.printStackTrace();\n return null;\n }\n }", "public static void main(String[] args) throws FileNotFoundException {\r\n\t\tJsonParser parser = Json.createParser(new FileReader(JSON_FILE_NAME));\r\n\t\t\r\n\t\t// parse the file\r\n\t\twhile (parser.hasNext()) {\r\n\t\t\tJsonParser.Event event = parser.next();\r\n\t\t\tif (event.equals(JsonParser.Event.KEY_NAME)) {\r\n\t\t\t\tString key = parser.getString();\r\n\t\t\t\tparser.next();\r\n\t\t\t\tString value = parser.getString();\r\n\t\t\t\tSystem.out.printf(\">> %s: %s\\n\", key, value);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}", "public static void main(String[] args) {\n Client client = Client.create();\n WebResource resource = client.resource(\"http://localhost:8080/rest/resource/strings\");\n String strings = resource.get(String.class);\n System.out.println(strings);\n }", "public static JSONObject loadJSONObjectFromAsset(Context context) {\n String jsonStr = null;\n JSONObject jsonObject = null;\n try {\n //here we need context to access ASSETS --> ANDROID TUTORIAL / codeBlock - Patterns / Application.java\n InputStream is = context.getAssets().open(\"listHomeItem.json\");\n int size = is.available();\n byte[] buffer = new byte[size];\n is.read(buffer);\n is.close();\n jsonStr = new String(buffer, \"UTF-8\");\n\n jsonObject = new JSONObject(jsonStr);\n\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n\n } catch (JSONException e) {\n e.printStackTrace();\n return null;\n }\n return jsonObject;\n }", "String readSampleJsonDoc(String file) {\n\t\tStringBuffer sb = new StringBuffer();\n\t\tBufferedReader br = null;\n\n\t\ttry {\n\t\t\tbr = new BufferedReader(new FileReader(new File(file)));\n\t\t\tString line;\n\t\t\twhile ((line = br.readLine()) != null) {\n\t\t\t\tsb.append(line + NEWLINE);\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (br != null) {\n\t\t\t\t\tbr.close();\n\t\t\t\t}\n\t\t\t} catch (IOException e) {\n\t\t\t}\n\t\t}\n\t\treturn sb.toString();\n\t}", "public void load(){\n // Recover docIDs\n try(Reader reader = new FileReader(\"postings/docIDs.json\")){\n this.docIDs = (new Gson()).fromJson(reader,\n new TypeToken<Map<String, String>>(){}.getType());\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n try(Reader reader = new FileReader(\"postings/docLengths.json\")){\n this.docLengths = (new Gson()).fromJson(reader,\n new TypeToken<Map<String, Integer>>(){}.getType());\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n try(Reader reader = new FileReader(\"postings/titleToNumber.json\")){\n this.titleToNumber = (new Gson()).fromJson(reader,\n new TypeToken<Map<String, Integer>>(){}.getType());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "static ArrayList<Integer> getAllQuestionIDs(Context context){\n JsonReader reader;\n ArrayList<Integer> questionIDs = new ArrayList<>();\n try {\n reader = readJSONFromAsset(context);\n reader.beginArray();\n while (reader.hasNext()) {\n questionIDs.add(readQuestion(reader).getQuestionID());\n }\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return questionIDs;\n }", "public static void main(String[] args) throws IOException {\n String path = \"D:\\\\data\\\\code\\\\github-workspace\\\\tiny\\\\app\\\\web\\\\home\\\\src\\\\test\\\\resources\\\\table-result-3.json\";\n String jsonStr = FileUtils.readFileToString(new File(path));\n// Object obj = parseLayoutResult2(jsonStr);\n Object obj = parseContentResult2(jsonStr);\n System.out.println(obj);\n\n }", "private MoodsCreator(Resources resources){\n\n String result;\n try {\n InputStream inputStream = resources.openRawResource(R.raw.moods);\n\n StringBuffer buffer = new StringBuffer();\n BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));\n\n String line;\n while ((line = reader.readLine()) != null) {\n\n buffer.append(line + \"\\n\");\n }\n result = buffer.toString();\n Log.d(\"MOODS\", result);\n\n JSONObject moodsJson = new JSONObject(result);\n JSONArray moodsJsonArray = new JSONArray(moodsJson.get(\"moods\").toString());\n\n for(int i =0;i<moodsJsonArray.length();++i){\n JSONObject moodfromJson = moodsJsonArray.getJSONObject(i);\n Mood mood = new Mood(moodfromJson.get(\"name\").toString(),moodfromJson.getInt(\"red\"),moodfromJson.getInt(\"green\"), moodfromJson.getInt(\"blue\"), moodfromJson.getInt(\"alpha\"));\n\n Log.d(\"MOOD\",mood.name + \" \"+mood.alpha + \" \"+ mood.red);\n moods.put(moodfromJson.get(\"name\").toString(),mood);\n }\n\n Log.d(\"moodsMap\",moods.toString());\n }\n catch(Exception e){\n\n }\n\n }", "public static JsonNode getLibraryMetadata(Object resource, List<String> desc) throws Exception {\n\t\tfinal ObjectMapper mapper = BeanTemplateUtils.configureMapper(Optional.empty());\t\t\n\t\tfinal JsonNode v1_bean = \n\t\t\t\t((ObjectNode) mapper.readTree(resource.getClass().getResourceAsStream(\"test_v1_sync_sample_share.json\")))\n\t\t\t\t.put(\"description\", desc.stream().collect(Collectors.joining(\"\\n\")));\n\t\t\t\t\n\t\treturn v1_bean;\n\t}", "String getJSON();", "private void loadWorld() {\n try {\n world = jsonReader.read();\n System.out.println(\"Loaded world from \" + JSON_STORE);\n } catch (IOException | InvalidDataException e) {\n System.out.println(\"Unable to read from file: \" + JSON_STORE);\n }\n }", "private JSONObject loadTemplate(Path extensionResourcePath) throws ExtensionManagementException {\n\n Path templatePath = extensionResourcePath.resolve(TEMPLATE_FILE_NAME);\n if (Files.exists(templatePath) && Files.isRegularFile(templatePath)) {\n return readJSONFile(templatePath);\n }\n return null;\n }", "private String loadJSONFromAsset() {\n String json = null;\n try {\n //AssetManager assetManager = getAssets();\n InputStream is = getAssets().open(\"sa.json\");\n //InputStream is = getResources().openRawResource(\"sa.json\");\n int size = is.available();\n\n byte[] buffer = new byte[size];\n\n is.read(buffer);\n\n is.close();\n\n json = new String(buffer, \"UTF-8\");\n Log.i(\"Json\",json);\n\n\n } catch (Exception ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n\n }", "protected void loadMockData() {\n\n int ctr;\n InputStream inputStream = getResources().openRawResource(R.raw.song_list);\n ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n\n try {\n ctr = inputStream.read();\n while (ctr != -1) {\n byteArrayOutputStream.write(ctr);\n ctr = inputStream.read();\n }\n inputStream.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n // Parse the data.\n try {\n JSONObject jObject = new JSONObject(byteArrayOutputStream.toString());\n\n String status_code = jObject.getString(\"statusCode\");\n\n if (status_code.equalsIgnoreCase(\"200\")) {\n JSONArray jArray = jObject.getJSONArray(\"data\");\n\n audioList = new ArrayList<>();\n\n for (int i = 0; i < jArray.length(); i++) {\n JSONObject song = jArray.getJSONObject(i);\n\n String genre = song.getString(\"genre\");\n String album = song.getString(\"album\");\n String author = song.getString(\"author\");\n String title = song.getString(\"title\");\n String url = song.getString(\"url\");\n String imgUrl = song.getString(\"img\");\n\n Audio audio = new Audio(genre, album, author, title, url, imgUrl);\n\n // Save to audioList.\n audioList.add(audio);\n }\n }\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }", "private void readFromJSON(String filename) {\n JSONParser parser = new JSONParser();\n\n try\n {\n Object obj = parser.parse(new FileReader(filename));\n JSONObject jsonObject = (JSONObject) obj;\n Menu drinks = getMenu(jsonObject, \"Drink\");\n Menu types = getMenu(jsonObject, \"Type\");\n Menu toppings = getMenu(jsonObject, \"Toppings\");\n Menu sizes = getMenu(jsonObject, \"Size\");\n menuMap.put(\"Drink\", drinks);\n menuMap.put(\"Size\", sizes);\n menuMap.put(\"Toppings\", toppings);\n menuMap.put(\"Type\", types);\n\n } catch (FileNotFoundException e) {\n System.out.println(\"Not found menu.json, exit now.\");\n System.exit(1);\n } catch (IOException e) {\n e.printStackTrace();\n } catch (ParseException e) {\n e.printStackTrace();\n }\n\n }", "@GET\n\t@Path(\"/helloJSONList\")\n\t/**\n\t * Here is an example of a simple REST get request that returns a String.\n\t * We also illustrate here how we can convert Java objects to JSON strings.\n\t * @return - List of words as JSON\n\t * @throws IOException\n\t */\n\tpublic String helloJSONList() throws IOException {\n\n\t\tList<String> listOfWords = new ArrayList<String>();\n\t\tlistOfWords.add(\"Hello\");\n\t\tlistOfWords.add(\"World!\");\n\n\t\t// We can turn arbatory Java objects directly into JSON strings using\n\t\t// Jackson seralization, assuming that the Java objects are not too complex.\n\t\tString listAsJSONString = oWriter.writeValueAsString(listOfWords);\n\n\t\treturn listAsJSONString;\n\t}", "static JsonResource forString( String contents ) {\n return new JsonResource() {\n @Override\n public <T> T readFrom( ReadMethod<T> consumer ) throws IOException {\n try ( ByteArrayInputStream stream = new ByteArrayInputStream(contents.getBytes(Json.getDefaultConfig().getCharset())) ) {\n return consumer.read(stream);\n }\n }\n };\n }", "private void downloadJSON() {\n new downloadJsonAsync().execute(Urls.GET_TAGS, Urls.GET_REST);\n }", "public JSONObject SourceResource() {\n JSONObject source = jsonParent.getJSONObject(\"sourceResource\");\n return source;\n }", "@Test\r\n public void testParseConnection() throws MalformedURLException {\r\n JsonArray array = null;\r\n JsonParser parser = new JsonParser();\r\n URL url = new URL(\"https://en.wikipedia.org/w/api.php?action=query&format=json&prop=revisions&titles=\\\" + \\\"Ball State\\\" + \\\"&rvprop=timestamp|user&rvlimit=24&redirects\");\r\n InputStream inputstream = getClass().getClassLoader().getResourceAsStream(\"sample.json\");\r\n assert inputstream != null;\r\n Reader reader = new InputStreamReader(inputstream);\r\n JsonElement rootElement = parser.parse(reader);\r\n JsonObject rootObject = rootElement.getAsJsonObject();\r\n JsonObject pages = rootObject.getAsJsonObject(\"query\").getAsJsonObject(\"pages\");\r\n for (Map.Entry<String, JsonElement> entry : pages.entrySet()) {\r\n JsonObject entryObject = entry.getValue().getAsJsonObject();\r\n array = entryObject.getAsJsonArray(\"revisions\");\r\n }\r\n System.out.println(array);\r\n System.out.println(url);\r\n }", "@VisibleForTesting\n interface JsonReader {\n /**\n * Returns the contents of the JSON file that is pointed to by the given {@code resId} as\n * a string.\n *\n * @param context The current Context.\n * @param resId The resource id of the JSON file.\n * @return A string representation of the file or {@code null} if an error occurred.\n */\n @Nullable\n String jsonFileToString(Context context, @RawRes int resId);\n }", "@Override\n public Map<String, Object> getResource() {\n List<Customer> customerList = customerRepository.findAllByName(\"toto\");\n Map<String,Object> model = new HashMap<String,Object>();\n model.put(\"id\", UUID.randomUUID().toString());\n model.put(\"content\", \"Hello World\");\n return model;\n }", "@Test\r\n public void testRevisionParser() {\r\n JsonParser parser = new JsonParser();\r\n InputStream inputstream = getClass().getClassLoader().getResourceAsStream(\"sample.json\");\r\n assert inputstream != null;\r\n Reader reader = new InputStreamReader(inputstream);\r\n JsonElement rootElement = parser.parse(reader);\r\n JsonObject rootObject = rootElement.getAsJsonObject();\r\n JsonObject pages = rootObject.getAsJsonObject(\"query\").getAsJsonObject(\"pages\");\r\n JsonArray array = null;\r\n for (Map.Entry<String, JsonElement> entry : pages.entrySet()) {\r\n JsonObject entryObject = entry.getValue().getAsJsonObject();\r\n array = entryObject.getAsJsonArray(\"revisions\");\r\n Assert.assertNotNull(array);\r\n }\r\n System.out.println(array);\r\n\r\n }", "public static List<String> mainReadFile(String[] args) throws IOException, URISyntaxException {\n List<String> exmp = new ArrayList<>();\n File initialFile = resolveFileFromResources(args[0]);\n // System.out.println(initialFile);\n ObjectMapper obM = getObjectMapper();\n Trades[] exmpTrade = obM.readValue(initialFile, Trades[].class);\n for (Trades trade : exmpTrade) {\n exmp.add(trade.getSymbol());\n }\n printJsonObject(exmp);\n //return Collections.emptyList();\n return exmp;\n }", "private void loadJSON() throws FileNotFoundException\n\t{\n\n\t\tGsonBuilder builder= new GsonBuilder();\n\t\tGson gson = builder.create();\n\t\t\t\t\n\t\t//get a list of folders in the data directory\n\t\t\n\t\tFile[] directories = new File(\"data\").listFiles();\n\n\t\t//Loop through folders in data directory\n\t\tfor(File folder : directories)\n\t\t\t{\n\t\t\t\t//get a list of files inside the folder\n\t\t\t\tFile[] jsonItems = new File(folder.toString()).listFiles();\n\t\t\t\t\n\t\t\t\t//Loop through files inside the folder \n\t\t\t\tfor(File file : jsonItems)\n\t\t\t\t{\n\t\t\t\t\t//Store in directory map... substring to remove the \"data/\" portion... placed by filename to foldername\n\t\t\t\t\tString dir = file.toString().substring(5);\n\t\t\t\t\t\n\t\t\t\t\t//Generate player data from gson\n\t\t\t\t\tJsonReader reader = new JsonReader(new FileReader(file));\n\t\t\t\t\tPlayer player = gson.fromJson(reader, Player.class);\n\t\t\t\t\t\n\t\t\t\t\t//Store it in the map tied to it's directory\n\t\t\t\t\tplayerData.put(dir, player);\n\t\t\t\t}\n\t\t\t}\n\t\t}", "private JsonObject loadJSONFile(String jsonFilePath) throws IOException {\r\n\tInputStream is = new FileInputStream(jsonFilePath);\r\n\tJsonReader jsonReader = Json.createReader(is);\r\n\tJsonObject json = jsonReader.readObject();\r\n\tjsonReader.close();\r\n\tis.close();\r\n\treturn json;\r\n }", "private JSONObject loadMetadata(Path extensionResourcePath) throws ExtensionManagementException {\n\n Path metadataPath = extensionResourcePath.resolve(METADATA_FILE_NAME);\n if (Files.exists(metadataPath) && Files.isRegularFile(metadataPath)) {\n return readJSONFile(metadataPath);\n }\n return null;\n }", "public void loadFromSource(Object aSrc)\n{\n WebURL url = WebURL.getURL(aSrc);\n String jsonText = url.getText();\n loadFromString(jsonText);\n}", "public JSONArray readFromJSON(){\n\n JSONArray jsonArray=null;\n\n try {\n InputStream inputStream =context.getResources().getAssets().open(FILE_NAME);\n int size = inputStream.available();\n byte[] data = new byte[size];\n inputStream.read(data);\n inputStream.close();\n String json = new String(data, \"UTF-8\");\n jsonArray = new JSONArray(json);\n } catch (IOException e) {\n e.printStackTrace();\n } catch (JSONException e) {\n e.printStackTrace();\n }\n return jsonArray;\n }", "private TabulatorItems[] getJsonArrayOfItems(Resource resource) {\n ObjectMapper mapper = new ObjectMapper();\n TabulatorItems[] items = null;\n try {\n items = mapper.readValue(new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8), TabulatorItems[].class);\n } catch (IOException ex) {\n Logger.getLogger(CollectionApiUIImpl.class.getName()).log(Level.SEVERE, null, ex);\n }\n return items;\n }", "public void load() throws IOException {\r\n\t\tFile file = new File(projectDir, TERN_PROJECT);\r\n\t\tif (file.exists()) {\r\n\t\t\tJSONParser parser = new JSONParser();\r\n\t\t\ttry {\r\n\t\t\t\tJSONObject result = (JSONObject) parser.parse(new FileReader(\r\n\t\t\t\t\t\tfile));\r\n\t\t\t\tsuper.putAll(result);\r\n\t\t\t} catch (ParseException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private String loadJSONFromAsset(){\n String json = null;\n AssetManager assetManager = getAssets();\n try{\n InputStream IS = assetManager.open(\"datosFases.json\");\n int size = IS.available();\n byte[] buffer = new byte[size];\n IS.read(buffer);\n IS.close();\n json = new String(buffer,\"UTF-8\");\n\n } catch (IOException ex){\n ex.printStackTrace();\n return null;\n }\n\n return json;\n }", "public void testImportJSONFromRequestParam() throws IOException, JsonException {\n final String testPath = TEST_BASE_PATH;\n Map<String, String> props = new HashMap<String, String>();\n String testNode = testClient.createNode(HTTP_BASE_URL + testPath, props);\n urlsToDelete.add(testNode);\n\n props.clear();\n props.put(SlingPostConstants.RP_OPERATION,\n \t\tSlingPostConstants.OPERATION_IMPORT);\n\n String testNodeName = \"testNode_\" + String.valueOf(random.nextInt());\n props.put(SlingPostConstants.RP_NODE_NAME_HINT, testNodeName);\n String jsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/testimport.json\"));\n props.put(SlingPostConstants.RP_CONTENT, jsonContent);\n props.put(SlingPostConstants.RP_CONTENT_TYPE, \"json\");\n props.put(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + \"/*\");\n String importedNodeUrl = testClient.createNode(HTTP_BASE_URL + testPath, props);\n\n // assert content at new location\n String content = getContent(importedNodeUrl + \".3.json\", CONTENT_TYPE_JSON);\n\n\t\tJsonObject jsonObj = JsonUtil.parseObject(content);\n\t\tassertNotNull(jsonObj);\n\n\t\t//assert the imported content is there.\n String expectedJsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/importresults.json\"));\n\t\tassertExpectedJSON(JsonUtil.parseObject(expectedJsonContent), jsonObj);\n }", "private JSONObject getAssetJson(String filename) {\n return new JSONObject(\n resourceHandler.getResourceFileAsString(ResourceHandler.VALORANT_BASE_PATH + \"Data/\" + filename)\n );\n }", "public static void main(String[] args)\n\t\t\tthrows IOException, MalformedURLException, FileNotFoundException, IOException {\n\t\tString string = \"\";\n\n\t\tInputStream input = new FileInputStream(\"C:\\\\Users\\\\siva_\\\\workspace\\\\RESTfulExample1\\\\json.txt\");\n\n\t\tInputStreamReader reader = new InputStreamReader(input);\n\t\tBufferedReader bReader = new BufferedReader(reader);\n\t\tString line = null;\n\n\t\twhile ((line = bReader.readLine()) != null) {\n\t\t\tstring += line + \"\\n\";\n\t\t}\n\t\tbReader.close();\n\t\tJSONObject jsonObj = new JSONObject(string);\n\t\tSystem.out.println(\"The JSON File contents are:\");\n\t\tSystem.out.println(jsonObj.toString());\n\n\t\tURL url = new URL(\"http://localhost:8080/RESTfulExample1/api/JSONProcessorService\");\n\t\tSystem.out.println(\"connection opened at \" + url.getHost());\n\t\tURLConnection connection = url.openConnection();\n\n\t\tconnection.setDoOutput(true);\n\t\tconnection.setRequestProperty(\"Content-type\", \"application/json\");\n\t\tconnection.setConnectTimeout(5000);\n\t\tconnection.setReadTimeout(5000);\n\n\t\tOutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream());\n\t\tout.write(jsonObj.toString());\n\t\tout.close();\n\t\t\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n\n\t\tif (br.readLine() == null) {\n\t\t\tSystem.out.println(\"Read nothing terminating.....\");\n\t\t\treturn;\n\t\t}\n\n\t\tSystem.out.println(\"Webservice invoked successfully\");\n\n\t}", "public static void readJSON() throws IOException {\n\t\tBufferedReader br = new BufferedReader(new FileReader(f));\n\t\tString line;\n\t\tif((line = br.readLine()) != null) {\n\t\t\tString [] flightStates = parseJSON(line);\n\t\t\tfor(String state : flightStates) {\n\t\t\t\tFlightState fs = new FlightState(state);\n\t\t\t\tsendToKafka(fs);\n\t\t\t}\n\t\t}\n\t\tbr.close();\n\t}", "@GET\n @Path(\"location/Arovince\")\n @Produces(\"application/json\")\n public String getJson() throws IOException {\n FileWriter file = new FileWriter(\"/home/component/NetBeansProjects/ArovinceAndSchool/web/api/Arovince.json\");\n JSONObject jsonArray = null;\n\n try {\n URL url = new URL(\"https://opend.data.go.th/get-ckan/datastore_search?resource_id=df922923-e009-4dee-92fc-d963a86ce4b8\"); \n HttpURLConnection httpURLConnection = (HttpURLConnection)url.openConnection();\n httpURLConnection.setRequestMethod(\"GET\");\n httpURLConnection.setRequestProperty(\"api-key\", \"XOe9aVTolOhCbyTU103IqAKTNNNPX8b5\");\n String line = \"\";\n InputStreamReader inputStreamReader = new InputStreamReader(httpURLConnection.getInputStream());\n BufferedReader bufferedReader = new BufferedReader(inputStreamReader);\n StringBuilder response = new StringBuilder();\n\n try {\n while((line = bufferedReader.readLine()) != null) {\n file.write(line);\n response.append(line);\n }\n } catch (IOException var10) {\n }\n\n file.close();\n bufferedReader.close();\n jsonArray = new JSONObject(response.toString());\n return jsonArray.toString(4);\n } catch (Exception var11) {\n return \"\" + var11;\n }\n }", "@Test\n public void toAndFromJsonTestWithFollowUpQuestions() throws IOException {\n Question bonusQuestion = new Question(\"BonusQ1\", \"This is a followupCounts to a followupCounts question!\", \"Plane\", \"Nice!\", Arrays.asList(\"Nice!\", \"Sweet!\", \"Cool!\"), \"../static/images/equine02.jpg\");\n Question attach1 = new Question(\"AttachQ1\", \"Which attachment is this?\", \"Attachment\",\n \"Type1\", Arrays.asList(\"Type1\", \"Type2\", \"Type3\"), \"../static/images/equine02.jpg\");\n Question attach2 = new Question(\"AttachQ2\", \"Which attachment is this?\", \"Attachment\",\n \"Type3\", Arrays.asList(\"Type1\", \"Type2\", \"Type3\"), \"../static/images/equine02.jpg\");\n Question attach3 = new Question(\"AttachQ1\", \"Which attachment is this?\", \"Attachment\",\n \"Type2\", Arrays.asList(\"Type1\", \"Type2\", \"Type3\"), \"../static/images/equine02.jpg\", Arrays.asList(bonusQuestion));\n List<Question> attachmentQuestions = Arrays.asList(attach1, attach2, attach3);\n Question myQ = new Question(\"StructureQ1\", \"What kind of structure is this?\", EquineQuestionTypes.structure.toString(), \"Structure1\", Arrays.asList(\"Structure1\", \"Structure2\", \"Structure3\"), \"../static/images/equine02.jpg\", attachmentQuestions);\n Question myQ2 = new Question(\"PlaneQ1\", \"What plane is this?\", EquineQuestionTypes.plane.toString(), \"Transverse\", Arrays.asList(\"Transverse\", \"Longitudinal\"), \"../static/images/equine02.jpg\");\n List<Question> hardcodedQuestions = Arrays.asList(myQ, myQ2);\n\n //Write to file\n JsonUtil.toJsonFile(\"src/test/resources/autoGenerated/questionsWithFollowup.json\", hardcodedQuestions);\n\n //Load back in\n List<Question> questionsFromFile = JsonUtil.listFromJsonFile(\"src/test/resources/autoGenerated/questionsWithFollowup.json\", Question.class);\n\n assertEquals(2, questionsFromFile.size());\n Question questionWithFollowups = questionsFromFile.get(0);\n assertEquals(3, questionWithFollowups.getFollowupQuestions().size());\n Question questionWithoutFollowups = questionsFromFile.get(1);\n assertEquals(0, questionWithoutFollowups.getFollowupQuestions().size());\n\n }", "public String loadJSONFromAsset() {\n String json = null;\n try {\n InputStream is = getAssets().open(\"election-county-2012.json\");\n int size = is.available();\n byte[] buffer = new byte[size];\n is.read(buffer);\n is.close();\n json = new String(buffer, \"UTF-8\");\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n }", "private void loadHelpContent() {\n\t\tGson gson = new GsonBuilder().setPrettyPrinting().create();\n\t\tBufferedReader br;\n\t\ttry {\n\t\t\tbr = new BufferedReader(\n\t\t\t\t\tnew UnicodeReader(new FileInputStream(new File(getHelpContentFilePath())), \"UTF-8\"));\n\t\t\tsx3ConfigurationHelp = gson.fromJson(br, SX3ConfiguartionHelp.class);\n\t\t\tSX3Manager.getInstance().setSx3ConfiguartionHelp(sx3ConfigurationHelp);\n\t\t} catch (FileNotFoundException e) {\n\t\t\tsx3ConfigurationHelp = new SX3ConfiguartionHelp();\n\t\t\tSX3Manager.getInstance().addLog(\"<span style='color:red;'>\" + e.getMessage() + \".</span><br>\");\n\n\t\t}\n\t}", "String getJson();", "String getJson();", "String getJson();", "private ArrayList<Book> loadBooks(InputStream is) throws IOException{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(is));\r\n\t\tStringBuilder jsonFileContent = new StringBuilder();\r\n\t\t//read line by line from file\r\n\t\tString nextLine = null;\r\n\t\twhile ((nextLine = br.readLine()) != null){\r\n\t\t\tjsonFileContent.append(nextLine);\r\n\t\t}\r\n\r\n\t\tGson gson = new Gson();\r\n\t\t//this is a require type definition by the Gson utility so Gson will \r\n\t\t//understand what kind of object representation should the json file match\r\n\t\tType type = new TypeToken<ArrayList<Book>>(){}.getType();\r\n\t\tArrayList<Book> books = gson.fromJson(jsonFileContent.toString(), type);\r\n\t\t//close\r\n\t\tbr.close();\t\r\n\t\treturn books;\r\n\t}", "public String readJsonFile(String fileName)\n {\n FileInputStream fileInputStream = null;\n String text;\n StringBuilder stringBuilder = new StringBuilder();\n\n try\n {\n fileInputStream = mainContext.openFileInput(fileName);\n InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream);\n BufferedReader bufferedReader = new BufferedReader(inputStreamReader);\n\n while((text = bufferedReader.readLine()) != null)\n {\n stringBuilder.append(text).append(\"\\n\");\n }\n }\n catch (IOException e)\n {\n System.out.println(e.getMessage());\n }\n\n return stringBuilder.toString();\n }", "@Test\n\tpublic void testWithJsonPath() {\n\t\t\t\t\n\t\tResponse response = given().accept(ContentType.JSON)\n\t\t.and().pathParam(\"id\", 110)\n\t\t.when().get(ConfigurationReader.getProperty(\"hrapp.baseurl\")+\"/employees/{id}\");\n\t\t\n\t\tJsonPath json = response.jsonPath(); //get json body and assign to jsonPath object\n\t\t//we are assiging whole response to json object so we can easyly reach and use it \n\t\t\n\t\tSystem.out.println(json.getInt(\"employee_id\"));\n\t\tSystem.out.println(json.getString(\"first_name\"));\n\t\tSystem.out.println(json.getString(\"job_id\"));\n\t\tSystem.out.println(json.getInt(\"salary\"));\n\t\tSystem.out.println(json.getString(\"links[0].href\")); //get specific element from array \n\t \n\t\t//assign all hrefs into a list of strings \n\t\tList<String> hrefs = json.getList(\"links.href\");\n\t\t\n\t\t//everything in arraylist \n\t System.out.println(hrefs);\n\t \n\t //one by one \n\t\tfor(String href:hrefs) {\n\t\t\tSystem.out.println(href);\n\t\t}\n\t}", "public void testImportJSONFromFile() throws IOException, JsonException {\n final String testPath = TEST_BASE_PATH;\n Map<String, String> props = new HashMap<String, String>();\n String testNode = testClient.createNode(HTTP_BASE_URL + testPath, props);\n urlsToDelete.add(testNode);\n\n props.clear();\n props.put(SlingPostConstants.RP_OPERATION,\n \t\tSlingPostConstants.OPERATION_IMPORT);\n\n String testNodeName = \"testNode_\" + String.valueOf(random.nextInt());\n props.put(SlingPostConstants.RP_NODE_NAME_HINT, testNodeName);\n testFile = getTestFile(getClass().getResourceAsStream(\"/integration-test/servlets/post/testimport.json\"));\n props.put(SlingPostConstants.RP_CONTENT_TYPE, \"json\");\n props.put(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + \"/*\");\n String importedNodeUrl = testClient.createNode(HTTP_BASE_URL + testPath, new NameValuePairList(props), null, true,\n \t\ttestFile, SlingPostConstants.RP_CONTENT_FILE, null);\n\n // assert content at new location\n String content = getContent(importedNodeUrl + \".3.json\", CONTENT_TYPE_JSON);\n\n\t\tJsonObject jsonObj = JsonUtil.parseObject(content);\n\t\tassertNotNull(jsonObj);\n\n\t\t//assert the imported content is there.\n String expectedJsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/importresults.json\"));\n\t\tassertExpectedJSON(JsonUtil.parseObject(expectedJsonContent), jsonObj);\n }", "private Demo doReadDemo(final ClassLoader demoResourceLoader) throws IOException {\n final Demo demo = new Demo();\n\n final URL demoConfiguration = demoResourceLoader.getResource(CONFIGURATION_NAME);\n\n if (null == demoConfiguration) {\n logger.logWarning(\"No {0} found in demo root. Please configure the demo properly.\",\n CONFIGURATION_NAME);\n } else {\n // load demo configuration\n final Properties configuration = new Properties();\n final InputStream demoConfigurationStream = demoConfiguration.openStream();\n try {\n configuration.load(demoConfiguration.openStream());\n } finally {\n demoConfigurationStream.close();\n }\n demo.setConfiguration(configuration);\n \n final String environment = demo.getProperty(\"environment\");\n if(null == environment) {\n logger.logWarning(\"Demo environment has not been configured.\");\n } else {\n final String scenarios = demo.getProperty(\"scenarios\");\n if (null == scenarios) {\n logger.logWarning(\"Demo scenarios have not been configured.\");\n }\n final StringTokenizer tokenizer = new StringTokenizer(scenarios, \",\");\n while (tokenizer.hasMoreTokens()) {\n configureScenario(demo, tokenizer.nextToken(), demoResourceLoader);\n }\n }\n }\n return demo;\n }", "public void testImportJSONFromRequestParamWithoutOptionalName() throws IOException, JsonException {\n final String testPath = TEST_BASE_PATH;\n Map<String, String> props = new HashMap<String, String>();\n String testNode = testClient.createNode(HTTP_BASE_URL + testPath, props);\n urlsToDelete.add(testNode);\n\n props.clear();\n props.put(SlingPostConstants.RP_OPERATION,\n \t\tSlingPostConstants.OPERATION_IMPORT);\n\n String jsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/testimport2.json\"));\n props.put(SlingPostConstants.RP_CONTENT, jsonContent);\n props.put(SlingPostConstants.RP_CONTENT_TYPE, \"json\");\n props.put(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + \"/*\");\n String importedNodeUrl = testClient.createNode(HTTP_BASE_URL + testPath, props);\n\n //make sure the name is what was inside the file.\n assertTrue(importedNodeUrl.endsWith(\"/nodeName\"));\n\n // assert content at new location\n String content = getContent(importedNodeUrl + \".3.json\", CONTENT_TYPE_JSON);\n\n\t\tJsonObject jsonObj = JsonUtil.parseObject(content);\n\t\tassertNotNull(jsonObj);\n\n\t\t//assert the imported content is there.\n String expectedJsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/importresults.json\"));\n\t\tassertExpectedJSON(JsonUtil.parseObject(expectedJsonContent), jsonObj);\n }", "private SpecificationByExample loadSpecificationFromResource(Resource resource) throws IOException {\r\n Specification specification= specificationReader.readSpecification(resource);\r\n\r\n SpecificationByExample specificationByExample;\r\n if (specification instanceof SpecificationByExample) {\r\n specificationByExample = (SpecificationByExample) specification;\r\n } else {\r\n specificationByExample = new SpecificationToSpecificationByExampleAdaptor(specification);\r\n }\r\n specificationByExample.setFixtureClass(fixture);\r\n return specificationByExample;\r\n }", "public String loadJSONFromAsset() {\n String json = null;\n try {\n json = new String(buffer, \"UTF-8\");\n } catch (UnsupportedEncodingException e1) {\n e1.printStackTrace();\n }\n\n return json;\n }", "@Test\n\tpublic void testJsonPath() {\n\tString responseAsString=\n\t\twhen().\n\t\t\tget(\"http://jsonplaceholder.typicode.com/photos\").\n\t\tthen().\n\t\textract().asString();\n\t\t\n\tList<Integer> albumIds = from(responseAsString).get(\"id\");\n\tSystem.out.println(albumIds.size());\n\t}", "private static void readWineListFromFile() {\n\t\tJSONParser parser = new JSONParser();\n\n\t\ttry (Reader reader = new FileReader(\"wines.json\")) {\n\n\t\t\tJSONArray wineListJSON = (JSONArray) parser.parse(reader);\n\n\t\t\tfor (int i = 0 ; i < wineListJSON.size(); i++) {\n\t\t\t\tJSONObject wine = (JSONObject) wineListJSON.get(i);\n\t\t\t\tString name = (String) wine.get(\"name\");\n\t\t\t\tint year = Integer.valueOf(wine.get(\"year\").toString());\n\t\t\t\tString description = (String) wine.get(\"description\");\n\t\t\t\tString vine = (String) wine.get(\"vine\");\n\t\t\t\tint quantity = Integer.valueOf(wine.get(\"quantity\").toString());\n\t\t\t\tdouble price = (double) wine.get(\"price\");\n\n\t\t\t\t// Add the JSON object to the wine list\n\t\t\t\tMain.wineList.add(new Wine(name, year, description, vine, quantity, price));\n\n\t\t\t}\n\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (ParseException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "List<Resource> resources();", "public JSONObject read(InputStream uploadedInputStream);", "public String loadJSONFromAsset() {\n String json;\n try {\n InputStream is = getAssets().open(\"track_v0649.json\");\n int size = is.available();\n byte[] buffer = new byte[size];\n\n is.read(buffer);\n is.close();\n json = new String(buffer, \"UTF-8\");\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n }", "public void testImportJSONFromFileWithoutOptionalName() throws IOException, JsonException {\n final String testPath = TEST_BASE_PATH;\n Map<String, String> props = new HashMap<String, String>();\n String testNode = testClient.createNode(HTTP_BASE_URL + testPath, props);\n urlsToDelete.add(testNode);\n\n props.clear();\n props.put(SlingPostConstants.RP_OPERATION,\n \t\tSlingPostConstants.OPERATION_IMPORT);\n\n testFile = getTestFile(getClass().getResourceAsStream(\"/integration-test/servlets/post/testimport2.json\"));\n props.put(SlingPostConstants.RP_CONTENT_TYPE, \"json\");\n props.put(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + \"/*\");\n String importedNodeUrl = testClient.createNode(HTTP_BASE_URL + testPath, new NameValuePairList(props), null, true,\n \t\ttestFile, SlingPostConstants.RP_CONTENT_FILE, null);\n\n //make sure the name is what was inside the file.\n assertTrue(importedNodeUrl.endsWith(\"/nodeName\"));\n\n // assert content at new location\n String content = getContent(importedNodeUrl + \".3.json\", CONTENT_TYPE_JSON);\n\n\t\tJsonObject jsonObj = JsonUtil.parseObject(content);\n\t\tassertNotNull(jsonObj);\n\n\t\t//assert the imported content is there.\n String expectedJsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/importresults.json\"));\n\t\tassertExpectedJSON(JsonUtil.parseObject(expectedJsonContent), jsonObj);\n }", "public void ready(final YuiContext Y) {\n\t\tJsArr data_in = JsArr.create(\n\t\t\tJsObject.one(\"make\", \"Chevrolet\")._(\"model\", \"Bel Air\")._(\"year\", 1957),\n\t\t\tJsObject.one(\"make\", \"Dodge\")._(\"model\", \"Dart\")._(\"year\", 1964),\n\t\t\tJsObject.one(\"make\", \"Ford\")._(\"model\", \"Mustang\")._(\"year\", 1968) \n\t\t); \n\t\tSchema schema = Schema.create().resultFields(new Field[]{\n\t\t\tField.create().key(\"model\"), Field.create().key(\"year\") \n\t\t}); \n\t\tDataSchemaResult data_out = Y.DataSchemaArray().apply(schema, data_in);\n\t\tWindow.alert(Y.dump(data_out.results())); //data_out.results().length()+\" - \"+JsUtil.dumpObj(data_out, true));\n\t\t\n\t\t\n\t\t//another little test, this time reading a json string contained mixed formed data\n\t\tString data_in2 = \"[\\n\"+\n\t\t\" {make:\\\"Chevrolet\\\",model:\\\"Bel Air\\\",year:1957},\\n\"+\n\t\t\" [\\\"Dodge\\\", \\\"Dart\\\", 1964],\\n\"+\n\t\t\" \\\"1968 Ford Mustang\\\"\\n\"+\n\t\t\"]\"; \n\t\t\n\t\tSchema schema2 = Schema.create().resultFields(new Field[]{\n\t\t\t\tField.create().key(\"make\"), Field.create().key(\"model\"), Field.create().key(\"year\") \n\t\t}); \n\t\tDataSchemaResult data_out2 = Y.DataSchemaArray().apply(schema2, JsonUtils.unsafeEval(data_in2));\n\t\tWindow.alert(Y.dump(data_out2.results())); \n\t}", "public JsonArray getJsonFromService(\n String myQuestion, //\n String endpoint, //\n float minimumConfidence, //\n RestTemplate restTemplate, //\n CacheOfRestTemplateResponse myCacheOfResponses //\n ) throws URISyntaxException, DBpediaSpotlightJsonParsingNotPossible {\n URI uri = createRequestUriWithParameters(myQuestion, endpoint, minimumConfidence);\n JsonObject response = fetchNamedEntitiesFromWebService(restTemplate, myCacheOfResponses, uri);\n JsonArray resources = getResourcesOfResponse(response, myQuestion);\n\n return resources;\n }", "@Override\n public String toString() {return \"Json-File Reader\";}", "public static void main(String[] args) throws IOException {\n\t\t// TODO Auto-generated method stub\n\t\tJsonFileParser parser = new JsonFileParser();\n\t\tparser.parseJsonFile(args);\n\t\tList<String> labelset = parser.getLset();\n\t\tfor(String label : labelset){\n\t\t\tSystem.out.println(label);\n\t\t}\n\t\tList<String> corpus = parser.getCorpus();\n\t\tfor(String doc : corpus){\n\t\t\tSystem.out.println(doc);\n\t\t}\n\t\tList<String> labels = parser.getLabels();\n\t\tfor(String label : labels){\n\t\t\tSystem.out.println(label);\n\t\t}\n\t\tList<String> headerInforList = parser.getPmids();\n\t\tfor(String pmid : headerInforList){\n\t\t\tSystem.out.println(pmid);\n\t\t}\n\t}", "public static void initialize() {\r\n\t\tjson = new JSONFile(filePath);\t\r\n\t}" ]
[ "0.65106744", "0.64942837", "0.621569", "0.6097948", "0.605114", "0.5976828", "0.59634453", "0.58937454", "0.5882496", "0.5728595", "0.5726738", "0.5716714", "0.5703193", "0.56933194", "0.56922007", "0.5684327", "0.5670406", "0.5665765", "0.5579029", "0.55726236", "0.5563291", "0.5542161", "0.5523732", "0.55018896", "0.54970455", "0.548195", "0.5474336", "0.54640186", "0.5443245", "0.54425824", "0.54421663", "0.5433782", "0.541568", "0.54123783", "0.54122406", "0.5405062", "0.5385872", "0.53744465", "0.5371214", "0.537099", "0.5369813", "0.5364451", "0.53542566", "0.5348374", "0.5348107", "0.5345096", "0.53292155", "0.5319196", "0.531579", "0.5307478", "0.53013295", "0.5296883", "0.5295683", "0.52945685", "0.5293875", "0.5287224", "0.52865434", "0.52824074", "0.5256617", "0.52546346", "0.52443564", "0.5238204", "0.5237661", "0.52361053", "0.5231939", "0.5221327", "0.5211724", "0.52102137", "0.5208383", "0.5208335", "0.5205505", "0.520267", "0.52007747", "0.5197523", "0.51931566", "0.5183759", "0.5158344", "0.5151503", "0.51513517", "0.51432705", "0.51432705", "0.51432705", "0.5140156", "0.5139785", "0.51395804", "0.51303816", "0.51262987", "0.5117251", "0.511516", "0.5113012", "0.5111478", "0.51105314", "0.51083374", "0.51013047", "0.50988775", "0.5087814", "0.5081152", "0.5077141", "0.507294", "0.50719947", "0.5064289" ]
0.0
-1
Read in the JSON from the example resources
@Test public void testTradesAdapter() throws IOException { InputStream is = CryptopiaAdaptersTest.class.getResourceAsStream( "/org/knowm/xchange/cryptopia/dto/marketdata/example-trades.json"); // Use Jackson to parse it ObjectMapper mapper = new ObjectMapper(); CryptopiaBaseResponse<List<CryptopiaMarketHistory>> cryptopiaMarketHistory = mapper.readValue(is, CryptopiaBaseResponseCryptopiaMarketHistory.class); is.close(); assertThat(cryptopiaMarketHistory).isNotNull(); Trades trades = CryptopiaAdapters.adaptTrades(cryptopiaMarketHistory.getData()); assertThat(trades).isNotNull(); assertThat(trades.getlastID()).isEqualTo(1501995183); assertThat(trades.getTradeSortType()).isEqualTo(Trades.TradeSortType.SortByTimestamp); assertThat(trades.getTrades().size()).isGreaterThan(1); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n\tpublic void readJSONFromFile() {\n\t\t\n\t\tJsonPath jsonFile = new JsonPath(new File (\"C:\\\\Users\\\\cmlzd\\\\Desktop\\\\employees.json\"));\n\t\t\n\t\tSystem.out.println(jsonFile.getString(\"items.email\"));\n\t\t\n\t\t\n\t}", "private static JsonReader readJSONFromAsset(Context context) throws IOException {\n AssetManager assetManager = context.getAssets();\n JsonReader reader;\n try {\n reader = new JsonReader(new InputStreamReader(assetManager.open(\"questionlist.json\")));\n } finally {\n\n }\n return reader;\n }", "public static Books readJSON(){\n Gson gson = new GsonBuilder().create();\n Books books = new Books();\n try {\n books = gson.fromJson(new JsonReader(new FileReader(\"books.json\")), Books.class);\n } catch (IOException e){\n e.printStackTrace();\n }\n return books;\n }", "protected JSONArray readJsonFromLocalResources(InputStream resources) {\n\n InputStream is = resources;\n ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n\n if (is != null) {\n\n int ctr;\n try {\n ctr = is.read();\n while (ctr != -1) {\n byteArrayOutputStream.write(ctr);\n ctr = is.read();\n }\n\n if (byteArrayOutputStream.size() > 0) {\n Logger.d(\"JSON= \" + byteArrayOutputStream.toString());\n return new JSONArray(byteArrayOutputStream.toString());\n }\n\n } catch (IOException e) {\n Logger.e(\"Could not read the json file, IOException\" + e);\n } catch (JSONException ex) {\n Logger.e(\"Could not parse into json object, JSONException\" + ex);\n } finally {\n\n try {\n is.close();\n } catch (IOException ex) {\n Logger.e(\"Could not close InputStream, IOException\" + ex);\n }\n }\n }\n\n Logger.d(\"Could not return json object\"); //Let's hope not to hit this line\n return null;\n }", "public String loadJSONFromAsset() {\n String json;\n String file = \"assets/words.json\";\n\n try {\n InputStream is = this.getClass().getClassLoader().getResourceAsStream(file);\n int size = is.available();\n byte[] buffer = new byte[size];\n is.read(buffer);\n is.close();\n json = new String(buffer, \"UTF-8\");\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n }", "private Demo doReadDemo() throws IOException {\n // create a resource loader\n final URL defaultRoot = ResourceUtil.getURL(\"demo/\");\n final URLClassLoader resourceLoader = new URLClassLoader(\n new URL[] { defaultRoot }, null);\n return doReadDemo(resourceLoader);\n }", "public static void loadPracticeListFromFile() {\n JSONParser jsonParser = new JSONParser();\n\n try (FileReader reader = new FileReader(\"src/practiceList.json\")) {\n // Read JSON file\n Object object = jsonParser.parse(reader);\n\n //Iterate over word list array\n JSONArray wordList = (JSONArray) object;\n for (Object o : wordList) {\n\n JSONObject next = (JSONObject) o;\n String extra = \"\";\n\n if (((String) next.get(\"wordType\")).equalsIgnoreCase(\"verb\")) {\n extra = \"to \";\n }\n\n Word loadedWord = new Word(extra + next.get(\"english\"), (String) next.get(\"welsh\"), (String) next.get(\"wordType\"));\n\n addIntoPracticedWords(loadedWord);\n }\n\n } catch (ParseException | IOException e) {\n System.out.println(\"PracticeList file not found, will be created on exit.\");\n }\n }", "public Integer loadJSONFile()\n {\n JSONParser parser = new JSONParser();\n try{\n\n Object obj = parser.parse(new FileReader(\"/Users/rnuka/Desktop/sample.json\"));\n JSONObject jsonObj = (JSONObject)obj;\n\n Long age = (Long)jsonObj.get(\"age\");\n System.out.println(\"age:\"+age);\n\n String name = (String)jsonObj.get(\"name\");\n System.out.println(\"name:\" + name);\n\n JSONArray address = (JSONArray)jsonObj.get(\"address\");\n\n for(Object str : address){\n System.out.println(str);\n }\n\n\n\n }catch(Exception e){\n e.printStackTrace();\n }\n return 1;\n }", "private void read() {\n\n\t\t\t\tString road=getActivity().getFilesDir().getAbsolutePath()+\"product\"+\".txt\";\n\n\t\t\t\ttry {\n\t\t\t\t\tFile file = new File(road); \n\t\t\t\t\tFileInputStream fis = new FileInputStream(file); \n\t\t\t\t\tint length = fis.available(); \n\t\t\t\t\tbyte [] buffer = new byte[length]; \n\t\t\t\t\tfis.read(buffer); \n\t\t\t\t\tString res1 = EncodingUtils.getString(buffer, \"UTF-8\"); \n\t\t\t\t\tfis.close(); \n\t\t\t\t\tjson(res1.toString());\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} \n\t\t\t}", "public String loadJSONFromAsset(Context context) {\n String json = null;\n try {\n InputStream is;\n int id = context.getResources().getIdentifier(\"sentiment\", \"raw\", context.getPackageName());\n is = context.getResources().openRawResource(id);\n\n int size = is.available();\n\n byte[] buffer = new byte[size];\n\n is.read(buffer);\n\n is.close();\n\n json = new String(buffer, \"UTF-8\");\n\n\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n\n }", "@GetMapping(\"/getJson\")\r\n\tpublic HashMap<String, Object> getJsonValue() throws IOException {\n\r\n\t\tHashMap<String, Object> globalVariable = null;\r\n\t\tObjectMapper mapper = new ObjectMapper();\r\n\t\tString path = \"rules/backUp.json\";\r\n\r\n\t\tResourceLoader resource = new DefaultResourceLoader();\r\n\t\torg.springframework.core.io.Resource resource2 = resource.getResource(\"classpath:\" + path);\r\n\r\n\t\tReader reader = new InputStreamReader(resource2.getInputStream());\r\n\t\tSystem.out.println(\"reader ouput \" + reader.toString());\r\n\t\tString fileData = FileCopyUtils.copyToString(reader);\r\n\t\tSystem.out.println(\" filedate is \" + fileData);\r\n\r\n\t\tTypeReference<HashMap<String, Object>> typeRef = new TypeReference<HashMap<String, Object>>() {\r\n\t\t};\r\n\t\tHashMap<String, Object> readValue = mapper.readValue(fileData, typeRef);\r\n\t\treturn readValue;\r\n\t}", "@GetMapping(\"/getThingsDescription\")\n public ResponseEntity<?> getThingsDescription() {\n log.info(\"Thing Description from TechUnit ... \");\n\n ClassLoader cl = getClass().getClassLoader();\n\n String thingsDescription = \"\";\n try {\n thingsDescription = IOUtils\n .toString(cl.getResourceAsStream(\"things-wearhealth.json\"));\n } catch (Exception ex) {\n log.error(\"Unable to load Things Description...\");\n ex.printStackTrace();\n }\n return new ResponseEntity<>(thingsDescription, HttpStatus.OK);\n }", "public void ReadJson() {\n System.out.println(\"Read Json Method in the Mother Class\");\n }", "public void readInventoryMainJsonFile() throws IOException, ParseException {\n\n\t\t// Providing read-only access to JSON data.\n\t\tJSONParser parser = new JSONParser();\n\n\t\t// Reading the external JSON file.\n\t\tFileReader reader = new FileReader(\".\\\\resources\\\\InventoryMain.json\");\n\n\t\t// Creating main object to store JSONParser, JSONObject and JSONArray.\n\t\tObject inventoryMain = parser.parse(reader);\n\n\t\t// Parsing object to JSONObject from InventoryMain.json file.\n\t\tJSONObject inventoryObj = (JSONObject) inventoryMain;\n\n\t\t// Getting the arrays of JSON file.\n\t\tJSONArray riceArray = (JSONArray) inventoryObj.get(\"Rice\");\n\t\tJSONArray pulseArray = (JSONArray) inventoryObj.get(\"Pulses\");\n\t\tJSONArray wheatArray = (JSONArray) inventoryObj.get(\"Wheat\");\n\n\t\t// Getting details of rice.\n\t\tSystem.out.println(\"Details of Rice are: \");\n\t\tfor (int i = 0; i < riceArray.size(); i++) {\n\t\t\tJSONObject riceDetails = (JSONObject) riceArray.get(i);\n\n\t\t\tString name = (String) riceDetails.get(\"name\");\n\t\t\tlong weight = (long) riceDetails.get(\"weight\");\n\t\t\tlong price = (long) riceDetails.get(\"price\");\n\n\t\t\tSystem.out.println(\"\\nName: \" + name);\n\t\t\tSystem.out.println(\"Weight: \" + weight);\n\t\t\tSystem.out.println(\"Price per KG is: \" + price);\n\n\t\t\t// Calculating price of different types of rice.\n\t\t\tlong ricePrice = weight * price;\n\t\t\tSystem.out.println(\"\\nTotal price of \" + riceDetails.get(\"name\") + \" is \" + ricePrice);\n\n\t\t}\n\n\t\t// Getting details of Pulse.\n\t\tSystem.out.println(\"\\nDetails of Pulse are: \");\n\t\tfor (int j = 0; j < pulseArray.size(); j++) {\n\t\t\tJSONObject pulseDetails = (JSONObject) pulseArray.get(j);\n\n\t\t\tString name = (String) pulseDetails.get(\"name\");\n\t\t\tlong weight = (long) pulseDetails.get(\"weight\");\n\t\t\tlong price = (long) pulseDetails.get(\"price\");\n\n\t\t\tSystem.out.println(\"\\nName: \" + name);\n\t\t\tSystem.out.println(\"Weight: \" + weight);\n\t\t\tSystem.out.println(\"Price per KG is: \" + price);\n\n\t\t\t// Calculating price of different types of Pulses.\n\t\t\tlong pulsePrice = weight * price;\n\t\t\tSystem.out.println(\"\\nTotal price of \" + pulseDetails.get(\"name\") + \" is \" + pulsePrice);\n\n\t\t}\n\t\t// Getting details of Wheat.\n\t\tSystem.out.println(\"\\nDetails of Wheat are: \");\n\t\tfor (int i = 0; i < wheatArray.size(); i++) {\n\t\t\tJSONObject wheatDetails = (JSONObject) wheatArray.get(i);\n\n\t\t\tString name = (String) wheatDetails.get(\"name\");\n\t\t\tlong weight = (long) wheatDetails.get(\"weight\");\n\t\t\tlong price = (long) wheatDetails.get(\"price\");\n\n\t\t\tSystem.out.println(\"\\nName: \" + name);\n\t\t\tSystem.out.println(\"Weight: \" + weight);\n\t\t\tSystem.out.println(\"Price per KG is: \" + price);\n\t\t\t// Calculating price of different types of Wheat.\n\t\t\tlong wheatPrice = weight * price;\n\t\t\tSystem.out.println(\"\\nTotal price of \" + wheatDetails.get(\"name\") + \" is \" + wheatPrice);\n\n\t\t}\n\n\t}", "public static void main(String[] args) throws IOException\n {\n File file = new File(\"D:\\\\work\\\\incoming\\\\F&D\\\\enrichment API\\\\context_test_record.jsonld\");\n\n Model m = ModelFactory.createDefaultModel();\n \n try {\n m.read(new FileInputStream(file), null, \"JSONLD\");\n }\n catch (Exception e) {\n e.printStackTrace(System.err);\n return;\n }\n\n// URL url = new URL(\"file:///C:/Users/Hugo/Google%20Drive/Europeana/EDM/jsonld/context.jsonld\");\n URL url = new URL(\"file:///D:/work/incoming/F&D/enrichment%20API/context.jsonld\");\n new JsonLdWriter(url).write(m, new OutputStreamWriter(System.out));\n }", "public void init() {\n\n mJokes = new ArrayList<>();\n\n StringBuilder sBuilder = new StringBuilder();\n\n try {\n\n InputStream in = getClass().getResourceAsStream(\"/jokes.json\");\n BufferedReader reader = new BufferedReader(new InputStreamReader(in));\n\n String mLine = reader.readLine();\n while (mLine != null) {\n //process line\n sBuilder.append(mLine);\n mLine = reader.readLine();\n }\n\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n\n String jsonString = sBuilder.toString();\n\n if( jsonString != null ){\n\n JsonParser parser = new JsonParser();\n JsonObject jsonObject = parser.parse(jsonString).getAsJsonObject();\n\n JsonArray jokesArray = jsonObject.getAsJsonArray(\"jokes\");\n\n for (JsonElement element : jokesArray) {\n String joke = element.getAsJsonObject().get(\"joke\").getAsString();\n mJokes.add(joke);\n }\n }\n\n }", "private JSONObject getJsonObject(Resource resource) {\n JSONParser parser = new JSONParser();\n JSONObject obj = null;\n try {\n obj = (JSONObject) parser.parse(new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8));\n } catch (Exception e) {\n e.printStackTrace();\n }\n return obj;\n }", "private Demo doReadDemo(final FileSystem fileSystem) throws IOException {\n // create a resource loader\n final URL[] demoRoot = new URL[] {\n fileSystem.getRoot().toURI().toURL() \n };\n final URLClassLoader resourceLoader = new URLClassLoader(demoRoot, null);\n return doReadDemo(resourceLoader);\n }", "public void loadToDoList() {\n try {\n toDoList = jsonReader.read();\n System.out.println(\"Loaded \" + toDoList.getName() + \" from \" + JSON_STORE);\n } catch (IOException e) {\n System.out.println(\"Unable to read from file: \" + JSON_STORE);\n }\n }", "public String loadJSONFile(int resourceIdentifier) {\n if (resourceIdentifier != 0) {\n InputStream input = getResources().openRawResource(resourceIdentifier);\n java.util.Scanner s = new java.util.Scanner(input).useDelimiter(\"\\\\A\");\n return s.hasNext() ? s.next() : null;\n } else {\n return null;\n }\n }", "public App read() throws IOException {\n String jsonData = readFile(source);\n JSONObject jsonObject = new JSONObject(jsonData);\n return parseApp(jsonObject);\n }", "private static JSONObject fileReader(String path) throws Exception{\r\n return (JSONObject) jsonParser.parse(new String(Files.readAllBytes(Paths.get(path))));\r\n }", "public Tamagotchi read() throws IOException {\n String jsonData = readFile(source);\n JSONObject jsonObject = new JSONObject(jsonData);\n return tamagotchiToJson(jsonObject);\n }", "public void retrieveData(){\n\t\tloaderImage.loadingStart();\n\t\tJsonClient js = new JsonClient();\n\t\tjs.retrieveData(JSON_URL, this);\n\t}", "public JSONObject getJSONFromFile() throws IOException\n\t{\n\t\tInputStream is = context.getResources().openRawResource(R.raw.schedule);\n\t\tWriter writer = new StringWriter();\n\t\tchar[] buffer = new char[1024];\n\t\ttry {\n\t\t Reader reader = new BufferedReader(new InputStreamReader(is, \"UTF-8\"));\n\t\t int n;\n\t\t while ((n = reader.read(buffer)) != -1) {\n\t\t writer.write(buffer, 0, n);\n\t\t }\n\t\t} finally {\n\t\t is.close();\n\t\t}\n\n\t\tString jsonString = writer.toString();\n\t\tJSONObject jObj=null;\n\t\t\n\t\t// try parse the string to a JSON object\n\t\ttry {\n\t\t\tjObj = new JSONObject(jsonString);\n\t\t} catch (JSONException e) {\n\t\t\tLog.e(\"JSON Parser\", \"Error parsing data \" + e.toString());\n\t\t}\n\t\t\t\n\t\treturn jObj;\n\t\t// return JSON String\n\n\t}", "@Test\n public void testFromJSON() {\n System.out.println(\"fromJSON\");\n String json = \"\";\n Resource expResult = null;\n Resource result = Resource.fromJSON(json);\n assertEquals(expResult, result);\n // TODO review the generated test code and remove the default call to fail.\n fail(\"The test case is a prototype.\");\n }", "public static List<DataItem> importFromJSON(Context context){\n FileReader reader = null;\n File file = new File(Environment.getExternalStorageDirectory(), FILE_NAME);\n\n try {\n //Instantiate FileReader with file\n reader = new FileReader(file);\n //Populate DataItems class and return result\n Gson gson = new Gson();\n DataItems dataItems = gson.fromJson(reader, DataItems.class);\n return dataItems.getDataItems();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n }finally {\n if (reader != null) {\n try {\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }\n return null;\n }", "@Override\n \tpublic Representation getResource() throws Exception {\n \t\tJsonRepresentation result = null;\n \t\t// Rcupre l'identifiant unique de la ressource demande.\n \t\tString interId = (String) this.getRequestAttributes().get(\"interId\");\n \t\tString srcId = (String) this.getRequestAttributes().get(\"sourceId\");\n \t\tSystem.out.println(srcId);\n \t\t// Rcupration des sources de l'intervention\n \t\tList<Source> sources = Interventions.getInstance().getIntervention(interId).getSources();\n \n \t\tSource source = null;\n \t\t\n \t\t// Si on demande un source prcis\n \t\tif (srcId != null) {\n \t\t\t// Recherche du source demand\n \t\t\tfor (int i = 0; i < sources.size(); i++) {\n \t\t\t\tif (sources.get(i).getUniqueID().equals(srcId)) {\n \t\t\t\t\tsource = sources.get(i);\n \t\t\t\t}\n \t\t\t}\n \t\t\t// Si le source n'est pas trouv\n \t\t\tif (source == null) {\n \t\t\t\tresult = null;\n \t\t\t\tgetResponse().setStatus(Status.CLIENT_ERROR_NOT_ACCEPTABLE);\n \t\t\t} else {\n \t\t\t\tresult = new JsonRepresentation(source.toJSON());\n \t\t\t}\n \t\t// Si on veut tous les sources\n \t\t} else if (srcId == null) {\n \t\t\t\n \t\t\tJSONArray jsonAr = new JSONArray(); //Cration d'une liste Json\n \t\t\tfor(int i=0; i< sources.size();i++){\n\t\t\t\tjsonAr.put(sources.get(i).toJSON()); // On ajoute un jsonObject contenant le source dans le jsonArray\n \t\t\t}\n \t\t\t\n \t\t\tresult = new JsonRepresentation(jsonAr); // On cre la reprsentation de la liste\n \t\t}\n \n \t\t// Retourne la reprsentation, le code status indique au client si elle est valide\n \t\treturn result;\n \t}", "public String loadJSONFromAsset(Context context) {\n json = null;\n try {\n InputStream is = getApplicationContext().getAssets().open(\"techdrop.json\");\n int size = is.available();\n byte[] buffer = new byte[size];\n is.read(buffer);\n is.close();\n json = new String(buffer, \"UTF-8\");\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n }", "public static List<DataItem> importFromResource(Context context){\n InputStreamReader reader = null;\n InputStream inputStream = null;\n\n try {\n //Instantiate InputStream with static raw file the assign it to InputStreamReader\n inputStream = context.getResources().openRawResource(R.raw.menuitems);\n reader = new InputStreamReader(inputStream);\n //Populate DataItems class and return result\n Gson gson = new Gson();\n DataItems dataItems = gson.fromJson(reader, DataItems.class);\n return dataItems.getDataItems();\n }finally {\n //close both classes\n if (reader != null) {\n try {\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n if (inputStream != null) {\n try {\n inputStream.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n\n }\n }", "@Test\r\n public void testRevision() {\r\n InputStream inputstream = getClass().getClassLoader().getResourceAsStream(\"sample.json\");\r\n assert inputstream != null;\r\n Reader reader = new InputStreamReader(inputstream);\r\n JsonParser parser = new JsonParser();\r\n JsonElement rootElement = parser.parse(reader);\r\n\r\n RevisionParser revisionParser = new RevisionParser();\r\n List<Revision> revisionList = revisionParser.parse(rootElement);\r\n\r\n for (Revision r: revisionList) {\r\n System.out.println(r);\r\n }\r\n Assert.assertEquals(revisionList.get(0).toString(), \"Name: Monkbot\tTimeStamp: Fri Sep 13 11:10:41 EDT 2019\");\r\n }", "@Override\n public Object loadFromJson(Context context) {\n Gson gson = new Gson();\n String json = FileManager.getInstance().loadFromFile(getFileName(), context);\n if(json.equals(\"\")) {\n return null;\n }\n\n return gson.fromJson(json, MatchStorage.class);\n\n }", "public String generateJsonFileFromParsedTextFileInApp() {\n\t\treturn generateJsonFileFromParsedTextFile(TEXTSAMPLEFILE);\n\t}", "static JsonResource forClasspath( ClassLoader classLoader, String name ) {\n final ClassLoader loader = classLoader == null ? Thread.currentThread().getContextClassLoader() : classLoader;\n return new JsonResource() {\n @Override\n public <T> T readFrom( ReadMethod<T> consumer ) throws IOException {\n InputStream stream = loader.getResourceAsStream(name);\n if ( stream == null )\n throw new FileNotFoundException(\"Resource \" + name + \" not found\");\n try {\n return consumer.read( stream );\n } finally {\n stream.close();\n }\n }\n };\n }", "private static JsonObject readJSON(String path) {\n\n\t\tString fileContents = \"\";\n\t\tBufferedReader reader = null;\n\n\t\ttry {\n\t\t\treader = new BufferedReader(new FileReader(path));\n\t\t} catch (FileNotFoundException e) {\n\t\t\tfail(ErrorMessage.inputFileNotFoundError);\n\t\t}\n\n\t\tString line;\n\n\t\ttry {\n\t\t\twhile ((line = reader.readLine()) != null) {\n\t\t\t\tfileContents += line;\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\tfail(ErrorMessage.readFileError);\n\t\t}\n\n\t\ttry {\n\t\t\treader.close();\n\t\t} catch (IOException e) {\n\t\t\tfail(ErrorMessage.closeFileError);\n\t\t}\n\n\t\tJsonObject jsonLicense = Json.createReader(new StringReader(fileContents)).readObject();\n\n\t\treturn jsonLicense;\n\t}", "static JsonResource forFile( File file ) {\n return new JsonResource() {\n @Override\n public <T> T readFrom( ReadMethod<T> consumer ) throws IOException {\n try ( FileInputStream stream = new FileInputStream(file) ) {\n return consumer.read(stream);\n }\n }\n };\n }", "private JSONObject readJSONFile(Path path) throws ExtensionManagementException {\n\n if (Files.exists(path) && Files.isRegularFile(path)) {\n try {\n String jsonString = FileUtils.readFileToString(path.toFile(), UTF8);\n return new JSONObject(jsonString);\n } catch (JSONException e) {\n throw new ExtensionManagementException(\"Error while parsing JSON file: \" + path, e);\n } catch (IOException e) {\n throw new ExtensionManagementException(\"Error while reading JSON file: \" + path, e);\n }\n } else {\n throw new ExtensionManagementException(\"JSON file not found: \" + path);\n }\n }", "public static JsonObject getTestVectors(String filename) throws \n IOException {\n InputStream is = JsonUtil.class.getClassLoader().getResourceAsStream(filename);\n JsonReader reader = new JsonReader(new InputStreamReader(is, UTF_8));\n JsonElement elem = JsonParser.parseReader(reader);\n return elem.getAsJsonObject();\n }", "private static String readJsonFile (String fileName) {\n if (!fileName.endsWith(\".json\")){\n throw new IllegalArgumentException(\"Invalid file name\");\n }\n String jsonStr = \"\";\n try{\n isFileExistOrCreatIt(fileName);\n File jsonFile = new File(\"src//main//resources\"+\"//\"+fileName);\n Reader reader = new InputStreamReader(new FileInputStream(jsonFile),\"utf-8\");\n int ch = 0;\n StringBuffer sb = new StringBuffer();\n while((ch = reader.read())!=-1){\n sb.append((char) ch);\n }\n reader.close();\n jsonStr = sb.toString();\n return jsonStr;\n\n } catch (IOException e) {\n e.printStackTrace();\n return null;\n }\n }", "public static void main(String[] args) throws FileNotFoundException {\r\n\t\tJsonParser parser = Json.createParser(new FileReader(JSON_FILE_NAME));\r\n\t\t\r\n\t\t// parse the file\r\n\t\twhile (parser.hasNext()) {\r\n\t\t\tJsonParser.Event event = parser.next();\r\n\t\t\tif (event.equals(JsonParser.Event.KEY_NAME)) {\r\n\t\t\t\tString key = parser.getString();\r\n\t\t\t\tparser.next();\r\n\t\t\t\tString value = parser.getString();\r\n\t\t\t\tSystem.out.printf(\">> %s: %s\\n\", key, value);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}", "public static void main(String[] args) {\n Client client = Client.create();\n WebResource resource = client.resource(\"http://localhost:8080/rest/resource/strings\");\n String strings = resource.get(String.class);\n System.out.println(strings);\n }", "public static JSONObject loadJSONObjectFromAsset(Context context) {\n String jsonStr = null;\n JSONObject jsonObject = null;\n try {\n //here we need context to access ASSETS --> ANDROID TUTORIAL / codeBlock - Patterns / Application.java\n InputStream is = context.getAssets().open(\"listHomeItem.json\");\n int size = is.available();\n byte[] buffer = new byte[size];\n is.read(buffer);\n is.close();\n jsonStr = new String(buffer, \"UTF-8\");\n\n jsonObject = new JSONObject(jsonStr);\n\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n\n } catch (JSONException e) {\n e.printStackTrace();\n return null;\n }\n return jsonObject;\n }", "String readSampleJsonDoc(String file) {\n\t\tStringBuffer sb = new StringBuffer();\n\t\tBufferedReader br = null;\n\n\t\ttry {\n\t\t\tbr = new BufferedReader(new FileReader(new File(file)));\n\t\t\tString line;\n\t\t\twhile ((line = br.readLine()) != null) {\n\t\t\t\tsb.append(line + NEWLINE);\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\tif (br != null) {\n\t\t\t\t\tbr.close();\n\t\t\t\t}\n\t\t\t} catch (IOException e) {\n\t\t\t}\n\t\t}\n\t\treturn sb.toString();\n\t}", "public void load(){\n // Recover docIDs\n try(Reader reader = new FileReader(\"postings/docIDs.json\")){\n this.docIDs = (new Gson()).fromJson(reader,\n new TypeToken<Map<String, String>>(){}.getType());\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n try(Reader reader = new FileReader(\"postings/docLengths.json\")){\n this.docLengths = (new Gson()).fromJson(reader,\n new TypeToken<Map<String, Integer>>(){}.getType());\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n try(Reader reader = new FileReader(\"postings/titleToNumber.json\")){\n this.titleToNumber = (new Gson()).fromJson(reader,\n new TypeToken<Map<String, Integer>>(){}.getType());\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "static ArrayList<Integer> getAllQuestionIDs(Context context){\n JsonReader reader;\n ArrayList<Integer> questionIDs = new ArrayList<>();\n try {\n reader = readJSONFromAsset(context);\n reader.beginArray();\n while (reader.hasNext()) {\n questionIDs.add(readQuestion(reader).getQuestionID());\n }\n reader.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n return questionIDs;\n }", "public static void main(String[] args) throws IOException {\n String path = \"D:\\\\data\\\\code\\\\github-workspace\\\\tiny\\\\app\\\\web\\\\home\\\\src\\\\test\\\\resources\\\\table-result-3.json\";\n String jsonStr = FileUtils.readFileToString(new File(path));\n// Object obj = parseLayoutResult2(jsonStr);\n Object obj = parseContentResult2(jsonStr);\n System.out.println(obj);\n\n }", "private MoodsCreator(Resources resources){\n\n String result;\n try {\n InputStream inputStream = resources.openRawResource(R.raw.moods);\n\n StringBuffer buffer = new StringBuffer();\n BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));\n\n String line;\n while ((line = reader.readLine()) != null) {\n\n buffer.append(line + \"\\n\");\n }\n result = buffer.toString();\n Log.d(\"MOODS\", result);\n\n JSONObject moodsJson = new JSONObject(result);\n JSONArray moodsJsonArray = new JSONArray(moodsJson.get(\"moods\").toString());\n\n for(int i =0;i<moodsJsonArray.length();++i){\n JSONObject moodfromJson = moodsJsonArray.getJSONObject(i);\n Mood mood = new Mood(moodfromJson.get(\"name\").toString(),moodfromJson.getInt(\"red\"),moodfromJson.getInt(\"green\"), moodfromJson.getInt(\"blue\"), moodfromJson.getInt(\"alpha\"));\n\n Log.d(\"MOOD\",mood.name + \" \"+mood.alpha + \" \"+ mood.red);\n moods.put(moodfromJson.get(\"name\").toString(),mood);\n }\n\n Log.d(\"moodsMap\",moods.toString());\n }\n catch(Exception e){\n\n }\n\n }", "public static JsonNode getLibraryMetadata(Object resource, List<String> desc) throws Exception {\n\t\tfinal ObjectMapper mapper = BeanTemplateUtils.configureMapper(Optional.empty());\t\t\n\t\tfinal JsonNode v1_bean = \n\t\t\t\t((ObjectNode) mapper.readTree(resource.getClass().getResourceAsStream(\"test_v1_sync_sample_share.json\")))\n\t\t\t\t.put(\"description\", desc.stream().collect(Collectors.joining(\"\\n\")));\n\t\t\t\t\n\t\treturn v1_bean;\n\t}", "String getJSON();", "private void loadWorld() {\n try {\n world = jsonReader.read();\n System.out.println(\"Loaded world from \" + JSON_STORE);\n } catch (IOException | InvalidDataException e) {\n System.out.println(\"Unable to read from file: \" + JSON_STORE);\n }\n }", "private JSONObject loadTemplate(Path extensionResourcePath) throws ExtensionManagementException {\n\n Path templatePath = extensionResourcePath.resolve(TEMPLATE_FILE_NAME);\n if (Files.exists(templatePath) && Files.isRegularFile(templatePath)) {\n return readJSONFile(templatePath);\n }\n return null;\n }", "private String loadJSONFromAsset() {\n String json = null;\n try {\n //AssetManager assetManager = getAssets();\n InputStream is = getAssets().open(\"sa.json\");\n //InputStream is = getResources().openRawResource(\"sa.json\");\n int size = is.available();\n\n byte[] buffer = new byte[size];\n\n is.read(buffer);\n\n is.close();\n\n json = new String(buffer, \"UTF-8\");\n Log.i(\"Json\",json);\n\n\n } catch (Exception ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n\n }", "protected void loadMockData() {\n\n int ctr;\n InputStream inputStream = getResources().openRawResource(R.raw.song_list);\n ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();\n\n try {\n ctr = inputStream.read();\n while (ctr != -1) {\n byteArrayOutputStream.write(ctr);\n ctr = inputStream.read();\n }\n inputStream.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n // Parse the data.\n try {\n JSONObject jObject = new JSONObject(byteArrayOutputStream.toString());\n\n String status_code = jObject.getString(\"statusCode\");\n\n if (status_code.equalsIgnoreCase(\"200\")) {\n JSONArray jArray = jObject.getJSONArray(\"data\");\n\n audioList = new ArrayList<>();\n\n for (int i = 0; i < jArray.length(); i++) {\n JSONObject song = jArray.getJSONObject(i);\n\n String genre = song.getString(\"genre\");\n String album = song.getString(\"album\");\n String author = song.getString(\"author\");\n String title = song.getString(\"title\");\n String url = song.getString(\"url\");\n String imgUrl = song.getString(\"img\");\n\n Audio audio = new Audio(genre, album, author, title, url, imgUrl);\n\n // Save to audioList.\n audioList.add(audio);\n }\n }\n } catch (JSONException e) {\n e.printStackTrace();\n }\n }", "private void readFromJSON(String filename) {\n JSONParser parser = new JSONParser();\n\n try\n {\n Object obj = parser.parse(new FileReader(filename));\n JSONObject jsonObject = (JSONObject) obj;\n Menu drinks = getMenu(jsonObject, \"Drink\");\n Menu types = getMenu(jsonObject, \"Type\");\n Menu toppings = getMenu(jsonObject, \"Toppings\");\n Menu sizes = getMenu(jsonObject, \"Size\");\n menuMap.put(\"Drink\", drinks);\n menuMap.put(\"Size\", sizes);\n menuMap.put(\"Toppings\", toppings);\n menuMap.put(\"Type\", types);\n\n } catch (FileNotFoundException e) {\n System.out.println(\"Not found menu.json, exit now.\");\n System.exit(1);\n } catch (IOException e) {\n e.printStackTrace();\n } catch (ParseException e) {\n e.printStackTrace();\n }\n\n }", "@GET\n\t@Path(\"/helloJSONList\")\n\t/**\n\t * Here is an example of a simple REST get request that returns a String.\n\t * We also illustrate here how we can convert Java objects to JSON strings.\n\t * @return - List of words as JSON\n\t * @throws IOException\n\t */\n\tpublic String helloJSONList() throws IOException {\n\n\t\tList<String> listOfWords = new ArrayList<String>();\n\t\tlistOfWords.add(\"Hello\");\n\t\tlistOfWords.add(\"World!\");\n\n\t\t// We can turn arbatory Java objects directly into JSON strings using\n\t\t// Jackson seralization, assuming that the Java objects are not too complex.\n\t\tString listAsJSONString = oWriter.writeValueAsString(listOfWords);\n\n\t\treturn listAsJSONString;\n\t}", "static JsonResource forString( String contents ) {\n return new JsonResource() {\n @Override\n public <T> T readFrom( ReadMethod<T> consumer ) throws IOException {\n try ( ByteArrayInputStream stream = new ByteArrayInputStream(contents.getBytes(Json.getDefaultConfig().getCharset())) ) {\n return consumer.read(stream);\n }\n }\n };\n }", "private void downloadJSON() {\n new downloadJsonAsync().execute(Urls.GET_TAGS, Urls.GET_REST);\n }", "public JSONObject SourceResource() {\n JSONObject source = jsonParent.getJSONObject(\"sourceResource\");\n return source;\n }", "@Test\r\n public void testParseConnection() throws MalformedURLException {\r\n JsonArray array = null;\r\n JsonParser parser = new JsonParser();\r\n URL url = new URL(\"https://en.wikipedia.org/w/api.php?action=query&format=json&prop=revisions&titles=\\\" + \\\"Ball State\\\" + \\\"&rvprop=timestamp|user&rvlimit=24&redirects\");\r\n InputStream inputstream = getClass().getClassLoader().getResourceAsStream(\"sample.json\");\r\n assert inputstream != null;\r\n Reader reader = new InputStreamReader(inputstream);\r\n JsonElement rootElement = parser.parse(reader);\r\n JsonObject rootObject = rootElement.getAsJsonObject();\r\n JsonObject pages = rootObject.getAsJsonObject(\"query\").getAsJsonObject(\"pages\");\r\n for (Map.Entry<String, JsonElement> entry : pages.entrySet()) {\r\n JsonObject entryObject = entry.getValue().getAsJsonObject();\r\n array = entryObject.getAsJsonArray(\"revisions\");\r\n }\r\n System.out.println(array);\r\n System.out.println(url);\r\n }", "@VisibleForTesting\n interface JsonReader {\n /**\n * Returns the contents of the JSON file that is pointed to by the given {@code resId} as\n * a string.\n *\n * @param context The current Context.\n * @param resId The resource id of the JSON file.\n * @return A string representation of the file or {@code null} if an error occurred.\n */\n @Nullable\n String jsonFileToString(Context context, @RawRes int resId);\n }", "@Override\n public Map<String, Object> getResource() {\n List<Customer> customerList = customerRepository.findAllByName(\"toto\");\n Map<String,Object> model = new HashMap<String,Object>();\n model.put(\"id\", UUID.randomUUID().toString());\n model.put(\"content\", \"Hello World\");\n return model;\n }", "@Test\r\n public void testRevisionParser() {\r\n JsonParser parser = new JsonParser();\r\n InputStream inputstream = getClass().getClassLoader().getResourceAsStream(\"sample.json\");\r\n assert inputstream != null;\r\n Reader reader = new InputStreamReader(inputstream);\r\n JsonElement rootElement = parser.parse(reader);\r\n JsonObject rootObject = rootElement.getAsJsonObject();\r\n JsonObject pages = rootObject.getAsJsonObject(\"query\").getAsJsonObject(\"pages\");\r\n JsonArray array = null;\r\n for (Map.Entry<String, JsonElement> entry : pages.entrySet()) {\r\n JsonObject entryObject = entry.getValue().getAsJsonObject();\r\n array = entryObject.getAsJsonArray(\"revisions\");\r\n Assert.assertNotNull(array);\r\n }\r\n System.out.println(array);\r\n\r\n }", "public static List<String> mainReadFile(String[] args) throws IOException, URISyntaxException {\n List<String> exmp = new ArrayList<>();\n File initialFile = resolveFileFromResources(args[0]);\n // System.out.println(initialFile);\n ObjectMapper obM = getObjectMapper();\n Trades[] exmpTrade = obM.readValue(initialFile, Trades[].class);\n for (Trades trade : exmpTrade) {\n exmp.add(trade.getSymbol());\n }\n printJsonObject(exmp);\n //return Collections.emptyList();\n return exmp;\n }", "private void loadJSON() throws FileNotFoundException\n\t{\n\n\t\tGsonBuilder builder= new GsonBuilder();\n\t\tGson gson = builder.create();\n\t\t\t\t\n\t\t//get a list of folders in the data directory\n\t\t\n\t\tFile[] directories = new File(\"data\").listFiles();\n\n\t\t//Loop through folders in data directory\n\t\tfor(File folder : directories)\n\t\t\t{\n\t\t\t\t//get a list of files inside the folder\n\t\t\t\tFile[] jsonItems = new File(folder.toString()).listFiles();\n\t\t\t\t\n\t\t\t\t//Loop through files inside the folder \n\t\t\t\tfor(File file : jsonItems)\n\t\t\t\t{\n\t\t\t\t\t//Store in directory map... substring to remove the \"data/\" portion... placed by filename to foldername\n\t\t\t\t\tString dir = file.toString().substring(5);\n\t\t\t\t\t\n\t\t\t\t\t//Generate player data from gson\n\t\t\t\t\tJsonReader reader = new JsonReader(new FileReader(file));\n\t\t\t\t\tPlayer player = gson.fromJson(reader, Player.class);\n\t\t\t\t\t\n\t\t\t\t\t//Store it in the map tied to it's directory\n\t\t\t\t\tplayerData.put(dir, player);\n\t\t\t\t}\n\t\t\t}\n\t\t}", "private JsonObject loadJSONFile(String jsonFilePath) throws IOException {\r\n\tInputStream is = new FileInputStream(jsonFilePath);\r\n\tJsonReader jsonReader = Json.createReader(is);\r\n\tJsonObject json = jsonReader.readObject();\r\n\tjsonReader.close();\r\n\tis.close();\r\n\treturn json;\r\n }", "private JSONObject loadMetadata(Path extensionResourcePath) throws ExtensionManagementException {\n\n Path metadataPath = extensionResourcePath.resolve(METADATA_FILE_NAME);\n if (Files.exists(metadataPath) && Files.isRegularFile(metadataPath)) {\n return readJSONFile(metadataPath);\n }\n return null;\n }", "public void loadFromSource(Object aSrc)\n{\n WebURL url = WebURL.getURL(aSrc);\n String jsonText = url.getText();\n loadFromString(jsonText);\n}", "public JSONArray readFromJSON(){\n\n JSONArray jsonArray=null;\n\n try {\n InputStream inputStream =context.getResources().getAssets().open(FILE_NAME);\n int size = inputStream.available();\n byte[] data = new byte[size];\n inputStream.read(data);\n inputStream.close();\n String json = new String(data, \"UTF-8\");\n jsonArray = new JSONArray(json);\n } catch (IOException e) {\n e.printStackTrace();\n } catch (JSONException e) {\n e.printStackTrace();\n }\n return jsonArray;\n }", "private TabulatorItems[] getJsonArrayOfItems(Resource resource) {\n ObjectMapper mapper = new ObjectMapper();\n TabulatorItems[] items = null;\n try {\n items = mapper.readValue(new InputStreamReader(resource.getInputStream(), StandardCharsets.UTF_8), TabulatorItems[].class);\n } catch (IOException ex) {\n Logger.getLogger(CollectionApiUIImpl.class.getName()).log(Level.SEVERE, null, ex);\n }\n return items;\n }", "public void load() throws IOException {\r\n\t\tFile file = new File(projectDir, TERN_PROJECT);\r\n\t\tif (file.exists()) {\r\n\t\t\tJSONParser parser = new JSONParser();\r\n\t\t\ttry {\r\n\t\t\t\tJSONObject result = (JSONObject) parser.parse(new FileReader(\r\n\t\t\t\t\t\tfile));\r\n\t\t\t\tsuper.putAll(result);\r\n\t\t\t} catch (ParseException e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "private String loadJSONFromAsset(){\n String json = null;\n AssetManager assetManager = getAssets();\n try{\n InputStream IS = assetManager.open(\"datosFases.json\");\n int size = IS.available();\n byte[] buffer = new byte[size];\n IS.read(buffer);\n IS.close();\n json = new String(buffer,\"UTF-8\");\n\n } catch (IOException ex){\n ex.printStackTrace();\n return null;\n }\n\n return json;\n }", "public void testImportJSONFromRequestParam() throws IOException, JsonException {\n final String testPath = TEST_BASE_PATH;\n Map<String, String> props = new HashMap<String, String>();\n String testNode = testClient.createNode(HTTP_BASE_URL + testPath, props);\n urlsToDelete.add(testNode);\n\n props.clear();\n props.put(SlingPostConstants.RP_OPERATION,\n \t\tSlingPostConstants.OPERATION_IMPORT);\n\n String testNodeName = \"testNode_\" + String.valueOf(random.nextInt());\n props.put(SlingPostConstants.RP_NODE_NAME_HINT, testNodeName);\n String jsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/testimport.json\"));\n props.put(SlingPostConstants.RP_CONTENT, jsonContent);\n props.put(SlingPostConstants.RP_CONTENT_TYPE, \"json\");\n props.put(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + \"/*\");\n String importedNodeUrl = testClient.createNode(HTTP_BASE_URL + testPath, props);\n\n // assert content at new location\n String content = getContent(importedNodeUrl + \".3.json\", CONTENT_TYPE_JSON);\n\n\t\tJsonObject jsonObj = JsonUtil.parseObject(content);\n\t\tassertNotNull(jsonObj);\n\n\t\t//assert the imported content is there.\n String expectedJsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/importresults.json\"));\n\t\tassertExpectedJSON(JsonUtil.parseObject(expectedJsonContent), jsonObj);\n }", "private JSONObject getAssetJson(String filename) {\n return new JSONObject(\n resourceHandler.getResourceFileAsString(ResourceHandler.VALORANT_BASE_PATH + \"Data/\" + filename)\n );\n }", "public static void main(String[] args)\n\t\t\tthrows IOException, MalformedURLException, FileNotFoundException, IOException {\n\t\tString string = \"\";\n\n\t\tInputStream input = new FileInputStream(\"C:\\\\Users\\\\siva_\\\\workspace\\\\RESTfulExample1\\\\json.txt\");\n\n\t\tInputStreamReader reader = new InputStreamReader(input);\n\t\tBufferedReader bReader = new BufferedReader(reader);\n\t\tString line = null;\n\n\t\twhile ((line = bReader.readLine()) != null) {\n\t\t\tstring += line + \"\\n\";\n\t\t}\n\t\tbReader.close();\n\t\tJSONObject jsonObj = new JSONObject(string);\n\t\tSystem.out.println(\"The JSON File contents are:\");\n\t\tSystem.out.println(jsonObj.toString());\n\n\t\tURL url = new URL(\"http://localhost:8080/RESTfulExample1/api/JSONProcessorService\");\n\t\tSystem.out.println(\"connection opened at \" + url.getHost());\n\t\tURLConnection connection = url.openConnection();\n\n\t\tconnection.setDoOutput(true);\n\t\tconnection.setRequestProperty(\"Content-type\", \"application/json\");\n\t\tconnection.setConnectTimeout(5000);\n\t\tconnection.setReadTimeout(5000);\n\n\t\tOutputStreamWriter out = new OutputStreamWriter(connection.getOutputStream());\n\t\tout.write(jsonObj.toString());\n\t\tout.close();\n\t\t\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));\n\n\t\tif (br.readLine() == null) {\n\t\t\tSystem.out.println(\"Read nothing terminating.....\");\n\t\t\treturn;\n\t\t}\n\n\t\tSystem.out.println(\"Webservice invoked successfully\");\n\n\t}", "public static void readJSON() throws IOException {\n\t\tBufferedReader br = new BufferedReader(new FileReader(f));\n\t\tString line;\n\t\tif((line = br.readLine()) != null) {\n\t\t\tString [] flightStates = parseJSON(line);\n\t\t\tfor(String state : flightStates) {\n\t\t\t\tFlightState fs = new FlightState(state);\n\t\t\t\tsendToKafka(fs);\n\t\t\t}\n\t\t}\n\t\tbr.close();\n\t}", "@GET\n @Path(\"location/Arovince\")\n @Produces(\"application/json\")\n public String getJson() throws IOException {\n FileWriter file = new FileWriter(\"/home/component/NetBeansProjects/ArovinceAndSchool/web/api/Arovince.json\");\n JSONObject jsonArray = null;\n\n try {\n URL url = new URL(\"https://opend.data.go.th/get-ckan/datastore_search?resource_id=df922923-e009-4dee-92fc-d963a86ce4b8\"); \n HttpURLConnection httpURLConnection = (HttpURLConnection)url.openConnection();\n httpURLConnection.setRequestMethod(\"GET\");\n httpURLConnection.setRequestProperty(\"api-key\", \"XOe9aVTolOhCbyTU103IqAKTNNNPX8b5\");\n String line = \"\";\n InputStreamReader inputStreamReader = new InputStreamReader(httpURLConnection.getInputStream());\n BufferedReader bufferedReader = new BufferedReader(inputStreamReader);\n StringBuilder response = new StringBuilder();\n\n try {\n while((line = bufferedReader.readLine()) != null) {\n file.write(line);\n response.append(line);\n }\n } catch (IOException var10) {\n }\n\n file.close();\n bufferedReader.close();\n jsonArray = new JSONObject(response.toString());\n return jsonArray.toString(4);\n } catch (Exception var11) {\n return \"\" + var11;\n }\n }", "@Test\n public void toAndFromJsonTestWithFollowUpQuestions() throws IOException {\n Question bonusQuestion = new Question(\"BonusQ1\", \"This is a followupCounts to a followupCounts question!\", \"Plane\", \"Nice!\", Arrays.asList(\"Nice!\", \"Sweet!\", \"Cool!\"), \"../static/images/equine02.jpg\");\n Question attach1 = new Question(\"AttachQ1\", \"Which attachment is this?\", \"Attachment\",\n \"Type1\", Arrays.asList(\"Type1\", \"Type2\", \"Type3\"), \"../static/images/equine02.jpg\");\n Question attach2 = new Question(\"AttachQ2\", \"Which attachment is this?\", \"Attachment\",\n \"Type3\", Arrays.asList(\"Type1\", \"Type2\", \"Type3\"), \"../static/images/equine02.jpg\");\n Question attach3 = new Question(\"AttachQ1\", \"Which attachment is this?\", \"Attachment\",\n \"Type2\", Arrays.asList(\"Type1\", \"Type2\", \"Type3\"), \"../static/images/equine02.jpg\", Arrays.asList(bonusQuestion));\n List<Question> attachmentQuestions = Arrays.asList(attach1, attach2, attach3);\n Question myQ = new Question(\"StructureQ1\", \"What kind of structure is this?\", EquineQuestionTypes.structure.toString(), \"Structure1\", Arrays.asList(\"Structure1\", \"Structure2\", \"Structure3\"), \"../static/images/equine02.jpg\", attachmentQuestions);\n Question myQ2 = new Question(\"PlaneQ1\", \"What plane is this?\", EquineQuestionTypes.plane.toString(), \"Transverse\", Arrays.asList(\"Transverse\", \"Longitudinal\"), \"../static/images/equine02.jpg\");\n List<Question> hardcodedQuestions = Arrays.asList(myQ, myQ2);\n\n //Write to file\n JsonUtil.toJsonFile(\"src/test/resources/autoGenerated/questionsWithFollowup.json\", hardcodedQuestions);\n\n //Load back in\n List<Question> questionsFromFile = JsonUtil.listFromJsonFile(\"src/test/resources/autoGenerated/questionsWithFollowup.json\", Question.class);\n\n assertEquals(2, questionsFromFile.size());\n Question questionWithFollowups = questionsFromFile.get(0);\n assertEquals(3, questionWithFollowups.getFollowupQuestions().size());\n Question questionWithoutFollowups = questionsFromFile.get(1);\n assertEquals(0, questionWithoutFollowups.getFollowupQuestions().size());\n\n }", "public String loadJSONFromAsset() {\n String json = null;\n try {\n InputStream is = getAssets().open(\"election-county-2012.json\");\n int size = is.available();\n byte[] buffer = new byte[size];\n is.read(buffer);\n is.close();\n json = new String(buffer, \"UTF-8\");\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n }", "private void loadHelpContent() {\n\t\tGson gson = new GsonBuilder().setPrettyPrinting().create();\n\t\tBufferedReader br;\n\t\ttry {\n\t\t\tbr = new BufferedReader(\n\t\t\t\t\tnew UnicodeReader(new FileInputStream(new File(getHelpContentFilePath())), \"UTF-8\"));\n\t\t\tsx3ConfigurationHelp = gson.fromJson(br, SX3ConfiguartionHelp.class);\n\t\t\tSX3Manager.getInstance().setSx3ConfiguartionHelp(sx3ConfigurationHelp);\n\t\t} catch (FileNotFoundException e) {\n\t\t\tsx3ConfigurationHelp = new SX3ConfiguartionHelp();\n\t\t\tSX3Manager.getInstance().addLog(\"<span style='color:red;'>\" + e.getMessage() + \".</span><br>\");\n\n\t\t}\n\t}", "String getJson();", "String getJson();", "String getJson();", "private ArrayList<Book> loadBooks(InputStream is) throws IOException{\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(is));\r\n\t\tStringBuilder jsonFileContent = new StringBuilder();\r\n\t\t//read line by line from file\r\n\t\tString nextLine = null;\r\n\t\twhile ((nextLine = br.readLine()) != null){\r\n\t\t\tjsonFileContent.append(nextLine);\r\n\t\t}\r\n\r\n\t\tGson gson = new Gson();\r\n\t\t//this is a require type definition by the Gson utility so Gson will \r\n\t\t//understand what kind of object representation should the json file match\r\n\t\tType type = new TypeToken<ArrayList<Book>>(){}.getType();\r\n\t\tArrayList<Book> books = gson.fromJson(jsonFileContent.toString(), type);\r\n\t\t//close\r\n\t\tbr.close();\t\r\n\t\treturn books;\r\n\t}", "public String readJsonFile(String fileName)\n {\n FileInputStream fileInputStream = null;\n String text;\n StringBuilder stringBuilder = new StringBuilder();\n\n try\n {\n fileInputStream = mainContext.openFileInput(fileName);\n InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream);\n BufferedReader bufferedReader = new BufferedReader(inputStreamReader);\n\n while((text = bufferedReader.readLine()) != null)\n {\n stringBuilder.append(text).append(\"\\n\");\n }\n }\n catch (IOException e)\n {\n System.out.println(e.getMessage());\n }\n\n return stringBuilder.toString();\n }", "@Test\n\tpublic void testWithJsonPath() {\n\t\t\t\t\n\t\tResponse response = given().accept(ContentType.JSON)\n\t\t.and().pathParam(\"id\", 110)\n\t\t.when().get(ConfigurationReader.getProperty(\"hrapp.baseurl\")+\"/employees/{id}\");\n\t\t\n\t\tJsonPath json = response.jsonPath(); //get json body and assign to jsonPath object\n\t\t//we are assiging whole response to json object so we can easyly reach and use it \n\t\t\n\t\tSystem.out.println(json.getInt(\"employee_id\"));\n\t\tSystem.out.println(json.getString(\"first_name\"));\n\t\tSystem.out.println(json.getString(\"job_id\"));\n\t\tSystem.out.println(json.getInt(\"salary\"));\n\t\tSystem.out.println(json.getString(\"links[0].href\")); //get specific element from array \n\t \n\t\t//assign all hrefs into a list of strings \n\t\tList<String> hrefs = json.getList(\"links.href\");\n\t\t\n\t\t//everything in arraylist \n\t System.out.println(hrefs);\n\t \n\t //one by one \n\t\tfor(String href:hrefs) {\n\t\t\tSystem.out.println(href);\n\t\t}\n\t}", "public void testImportJSONFromFile() throws IOException, JsonException {\n final String testPath = TEST_BASE_PATH;\n Map<String, String> props = new HashMap<String, String>();\n String testNode = testClient.createNode(HTTP_BASE_URL + testPath, props);\n urlsToDelete.add(testNode);\n\n props.clear();\n props.put(SlingPostConstants.RP_OPERATION,\n \t\tSlingPostConstants.OPERATION_IMPORT);\n\n String testNodeName = \"testNode_\" + String.valueOf(random.nextInt());\n props.put(SlingPostConstants.RP_NODE_NAME_HINT, testNodeName);\n testFile = getTestFile(getClass().getResourceAsStream(\"/integration-test/servlets/post/testimport.json\"));\n props.put(SlingPostConstants.RP_CONTENT_TYPE, \"json\");\n props.put(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + \"/*\");\n String importedNodeUrl = testClient.createNode(HTTP_BASE_URL + testPath, new NameValuePairList(props), null, true,\n \t\ttestFile, SlingPostConstants.RP_CONTENT_FILE, null);\n\n // assert content at new location\n String content = getContent(importedNodeUrl + \".3.json\", CONTENT_TYPE_JSON);\n\n\t\tJsonObject jsonObj = JsonUtil.parseObject(content);\n\t\tassertNotNull(jsonObj);\n\n\t\t//assert the imported content is there.\n String expectedJsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/importresults.json\"));\n\t\tassertExpectedJSON(JsonUtil.parseObject(expectedJsonContent), jsonObj);\n }", "private Demo doReadDemo(final ClassLoader demoResourceLoader) throws IOException {\n final Demo demo = new Demo();\n\n final URL demoConfiguration = demoResourceLoader.getResource(CONFIGURATION_NAME);\n\n if (null == demoConfiguration) {\n logger.logWarning(\"No {0} found in demo root. Please configure the demo properly.\",\n CONFIGURATION_NAME);\n } else {\n // load demo configuration\n final Properties configuration = new Properties();\n final InputStream demoConfigurationStream = demoConfiguration.openStream();\n try {\n configuration.load(demoConfiguration.openStream());\n } finally {\n demoConfigurationStream.close();\n }\n demo.setConfiguration(configuration);\n \n final String environment = demo.getProperty(\"environment\");\n if(null == environment) {\n logger.logWarning(\"Demo environment has not been configured.\");\n } else {\n final String scenarios = demo.getProperty(\"scenarios\");\n if (null == scenarios) {\n logger.logWarning(\"Demo scenarios have not been configured.\");\n }\n final StringTokenizer tokenizer = new StringTokenizer(scenarios, \",\");\n while (tokenizer.hasMoreTokens()) {\n configureScenario(demo, tokenizer.nextToken(), demoResourceLoader);\n }\n }\n }\n return demo;\n }", "public void testImportJSONFromRequestParamWithoutOptionalName() throws IOException, JsonException {\n final String testPath = TEST_BASE_PATH;\n Map<String, String> props = new HashMap<String, String>();\n String testNode = testClient.createNode(HTTP_BASE_URL + testPath, props);\n urlsToDelete.add(testNode);\n\n props.clear();\n props.put(SlingPostConstants.RP_OPERATION,\n \t\tSlingPostConstants.OPERATION_IMPORT);\n\n String jsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/testimport2.json\"));\n props.put(SlingPostConstants.RP_CONTENT, jsonContent);\n props.put(SlingPostConstants.RP_CONTENT_TYPE, \"json\");\n props.put(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + \"/*\");\n String importedNodeUrl = testClient.createNode(HTTP_BASE_URL + testPath, props);\n\n //make sure the name is what was inside the file.\n assertTrue(importedNodeUrl.endsWith(\"/nodeName\"));\n\n // assert content at new location\n String content = getContent(importedNodeUrl + \".3.json\", CONTENT_TYPE_JSON);\n\n\t\tJsonObject jsonObj = JsonUtil.parseObject(content);\n\t\tassertNotNull(jsonObj);\n\n\t\t//assert the imported content is there.\n String expectedJsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/importresults.json\"));\n\t\tassertExpectedJSON(JsonUtil.parseObject(expectedJsonContent), jsonObj);\n }", "private SpecificationByExample loadSpecificationFromResource(Resource resource) throws IOException {\r\n Specification specification= specificationReader.readSpecification(resource);\r\n\r\n SpecificationByExample specificationByExample;\r\n if (specification instanceof SpecificationByExample) {\r\n specificationByExample = (SpecificationByExample) specification;\r\n } else {\r\n specificationByExample = new SpecificationToSpecificationByExampleAdaptor(specification);\r\n }\r\n specificationByExample.setFixtureClass(fixture);\r\n return specificationByExample;\r\n }", "public String loadJSONFromAsset() {\n String json = null;\n try {\n json = new String(buffer, \"UTF-8\");\n } catch (UnsupportedEncodingException e1) {\n e1.printStackTrace();\n }\n\n return json;\n }", "@Test\n\tpublic void testJsonPath() {\n\tString responseAsString=\n\t\twhen().\n\t\t\tget(\"http://jsonplaceholder.typicode.com/photos\").\n\t\tthen().\n\t\textract().asString();\n\t\t\n\tList<Integer> albumIds = from(responseAsString).get(\"id\");\n\tSystem.out.println(albumIds.size());\n\t}", "private static void readWineListFromFile() {\n\t\tJSONParser parser = new JSONParser();\n\n\t\ttry (Reader reader = new FileReader(\"wines.json\")) {\n\n\t\t\tJSONArray wineListJSON = (JSONArray) parser.parse(reader);\n\n\t\t\tfor (int i = 0 ; i < wineListJSON.size(); i++) {\n\t\t\t\tJSONObject wine = (JSONObject) wineListJSON.get(i);\n\t\t\t\tString name = (String) wine.get(\"name\");\n\t\t\t\tint year = Integer.valueOf(wine.get(\"year\").toString());\n\t\t\t\tString description = (String) wine.get(\"description\");\n\t\t\t\tString vine = (String) wine.get(\"vine\");\n\t\t\t\tint quantity = Integer.valueOf(wine.get(\"quantity\").toString());\n\t\t\t\tdouble price = (double) wine.get(\"price\");\n\n\t\t\t\t// Add the JSON object to the wine list\n\t\t\t\tMain.wineList.add(new Wine(name, year, description, vine, quantity, price));\n\n\t\t\t}\n\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t} catch (ParseException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "List<Resource> resources();", "public JSONObject read(InputStream uploadedInputStream);", "public String loadJSONFromAsset() {\n String json;\n try {\n InputStream is = getAssets().open(\"track_v0649.json\");\n int size = is.available();\n byte[] buffer = new byte[size];\n\n is.read(buffer);\n is.close();\n json = new String(buffer, \"UTF-8\");\n } catch (IOException ex) {\n ex.printStackTrace();\n return null;\n }\n return json;\n }", "public void testImportJSONFromFileWithoutOptionalName() throws IOException, JsonException {\n final String testPath = TEST_BASE_PATH;\n Map<String, String> props = new HashMap<String, String>();\n String testNode = testClient.createNode(HTTP_BASE_URL + testPath, props);\n urlsToDelete.add(testNode);\n\n props.clear();\n props.put(SlingPostConstants.RP_OPERATION,\n \t\tSlingPostConstants.OPERATION_IMPORT);\n\n testFile = getTestFile(getClass().getResourceAsStream(\"/integration-test/servlets/post/testimport2.json\"));\n props.put(SlingPostConstants.RP_CONTENT_TYPE, \"json\");\n props.put(SlingPostConstants.RP_REDIRECT_TO, SERVLET_CONTEXT + testPath + \"/*\");\n String importedNodeUrl = testClient.createNode(HTTP_BASE_URL + testPath, new NameValuePairList(props), null, true,\n \t\ttestFile, SlingPostConstants.RP_CONTENT_FILE, null);\n\n //make sure the name is what was inside the file.\n assertTrue(importedNodeUrl.endsWith(\"/nodeName\"));\n\n // assert content at new location\n String content = getContent(importedNodeUrl + \".3.json\", CONTENT_TYPE_JSON);\n\n\t\tJsonObject jsonObj = JsonUtil.parseObject(content);\n\t\tassertNotNull(jsonObj);\n\n\t\t//assert the imported content is there.\n String expectedJsonContent = getStreamAsString(getClass().getResourceAsStream(\"/integration-test/servlets/post/importresults.json\"));\n\t\tassertExpectedJSON(JsonUtil.parseObject(expectedJsonContent), jsonObj);\n }", "public void ready(final YuiContext Y) {\n\t\tJsArr data_in = JsArr.create(\n\t\t\tJsObject.one(\"make\", \"Chevrolet\")._(\"model\", \"Bel Air\")._(\"year\", 1957),\n\t\t\tJsObject.one(\"make\", \"Dodge\")._(\"model\", \"Dart\")._(\"year\", 1964),\n\t\t\tJsObject.one(\"make\", \"Ford\")._(\"model\", \"Mustang\")._(\"year\", 1968) \n\t\t); \n\t\tSchema schema = Schema.create().resultFields(new Field[]{\n\t\t\tField.create().key(\"model\"), Field.create().key(\"year\") \n\t\t}); \n\t\tDataSchemaResult data_out = Y.DataSchemaArray().apply(schema, data_in);\n\t\tWindow.alert(Y.dump(data_out.results())); //data_out.results().length()+\" - \"+JsUtil.dumpObj(data_out, true));\n\t\t\n\t\t\n\t\t//another little test, this time reading a json string contained mixed formed data\n\t\tString data_in2 = \"[\\n\"+\n\t\t\" {make:\\\"Chevrolet\\\",model:\\\"Bel Air\\\",year:1957},\\n\"+\n\t\t\" [\\\"Dodge\\\", \\\"Dart\\\", 1964],\\n\"+\n\t\t\" \\\"1968 Ford Mustang\\\"\\n\"+\n\t\t\"]\"; \n\t\t\n\t\tSchema schema2 = Schema.create().resultFields(new Field[]{\n\t\t\t\tField.create().key(\"make\"), Field.create().key(\"model\"), Field.create().key(\"year\") \n\t\t}); \n\t\tDataSchemaResult data_out2 = Y.DataSchemaArray().apply(schema2, JsonUtils.unsafeEval(data_in2));\n\t\tWindow.alert(Y.dump(data_out2.results())); \n\t}", "public JsonArray getJsonFromService(\n String myQuestion, //\n String endpoint, //\n float minimumConfidence, //\n RestTemplate restTemplate, //\n CacheOfRestTemplateResponse myCacheOfResponses //\n ) throws URISyntaxException, DBpediaSpotlightJsonParsingNotPossible {\n URI uri = createRequestUriWithParameters(myQuestion, endpoint, minimumConfidence);\n JsonObject response = fetchNamedEntitiesFromWebService(restTemplate, myCacheOfResponses, uri);\n JsonArray resources = getResourcesOfResponse(response, myQuestion);\n\n return resources;\n }", "@Override\n public String toString() {return \"Json-File Reader\";}", "public static void main(String[] args) throws IOException {\n\t\t// TODO Auto-generated method stub\n\t\tJsonFileParser parser = new JsonFileParser();\n\t\tparser.parseJsonFile(args);\n\t\tList<String> labelset = parser.getLset();\n\t\tfor(String label : labelset){\n\t\t\tSystem.out.println(label);\n\t\t}\n\t\tList<String> corpus = parser.getCorpus();\n\t\tfor(String doc : corpus){\n\t\t\tSystem.out.println(doc);\n\t\t}\n\t\tList<String> labels = parser.getLabels();\n\t\tfor(String label : labels){\n\t\t\tSystem.out.println(label);\n\t\t}\n\t\tList<String> headerInforList = parser.getPmids();\n\t\tfor(String pmid : headerInforList){\n\t\t\tSystem.out.println(pmid);\n\t\t}\n\t}", "public static void initialize() {\r\n\t\tjson = new JSONFile(filePath);\t\r\n\t}" ]
[ "0.65106744", "0.64942837", "0.621569", "0.6097948", "0.605114", "0.5976828", "0.59634453", "0.58937454", "0.5882496", "0.5728595", "0.5726738", "0.5716714", "0.5703193", "0.56933194", "0.56922007", "0.5684327", "0.5670406", "0.5665765", "0.5579029", "0.55726236", "0.5563291", "0.5542161", "0.5523732", "0.55018896", "0.54970455", "0.548195", "0.5474336", "0.54640186", "0.5443245", "0.54425824", "0.54421663", "0.5433782", "0.541568", "0.54123783", "0.54122406", "0.5405062", "0.5385872", "0.53744465", "0.5371214", "0.537099", "0.5369813", "0.5364451", "0.53542566", "0.5348374", "0.5348107", "0.5345096", "0.53292155", "0.5319196", "0.531579", "0.5307478", "0.53013295", "0.5296883", "0.5295683", "0.52945685", "0.5293875", "0.5287224", "0.52865434", "0.52824074", "0.5256617", "0.52546346", "0.52443564", "0.5238204", "0.5237661", "0.52361053", "0.5231939", "0.5221327", "0.5211724", "0.52102137", "0.5208383", "0.5208335", "0.5205505", "0.520267", "0.52007747", "0.5197523", "0.51931566", "0.5183759", "0.5158344", "0.5151503", "0.51513517", "0.51432705", "0.51432705", "0.51432705", "0.5140156", "0.5139785", "0.51395804", "0.51303816", "0.51262987", "0.5117251", "0.511516", "0.5113012", "0.5111478", "0.51105314", "0.51083374", "0.51013047", "0.50988775", "0.5087814", "0.5081152", "0.5077141", "0.507294", "0.50719947", "0.5064289" ]
0.0
-1
TODO: Warning this method won't work in the case the id fields are not set
@Override public boolean equals(Object object) { if (!(object instanceof FacilityCarrierShipment)) { return false; } FacilityCarrierShipment other = (FacilityCarrierShipment) object; if ((this.facilityCarrierShipmentPK == null && other.facilityCarrierShipmentPK != null) || (this.facilityCarrierShipmentPK != null && !this.facilityCarrierShipmentPK.equals(other.facilityCarrierShipmentPK))) { return false; } return true; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void setId(Integer id) { this.id = id; }", "private Integer getId() { return this.id; }", "public void setId(int id){ this.id = id; }", "public void setId(Long id) {this.id = id;}", "public void setId(Long id) {this.id = id;}", "public void setID(String idIn) {this.id = idIn;}", "public void setId(int id) { this.id = id; }", "public void setId(int id) { this.id = id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public int getId() { return id; }", "public void setId(long id) { this.id = id; }", "public void setId(long id) { this.id = id; }", "public int getId(){ return id; }", "public int getId() {return id;}", "public int getId() {return Id;}", "public int getId(){return id;}", "public void setId(long id) {\n id_ = id;\n }", "private int getId() {\r\n\t\treturn id;\r\n\t}", "public Integer getId(){return id;}", "public int id() {return id;}", "public long getId(){return this.id;}", "public int getId(){\r\n return this.id;\r\n }", "@Override public String getID() { return id;}", "public Long id() { return this.id; }", "public Integer getId() { return id; }", "@Override\n\tpublic Integer getId() {\n return id;\n }", "@Override\n public Long getId () {\n return id;\n }", "@Override\n public long getId() {\n return id;\n }", "public Long getId() {return id;}", "public Long getId() {return id;}", "public String getId(){return id;}", "@Override\r\n\tpublic Long getId() {\n\t\treturn null;\r\n\t}", "public Integer getId() { return this.id; }", "@Override\r\n public int getId() {\n return id;\r\n }", "@Override\n\t\tpublic long getId() {\n\t\t\treturn 0;\n\t\t}", "public int getId() {\n return id;\n }", "public long getId() { return _id; }", "public int getId() {\n/* 35 */ return this.id;\n/* */ }", "public long getId() { return id; }", "public long getId() { return id; }", "public void setId(Long id) \n {\n this.id = id;\n }", "@Override\n\tpublic Long getId() {\n\t\treturn null;\n\t}", "@Override\n\tpublic Long getId() {\n\t\treturn null;\n\t}", "public void setId(String id) {\n this.id = id;\n }", "@Override\n\tpublic void setId(Long id) {\n\t}", "public Long getId() {\n return id;\n }", "public long getId() { return this.id; }", "public int getId()\n {\n return id;\n }", "public void setId(int id){\r\n this.id = id;\r\n }", "@Test\r\n\tpublic void testSetId() {\r\n\t\tbreaku1.setId(5);\r\n\t\texternu1.setId(6);\r\n\t\tmeetingu1.setId(7);\r\n\t\tteachu1.setId(8);\r\n\r\n\t\tassertEquals(5, breaku1.getId());\r\n\t\tassertEquals(6, externu1.getId());\r\n\t\tassertEquals(7, meetingu1.getId());\r\n\t\tassertEquals(8, teachu1.getId());\r\n\t}", "protected abstract String getId();", "@Override\n\tpublic int getId(){\n\t\treturn id;\n\t}", "public int getID() {return id;}", "public int getID() {return id;}", "public String getId() { return id; }", "public String getId() { return id; }", "public String getId() { return id; }", "public int getId ()\r\n {\r\n return id;\r\n }", "@Override\n public int getField(int id) {\n return 0;\n }", "public void setId(Long id)\n/* */ {\n/* 66 */ this.id = id;\n/* */ }", "public int getId(){\r\n return localId;\r\n }", "void setId(int id) {\n this.id = id;\n }", "@Override\n public Integer getId() {\n return id;\n }", "@Override\n\tpublic Object selectById(Object id) {\n\t\treturn null;\n\t}", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "private void clearId() {\n \n id_ = 0;\n }", "@Override\n public int getId() {\n return id;\n }", "@Override\n public int getId() {\n return id;\n }", "public void setId(int id)\n {\n this.id=id;\n }", "@Override\r\n public int getID()\r\n {\r\n\treturn id;\r\n }", "@Override\n\tpublic Integer getId() {\n\t\treturn null;\n\t}", "public int getId()\r\n {\r\n return id;\r\n }", "public void setId(Long id){\n this.id = id;\n }", "@java.lang.Override\n public int getId() {\n return id_;\n }", "@java.lang.Override\n public int getId() {\n return id_;\n }", "private void clearId() {\n \n id_ = 0;\n }", "final protected int getId() {\n\t\treturn id;\n\t}", "public abstract Long getId();", "public void setId(Long id) \r\n {\r\n this.id = id;\r\n }", "@Override\n public long getId() {\n return this.id;\n }", "public String getId(){ return id.get(); }", "@SuppressWarnings ( \"unused\" )\n private void setId ( final Long id ) {\n this.id = id;\n }", "public void setId(long id){\n this.id = id;\n }", "public void setId(long id){\n this.id = id;\n }", "public void setId(Integer id)\r\n/* */ {\r\n/* 122 */ this.id = id;\r\n/* */ }", "public Long getId() \n {\n return id;\n }", "@Override\n\tpublic void setId(int id) {\n\n\t}", "public void test_getId() {\n assertEquals(\"'id' value should be properly retrieved.\", id, instance.getId());\n }", "@Override\r\n\tpublic Object getId() {\n\t\treturn null;\r\n\t}", "public int getID(){\n return id;\n }", "public int getId()\n {\n return id;\n }", "public String getID(){\n return Id;\n }" ]
[ "0.6896886", "0.6838461", "0.67056817", "0.66419715", "0.66419715", "0.6592331", "0.6579151", "0.6579151", "0.6574321", "0.6574321", "0.6574321", "0.6574321", "0.6574321", "0.6574321", "0.65624106", "0.65624106", "0.65441847", "0.65243006", "0.65154546", "0.6487427", "0.6477893", "0.6426692", "0.6418966", "0.6416817", "0.6401561", "0.63664836", "0.63549376", "0.63515353", "0.6347672", "0.6324549", "0.6319196", "0.6301484", "0.62935394", "0.62935394", "0.62832105", "0.62710917", "0.62661785", "0.6265274", "0.6261401", "0.6259253", "0.62559646", "0.6251244", "0.6247282", "0.6247282", "0.6245526", "0.6238957", "0.6238957", "0.6232451", "0.62247443", "0.6220427", "0.6219304", "0.6211484", "0.620991", "0.62023336", "0.62010616", "0.6192621", "0.61895776", "0.61895776", "0.61893976", "0.61893976", "0.61893976", "0.6184292", "0.618331", "0.61754644", "0.6173718", "0.6168409", "0.6166131", "0.6161708", "0.6157667", "0.6157667", "0.6157667", "0.6157667", "0.6157667", "0.6157667", "0.6157667", "0.61556244", "0.61556244", "0.61430943", "0.61340135", "0.6128617", "0.6127841", "0.61065215", "0.61043483", "0.61043483", "0.6103568", "0.61028486", "0.61017346", "0.6101399", "0.6098963", "0.6094214", "0.6094", "0.6093529", "0.6093529", "0.6091623", "0.60896", "0.6076881", "0.60723215", "0.6071593", "0.6070138", "0.6069936", "0.6069529" ]
0.0
-1
Call writeCSV with default value
public void writeEvaluateResultCSV(String resultFilePath) { writeCSV(resultFilePath, evaluates()); System.out.println("write evaluate result finished:" + resultFilePath); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void createCSV() {\n\t\t// Need to integrate CSV calling logic\n\t}", "CSV createCSV();", "@Override\n\tpublic void exportToCSV() {\n\n\t}", "@Test\n public void testOutputCSV() throws Throwable {\n testOutputCSV(false);\n }", "void createCsv(String location);", "public void exportToCSV();", "public interface ICsvListWriter extends ICsvWriter {\n\t\n\t/**\n\t * Writes a List of Objects as columns of a CSV file. <tt>toString()</tt> will be called on each element prior to\n\t * writing.\n\t * \n\t * @param columns\n\t * the columns to write\n\t * @throws IllegalArgumentException\n\t * if columns.size == 0\n\t * @throws IOException\n\t * If an I/O error occurs\n\t * @throws NullPointerException\n\t * if columns is null\n\t * @throws SuperCsvException\n\t * if there was a general exception while writing\n\t * @since 1.0\n\t */\n\tvoid write(List<?> columns) throws IOException;\n\t\n\t/**\n\t * Writes a List of Objects as columns of a CSV file, performing any necessary processing beforehand.\n\t * <tt>toString()</tt> will be called on each (processed) element prior to writing.\n\t * \n\t * @param columns\n\t * the columns to write\n\t * @param processors\n\t * an array of CellProcessors used to further process data before it is written (each element in the\n\t * processors array corresponds with a CSV column - the number of processors should match the number of\n\t * columns). A <tt>null</tt> entry indicates no further processing is required (the value returned by\n\t * toString() will be written as the column value).\n\t * @throws IllegalArgumentException\n\t * if columns.size == 0\n\t * @throws IOException\n\t * If an I/O error occurs\n\t * @throws NullPointerException\n\t * if columns or processors is null\n\t * @throws SuperCsvConstraintViolationException\n\t * if a CellProcessor constraint failed\n\t * @throws SuperCsvException\n\t * if there was a general exception while writing/processing\n\t * @since 1.0\n\t */\n\tvoid write(List<?> columns, CellProcessor[] processors) throws IOException;\n\t\n\t/**\n\t * Writes a array of Objects as columns of a CSV file. <tt>toString()</tt> will be called on each element prior to\n\t * writing.\n\t * \n\t * @param columns\n\t * the columns to write\n\t * @throws IllegalArgumentException\n\t * if columns.length == 0\n\t * @throws IOException\n\t * If an I/O error occurs\n\t * @throws NullPointerException\n\t * if columns is null\n\t * @throws SuperCsvException\n\t * if there was a general exception while writing\n\t * @since 1.0\n\t */\n\tvoid write(Object... columns) throws IOException;\n\t\n\t/**\n\t * Writes an array of strings as columns of a CSV file.\n\t * \n\t * @param columns\n\t * the columns to write\n\t * @throws IllegalArgumentException\n\t * if columns.length == 0\n\t * @throws IOException\n\t * If an I/O error occurs\n\t * @throws NullPointerException\n\t * if columns is null\n\t * @throws SuperCsvException\n\t * if there was a general exception while writing\n\t * @since 1.0\n\t */\n\tvoid write(String... columns) throws IOException;\n\t\n}", "private void writeCsv(float[] vals, String stimulus, PrintWriter outfile) throws FileNotFoundException {\n for (int i = 0; i < vals.length; i++) {\n outfile.append(vals[i] + \",\");\n }\n outfile.append(stimulus);\n outfile.append(\"\\n\");\n\n }", "public void csv() throws IOException {\n\t\t\n\t\tSystem.out.println(); //spacing\\\n\t\tFileWriter f;\n\t\t\n\t\tif (bundle.getString(\"csvName\").endsWith(\".csv\")) {\n\t\t\tf = new FileWriter(bundle.getString(\"csvName\"));\n\t\t}\n\t\t\n\t\telse {\n\t\t\tf = new FileWriter(bundle.getString(\"csvName\") + \".csv\");\n\t\t}\n\t\t\n\t\tPrintWriter p = new PrintWriter(f);\n\t\tObject[][] input = {revisionsToo, flowOfTime};\n\t\tCSVWork(input, p, f);\n\t\t\n\t\tObject[][] nextInput = {revisions, ratings};\n\t\tCSVWork(nextInput, p, f);\n\t\t\n\t\tnextInput[1] = irrelevants;\n\t\tCSVWork(nextInput, p, f);\n\t\t\n\t\tnextInput[1] = relevants;\n\t\tCSVWork(nextInput, p, f);\n\t\t\n\t\tnextInput[0] = intervals;\n\t\tnextInput[1] = commits;\n\t\tCSVWork(nextInput, p, f);\n\t\t\n\t\tspecialCSV(existsHere, p);\n\t\t\n\t\tp.flush();\n\t\tp.close();\n\t\tf.close();\n\t}", "@Test\n @Ignore(\"Need to implement\")\n public void testOutputDynamicCsvMode() throws Throwable {\n testOutputDynamic(true);\n }", "public void createCsvFile(String fileName) { \n \n try { \n \n fileWriter = new FileWriter(fileName); \n \n //Write the CSV file header \n fileWriter.append(FILE_HEADER.toString()); \n \n //Add a new line separator after the header \n fileWriter.append(NEW_LINE_SEPARATOR); \n \n System.out.println(\"CSV file was created successfully !!!\"); \n \n } catch (Exception e) { \n \n System.out.println(\"Error in CsvFileWriter !!!\"); \n e.printStackTrace(); \n \n } finally { \n \n try {\n \n fileWriter.flush(); \n //fileWriter.close(); \n \n } catch (IOException e) { \n \n System.out.println(\"Error while flushing/closing fileWriter !!!\"); \n e.printStackTrace(); \n } \n \n } \n \n}", "@Override\n public void saveCSVFile(String csvPath, String output) {\n this.csvPath = csvPath;\n BufferedWriter outputFile = null;\n\n try {\n outputFile = new BufferedWriter(new FileWriter(this.csvPath));\n if (this.header == null) {\n this.header = Rules.getDefaultHeaders();\n }\n outputFile.write(header);\n outputFile.write(output);\n outputFile.close();\n } catch (FileNotFoundException fnfe) {\n System.out.println(\"File not found\");\n } catch (IOException ioe) {\n System.out.println(\"Something went wrong\");\n }\n }", "@Override\n\tpublic void configuration(String csv) {\n\n\t}", "public static void csvWrite(FileWriter csvWriter, String[] data) {\n try {\n for(int j = 0; j < data.length; j++) {\n if(j < data.length -1) {\n csvWriter.write(data[j] + \", \");\n } else {\n csvWriter.write(data[j] + \"\\n\");\n }\n }\n } catch (IOException e) {\n System.out.println(\"Writing error: \" + e.getMessage());\n }\n }", "String toCSVString();", "public static void writeCSV(Calendar cal) {\n\n try {\n\n BufferedWriter bw = null;\n\n String fileString = \"P5Calendar.csv\";\n String fileLine = \"\";\n\n FileWriter fw = new FileWriter(fileString, false);\n bw = new BufferedWriter(fw);\n\n ArrayList<Activity> activities = cal.getActivities();\n\n for (int j = 0; j < 1; j++) {\n bw.write(\"Year\" + \",\" + \"Month\" + \",\" + \"Activity\" + \",\" + \"Role\" + \"\\n\");\n }\n\n for (int i = 0; i < activities.size(); i++) {\n Activity activity = activities.get(i);\n bw.append(activity.Year + \",\" + activity.Month + \",\" + activity.Name + \",\" + activity.Roles);\n }\n\n bw.close();\n\n } catch (IOException e) {\n\n e.printStackTrace();\n\n }\n\n }", "@Override\n\tpublic void createCSVOutput() {\n\t\tFile file = new File(\"rejectedByEsteticalRestructurationRejector.csv\"); \n\t\t\n\t\t//test if the file already exist\n\t\tif(file.exists()) {\n\t\t\tSystem.out.println(\"le fichier rejectedByEstheticalRestructurationRejector.csv existe deja\");\n\t\t\tSystem.exit(0);\n\t\t}\n\t\t\n\t\t//create the different column for the CSV file\n\t\tString[] titles = { \"before\" , \"after\", \"id\"};\n\t\ttry {\n\t\t\toutputFile = new CsvFileWriter(file, '\\t', titles);\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\t\t\n\t}", "public static void writeCSV(Collection<? extends CSVable> src, File to) throws IOException {\r\n\t\tfinal String SYSTEM_LINE_END = System.getProperty(\"line.separator\");\r\n\t\t\r\n\t\tFileWriter fw = null;\r\n\t\tBufferedWriter bw = null;\r\n\t\t\r\n\t\ttry {\r\n\t\t\t// Create the file if it doesn't exist yet\r\n\t\t\tif ( ! to.exists() ) {\r\n\t\t\t\tto.createNewFile();\r\n\t\t\t}\r\n\r\n\t\t\tfw = new FileWriter(to.getAbsoluteFile(), false);\r\n\t\t\tbw = new BufferedWriter(fw);\r\n\r\n\t\t\tsynchronized (src) {\r\n\t\t\t\tfor ( CSVable obj : src ) {\r\n\t\t\t\t\tbw.write(obj.toCSVRow() + SYSTEM_LINE_END);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\tfinally {\r\n\t\t\ttry {\r\n\t\t\t\tif (bw != null) {\r\n\t\t\t\t\tbw.close();\r\n\t\t\t\t}\r\n\t\t\t\tif (fw != null) {\r\n\t\t\t\t\tfw.close();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tcatch (IOException e) {\r\n\t\t\t\tSystem.err.println(\"I'm having really bad luck today - I couldn't even close the CSV file!\");\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t}", "String[] toCSV() throws Exception;", "private void initializewriters() {\n try {\n outputfile = new FileWriter(journeyfile);\n // create CSVWriter object filewriter object as parameter\n writer = new CSVWriter(outputfile);\n\n // adding header to csv\n String[] header = {\"Lat\", \"Lng\", \"Zacc\", \"Timestamp\"};\n writer.writeNext(header);\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n\n }", "private void openCsvDialog(){\n JFileChooser aFileChooser = new JFileChooser();\n aFileChooser.setFileFilter(new MyFileFilterCSV());\n if (lastUsedFileCSV != null){\n aFileChooser.setCurrentDirectory(lastUsedFileCSV.getParentFile());\n aFileChooser.setSelectedFile(lastUsedFileCSV);\n }else{\n File file = new File(aFileChooser.getCurrentDirectory(), dataset.getName()+\".csv\");\n aFileChooser.setSelectedFile(file);\n }\n int r = aFileChooser.showSaveDialog(this);\n if (r == JFileChooser.APPROVE_OPTION){\n setCursor(new Cursor(Cursor.WAIT_CURSOR));\n File file = aFileChooser.getSelectedFile();\n if(!MyUtilities.isCSVFile(file)){\n file = MyUtilities.getCSVFile(file);\n }\n lastUsedFileCSV = file;\n String sep = getCSVSeparator();\n PrintWriter writer = null;\n try{\n writer = new PrintWriter(new BufferedWriter (new OutputStreamWriter(new FileOutputStream(file), \"utf-8\")));\n // header\n String s = \"\";\n for(int j=0; j<dataset.getListDataHeader().length; j++){\n s += dataset.getListDataHeader()[j] == null? \"\" : dataset.getListDataHeader()[j].getValue();\n if(j <dataset.getListDataHeader().length -1)\n s+= sep;\n }\n writer.println(s);\n // data\n Data[][] data = dataset.getData();\n int nbR = dataset.getNbRows();\n int nbC = dataset.getNbCol();\n for(int i=0; i<nbR; i++){\n s = \"\";\n for(int j=0; j<nbC; j++){\n if(data[i][j] != null){\n if(data[i][j].isDoubleValue()){\n if(!Double.isNaN(data[i][j].getDoubleValue()))\n s += NumberFormat.getNumberInstance(getLocale()).format(data[i][j].getDoubleValue());\n }else{\n s += data[i][j].getValue();\n }\n }\n if(j <nbC -1)\n s+= sep;\n }\n writer.println(s);\n }\n //log\n\t\tdataProcessToolPanel.logExportCSV(dataset, file.getPath());\n }catch (IOException e){\n setCursor(new Cursor(Cursor.DEFAULT_CURSOR));\n displayError(new CopexReturn(getBundleString(\"MSG_ERROR_CSV\"), false), getBundleString(\"TITLE_DIALOG_ERROR\"));\n }\n finally{\n if (writer != null)\n try{\n writer.close();\n setCursor(new Cursor(Cursor.DEFAULT_CURSOR));\n }catch (Exception e){\n setCursor(new Cursor(Cursor.DEFAULT_CURSOR));\n displayError(new CopexReturn(getBundleString(\"MSG_ERROR_CSV\"), false), getBundleString(\"TITLE_DIALOG_ERROR\"));\n }\n }\n }\n }", "public static void writeToCSV() {\n final String CSV_SEPARATOR = \",\";\n final String QUOTE = \"\\\"\";\n if (!Crawler.getKeyWordsHits().isEmpty()) {\n try (BufferedWriter bufferedWriter =\n new BufferedWriter(\n new OutputStreamWriter(\n new FileOutputStream(\"results.csv\", true), StandardCharsets.UTF_8))) {\n\n Crawler.getKeyWordsHits().forEach((keyWord, hitsNumber) -> {\n String oneLine = QUOTE + keyWord + QUOTE +\n CSV_SEPARATOR +\n hitsNumber;\n try {\n bufferedWriter.write(oneLine);\n bufferedWriter.newLine();\n } catch (IOException e) {\n e.printStackTrace();\n }\n });\n String lastLine = QUOTE + Crawler.getUrl() + QUOTE + CSV_SEPARATOR + Crawler.getTotalHits();\n bufferedWriter.write(lastLine);\n bufferedWriter.newLine();\n bufferedWriter.flush();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n Crawler.setKeyWordsHits(new HashMap<>());\n Crawler.setTotalHits(0);\n }", "private static void createCSV(String filename, ArrayList<Long> sizes, ArrayList<Long> times){\n File csv = new File(\"\"+filename);\n try {\n if(csv.createNewFile()) {\n PrintWriter file = new PrintWriter(new FileWriter(csv));\n file.print(\"Size (n)\");\n for (Long size : sizes)\n file.print(\",\" + size);\n file.print(\"\\nTimes (ms)\");\n for(Long time:times)\n file.print(\",\"+time);\n file.println();\n file.close();\n\n } else {\n Scanner fileReader = new Scanner(csv);\n String currentSizes = fileReader.nextLine();\n int size=currentSizes.split(\",\").length-1;\n if(size<sizes.size()){\n for(int i=size;i<sizes.size();i++)\n currentSizes+=\",\"+sizes.get(i);\n currentSizes+=\"\\n\";\n while(fileReader.hasNextLine())\n currentSizes+=fileReader.nextLine()+\"\\n\";\n FileWriter writer = new FileWriter(csv);\n writer.write(currentSizes);\n writer.close();\n }\n\n PrintWriter file = new PrintWriter(new FileWriter(csv,true));\n file.print(\"Times (ms)\");\n for(Long time:times)\n file.print(\",\"+time);\n file.println();\n file.close();\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n }", "private void writePzIntoCsv(double[] vals, PrintWriter outfile) {\n for (int i = 0; i < vals.length; i++) {\n outfile.append(vals[i] + \",\");\n }\n //outfile.append(stimulus);\n outfile.append(\"\\n\");\n }", "public void closeCsvFile()\n{\n try {\n \n fileWriter.flush(); \n fileWriter.close(); \n \n } catch (IOException e) { \n \n System.out.println(\"Error while flushing/closing fileWriter !!!\"); \n e.printStackTrace(); \n } \n \n}", "public void writeToCsv()\r\n {\r\n //listeye urunler eklendiginde cagrılacak (Products.csv)\r\n PrintWriter pWrite = null;\r\n try {\r\n pWrite = new PrintWriter(new File(\"Products.csv\"));\r\n }\r\n catch (FileNotFoundException e) {\r\n e.printStackTrace();\r\n }\r\n StringBuilder sBuilder = new StringBuilder();\r\n for (Product theProduct : allProducts ) {\r\n if (theProduct.getSize() == null && theProduct.getGender()!= null){\r\n sBuilder.append(theProduct.getName() + \";\" + theProduct.getPrice() + \";\"\r\n + theProduct.getGender() + \";\" + theProduct.getTag() + \";\"\r\n + theProduct.getContent() + \";\" + theProduct.getNumberOfProduct() + \"\\n\");\r\n }\r\n else if(theProduct.getGender() == null && theProduct.getSize() == null){\r\n sBuilder.append( theProduct.getName() + \";\" + theProduct.getPrice() + \";\"\r\n + theProduct.getTag() + \";\"+\r\n theProduct.getContent() + \";\" + theProduct.getNumberOfProduct() + \"\\n\");\r\n }\r\n else {\r\n sBuilder.append( theProduct.getName() + \";\" + theProduct.getPrice() + \";\" + theProduct.getSize() + \";\"\r\n + (theProduct).getGender() + \";\" + theProduct.getTag() + \";\"\r\n + theProduct.getContent() + \";\" + theProduct.getNumberOfProduct() + \"\\n\");\r\n }\r\n\r\n }\r\n pWrite.write(sBuilder.toString());\r\n pWrite.flush();\r\n pWrite.close();\r\n }", "public static void writeNewCSV(Calendar cal) {\n\n try {\n\n BufferedWriter bw = null;\n\n String fileString = \"P5Calendar.csv\";\n String fileLine = \"\";\n\n FileWriter fw = new FileWriter(fileString, true);\n bw = new BufferedWriter(fw);\n\n ArrayList<Activity> activities = cal.getActivities();\n\n int lastElement = activities.size();\n Activity activity = activities.get(lastElement - 1);\n bw.write(activity.Year + \",\" + activity.Month + \",\" + activity.Name + \",\" + activity.Roles.name + \" \" + \"(\"\n + activity.Roles.subRole + \")\" + \"\\n\");\n\n bw.close();\n\n } catch (IOException e) {\n\n e.printStackTrace();\n\n }\n }", "private void save(List<String[]> data, Integer numFichier, String nomFichier) throws IOException {\n FileWriter fileWriter = null;\n CSVWriter cSVWriter2 = null;\n //-------------------------------------------------------------\n // Construction du nom de fichier\n //-------------------------------------------------------------\n\n\n// String nomFichier = constructionNomFichier(flux);\n\n// // Mini rappel sur les ternaire en java : variable = (condition) ? valeur_si_vrai : valeur_si_faux; \n// String pays = (flux.getJournalLie() != null && flux.getJournalLie().getPays() != null && !flux.getJournalLie().getPays().isEmpty()) ? flux.getJournalLie().getPays() : \"XX\";\n// String ville = (flux.getJournalLie() != null && flux.getJournalLie().getCodeVille() != null && !flux.getJournalLie().getCodeVille().isEmpty()) ? flux.getJournalLie().getCodeVille() : \"XX\";\n// String langue = (flux.getJournalLie() != null && flux.getJournalLie().getLangue() != null && !flux.getJournalLie().getLangue().isEmpty()) ? flux.getJournalLie().getLangue() : \"XX\";\n// String codeJournal = (flux.getJournalLie() != null && flux.getJournalLie().getCodeJournal() != null && !flux.getJournalLie().getCodeJournal().isEmpty()) ? flux.getJournalLie().getCodeJournal() : \"XX\";\n// String codeTypeFlux = (flux.getTypeFlux() != null && flux.getTypeFlux().getCodeType() != null && !flux.getTypeFlux().getCodeType().isEmpty()) ? flux.getTypeFlux().getCodeType() : \"XXX\";\n//\n// nomFichier = langue + \"_\" + pays + \"_\" + codeJournal + \"_\" + codeTypeFlux;\n\n //--------------------------------------------------------------------------------\n // Enregistrement \n //--------------------------------------------------------------------------------\n try {\n fileWriter = new FileWriter(exportPath + nomFichier + \"__F__\" + numFichier.toString() + \".csv\");\n\n if (escapebySlash) {\n cSVWriter2 = new CSVWriter(fileWriter, '\\t', '\"', '\\\\');\n } else {\n cSVWriter2 = new CSVWriter(fileWriter, '\\t', '\"');\n }\n\n cSVWriter2.writeAll(data);\n\n\n } catch (Exception e) {\n logger.debug(\"Erreur lors de l'enregistrement\");\n } finally {\n if (cSVWriter2 != null) {\n try {\n cSVWriter2.close();\n } catch (Exception e) {\n }\n }\n\n if (fileWriter != null) {\n try {\n fileWriter.close();\n } catch (Exception e) {\n }\n }\n }\n\n data.clear(); // On purge le fichier data\n //---------------------------------------------------------------------------\n // Assemblage \n //---------------------------------------------------------------------------\n // Si ce n'est pas le premier fichier. Il faut réassembler\n// if (numFichier != 0) {\n// File f1 = new File(exportPath + nomFichier + \"__F__0.csv\");\n// File fCurrent = new File(exportPath + nomFichier + \"__F__\" + numFichier.toString() + \".csv\");\n// \n// String content = FileUtils.readFileToString(fCurrent);\n// FileUtils.write(f1, content, true);\n// \n// fCurrent.delete();\n// }\n }", "@RequestMapping(\"/generatecsv\")\r\n\tpublic String generateCsvFile() throws CsvDataTypeMismatchException, CsvRequiredFieldEmptyException {\r\n\r\n\t\tList<FinalCritExtDTO> list = service.generateDataForCsvFile();\r\n\r\n\t\tif (Objects.nonNull(list) && !list.isEmpty()) {\r\n\t\t\tlogger.info(\"data fetched from db and mapped of size \" + list.size());\r\n\t\t\twriter.writeDataAtOnce(list);\r\n\t\t} else\r\n\t\t\tlogger.info(\"No records found in db to be written\");\r\n\t\tlogger.debug(\"File successfully generated\");\r\n\t\treturn \"SUCCESS\";\r\n\t}", "public void writeCSVtable(String outBuffer) throws IOException\n {\n String csvFile;\n // Create a file chooser\n File currentDir = new File(\"\").getAbsoluteFile();\n final JFileChooser fc = new JFileChooser(currentDir);\n // In response to a button click:\n int returnVal = fc.showSaveDialog(null);\n // open file\n File file = fc.getSelectedFile();\n // obtain filename\n csvFile = file.getName();\n\n // open the file\n fWriter = new FileWriter(csvFile); \n // write ALL the to the file in 1 burst\n fWriter.write(outBuffer); \n // close the file\n fWriter.close();\n }", "public static void writeDataToCsvUsingStringArrayForActivity(PrintWriter writer, List<ActivityTabDTO> activityTabList, List<AssayTabDTO> assayTabDTOList, List<ReferenceTabDTO> referenceTabDTOList, List<StructureDetailsTabDTO> structureDetailsTabDTOList) {\n\n String[] CSV_ACTIVITY_TITLE = {\"Activity Details\"};\n String[] CSV_ACTIVITY_NEWLINE = {\"\"};\n\n String[] CSV_ACTIVITY_HEADER = {\"ACT_ID\", \"ASSAY_ID\", \"REF_ID\", \"GVK_ID\", \"ACTIVITY_TYPE\", \"STD_ACTIVITY_TYPE\", \"ACTIVITY_UOM\", \"STANDARD_UOM\", \"ACTIVITY_PREFIX\", \"STD_ACT_PREFIX\", \"ACTIVITY_VALUE\", \"SD\", \"ACTIVITY_REMARKS\", \"MICRO_MOLARVALUE\", \"ASSAY_TYPE\", \"ENZYME_CELL_ASSAY\", \"COMMON_NAME\", \"ACTIVITY_MECHANISM\", \"SOURCE\", \"CELLS_CELLLINE_ORGAN\", \"MEASURED\", \"ROA\", \"ASSAY_METHOD_NAME\", \"DOSE\", \"DOSE_UOM\", \"DOSE_PREFIX\", \"ACTIVITY\", \"PARAMETER\", \"REFERENCE\"};\n\n try (\n CSVWriter csvWriter = new CSVWriter(writer,\n CSVWriter.DEFAULT_SEPARATOR,\n CSVWriter.DEFAULT_ESCAPE_CHARACTER,\n CSVWriter.DEFAULT_LINE_END);\n ) {\n csvWriter.writeNext(CSV_ACTIVITY_TITLE);\n csvWriter.writeNext(CSV_ACTIVITY_HEADER);\n if (Objects.nonNull(activityTabList)) {\n for (ActivityTabDTO activityTabDataReturn : activityTabList) {\n for (AssayTabDTO assayTabDTO : assayTabDTOList) {\n for (ReferenceTabDTO referenceTabDTO : referenceTabDTOList) {\n for (StructureDetailsTabDTO reStructureDetailsTabDTO : structureDetailsTabDTOList) {\n String[] activityData = new String[]{\n activityTabDataReturn.getActId() + \"\",\n assayTabDTO.getAssayId() + \"\",\n referenceTabDTO.getRefId() + \"\",\n reStructureDetailsTabDTO.getGvkId() + \"\",\n activityTabDataReturn.getActivityType(),\n activityTabDataReturn.getStdActivityType() + \"\",\n activityTabDataReturn.getActivityUom() + \"\",\n activityTabDataReturn.getStandardUom() + \"\",\n activityTabDataReturn.getActivityPrefix() + \"\",\n activityTabDataReturn.getStdActPrefix() + \"\",\n activityTabDataReturn.getActivityValue() + \"\",\n activityTabDataReturn.getSd() + \"\",\n activityTabDataReturn.getActivityRemarks() + \"\",\n activityTabDataReturn.getMicroMolarvalue() + \"\",\n activityTabDataReturn.getAssayType() + \"\",\n activityTabDataReturn.getEnzymeCellAssay() + \"\",\n activityTabDataReturn.getCommonName() + \"\",\n activityTabDataReturn.getActivityMechanism() + \"\",\n activityTabDataReturn.getSource() + \"\",\n activityTabDataReturn.getCellsCelllineOrgan() + \"\",\n activityTabDataReturn.getMeasured() + \"\",\n activityTabDataReturn.getRoa() + \"\",\n activityTabDataReturn.getAssayMethodName() + \"\",\n activityTabDataReturn.getDose() + \"\",\n activityTabDataReturn.getDoseUom() + \"\",\n activityTabDataReturn.getDosePrefix() + \"\",\n activityTabDataReturn.getActivity() + \"\",\n activityTabDataReturn.getParameter() + \"\",\n activityTabDataReturn.getReference() + \"\",\n\n };\n\n csvWriter.writeNext(activityData);\n }\n }\n }\n }\n csvWriter.writeNext(CSV_ACTIVITY_NEWLINE);\n csvWriter.writeNext(CSV_ACTIVITY_NEWLINE);\n }\n\n\n } catch (Exception e) {\n System.out.println(\"Exception occured into the ActivityTab Data Export\" + e.getMessage());\n e.printStackTrace();\n }\n\n }", "private void writeCSVToFile(List<String[]> dataRows, String filepath) {\n try {\n FileWriter output = new FileWriter(filepath);\n CSVWriter csvWriter = new CSVWriter(output);\n\n csvWriter.writeAll(dataRows);\n\n csvWriter.close();\n\n System.out.println(\"Your order has been succesfully sent to Foodora\");\n\n } catch (IOException e) {\n System.out.println(\"Could not write to Foodora output file\");\n }\n\n }", "@Test\n public void testOutputCsvStream() throws Throwable {\n testOutputCSV(true);\n }", "@Override\n public String getDataInCSV() {\n return String.format(Locale.US, \"%d,%s\", this.timestamp, this.getStatusString());\n }", "public static void writeIntoCSVFromTable() {\n try {\n backItUp(ROOT);\n backItUp(ROOT + Calendar.getInstance().getTime() + \"/\");\n } catch (Throwable e) {\n itsLogger.error(e.getMessage(), e);\n }\n\n }", "@Test\n public void detailCompareDefaultDelimiterNoCompareOption(){\n LOGGER.info(\"------------- Start running detailCompareDefaultDelimiterNoCompareOption -------------\");\n srcCsv = Constant.RESOURCE_PATH + \"pluginautomation/sample/csv/output.csv\";\n desCsv = Constant.RESOURCE_PATH + \"pluginautomation/sample/csv/target.csv\";\n boolean result = CsvUtil.compareCsv(srcCsv, desCsv, null,null);\n assertTrue(result);\n }", "public void generateCSV(numList l) {\r\n\t\tFile file = new File(\"E:\\\\altruism results/\" + filename + \".csv\"); //the storage path of the csv file\r\n\t\ttry {\r\n\t\t\tif (file.exists() == false) {\r\n\t\t\t\tfile.createNewFile();\r\n\t\t\t}\r\n\t\t\tFileWriter fw = new FileWriter(file);\r\n\t\t\tBufferedWriter writer = new BufferedWriter(fw);\r\n\t\t\twriter.write(\"altruism,selfish\\r\\n\");\r\n\t\t\tfor (int i = 0; i < numList.TIME; i++) {\r\n\t\t\t\twriter.write(l.aList[i] + \",\");\r\n\t\t\t\twriter.write(l.sList[i] + \"\\r\\n\");\r\n\t\t\t}\r\n\r\n\t\t\twriter.flush();\r\n\t\t\twriter.close();\r\n\t\t\tfw.close();\r\n\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public static void CSVExport(String output, LinkedList<Patient> src, boolean[] shouldEx) {\n\t\tExportSepValuesFile(output, src, \",\", shouldEx);\n\t}", "private void writePauseCSV(Date start_time, Date end_time, double duration, String file_path) throws IOException {\n CSVWriter pause_csv_writer = null;\n List<String[]> read_all = new ArrayList<String[]>();\n List<String[]> write_all = new ArrayList<String[]>();\n String total_write_line[] = new String[6];\n String next_write_line[] = new String[3];\n double total_time_paused = 0;\n int number_of_pauses = 0;\n double average_pause_duration = 0;\n\n CSVReader pause_reader = null;\n\n try {\n pause_reader = new CSVReader(new FileReader(file_path), ',', '\"', 0);\n\n } catch (FileNotFoundException ex) {\n\n }\n\n if (pause_reader != null) {\n\n read_all = pause_reader.readAll();\n\n //remove the total line because this will be recalculated\n read_all.remove(read_all.size() - 1);\n\n //add the components to the read_all object\n next_write_line[0] = start_time.toString();\n next_write_line[1] = end_time.toString();\n next_write_line[2] = String.valueOf(duration);\n\n //add the new line to the read_all object\n read_all.add(next_write_line);\n\n int i = 1;\n\n //loop through the read_all object to recalculate the totals\n while (i < read_all.size()) {\n number_of_pauses++;\n total_time_paused = total_time_paused + Double.parseDouble(read_all.get(i)[2]);\n i++;\n }\n\n average_pause_duration = (Double) total_time_paused / number_of_pauses;\n\n total_write_line[0] = \"Number of Pauses:\";\n total_write_line[1] = String.valueOf(number_of_pauses);\n total_write_line[2] = \"Total Time Spent Paused:\";\n total_write_line[3] = String.valueOf(total_time_paused);\n total_write_line[4] = \"Average Pause Duration:\";\n total_write_line[5] = String.valueOf(average_pause_duration);\n\n read_all.add(total_write_line);\n\n pause_csv_writer = new CSVWriter(new FileWriter(file_path));\n pause_csv_writer.writeAll(read_all);\n pause_csv_writer.close();\n\n } else {\n pause_csv_writer = new CSVWriter(new FileWriter(file_path));\n\n //this code will only run after the first pause is recorded for the\n // activity so the first line and the total line will be equal\n next_write_line[0] = \"Pause Start Time\";\n next_write_line[1] = \"Pause End Time\";\n next_write_line[2] = \"Pause Duration\";\n pause_csv_writer.writeNext(next_write_line);\n\n next_write_line[0] = start_time.toString();\n next_write_line[1] = end_time.toString();\n next_write_line[2] = String.valueOf(duration);\n pause_csv_writer.writeNext(next_write_line);\n\n total_write_line[0] = \"Number of Pauses:\";\n total_write_line[1] = \"1\";\n total_write_line[2] = \"Total Time Spent Paused:\";\n total_write_line[3] = String.valueOf(duration);\n total_write_line[4] = \"Average Pause Duration:\";\n total_write_line[5] = String.valueOf(duration);\n\n // write the two initial lines to the csv\n pause_csv_writer.writeNext(total_write_line);\n pause_csv_writer.flush();\n pause_csv_writer.close();\n }\n\n }", "public void openCSVStream() {\n\t\ttry {\n\t\t\twriter = new CSVWriter(new FileWriter(getCSVFolder() + File.separator + getFileName() + \".csv\"), ',');\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public static void writeCsvFile(List<Person> currentState, Path exportPath) {\n requireNonNull(currentState);\n File dir = new File(exportPath.toString());\n dir.mkdirs();\n\n SimpleDateFormat dateFormat = new SimpleDateFormat(\"dd-MM-yy HH-mm-ss\");\n Date date = new Date();\n String exportUniqueName = \"export[\" + dateFormat.format(date) + \"].csv\";\n Path exportFilePath = Paths.get(exportPath.toString() , exportUniqueName);\n try {\n FileUtil.createIfMissing(exportFilePath);\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n\n try {\n serializeObjectToCsvFile(exportFilePath, currentState);\n } catch (IOException e) {\n logger.warning(\"Error writing from CsvFile file \" + exportFilePath);\n }\n }", "@Override\n protected void getSummaryCSV() throws IOException {\n if (!\"\".equals(config.statsfile.trim()))\n ((IVoltDBConnection)connection).writeSummaryCSV(fullStatsContext.fetch().getStats(), config.statsfile);\n }", "@Test\n public void detailCompareDefaultDelimiterWithCompareOption(){\n LOGGER.info(\"------------- Start running detailCompareDefaultDelimiterWithCompareOption -------------\");\n srcCsv = Constant.RESOURCE_PATH + \"pluginautomation/sample/csv/output.csv\";\n desCsv = Constant.RESOURCE_PATH + \"pluginautomation/sample/csv/target.csv\";\n boolean result = CsvUtil.compareCsv(srcCsv, desCsv, null,null, CsvUtil.CompareOptions.TRUE_FALSE_IS_1_0, CsvUtil.CompareOptions.SKIP_NUMBER_TYPE);\n assertTrue(result);\n }", "private static void generateCsvFileWithFinalData(File path) // String sFileName\n {\n String COMMA_DELIMITER = \",\";\n String NEW_LINE_SEPARATOR = \"\\n\";\n try\n {\n // String path to our created output data file\n String finalFilePath = String.valueOf(path.getParent()) + \"\\\\test.csv\";\n FileWriter writer = new FileWriter(finalFilePath);\n\n for (Player player : sortedFinalPlayerList) {\n writer.append(player.getLastName());\n writer.append(COMMA_DELIMITER);\n writer.append(player.getFirstName());\n writer.append(COMMA_DELIMITER);\n writer.append(player.getCountry());\n writer.append(COMMA_DELIMITER);\n writer.append(String.valueOf(player.getLongCommSubsCounter()));\n writer.append(NEW_LINE_SEPARATOR);\n }\n\n //generate whatever data you want\n writer.flush();\n writer.close();\n }\n catch(IOException e)\n {\n e.printStackTrace();\n }\n }", "public void saveFile(int theValue) {\n if (!outputInitialized) {\n return;\n }\n int largest = 0;\n for (int i=0; i<totSamples.length; i++) {\n if (totSamples[i]> largest) {\n largest = totSamples[i];\n }\n //myArray[i] = list_Samples[i].getListBoxItems();\n }\n String fname = ano + nf(mes, 2)+ nf(dia, 2) + nf(hora, 2) + nf(min, 2) + nf(sec, 2);\n foutput = createWriter(\"dados_\"+fname +\".csv\");\n\n\n\n for (int i=0; i<largest; i++) {\n String line =\"\";\n String[] val = new String[6];\n for (int j=0; j < numSamples; j++) {\n if (i < totSamples[j]) {\n ListBoxItem lb1 = list_Samples[j].getItem(i);\n val[j]=lb1.getText();\n } else {\n val[j]=\"\";\n }\n line += val[j]+\",\";\n } \n if (outputInitialized) {\n foutput.println(i+\",\"+line);\n }\n }\n foutput.flush(); // Writes the remaining data to the file\n foutput.close();\n}", "private Result outputCsv(Request request, Entry entry) throws Exception {\r\n Result result = getCsvResult(request, entry);\r\n result.setReturnFilename(\r\n IOUtil.stripExtension(getStorageManager().getFileTail(entry))\r\n + \".csv\");\r\n result.setMimeType(\"text/csv\");\r\n\r\n return result;\r\n }", "public void writeCSVLine(int[] entries) {\n\t\tint size = entries.length;\n\t\tString[] convertedEntries = new String[size];\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tconvertedEntries[i] = Integer.toString(entries[i]);\n\t\t}\n\t\twriter.writeNext(convertedEntries);\n\t}", "public static void writeIntoMappingCSV(String fileName, MappingClass newRecords, String[] header) throws Exception {\n logger.info(\"Start executing writeIntoMappingCSV method !!!\");\n\n FileWriter fileWriter = null;\n CSVPrinter csvFilePrinter = null;\n List mappingFileRecords = new ArrayList();\n\n CSVFormat csvFileFormat = CSVFormat.DEFAULT.withHeader(header);\n try {\n fileWriter = new FileWriter(fileName);\n csvFilePrinter = new CSVPrinter(fileWriter, csvFileFormat);\n for (Map.Entry<String, Integer> entry : newRecords.entrySet()) {\n mappingFileRecords.clear();\n mappingFileRecords.add(entry.getKey());\n mappingFileRecords.add(entry.getValue());\n csvFilePrinter.printRecord(mappingFileRecords);\n }\n\n logger.info(\"Successfully : writeIntoMappingCSV CSV file was created successfully !!!\");\n } finally {\n try {\n fileWriter.flush();\n fileWriter.close();\n csvFilePrinter.close();\n } finally {\n logger.warn(\"End executing writeIntoMappingCSV method !!!\");\n }\n }\n }", "void write(String... columns) throws IOException;", "public static void writeDataToCsvUsingStringArrayForAssay(PrintWriter writer, List<AssayTabDTO> assayTabList, List<ReferenceTabDTO> referenceTabDTOList, List<StructureDetailsTabDTO> structureDetailsTabDTOList) {\n\n String[] CSV_ASSAY_TITLE = {\"Assay Details\"};\n\n String[] CSV_ASSAY_HEADER = {\"ASSAY_ID\", \"REF_ID\", \"GVK_ID\", \"PROTEIN\", \"STANDARD_NAME\", \"MUTANT\", \"WILD_TYPE\", \"NEW_RESIDUE\", \"OLD_RESIDUE\", \"OPERATION\", \"ASSAY_POSITION\", \"TARGET_PROFILE\", \"P_S_M\", \"BUFFER\", \"BUFFER_CONC\", \"BUFFER_PREFIX\", \"BUFFER_UOM\", \"SUBSTRATE\", \"SUBSTRATE_CONC\", \"SUBSTRATE_PREFIX\", \"SUBSTRATE_UOM\", \"RADIO_LIGAND\", \"RADIO_LIGAND_PREFIX\", \"RADIO_LIGAND_UOM\", \"RADIO_LIGAND_CONC\", \"CO_ADMINISTERED\", \"CO_ADMINISTERED_PREFIX\", \"CO_ADMINISTERED_UOM\", \"CO_ADMINISTERED_VALUE\", \"IN_PRESENCE_OF\", \"IN_PRESENCE_OF_CONC\", \"IN_PRESENCE_OF_PREFIX\", \"IN_PRESENCE_OF_UOM\", \"INCUBATION_TIME\", \"INCUBATION_PREFIX\", \"INCUBATION_UOM\", \"TEMPERATURE\", \"TEMPERATURE_PREFIX\", \"TEMPERATURE_UOM\", \"PH_PREFIX\", \"PH\"};\n\n try (\n CSVWriter csvWriter = new CSVWriter(writer,\n CSVWriter.DEFAULT_SEPARATOR,\n CSVWriter.DEFAULT_ESCAPE_CHARACTER,\n CSVWriter.DEFAULT_LINE_END);\n ) {\n csvWriter.writeNext(CSV_ASSAY_TITLE);\n csvWriter.writeNext(CSV_ASSAY_HEADER);\n for (AssayTabDTO assayTabDataReturn : assayTabList) {\n for (ReferenceTabDTO referenceTabDTO : referenceTabDTOList) {\n for (StructureDetailsTabDTO structureDetailsTabDTO : structureDetailsTabDTOList) {\n String[] assayData = new String[]{\n assayTabDataReturn.getAssayId() + \"\",\n referenceTabDTO.getRefId() + \"\",\n structureDetailsTabDTO.getGvkId() + \"\",\n assayTabDataReturn.getProtein() + \"\",\n assayTabDataReturn.getStandardName() + \"\",\n assayTabDataReturn.getMutant() + \"\",\n assayTabDataReturn.getWildType() + \"\",\n assayTabDataReturn.getNewResidue() + \"\",\n assayTabDataReturn.getOldResidue() + \"\",\n assayTabDataReturn.getOperation() + \"\",\n assayTabDataReturn.getAssayPosition() + \"\",\n assayTabDataReturn.getTargetProfile() + \"\",\n assayTabDataReturn.getP_s_m() + \"\",\n assayTabDataReturn.getBuffer() + \"\",\n assayTabDataReturn.getBufferConc() + \"\",\n assayTabDataReturn.getBufferPrefix() + \"\",\n assayTabDataReturn.getBufferUom() + \"\",\n assayTabDataReturn.getSubstrate() + \"\",\n assayTabDataReturn.getSubstrateConc() + \"\",\n assayTabDataReturn.getSubstratePrefix() + \"\",\n assayTabDataReturn.getSubstrateUom() + \"\",\n assayTabDataReturn.getRadioLigand() + \"\",\n assayTabDataReturn.getRadioLigandPrefix() + \"\",\n assayTabDataReturn.getRadioLigandUom() + \"\",\n assayTabDataReturn.getRadioLigandConc() + \"\",\n assayTabDataReturn.getCoAdministered() + \"\",\n assayTabDataReturn.getCoAdministeredPrefix() + \"\",\n assayTabDataReturn.getCoAdministeredUom() + \"\",\n assayTabDataReturn.getCoAdministeredValue() + \"\",\n assayTabDataReturn.getInPresenceOf() + \"\",\n assayTabDataReturn.getInPresenceOfConc() + \"\",\n assayTabDataReturn.getInPresenceOfPrefix() + \"\",\n assayTabDataReturn.getInPresenceOfUom() + \"\",\n assayTabDataReturn.getIncubationTime() + \"\",\n assayTabDataReturn.getIncubationPrefix() + \"\",\n assayTabDataReturn.getIncubationUom() + \"\",\n assayTabDataReturn.getTemperature() + \"\",\n assayTabDataReturn.getTemperaturePrefix() + \"\",\n assayTabDataReturn.getTemperatureUom() + \"\",\n assayTabDataReturn.getPhPrefix() + \"\",\n assayTabDataReturn.getPh() + \"\"\n\n };\n\n csvWriter.writeNext(assayData);\n }\n }\n\n }\n\n\n } catch (Exception e) {\n System.out.println(\"Exception occured into the AssayTab Data Export\" + e.getMessage());\n e.printStackTrace();\n }\n\n }", "public void ach_doc_type_csv_test () {\n\t\t\n\t}", "public String[] toCsv();", "void write(Object... columns) throws IOException;", "@Test\n public void testIncludeHeaderCSV() throws Throwable {\n testIncludeHeaderCSV(false);\n }", "private void writeCsvHeader(String h1, String h2, String h3,String h4,String h5) throws IOException\r\n {\r\n \t String line = String.format(\"%s,%s,%s,%s,%s\\n\",h1,h2,h3,h4,h5);\r\n \t writer.write(line);\r\n }", "@Override\n\t\t\tpublic void run() {\n\t\t\t\tString filePath = env.getProperty(\"export.file.path\");\n\t\t\t\tFileSystem fileSystem = FileSystems.getDefault();\n\t\t\t\tif (StringUtils.isNotEmpty(empId)) {\n\t\t\t\t\tfilePath += \"/\" + empId;\n\t\t\t\t}\n\t\t\t\tPath path = fileSystem.getPath(filePath);\n\t\t\t\t// path = path.resolve(String.valueOf(empId));\n\t\t\t\tif (!Files.exists(path)) {\n\t\t\t\t\tPath newEmpPath = Paths.get(filePath);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tFiles.createDirectory(newEmpPath);\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tlog.error(\"Error while creating path \" + newEmpPath);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfilePath += \"/\" + exportFileName;\n\t\t\t\ttry {\n\t\t\t\t\t// initialize FileWriter object\n\t\t\t\t\tlog.debug(\"filePath = \" + filePath + \", isAppend=\" + isAppend);\n\t\t\t\t\tfileWriter = new FileWriter(filePath, isAppend);\n\t\t\t\t\t// initialize CSVPrinter object\n\t\t\t\t\tcsvFilePrinter = new CSVPrinter(fileWriter, csvFileFormat);\n\t\t\t\t\tif (!isAppend) {\n\t\t\t\t\t\t// Create CSV file header\n\t\t\t\t\t\tcsvFilePrinter.printRecord(JOB_DETAIL_REPORT_FILE_HEADER);\n\t\t\t\t\t}\n\t\t\t\t\tfor (JobDTO transaction : content) {\n\t\t\t\t\t\tList record = new ArrayList();\n\t\t\t\t\t\tlog.debug(\"Writing transaction record for site :\" + transaction.getSiteName());\n\t\t\t\t\t\trecord.add(transaction.getSiteName());\n\t\t\t\t\t\trecord.add(String.valueOf(transaction.getTitle()));\n\t\t\t\t\t\trecord.add(transaction.getEmployeeName());\n\t\t\t\t\t\trecord.add(transaction.getJobType());\n\t\t\t\t\t\trecord.add(transaction.getPlannedStartTime());\n\t\t\t\t\t\trecord.add(transaction.getActualEndTime());\n\t\t\t\t\t\trecord.add(transaction.getJobStatus() != null ? transaction.getJobStatus().name()\n\t\t\t\t\t\t\t\t: JobStatus.OPEN.name());\n\t\t\t\t\t\tcsvFilePrinter.printRecord(record);\n\t\t\t\t\t}\n\t\t\t\t\tlog.info(exportFileName + \" CSV file was created successfully !!!\");\n\t\t\t\t\tstatusMap.put(exportFileName, \"COMPLETED\");\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tlog.error(\"Error in CsvFileWriter !!! \" + e);\n\t\t\t\t\tstatusMap.put(exportFileName, \"FAILED\");\n\t\t\t\t} finally {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfileWriter.flush();\n\t\t\t\t\t\tfileWriter.close();\n\t\t\t\t\t\tcsvFilePrinter.close();\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tlog.error(\"Error while flushing/closing fileWriter/csvPrinter !!!\");\n\t\t\t\t\t\tstatusMap.put(exportFileName, \"FAILED\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlock.unlock();\n\t\t\t}", "private void addLineToCSV(String str) throws IOException\r\n {\r\n csvOutput.write(str.getBytes());\r\n csvOutput.write('\\n');\r\n }", "@Override\n\t\t\tpublic void run() {\n\t\t\t\tString filePath = env.getProperty(\"export.file.path\");\n\t\t\t\tFileSystem fileSystem = FileSystems.getDefault();\n\t\t\t\t// if(StringUtils.isNotEmpty(empId)) {\n\t\t\t\t// filePath += \"/\" + empId;\n\t\t\t\t// }\n\t\t\t\tPath path = fileSystem.getPath(filePath);\n\t\t\t\t// path = path.resolve(String.valueOf(empId));\n\t\t\t\tif (!Files.exists(path)) {\n\t\t\t\t\tPath newEmpPath = Paths.get(filePath);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tFiles.createDirectory(newEmpPath);\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tlog.error(\"Error while creating path \" + newEmpPath);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfilePath += \"/\" + exportFileName;\n\t\t\t\ttry {\n\t\t\t\t\t// initialize FileWriter object\n\t\t\t\t\tlog.debug(\"filePath = \" + filePath + \", isAppend=\" + isAppend);\n\t\t\t\t\tfileWriter = new FileWriter(filePath, isAppend);\n\t\t\t\t\t// initialize CSVPrinter object\n\t\t\t\t\tcsvFilePrinter = new CSVPrinter(fileWriter, csvFileFormat);\n\t\t\t\t\tif (!isAppend) {\n\t\t\t\t\t\t// Create CSV file header\n\t\t\t\t\t\tcsvFilePrinter.printRecord(EMPLOYEE_DETAIL_REPORT_FILE_HEADER);\n\t\t\t\t\t}\n\t\t\t\t\t// Write a new student object list to the CSV file\n\t\t\t\t\tfor (EmployeeDTO transaction : content) {\n\t\t\t\t\t\tList record = new ArrayList();\n\t\t\t\t\t\t// log.debug(\"Writing transaction record for Employee id :\"+\n\t\t\t\t\t\t// transaction.getEmployeeEmpId());\n\t\t\t\t\t\trecord.add(transaction.getEmpId());\n\t\t\t\t\t\trecord.add(transaction.getName());\n\t\t\t\t\t\trecord.add(transaction.getDesignation());\n\t\t\t\t\t\trecord.add(transaction.getManagerName());\n\t\t\t\t\t\trecord.add(transaction.getProjectName());\n\t\t\t\t\t\trecord.add(transaction.getSiteName());\n\t\t\t\t\t\trecord.add(transaction.getActive());\n\t\t\t\t\t\tcsvFilePrinter.printRecord(record);\n\t\t\t\t\t}\n\t\t\t\t\tlog.info(exportFileName + \" CSV file was created successfully !!!\");\n\t\t\t\t\tstatusMap.put(exportFileName, \"COMPLETED\");\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tlog.error(\"Error in CsvFileWriter !!!\");\n\t\t\t\t\tstatusMap.put(exportFileName, \"FAILED\");\n\t\t\t\t} finally {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfileWriter.flush();\n\t\t\t\t\t\tfileWriter.close();\n\t\t\t\t\t\tcsvFilePrinter.close();\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tlog.error(\"Error while flushing/closing fileWriter/csvPrinter !!!\");\n\t\t\t\t\t\tstatusMap.put(exportFileName, \"FAILED\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlock.unlock();\n\t\t\t}", "@Test\n public void detailCompareDefaultDelimiterBooleanOption(){\n LOGGER.info(\"------------- Start running detailCompareDefaultDelimiterNoCompareOption -------------\");\n srcCsv = Constant.RESOURCE_PATH + \"pluginautomation/sample/csv/output.csv\";\n desCsv = Constant.RESOURCE_PATH + \"pluginautomation/sample/csv/target.csv\";\n boolean result = CsvUtil.compareCsv(srcCsv, desCsv, null,null, CsvUtil.CompareOptions.TRUE_FALSE_IS_1_0);\n assertTrue(result);\n }", "@Bean\r\n public ItemWriter<OrderEntity> databaseCsvItemWriter() {\r\n LOG.debug(\"=== databaseCsvItemWriter\");\r\n FlatFileItemWriter<OrderEntity> csvFileWriter = new FlatFileItemWriter<>();\r\n\r\n // Extracting column names from properties file\r\n ArrayList<String> columns = (ArrayList<String>) fileProperties.getColumns();\r\n String columnsHeaders = \"\";\r\n for (int i = 0; i < columns.size(); i++) {\r\n columnsHeaders += columns.get(i);\r\n if (i < (columns.size() - 1)) {\r\n columnsHeaders += \",\";\r\n }\r\n }\r\n LOG.debug(\"=== columnsHeaders=>\" + columnsHeaders);\r\n\r\n StringHeaderWriter headerWriter = new StringHeaderWriter(columnsHeaders);\r\n csvFileWriter.setHeaderCallback(headerWriter);\r\n\r\n // Extracting destination file from properties file, adding de suffix Processed\r\n String exportFilePath =\r\n fileProperties.getName().substring(0, fileProperties.getName().lastIndexOf('.'))\r\n + \"Processed.csv\";\r\n LOG.debug(\"=== exportFilePath=>\" + exportFilePath);\r\n csvFileWriter.setResource(new FileSystemResource(exportFilePath));\r\n\r\n LineAggregator<OrderEntity> lineAggregator = createOrderLineAggregator();\r\n csvFileWriter.setLineAggregator(lineAggregator);\r\n\r\n return csvFileWriter;\r\n }", "public CSVExporter() {\n super(NAME, CONTENTTYPE);\n }", "public boolean saveData(String gameType, Board board, int time, String name1, String name2,\n String playerType1, String playerType2, int turn) throws IOException{\n System.out.println(\"Saving....\");\n nameFile(SAVE);\n m_FileName = PATH+ m_FileName +FILETYPE;\n m_Writer = new CSVWriter(new FileWriter(m_FileName));\n m_Data = new ArrayList<String[]>();\n m_LoadBoard = board.getBoard();\n\n for (int i = 0; i < BOARD_ROWS; i++) {\n for (int j = 0; j < BOARD_COLS; j++) {\n if (m_LoadBoard[j][i].getColour().equals(\"Red\")){\n m_Data.add(new String[] {gameType, String.valueOf(j), String.valueOf(i), m_LoadBoard[j][i].getColour(),\n name1, playerType1, String.valueOf(turn), String.valueOf(time)});\n\n } else if (m_LoadBoard[j][i].getColour().equals(\"Yellow\")){\n m_Data.add(new String[] {gameType, String.valueOf(j), String.valueOf(i), m_LoadBoard[j][i].getColour(),\n name2, playerType2, String.valueOf(turn), String.valueOf(time)});\n\n } else {\n m_Data.add(new String[] {gameType, String.valueOf(j), String.valueOf(i),\n m_LoadBoard[j][i].getColour(), \"\", \"\", String.valueOf(turn), String.valueOf(time)});\n }\n }\n }\n m_Writer.writeAll(m_Data);\n m_Writer.close();\n return true;\n }", "public void exportCsv() throws IOException\n {\n File csvOutputFile = new File(\"datas.csv\");\n try (PrintWriter writer = new PrintWriter(csvOutputFile)) {\n StringBuilder sb = new StringBuilder();\n sb.append(\"Temps\");\n sb.append(\",\");\n for (String title : this.getModelLabels())\n {\n sb.append(title);\n sb.append(\",\");\n }\n sb.append(\"\\n\");\n for (int i = 0; i < this.getEtatPopulation().size(); i++)\n {\n sb.append(i);\n sb.append(\",\");\n for (double value : this.getEtatPopulation().get(i))\n {\n sb.append(value);\n sb.append(\",\");\n }\n sb.append(\"\\n\");\n }\n writer.write(sb.toString());\n System.out.println(\"Datas Successfully Exported !\");\n }\n catch (Exception e)\n {\n System.out.println(e.getMessage());\n }\n\n }", "public static void createCSV(Passengers passengers) {\n String csvFile = \"miles_per_existing_member_NEW.csv\";\n try {\n writer = new FileWriter(csvFile);\n \n \n \n Map<Long,Integer> Members = passengers.getMembers();\n \n writeLine(Arrays.asList(\"memberID\",\"miles\"));\n for(Map.Entry<Long, Integer> entry : Members.entrySet()) {\n writeLine(Arrays.asList( entry.getKey().toString() , entry.getValue().toString() ));\n }\n\n writer.flush();\n writer.close();\n } \n catch (IOException ex) {\n Logger.getLogger(CSVUtilities.class.getName()).log(Level.SEVERE, null, ex);\n }\n }", "public static void writeCsvFile(List<City> cities, String filename) {\r\n\tCsvMapper mapper = new CsvMapper();\r\n\tCsvSchema schema = mapper.schemaFor(City.class).withHeader();\r\n\tObjectWriter writer = mapper.writer(schema);\r\n\r\n\ttry {\r\n\t writer.writeValue(new File(filename + \".csv\"), cities); // making separate file for each city\r\n\t System.out.println(\"The results are saved to \" + filename + \".csv\");\r\n\t} catch (JsonGenerationException | JsonMappingException e) {\r\n\t System.out.println(\"Could not write CSV file.\");\r\n\t e.printStackTrace();\r\n\t} catch (IOException e) {\r\n\t System.out.println(\"Could not write CSV file. File I/O problems.\");\r\n\t e.printStackTrace();\r\n\t}\r\n\r\n }", "private void writeCSVDict(String currentTime, String scanType, String timeStamp, String spectStart, String spectEnd, String numPoints, String resolution, String numAverages, String measTime, boolean saveOS) {\n\n String prefix = filePrefix.getText().toString();\n if (prefix.equals(\"\")) {\n prefix = \"Nano\";\n }\n\n if (saveOS) {\n String csv = android.os.Environment.getExternalStorageDirectory().getAbsolutePath() + \"/\" + prefix + currentTime + \".dict\";\n\n CSVWriter writer;\n try {\n writer = new CSVWriter(new FileWriter(csv));\n List<String[]> data = new ArrayList<String[]>();\n data.add(new String[]{\"Method\", scanType});\n data.add(new String[]{\"Timestamp\", timeStamp});\n data.add(new String[]{\"Spectral Range Start (nm)\", spectStart});\n data.add(new String[]{\"Spectral Range End (nm)\", spectEnd});\n data.add(new String[]{\"Number of Wavelength Points\", numPoints});\n data.add(new String[]{\"Digital Resolution\", resolution});\n data.add(new String[]{\"Number of Scans to Average\", numAverages});\n data.add(new String[]{\"Total Measurement Time (s)\", measTime});\n\n writer.writeAll(data);\n\n writer.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n }\n }", "public void write()\n {\n getCsvParser().parse(getReader());\n }", "public void appendLogFile(String str)\n{\n if(fileWriter != null)\n {\n try { \n \n fileWriter.append(str); \n \n } catch (Exception e) { \n \n System.out.println(\"Error in CsvFileWriter !!!\"); \n e.printStackTrace(); \n \n } finally { \n \n try {\n \n fileWriter.flush(); \n //fileWriter.close(); \n \n } catch (IOException e) { \n \n System.out.println(\"Error while flushing/closing fileWriter !!!\"); \n e.printStackTrace(); \n } \n \n } \n }\n}", "public void writecsv(String path, String username, String ccyCode, String usernameData, String ccyCodeData) {\r\n\t\tString csv = path;\r\n\t\tCSVWriter writer = null;\r\n\t\ttry {\r\n\t\t\twriter = new CSVWriter(new FileWriter(csv));\r\n\t\t} catch (IOException 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\tList<String[]> data = new ArrayList<String[]>();\r\n\t\tdata.add(new String[] {username,ccyCode});\r\n\t\tdata.add(new String[] {usernameData,ccyCodeData});\r\n\r\n\t\twriter.writeAll(data);\r\n\t\ttry {\r\n\t\t\twriter.close();\r\n\t\t} catch (IOException 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 void setCustomFormat(CSVCustomFormat format) {\n Log.d(TAG,\"setCustomFormat \"+format.getFormat().hashCode() + \" \"+getCustomFormatData().getFormat().hashCode());\n if(!format.equals(getCustomFormatData())) {\n Log.d(TAG,\"New Format\");\n csvCustomFormat.setValue(format);\n }\n }", "@Override\n\t\t\tpublic void run() {\n\t\t\t\tString filePath = env.getProperty(\"export.file.path\");\n\t\t\t\tFileSystem fileSystem = FileSystems.getDefault();\n\t\t\t\tif (StringUtils.isNotEmpty(empId)) {\n\t\t\t\t\tfilePath += \"/\" + empId;\n\t\t\t\t}\n\t\t\t\tPath path = fileSystem.getPath(filePath);\n\t\t\t\t// path = path.resolve(String.valueOf(empId));\n\t\t\t\tif (!Files.exists(path)) {\n\t\t\t\t\tPath newEmpPath = Paths.get(filePath);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tFiles.createDirectory(newEmpPath);\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tlog.error(\"Error while creating path \" + newEmpPath);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfilePath += \"/\" + exportFileName;\n\t\t\t\ttry {\n\t\t\t\t\t// initialize FileWriter object\n\t\t\t\t\tlog.debug(\"filePath = \" + filePath + \", isAppend=\" + isAppend);\n\t\t\t\t\tfileWriter = new FileWriter(filePath, isAppend);\n\t\t\t\t\t// initialize CSVPrinter object\n\t\t\t\t\tcsvFilePrinter = new CSVPrinter(fileWriter, csvFileFormat);\n\t\t\t\t\tif (!isAppend) {\n\t\t\t\t\t\t// Create CSV file header\n\t\t\t\t\t\tcsvFilePrinter.printRecord(DETAIL_REPORT_FILE_HEADER);\n\t\t\t\t\t}\n\t\t\t\t\t// Write a new student object list to the CSV file\n\t\t\t\t\tfor (AttendanceDTO transaction : content) {\n\t\t\t\t\t\tList record = new ArrayList();\n\t\t\t\t\t\tlog.debug(\"Writing transaction record for Employee id :\" + transaction.getEmployeeEmpId());\n\t\t\t\t\t\trecord.add(transaction.getSiteName());\n\t\t\t\t\t\trecord.add(transaction.getCreatedDate());\n\t\t\t\t\t\trecord.add(String.valueOf(transaction.getEmployeeEmpId()));\n\t\t\t\t\t\trecord.add(transaction.getEmployeeFullName());\n\t\t\t\t\t\trecord.add(DateUtil.convertUTCToIST(transaction.getCheckInTime()));\n\t\t\t\t\t\trecord.add(DateUtil.convertUTCToIST(transaction.getCheckOutTime()));\n\t\t\t\t\t\tcsvFilePrinter.printRecord(record);\n\t\t\t\t\t}\n\t\t\t\t\tlog.info(exportFileName + \" CSV file was created successfully !!!\");\n\t\t\t\t\tstatusMap.put(exportFileName, \"COMPLETED\");\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tlog.error(\"Error in CsvFileWriter !!!\");\n\t\t\t\t\tstatusMap.put(exportFileName, \"FAILED\");\n\t\t\t\t} finally {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfileWriter.flush();\n\t\t\t\t\t\tfileWriter.close();\n\t\t\t\t\t\tcsvFilePrinter.close();\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tlog.error(\"Error while flushing/closing fileWriter/csvPrinter !!!\");\n\t\t\t\t\t\tstatusMap.put(exportFileName, \"FAILED\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlock.unlock();\n\t\t\t}", "private static void writeRecords(Collection<Record> values)\n throws IOException {\n for (Record record : values) {\n writer2.writeRecord(record.makeup());\n // over write, update writer\n // System.out.println(lineNum);\n if (++lineNum > Merge.lineNumbers.get(fileNum)) {\n writer2.flush();\n writer2.close();\n\n fileNum++;\n lineNum = 0;\n writer2 = new CsvWriter(new OutputStreamWriter(\n new FileOutputStream(SORT_USER_FN + fileNum + \".csv\"),\n \"UTF-8\"), ',');\n }\n }\n\n }", "public String createCsv(@NonNull List<String> csvHeaders,\n @NonNull List<List<Serializable>> reports) {\n return \"\";\n }", "public static <T> void writeListToCSVFile(String csvFileName, List<T> list, String[] header,\n\t\t\tCellProcessor[] processors) throws CsvWriterException {\n\t\tICsvBeanWriter beanWriter = null;\n\n\t\ttry {\n\t\t\tbeanWriter = new CsvBeanWriter(new FileWriter(csvFileName), CsvPreference.STANDARD_PREFERENCE);\n\n\t\t\tbeanWriter.writeHeader(header);\n\n\t\t\tfor (T item : list) {\n\t\t\t\tbeanWriter.write(item, header, processors);\n\t\t\t}\n\n\t\t} catch (IOException ex) {\n\t\t\tthrow new CsvWriterException(\"An error ocurred while writing the CSV file: \", ex);\n\t\t} finally {\n\t\t\tif (beanWriter != null) {\n\t\t\t\ttry {\n\t\t\t\t\tbeanWriter.close();\n\t\t\t\t} catch (IOException ex) {\n\t\t\t\t\tSystem.err.println(\"An error ocurred while closing the CSV writer: \" + ex);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "void write(List<?> columns) throws IOException;", "public static void writeCSV(List<Item> items) throws IOException {\n\n try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(USER_ITEMS_FILE));\n\n CSVPrinter csvPrinter = new CSVPrinter(writer, CSVFormat.EXCEL.withHeader(\"itemNo\",\"Room\",\"Category\",\"Type\",\"make\",\"model\",\"serial\",\"receipt\",\"photo\",\"value\",\"comments\",\"lastupdate\",\"delete\",\"email_own\"));//4/30 JGP added email_own header\n ) {\n for (Item i: items) {\n if (!\"itemNo\".equals(i.getItemNo())) {\n csvPrinter.printRecord(i.getItemNo(), i.getRoom().getStatus(), i.getCategory().getCategory(), i.getType().getProductTypeString(), i.getMake(), i.getModel(), i.getSerial(), i.getReceipt(), i.getPhoto(), i.getValue(), i.getComments(), FORMATTER.format(new Date()).toString(), i.isDeleted().booleanValue(), i.email);//4/30 JGP added i.email string\n }\n }\n csvPrinter.flush();\n }\n\n /* EventBus eventBus = EventBusFactory.getEventBus();\n ParseEvent pevent = new ParseEvent(items);\n eventBus.register(pevent);\n eventBus.post(pevent);*/\n }", "public void writeCSVFile(File file, String data) throws Exception{\n BufferedWriter bufferWritter = new BufferedWriter(new FileWriter(file));\n bufferWritter.write(data);\n bufferWritter.close();\n }", "public void writeDataToCSV(Context context, String competition) throws IOException {\n\n fileExists = false;\n\n String FILE_PATH = \"Scouting_Data_\" + competition + \".csv\";\n File file = new File(context.getExternalFilesDir(\n Environment.DIRECTORY_DOCUMENTS), FILE_PATH);\n\n// if (!file.exists()) {\n// FileWriter fw = new FileWriter(file);\n// BufferedWriter bw = new BufferedWriter(fw);\n// bw.write(str);\n// bw.close();\n// }\n//\n// else {\n// FileOutputStream fileinput = new FileOutputStream(file, true);\n// PrintStream printstream = new PrintStream(fileinput);\n// printstream.print(\"\\n\" + str);\n// fileinput.close();\n// fileExists = true;\n// }\n }", "@Test public void testEuropeanComma() {\n char comma = ';';\n int n = random.nextInt(10) + 10;\n String[] src = new String[n];\n for (int i = 0; i < n; i++) {\n src[i] = randomString();\n }\n println(Arrays.toString(src));\n try (CSVUtil.Writer writer = CSVUtil.newWriter(path, comma)) {\n for (String s : src) {\n writer.write(s);\n }\n } catch (IOException e) {\n e.printStackTrace();\n assert false;\n }\n\n try {\n List<String[]> strings = CSVUtil.read(path, comma);\n assert strings.size() == 1;\n println(Arrays.toString(strings.get(0)));\n assert Arrays.toString(src).equals(Arrays.toString(strings.get(0)));\n } catch (IOException e) {\n e.printStackTrace();\n assert false;\n }\n\n try {\n List<String[]> strings = CSVUtil.read(path);\n assert strings.size() == 1;\n println(Arrays.toString(strings.get(0)));\n assert Arrays.toString(src).equals(Arrays.toString(strings.get(0)));\n } catch (IOException e) {\n e.printStackTrace();\n assert false;\n }\n }", "@Override\n public void write(Text arg0, Text arg1) throws IOException, InterruptedException {\n out.writeBytes(arg0.toString() + \",\");\n out.writeBytes(arg1.toString());\n out.writeBytes(\"\\r\\n\"); \n }", "protected void changeCSV(CSVDocument doc, int row, int col) {\n doc.moveRowUp(row);\n }", "@ParameterizedTest\n @CsvFileSource(files = \"src/test/resources/params/shoppinglist.csv\",\n numLinesToSkip = 1) // The first line in .csv is a header, this is to skip that line\n public void csvFileSource_StringDoubleIntStringString(String name,\n double price, int qty, String uom,\n String provider){\n System.out.println(\"name = \" + name + \", price = \" + price + \", qty = \" + qty\n + \", uom = \" + uom + \", provider = \" + provider);\n }", "private String formatCSV(String value){\r\n\t\treturn value.replaceAll(\"\\\"\",\"\\\"\\\"\");\r\n\t}", "@Override\n public void csvExport(String filename) {\n PrintWriter out = null;\n try {\n out = new PrintWriter(filename);\n\n for (Student key : map.keySet()) {\n out.println(key.getFirst() + \", \" + key.getLast() + \", \" + key.getID() + \", \" + map.get(key).getLetter());\n }\n } catch (FileNotFoundException ex) {\n System.out.println(\"File was not found\");\n } finally {\n out.close();\n }\n }", "@ParameterizedTest\n @CsvFileSource(files = {\"src/test/resources/params/shoppinglist.csv\",\n \"src/test/resources/params/shoppinglist2.csv\"},\n numLinesToSkip = 1) // The first line in .csv is a header, this is to skip that line\n public void csvFileSource_StringDoubleIntStringString2(String name,\n double price, int qty, String uom,\n String provider){\n System.out.println(\"name = \" + name + \", price = \" + price + \", qty = \" + qty\n + \", uom = \" + uom + \", provider = \" + provider);\n }", "@Test(timeout=100)\r\n\tpublic void testSetDelimiter() {\r\n\t\tString [] r1 = {\"NAME\", \"ADDRESS\",\"EMAIL\"};\r\n\t\t// should not remove space inside of quotes\r\n\t\tString [] r2 = {\"Santa Claus\",\"North Pole\",\"[email protected]\"};\r\n\t\tString [] r3 = {\"Obama\",\"1 Pennsylvania Ave\",\"[email protected]\"};\r\n\t\t// default delimiter\r\n\t\twriteArrayToLine(r1);\r\n\t\t// change delimiter\r\n\t\tdelim = ':';\r\n\t\twriteArrayToLine(r2);\r\n\t\twriteArrayToLine(r3);\r\n\t\tout.close();\r\n\t\t\r\n\t\tCSVReader csv = new CSVReader(getInstream());\r\n\t\tassertArrayEquals( r1, csv.next() );\r\n\t\tcsv.setDelimiter(delim);\r\n\t\tassertArrayEquals( r2, csv.next() );\r\n\t\tassertArrayEquals( r3, csv.next() );\r\n\t}", "static public void writeCSVReply (String csvFile, String validInfo)\n\t{\n\t\tFile f = new File(csvFile);\n\t\t\n\t\tString columnName = \"Nom: \\tDate de sortie: \\tRéalisateur: \\tDescription: \\tBande d'annonce: \\tSéances: \\n\";\n\t\tvalidInfo = columnName + validInfo;\n\t\t\n\t\ttry\n\t\t{\n\t\t\tFileWriter fw = new FileWriter (f);\n\t\t\tfw.write (validInfo);\n\t\t\tfw.write (\"\\r\\n\");\n\t\t\tfw.close();\n\t\t}\n\t\tcatch (IOException exception)\n\t\t{\n\t\t\tSystem.out.println (\"error when reading CSV file : \" + exception.getMessage());\n\t\t}\n\t}", "public void outputToCSV() throws FileNotFoundException, UnsupportedEncodingException {\n PrintWriter writer = new PrintWriter(\"test_data.csv\", \"UTF-8\");\n\n //For every object in array list, print surname, initials and extension, separated by commmas\n for (int i=0; i<toArrayList().size(); i++) {\n writer.println(toArrayList().get(i).getSurname() + \",\" + toArrayList().get(i).getInitials() + \",\" +\n toArrayList().get(i).getExtension());\n }\n writer.close();\n }", "public static void appendToCSV(List<Item> items) throws IOException {\n File file = new File(USER_ITEMS_FILE);\n FileWriter fileWriter = new FileWriter(file, true);\n try (BufferedWriter writer = new BufferedWriter(fileWriter);\n CSVPrinter csvPrinter = new CSVPrinter(writer, CSVFormat.EXCEL);\n ){\n for (Item i: items) {\n if (!\"itemNo\".equals(i.getItemNo())) {\n csvPrinter.printRecord(i.getItemNo(), i.getRoom().getStatus(), i.getCategory().getCategory(), i.getType().getProductTypeString(), i.getMake(), i.getModel(), i.getSerial(), i.getReceipt(), i.getPhoto(), i.getValue(), i.getComments(), FORMATTER.format(new Date()).toString(), i.isDeleted().booleanValue(), i.email);//4/30 JGP added i.email string\n }\n }\n }\n }", "public void dataFileCreate() {\r\n\t\tString COMMA_DELIMITER = \",\";\r\n\t\tString NEW_LINE_SEPERATOR = \"\\n\";\r\n\t\tString FILE_HEADER = \"Title,First Name,Last Name,Email,Phone Number\";\r\n\t\ttry {\r\n\t\t\tList<Customer> dataList = new ArrayList<Customer>();\r\n\t\t\tdataList.add(\r\n\t\t\t\t\tnew Customer(title, customerFirstName, customerLastName, custromerEmailId, customerPhoneNumber));\r\n\r\n\t\t\tFileWriter fileWriter = new FileWriter(\"CustomerDetails.csv\");\r\n\t\t\tBufferedWriter bufferWriter = new BufferedWriter(fileWriter);\r\n\t\t\tbufferWriter.append(FILE_HEADER);\r\n\r\n\t\t\tfor (Customer c : dataList) {\r\n\t\t\t\tbufferWriter.write(NEW_LINE_SEPERATOR);\r\n\t\t\t\tbufferWriter.write(c.getTitle());\r\n\t\t\t\tbufferWriter.write(COMMA_DELIMITER);\r\n\t\t\t\tbufferWriter.write(c.getFirstName());\r\n\t\t\t\tbufferWriter.write(COMMA_DELIMITER);\r\n\t\t\t\tbufferWriter.write(c.getLastName());\r\n\t\t\t\tbufferWriter.write(COMMA_DELIMITER);\r\n\t\t\t\tbufferWriter.write(c.getEmailAddress());\r\n\t\t\t\tbufferWriter.write(COMMA_DELIMITER);\r\n\t\t\t\tbufferWriter.write(String.valueOf(c.getPhone()));\r\n\t\t\t\tbufferWriter.write(COMMA_DELIMITER);\r\n\t\t\t}\r\n\r\n\t\t\tbufferWriter.close();\r\n\t\t} catch (Exception e) {\r\n\t\t\tSystem.out.println(e.getMessage());\r\n\t\t}\r\n\t}", "public void createCSV(ArrayList<String> result, String output){\t\r\n\t\ttry{\r\n\t\t\tFileOutputStream fileOutputStream = new FileOutputStream(output);\r\n\t\t\tOutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, \"MS949\");\r\n\t\t\tBufferedWriter fw = new BufferedWriter(outputStreamWriter);\r\n\t\t\tfor(String line : result){\r\n\t\t\t\tfw.write(line+\"\\n\");\r\n\t\t\t}\r\n\t\t\tfw.flush();\r\n\t\t\tfw.close();\r\n\t\t}catch (Exception e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public String getCSVString() {\n return getId() + \",\" + noOfRounds + \",\" + caliber + \",\" + manufacturer + \",\" + price;\n }", "public String[] sendCsvData(String userId,String tableName,List<String[]> csv, boolean deleteOldCsvData){\n\t\treturn this.meteorListSendReceive.sendCsvData(userId, tableName, csv,deleteOldCsvData);\n\t}", "public static void writeDataToCsvUsingStringArrayForReference(PrintWriter writer, List<ReferenceTabDTO> referenceTabList) {\n\n String[] CSV_REFERENCE_TITLE = {\"Reference Details\"};\n\n String[] CSV_REFERENCE_HEADER = {\"REF_ID\", \"REF_TYPE\", \"JOURNAL_PATENT_NAME\", \"REFERENCE\", \"YEAR\", \"VOLUME\", \"ISSUE\", \"START_PAGE\", \"END_PAGE\", \"DOI\", \"PUBMED_ID\", \"PATENT_NO\", \"APPLICATION_TYPE\", \"ISSN_NO\", \"TITLE\", \"ABSTRACT\", \"AUTHORS\", \"COMPANY_NAMES\", \"COMPANY_ADDRESSES\"};\n try (\n CSVWriter csvWriter = new CSVWriter(writer,\n CSVWriter.DEFAULT_SEPARATOR,\n CSVWriter.DEFAULT_ESCAPE_CHARACTER,\n CSVWriter.DEFAULT_LINE_END);\n ) {\n csvWriter.writeNext(CSV_REFERENCE_TITLE);\n csvWriter.writeNext(CSV_REFERENCE_HEADER);\n\n for (ReferenceTabDTO referenceTabDataReturn : referenceTabList) {\n String[] referenceData = new String[]{\n referenceTabDataReturn.getRefId() + \"\",\n referenceTabDataReturn.getRefType() + \"\",\n referenceTabDataReturn.getJournalPatentName(),\n referenceTabDataReturn.getReference(),\n referenceTabDataReturn.getYear() + \"\",\n referenceTabDataReturn.getVolume() + \"\",\n referenceTabDataReturn.getIssue() + \"\",\n referenceTabDataReturn.getStartPage() + \"\",\n referenceTabDataReturn.getEndPage() + \"\",\n referenceTabDataReturn.getDoi() + \"\",\n referenceTabDataReturn.getPubmedId() + \"\",\n referenceTabDataReturn.getPatentNo() + \"\",\n referenceTabDataReturn.getApplicationType() + \"\",\n referenceTabDataReturn.getIssnNo() + \"\",\n referenceTabDataReturn.getTitle() + \"\",\n referenceTabDataReturn.getAbstrac(),\n referenceTabDataReturn.getAuthors() + \"\",\n referenceTabDataReturn.getCompanyNames() + \"\",\n referenceTabDataReturn.getCompanyAddresses() + \"\"\n\n };\n csvWriter.writeNext(referenceData);\n }\n\n } catch (Exception e) {\n System.out.println(\"Exception occured into the ReferenceTab Data Export\" + e.getMessage());\n e.printStackTrace();\n }\n\n }", "@java.lang.Override\n public boolean hasCsv() {\n return schemaCase_ == 6;\n }", "@Override\n\t\t\tpublic void run() {\n\t\t\t\tString filePath = env.getProperty(\"export.file.path\");\n\t\t\t\tFileSystem fileSystem = FileSystems.getDefault();\n\t\t\t\tif (StringUtils.isNotEmpty(empId)) {\n\t\t\t\t\tfilePath += \"/\" + empId;\n\t\t\t\t}\n\t\t\t\tPath path = fileSystem.getPath(filePath);\n\t\t\t\t// path = path.resolve(String.valueOf(empId));\n\t\t\t\tif (!Files.exists(path)) {\n\t\t\t\t\tPath newEmpPath = Paths.get(filePath);\n\t\t\t\t\ttry {\n\t\t\t\t\t\tFiles.createDirectory(newEmpPath);\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tlog.error(\"Error while creating path \" + newEmpPath);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfilePath += \"/\" + exportFileName;\n\t\t\t\ttry {\n\t\t\t\t\t// initialize FileWriter object\n\t\t\t\t\tlog.debug(\"filePath = \" + filePath + \", isAppend=\" + isAppend);\n\t\t\t\t\tfileWriter = new FileWriter(filePath, isAppend);\n\t\t\t\t\tString siteName = null;\n\n\t\t\t\t\t// initialize CSVPrinter object\n\t\t\t\t\tcsvFilePrinter = new CSVPrinter(fileWriter, csvFileFormat);\n\t\t\t\t\tif (!isAppend) {\n\t\t\t\t\t\t// Create CSV file header\n\t\t\t\t\t\tcsvFilePrinter.printRecord(CONSOLIDATED_REPORT_FILE_HEADER);\n\t\t\t\t\t}\n\t\t\t\t\tfor (ReportResult transaction : content) {\n\t\t\t\t\t\tif (StringUtils.isEmpty(siteName) || !siteName.equalsIgnoreCase(transaction.getSiteName())) {\n\t\t\t\t\t\t\tcsvFilePrinter.printRecord(\"\");\n\t\t\t\t\t\t\tcsvFilePrinter\n\t\t\t\t\t\t\t\t\t.printRecord(\"CLIENT - \" + projName + \" SITE - \" + transaction.getSiteName());\n\t\t\t\t\t\t}\n\t\t\t\t\t\tList record = new ArrayList();\n\t\t\t\t\t\tlog.debug(\"Writing transaction record for site :\" + transaction.getSiteName());\n\t\t\t\t\t\trecord.add(transaction.getSiteName());\n\t\t\t\t\t\trecord.add(transaction.getLocatinName());\n\t\t\t\t\t\trecord.add(transaction.getAssignedJobCount());\n\t\t\t\t\t\trecord.add(transaction.getCompletedJobCount());\n\t\t\t\t\t\trecord.add(transaction.getOverdueJobCount());\n\t\t\t\t\t\trecord.add(transaction.getTat());\n\t\t\t\t\t\tcsvFilePrinter.printRecord(record);\n\t\t\t\t\t}\n\t\t\t\t\tlog.info(exportFileName + \" CSV file was created successfully !!!\");\n\t\t\t\t\tstatusMap.put(exportFileName, \"COMPLETED\");\n\t\t\t\t} catch (Exception e) {\n\t\t\t\t\tlog.error(\"Error in CsvFileWriter !!!\");\n\t\t\t\t\tstatusMap.put(exportFileName, \"FAILED\");\n\t\t\t\t} finally {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tfileWriter.flush();\n\t\t\t\t\t\tfileWriter.close();\n\t\t\t\t\t\tcsvFilePrinter.close();\n\t\t\t\t\t} catch (IOException e) {\n\t\t\t\t\t\tlog.error(\"Error while flushing/closing fileWriter/csvPrinter !!!\");\n\t\t\t\t\t\tstatusMap.put(exportFileName, \"FAILED\");\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlock.unlock();\n\t\t\t}", "public void saveCSV(Writer io, boolean addHeader, String fieldDelim)\n\t\t{\n\t\tSystem.out.println(\"field delim:\"+fieldDelim+\":\");\n\t\t\n\t\tPrintWriter pw=new PrintWriter(io);\n\t\t\n\t\tSet<String> col=getColumns();\n\t\t\n\t\t//Add header\n\t\tif(addHeader)\n\t\t\t{\n\t\t\tpw.print(\"frame\");\n\t\t\tpw.print(fieldDelim);\n\t\t\tpw.print(\"particle\");\n\t\t\tfor(String s:col)\n\t\t\t\t{\n\t\t\t\tpw.print(fieldDelim);\n\t\t\t\tpw.print(s);\n\t\t\t\t}\n\t\t\tpw.println();\n\t\t\t}\n\n\t\t//Write the data\n\t\tfor(EvDecimal frame:getFrames())\n\t\t\t{\n\t\t\tfor(Map.Entry<Integer, ParticleInfo> e:getFrame(frame).entrySet())\n\t\t\t\t{\n\t\t\t\tpw.print(frame);\n\t\t\t\tpw.print(fieldDelim);\n\t\t\t\tpw.print(e.getKey());\n\t\t\t\tMap<String,Object> props=e.getValue().map;\n\t\t\t\tfor(String columnName:col)\n\t\t\t\t\t{\n\t\t\t\t\tpw.print(fieldDelim);\n\t\t\t\t\tpw.print(props.get(columnName));\n\t\t\t\t\t}\n\t\t\t\tpw.println();\n\t\t\t\t}\n\t\t\t\n\t\t\t}\n\t\t\n\t\tpw.flush();\n\t\t}", "public static void save(ArrayList<String> inputsInOrder) throws IOException {\r\n\t\tboolean start = true;\r\n\r\n\t\tFileWriter filewrite = new FileWriter(csv);\r\n\t\tfor (String str : inputsInOrder) {\r\n\t\t\tif (start == true) {\r\n\t\t\t\tfilewrite.write(str);\r\n\t\t\t\tstart = false;\r\n\t\t\t} else {\r\n\t\t\t\tfilewrite.write(\",\");\r\n\t\t\t\tfilewrite.write(str);\r\n\t\t\t}\r\n\t\t}\r\n\t\tfilewrite.flush();\r\n\t\tfilewrite.close();\r\n\t}", "public void writeDataToCsv(String filename , ArrayList<TestDataInstance> inputData) {\n \n String header = \"\";\n \n File outFile = null;\n int dataCount = 0;\n try {\n outFile = new File(filename);\n \n FileWriter fw = new FileWriter(outFile);\n \n BufferedWriter bw = new BufferedWriter(fw);\n \n bw.write(header);\n \n for(TestDataInstance data : inputData) {\n bw.newLine();\n bw.write(data.toSamiamCsvString());\n dataCount++;\n }\n \n System.out.println(\"Written \" + dataCount + \" rows of data to SAMIAM CSV format @ \" + filename);\n \n } catch(Exception e) {\n e.printStackTrace();\n }\n \n }", "public Builder setCsv(\n com.google.cloud.datacatalog.v1.PhysicalSchema.CsvSchema.Builder builderForValue) {\n if (csvBuilder_ == null) {\n schema_ = builderForValue.build();\n onChanged();\n } else {\n csvBuilder_.setMessage(builderForValue.build());\n }\n schemaCase_ = 6;\n return this;\n }", "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}" ]
[ "0.66477", "0.6638588", "0.62938845", "0.62594235", "0.6221548", "0.6125734", "0.5953668", "0.5935491", "0.5921604", "0.59018165", "0.5852815", "0.5806592", "0.5726085", "0.566148", "0.5652624", "0.5636286", "0.56339395", "0.5609062", "0.5592106", "0.558335", "0.5577311", "0.5564267", "0.55276567", "0.5521599", "0.55144763", "0.55140823", "0.55067694", "0.54805297", "0.5471251", "0.546403", "0.54592156", "0.54559386", "0.5453335", "0.54445344", "0.5436312", "0.54351974", "0.5434114", "0.5426247", "0.542554", "0.54159963", "0.54138404", "0.5387835", "0.5337068", "0.5300975", "0.5299463", "0.5277031", "0.5261726", "0.5259827", "0.5246419", "0.52457964", "0.52271193", "0.5226461", "0.5217902", "0.5208752", "0.52018076", "0.5189317", "0.51804763", "0.5170733", "0.5170404", "0.51672596", "0.51594406", "0.5145565", "0.512565", "0.5114103", "0.51084554", "0.51012594", "0.51010627", "0.5093765", "0.50857854", "0.5080559", "0.5071558", "0.5044577", "0.5043583", "0.5043475", "0.5042175", "0.5037315", "0.5029983", "0.50268215", "0.5024016", "0.50167435", "0.5014321", "0.5009606", "0.50067824", "0.49937418", "0.4990783", "0.49839598", "0.49729058", "0.4971933", "0.49709818", "0.4964332", "0.49623665", "0.4961005", "0.49521106", "0.49516952", "0.49495432", "0.49415082", "0.49340352", "0.493005", "0.49271545", "0.49251133", "0.49142417" ]
0.0
-1
Print metrics and evaluate results in each file.
private MetricsSet getTotalResultPerFile(String[][] contents) { String[] csvHeaders = MetricsSet.METRICS_PER_FILE; MetricsSet thisFileResult = new MetricsSet(); int caseSize = csvHeaders.length - 2; Double[] RowSum = new Double[caseSize]; Integer[] RowCount = new Integer[caseSize]; for (int i = 0; i < caseSize; i ++) { RowSum[i] = 0.0; RowCount[i] = 0; } for (String[] row: contents) { for(int i = 0; i < caseSize; i++) { // if (row[i + 2].equals("NaN")) continue; Double tmp = Double.parseDouble(row[i + 2]); if (tmp < 0) continue; RowSum[i] += tmp; RowCount[i] += 1; } } thisFileResult.topk = Integer.parseInt(contents[1][1]); thisFileResult.precision = new Metrics(RowCount[0], RowSum[0]); //thisFileResult.recall = new Metrics(RowCount[1], RowSum[1]); //thisFileResult.fMeasure = new Metrics(RowCount[2], RowSum[2]); thisFileResult.MAP = new Metrics(RowCount[1], RowSum[1]); thisFileResult.MRR = new Metrics(RowCount[2], RowSum[2]); //thisFileResult.NDCG = new Metrics(RowCount[5], RowSum[5]); //thisFileResult.firstPos = new Metrics(RowCount[6], RowSum[6]); thisFileResult.time = new Metrics(RowCount[3], RowSum[3]); thisFileResult.queryNumb = this.ranks.length; return thisFileResult; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void printResults() {\n resultMap.entrySet().stream().forEach((Map.Entry<File, String> entry) -> {\n System.out.println(String.format(\"%s processed by thread: %s\", entry.getKey(), entry.getValue()));\n });\n System.out.println(String.format(\"processed %d entries\", resultMap.size()));\n }", "private void printResults() {\n\t\tfor (Test test : tests) {\n\t\t\ttest.printResults();\n\t\t}\n\t}", "static void getResults() throws IOException {\n\t\tint k = 2;\n\t\twhile (k <= 7) {\n\t\t\tint j = 1;\n\t\t\tString line;\n\t\t\tString precision = \"\";\n\t\t\tString recall = \"\";\n\t\t\tString fmeasure = \"\";\n\t\t\tString time = \"\";\n\n\n\t\t\twhile (j <= 10) {\n\t\t\t\tBufferedReader br = new BufferedReader(new FileReader(\n\t\t\t\t\t\tnew File(ConfigManager.getExperimentFolder() + \"M\" + k + \"/Testbeds-\"+j\n\t\t\t\t\t\t\t\t+ \"/Generated/PSL/test/Precision/F1NoTraining.txt\")));\n\n\t\t\t\twhile ((line = br.readLine()) != null) {\n\t\t\t\t\tif (line.contains(\"Precision :\")) {\n\t\t\t\t\t\tprecision += line.replace(\"Precision :\", \"\") + \"\\n\";\n\t\t\t\t\t}\n\t\t\t\t\tif (line.contains(\"Recall:\")) {\n\t\t\t\t\t\trecall += line.replace(\"Recall:\", \"\") + \"\\n\";\n\t\t\t\t\t}\n\t\t\t\t\tif (line.contains(\"Fmeasure:\")) {\n\t\t\t\t\t\tfmeasure += line.replace(\"Fmeasure:\", \"\") + \"\\n\";\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tif (line.contains(\"Time:\")) {\n\t\t\t\t\t\ttime += line.replace(\"Time:\", \"\") + \"\\n\";\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tj++;\n\t\t\t}\n\n\t\t\tSystem.out.print(precision);\n//\t\t\tSystem.out.print(recall);\n//\t\t\tSystem.out.print(fmeasure);\n//\t\t\tSystem.out.print(time);\n\n\t\t\tk++;\n\t\t}\n\t}", "@Override\n\tpublic void handleOutput(final List<RuleMatch> evaluationResults) throws IOException {\n\t\tthis.totalResults = evaluationResults.size();\n\t\tthis.uniqueFileSet = new HashSet<>();\n\t\tthis.perFileResults = new HashMap<>();\n\t\tthis.perFilePerRule = new HashMap<>();\n\n\t\tfor (final RuleMatch match : evaluationResults) {\n\t\t\tuniqueFileSet.add(match.getLogReference().getLogFile());\n\n\t\t\tList<RuleMatch> perFileList = perFileResults.get(match.getLogReference().getLogFile());\n\t\t\tif (perFileList == null) {\n\t\t\t\tperFileList = new ArrayList<>();\n\t\t\t}\n\t\t\tperFileList.add(match);\n\t\t\tperFileResults.put(match.getLogReference().getLogFile(), perFileList);\n\n\t\t\tMap<String, List<RuleMatch>> perRuleForFile = perFilePerRule.get(match.getLogReference().getLogFile());\n\t\t\tif (perRuleForFile == null) {\n\t\t\t\tperRuleForFile = new HashMap<>();\n\t\t\t}\n\t\t\tperFilePerRule.put(match.getLogReference().getLogFile(), perRuleForFile);\n\n\t\t\tList<RuleMatch> perTypeList = perRuleForFile.get(match.getMatchingRuleName());\n\t\t\tif (perTypeList == null) {\n\t\t\t\tperTypeList = new ArrayList<>();\n\t\t\t}\n\t\t\tperTypeList.add(match);\n\t\t\tperRuleForFile.put(match.getMatchingRuleName(), perTypeList);\n\n\t\t}\n\n\t\tthis.uniqueLogFilesAffected = uniqueFileSet.size();\n\t}", "public static void main() {\n // Since we cant use a global counter for all the different files\n // We use a global accumulator that takes the result from each file\n // After they are done with their respective file and save their result\n // This way they dont share a counter, but rather a place to store their counter\n // when they are done. \n AtomicInteger accumulator = new AtomicInteger(); // Default value = 0\n \n // word -> number of times that it appears over all files\n Map< String, Integer> occurrences = new HashMap<>();\n\n List< String> filenames = List.of(\n \"text1.txt\",\n \"text2.txt\",\n \"text3.txt\",\n \"text4.txt\",\n \"text5.txt\",\n \"text6.txt\",\n \"text7.txt\",\n \"text8.txt\",\n \"text9.txt\",\n \"text10.txt\"\n );\n\n CountDownLatch latch = new CountDownLatch(filenames.size());\n\n filenames.stream()\n .map(filename -> new Thread(() -> {\n int count = computeOccurrences(filename, occurrences);\n accumulator.addAndGet(count);\n latch.countDown();\n }))\n .forEach(Thread::start);\n\n try {\n latch.await();\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n System.out.println(accumulator);\n }", "public static void main(String[] args) {\n SimpleDateFormat dateFormat = new SimpleDateFormat(\"yyyy-MM-dd HH-mm-ss\");\n System.setProperty(\"current.date\", dateFormat.format(new Date()));\n // set path\n if (args.length > 1) path = args[1];\n // лучше называть каталог с результатами осмысленно :)\n File cfgFile = new File(args[0]);\n PropertyConfigurator.configure(cfgFile.getAbsolutePath());\n \n File[] files = getFilesInDir(path);\n for (File file : files) {\n // среднее считать - за сколько поколений в среднем достигается максимальнй фитнес - проще в расчетах писать и пихать в файл\n try {\n read(file.getAbsolutePath());\n System.out.println(\"Stats: \" + stats.size());\n }catch (IOException ex) { log.info(ex); }\n }\n \n System.out.println(\"bestFitness: \" + bestFitness);\n System.out.println(\"bestFile : \" + bestFile);\n System.out.println(\"bestUrgent : \" + bestUrgent);\n \n for (Integer id : stats.keySet()) {\n Stat stat = stats.get(id);\n //System.out.println(stat);\n //System.out.println(id + \". SumFit: \" + stat.sumFit() + \". SumUrg: \" + stat.sumUrgent());\n //System.out.println(id + \". AvgFit: \" + stat.avgFit() + \". avgUrg: \" + stat.avgUrgent());\n log.info(stat.avgFit() + \" \" + stat.avgUrgent() + \" \" + stat.id());\n }\n }", "public void ProcessFiles() {\n LOG.info(\"Processing SrcML files ...\");\n final Collection<File> allFiles = ctx.files.AllFiles();\n int processed = 0;\n final int numAllFiles = allFiles.size();\n final int logDiv = Math.max(1, Math.round(numAllFiles / 100f));\n\n for (File file : allFiles) {\n final String filePath = file.filePath;\n final FilePath fp = ctx.internFilePath(filePath);\n\n Document document = readSrcmlFile(filePath);\n DocWithFileAndCppDirectives extDoc = new DocWithFileAndCppDirectives(file, fp, document, ctx);\n\n internAllFunctionsInFile(file, document);\n processFeatureLocationsInFile(extDoc);\n\n if ((++processed) % logDiv == 0) {\n int percent = Math.round((100f * processed) / numAllFiles);\n LOG.info(\"Parsed SrcML file \" + processed + \"/\" + numAllFiles\n + \" (\" + percent + \"%) (\" + (numAllFiles - processed) + \" to go)\");\n }\n }\n\n LOG.info(\"Parsed all \" + processed + \" SrcML file(s).\");\n }", "public void printIndexMetrics(Directory index, boolean printMetricsToScreen, boolean printMetricsToFile){\n\t\t \n\t\ttry{\n\t\t\t //Creating our index\n\t\t\t IndexReader reader = DirectoryReader.open(index);\n\t\t\t \n\t\t\t //Need this map for metrics\n\t\t\t HashMap<String, HashSet<String>> hmap = convertIndexToMap(reader);\n\t\t\t \n\t\t\t HashMap<String, String> metrics = calculateMetrics(hmap, reader); \n\n\t\t\t //add the bad file metric... should probably just make this map global\n\t\t\t metrics.put(INDEX_METRIC_UNPARSABLE_CT, String.valueOf(numberOfUnparsableFiles));\n\t\t\t printMetrics(metrics, printMetricsToScreen, printMetricsToFile);\n\t\n\t\t\t reader.close(); \n\t\t}\n\t\tcatch(Exception e){\n\t\t\tSystem.out.println(\"There was some exception thrown during printing: \" + e.getStackTrace());\n\t\t}\n\t}", "public void score(List<String> modelFiles, List<String> testFiles, String outputFile) {\n/* 1223 */ int nFold = modelFiles.size();\n/* 1224 */ try (BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), \"UTF-8\"))) {\n/* 1225 */ for (int f = 0; f < nFold; f++) {\n/* */ \n/* */ \n/* 1228 */ List<RankList> test = readInput(testFiles.get(f));\n/* 1229 */ Ranker ranker = this.rFact.loadRankerFromFile(modelFiles.get(f));\n/* 1230 */ int[] features = ranker.getFeatures();\n/* */ \n/* 1232 */ if (normalize) {\n/* 1233 */ normalize(test, features);\n/* */ }\n/* 1235 */ for (RankList l : test) {\n/* 1236 */ for (int j = 0; j < l.size(); j++) {\n/* 1237 */ out.write(l.getID() + \"\\t\" + j + \"\\t\" + ranker.eval(l.get(j)) + \"\");\n/* 1238 */ out.newLine();\n/* */ }\n/* */ \n/* */ } \n/* */ } \n/* 1243 */ } catch (IOException ex) {\n/* */ \n/* 1245 */ throw RankLibError.create(\"Error in Evaluator::score(): \", ex);\n/* */ } \n/* */ }", "public void processFiles(){\n\t\tfor(String fileName : files) {\n\t\t\ttry {\n\t\t\t\tloadDataFromFile(fileName);\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\tSystem.out.println(\"Can't open file: \" + fileName);\n\t\t\t\tSystem.out.println();\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tprintInOrder();\n\t\t\tstudents.clear();\n\t\t}\n\t}", "public void displayResults() {\r\n Preferences.debug(\" ******* FitMultiExponential ********* \\n\\n\", Preferences.DEBUG_ALGORITHM);\r\n dumpTestResults();\r\n }", "public void runMethod() throws FileNotFoundException{\n int[] dataset=new int[]{10, 297, 593, 947, 1243, 1647, 1943, 2227, 2543, 2976};\n for(int n=0; n<dataset.length; n++){\n String fileName = (\"DataSet\"+dataset[n]);\n String[][] summaryData = toSummaryArray(toRawArray(fileName, dataset[n]));\n for(int j=0; j<3; j++){\n for(int i=0; i<5; i++){\n System.out.print(summaryData[i][j]+\",\");\n }\n System.out.print(\"\\n\");\n }\n }\n }", "@Override\n public void report() {\n\n try {\n File mFile = new File(\"/usr/local/etc/flink-remote/bm_files/metrics_logs/metrics.txt\");\n File eFile = new File(\"/usr/local/etc/flink-remote/bm_files/metrics_logs/latency_throughput.txt\");\n if (!mFile.exists()) {\n mFile.createNewFile();\n }\n if (!eFile.exists()) {\n eFile.createNewFile();\n }\n\n FileOutputStream mFileOut = new FileOutputStream(mFile, true);\n FileOutputStream eFileOut = new FileOutputStream(eFile, true);\n\n StringBuilder builder = new StringBuilder((int) (this.previousSize * 1.1D));\n StringBuilder eBuilder = new StringBuilder((int) (this.previousSize * 1.1D));\n\n// Instant now = Instant.now();\n LocalDateTime now = LocalDateTime.now();\n\n builder.append(lineSeparator).append(lineSeparator).append(now).append(lineSeparator);\n eBuilder.append(lineSeparator).append(lineSeparator).append(now).append(lineSeparator);\n\n builder.append(lineSeparator).append(\"---------- Counters ----------\").append(lineSeparator);\n eBuilder.append(lineSeparator).append(\"---------- records counter ----------\").append(lineSeparator);\n for (Map.Entry metric : counters.entrySet()) {\n builder.append(metric.getValue()).append(\": \").append(((Counter) metric.getKey()).getCount()).append(lineSeparator);\n if (( (String)metric.getValue()).contains(\"numRecords\")) {\n eBuilder.append(metric.getValue()).append(\": \").append(((Counter) metric.getKey()).getCount()).append(lineSeparator);\n }\n }\n\n builder.append(lineSeparator).append(\"---------- Gauges ----------\").append(lineSeparator);\n for (Map.Entry metric : gauges.entrySet()) {\n builder.append(metric.getValue()).append(\": \").append(((Gauge) metric.getKey()).getValue()).append(lineSeparator);\n }\n\n builder.append(lineSeparator).append(\"---------- Meters ----------\").append(lineSeparator);\n eBuilder.append(lineSeparator).append(\"---------- throughput ----------\").append(lineSeparator);\n for (Map.Entry metric : meters.entrySet()) {\n builder.append(metric.getValue()).append(\": \").append(((Meter) metric.getKey()).getRate()).append(lineSeparator);\n if (((String) metric.getValue()).contains(\"numRecords\")) {\n eBuilder.append(metric.getValue()).append(\": \").append(((Meter) metric.getKey()).getRate()).append(lineSeparator);\n }\n }\n\n builder.append(lineSeparator).append(\"---------- Histograms ----------\").append(lineSeparator);\n eBuilder.append(lineSeparator).append(\"---------- lantency ----------\").append(lineSeparator);\n for (Map.Entry metric : histograms.entrySet()) {\n HistogramStatistics stats = ((Histogram) metric.getKey()).getStatistics();\n builder.append(metric.getValue()).append(\": mean=\").append(stats.getMean()).append(\", min=\").append(stats.getMin()).append(\", p5=\").append(stats.getQuantile(0.05D)).append(\", p10=\").append(stats.getQuantile(0.1D)).append(\", p20=\").append(stats.getQuantile(0.2D)).append(\", p25=\").append(stats.getQuantile(0.25D)).append(\", p30=\").append(stats.getQuantile(0.3D)).append(\", p40=\").append(stats.getQuantile(0.4D)).append(\", p50=\").append(stats.getQuantile(0.5D)).append(\", p60=\").append(stats.getQuantile(0.6D)).append(\", p70=\").append(stats.getQuantile(0.7D)).append(\", p75=\").append(stats.getQuantile(0.75D)).append(\", p80=\").append(stats.getQuantile(0.8D)).append(\", p90=\").append(stats.getQuantile(0.9D)).append(\", p95=\").append(stats.getQuantile(0.95D)).append(\", p98=\").append(stats.getQuantile(0.98D)).append(\", p99=\").append(stats.getQuantile(0.99D)).append(\", p999=\").append(stats.getQuantile(0.999D)).append(\", max=\").append(stats.getMax()).append(lineSeparator);\n eBuilder.append(metric.getValue()).append(\": mean=\").append(stats.getMean()).append(\", min=\").append(stats.getMin()).append(\", p5=\").append(stats.getQuantile(0.05D)).append(\", p10=\").append(stats.getQuantile(0.1D)).append(\", p20=\").append(stats.getQuantile(0.2D)).append(\", p25=\").append(stats.getQuantile(0.25D)).append(\", p30=\").append(stats.getQuantile(0.3D)).append(\", p40=\").append(stats.getQuantile(0.4D)).append(\", p50=\").append(stats.getQuantile(0.5D)).append(\", p60=\").append(stats.getQuantile(0.6D)).append(\", p70=\").append(stats.getQuantile(0.7D)).append(\", p75=\").append(stats.getQuantile(0.75D)).append(\", p80=\").append(stats.getQuantile(0.8D)).append(\", p90=\").append(stats.getQuantile(0.9D)).append(\", p95=\").append(stats.getQuantile(0.95D)).append(\", p98=\").append(stats.getQuantile(0.98D)).append(\", p99=\").append(stats.getQuantile(0.99D)).append(\", p999=\").append(stats.getQuantile(0.999D)).append(\", max=\").append(stats.getMax()).append(lineSeparator);\n }\n\n mFileOut.write(builder.toString().getBytes());\n eFileOut.write(eBuilder.toString().getBytes());\n mFileOut.flush();\n eFileOut.flush();\n mFileOut.close();\n eFileOut.close();\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n }", "public final void evaluate() throws IOException {\n final ParserEvaluator evaluator = new ParserEvaluator(this.parser);\n evaluator.evaluate(this.testSamples);\n System.out.println(evaluator.getFMeasure());\n }", "public void run() throws FileNotFoundException, UnsupportedEncodingException {\n double averageError=1;\n int index=0;\n while(averageError> errorTreshold ||index<7) {\n trainPerceptrons();\n\n averageError= classifyPerformanceImages(asciiReader\n .getPerformanceImages());\n\n asciiReader.shuffleImages();\n index++;\n }\n \n System.out.println(\"# Average Error: \"+averageError);\n System.out.println(\"# Number of calibration rounds: \"+index);\n\n classifyTestImages();\n }", "private void test() {\n\t\tlong startTime = System.currentTimeMillis();\n\t\tBpmnModelInstance modelInstance = Bpmn.readModelFromFile(loadedFile);\n\t\tJsonEncoder jsonEncoder = new JsonEncoder(loadedFile.getName());\n\t\tBpmnBasicMetricsExtractor basicExtractor = new BpmnBasicMetricsExtractor(modelInstance, jsonEncoder);\n\t\tBpmnAdvancedMetricsExtractor advExtractor = new BpmnAdvancedMetricsExtractor(basicExtractor, jsonEncoder);\n\t\tlong loadTime = System.currentTimeMillis() - startTime;\n//\t\tSystem.out.println(\"Tempo load del file: \" + loadTime + \"ms\");\n\t\tbasicExtractor.runMetrics();\n\t\tlong basicTime = System.currentTimeMillis() - loadTime - startTime;\n//\t\tSystem.out.println(\"Tempo calcolo metriche di base: \" + basicTime + \"ms\");\n\t\tadvExtractor.runMetrics();\n\t\tlong advTime = System.currentTimeMillis() - basicTime - startTime - loadTime;\n//\t\tSystem.out.println(\"Tempo calcolo metriche avanzate: \" + advTime + \"ms\");\n\t\tjsonEncoder.exportJson();\n\t\tMySqlInterface db = new MySqlInterface();\n\t\tdb.connect();\n//\t\tdb.createTables(jsonEncoder);\n//\t\tdb.createAndInsertMetricsInfosTable();\n//\t\tdb.saveMetrics(jsonEncoder);\n//\t\tdb.closeConnection();\n\t}", "private static void printResults(Map<Path, Double> resultFiles2) {\r\n\t\tSystem.out.println();\r\n\t\tSystem.out.println(\"Najboljih 10 rezultata: \");\r\n\t\tint i = 0;\r\n\t\tfor (Map.Entry<Path, Double> e : resultFiles.entrySet()) {\r\n\t\t\tif (i==10) break;\r\n\t\t\tif (e.getValue() < 1E-9) break;\r\n\t\t\tSystem.out.printf(\"[%d] (%.4f) %s %n\", i, e.getValue(), e.getKey().toString());\r\n\t\t\ti++;\r\n\t\t}\r\n\t\t\r\n\t}", "public void percentages(String[] files, PrintWriter out) throws IOException {\n\t\t\n\t\tint i, j; //loop counters\n\t\tint[] infoArray; //array that holds the counters for each file-to-file comparison \n\t\tLinkedList<RevisionNode> theList = toAnalyze; // takes a copy of the RevisionNode list of data parsed from the log\n\t\t\n\t\tfor (i = 0; i < files.length; i++) { //for the every element in the parameter array\n\t\t\tinfoArray = new int[files.length]; //set the array length to reflect how many elements there are\n\t\t\tIterator<RevisionNode> lIterator = theList.iterator(); //iterate through the list, for every node\n\t\t\t\n\t\t\twhile (lIterator.hasNext()) { //for every node in the RevisionNode list\n\t\t\t\tRevisionNode next = lIterator.next(); //take the next node in the list\n\t\t\t\t\n\t\t\t\tif (next.getRelevantFiles().contains(files[i])) { //if the current revision involved the current file, else skip this\n\t\t\t\t\t\n\t\t\t\t\tfor (j = 0; j < files.length; j++) { //checks for the presence of every other file\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (next.getRelevantFiles().contains(files[j])) { //if another is present\n\t\t\t\t\t\t\tinfoArray[j] += 1; //increment its respective counter, also counts occurrences of the current file as well\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\tSystem.out.println(); //spacing\n\t\t\tout.println();\n\t\t\tSystem.out.println(\"For the file \" + files[i].substring(files[i].lastIndexOf(\"/\") + 1) + \":\"); //indicates what file we are talking about\n\t\t\tout.println(\"For the file \" + files[i].substring(files[i].lastIndexOf(\"/\") + 1) + \":\");\n\t\t\n\t\t\tfor (j = 0; j < files.length; j++) { //for the length of our data array\n\t\t\t\n\t\t\t\tif (j != i) { //ignoring the current files slot since it would be 100% no matter what\n\t\t\t\t\n\t\t\t\t\tint percent = (int) Math.round((infoArray[j] / (double) infoArray[i]) * 100); //round to the nearest percent\n\t\t\t\t\t//indicates that when file i is changed in a revision, file j is also changed at the same revision percent% of the time\n\t\t\t\t\tSystem.out.println(\"\\t When changed, \" + files[j].substring(files[j].lastIndexOf(\"/\") + 1) + \" is changed \" + percent + \"% of the time.\");\n\t\t\t\t\tout.println(\"\\t When changed, \" + files[j].substring(files[j].lastIndexOf(\"/\") + 1) + \" is changed \" + percent + \"% of the time.\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}", "private static void runTests() {\r\n\t\tfor (int i = 0; i < testFiles.length; i++) {\r\n\t\t\tConverter file = new Converter(testFiles[i]);\r\n\t\t\tfile.convert();\r\n\t\t\tSystem.out.println(\"---------\");\r\n\t\t}\r\n\t}", "static void getResults2(String root) throws IOException {\n\t\tint k = 1;\n\t\twhile (k <= 1) {\n\t\t\tint j = 1;\n\t\t\tString line;\n\t\t\tString multi = \"\";\n\t\t\tSystem.out.println(\"M\" + k);\n\n\t\t\twhile (j <= 10) {\n\t\t\t\tBufferedReader br = new BufferedReader(new FileReader(new File(root\n\t\t\t\t\t\t+ \"M1/M1.1/Testbeds-\" + j + \"/Generated/PSL//test/Precision/multi.txt\")));\n\n\t\t\t\twhile ((line = br.readLine()) != null) {\n\t\t\t\t\tmulti += line;\n\t\t\t\t\tSystem.out.print(line + \",\");\n\n\t\t\t\t}\n\t\t\t\tSystem.out.print(\"\\n\");\n\n\t\t\t\tj++;\n\t\t\t}\n\t\t\tk++;\n\t\t}\n\t}", "public void processResults() {\r\n try {\r\n rm5 = new Process(new File(_corePath.RAPID_MINER_PROCESS_XML));\r\n IOContainer ioResult = rm5.run();\r\n ExampleSet resultSet;\r\n int num_rules = 0;\r\n if (ioResult.getElementAt(0) instanceof ExampleSet) {\r\n resultSet = (ExampleSet) ioResult.getElementAt(0);\r\n for (int i = 0; i <= resultSet.size() - 1; i++) {\r\n if ((resultSet.getExample(i).get(\"Premise Items\").equals(1)) && (resultSet.getExample(i).get(\"Conclusion Items\").equals(1))) {\r\n num_rules++;\r\n results += \"<ul><li title=\\\"Premise\\\">\" + resultSet.getExample(i).get(\"Premise\") + \"</li>\"\r\n + \"<li title=\\\"Conclusion\\\">\" + resultSet.getExample(i).get(\"Conclusion\") + \"</li>\"\r\n + \"<li title=\\\"Confidence\\\" class=\\\"metrics\\\">\" + String.format(\"%f%n\", resultSet.getExample(i).get(\"Confidence\")) + \"</li>\"\r\n + \"<li title=\\\"Conviction\\\" class=\\\"metrics\\\">\";\r\n\r\n if (resultSet.getExample(i).get(\"Conviction\").equals(\"Infinity\")) {\r\n results += resultSet.getExample(i).get(\"Conviction\");\r\n } else {\r\n results += String.format(\"%f%n\", resultSet.getExample(i).get(\"Conviction\"));\r\n }\r\n\r\n results += \"</li>\"\r\n + \"<li title=\\\"Gain\\\" class=\\\"metrics\\\">\" + String.format(\"%f%n\", resultSet.getExample(i).get(\"Gain\")) + \"</li>\"\r\n + \"<li title=\\\"Laplace\\\" class=\\\"metrics\\\">\" + String.format(\"%f%n\", resultSet.getExample(i).get(\"Laplace\")) + \"</li>\"\r\n + \"<li title=\\\"Lift\\\" class=\\\"metrics\\\">\" + String.format(\"%f%n\", resultSet.getExample(i).get(\"Lift\")) + \"</li>\"\r\n + \"<li title=\\\"Ps\\\" class=\\\"metrics\\\">\" + String.format(\"%f%n\", resultSet.getExample(i).get(\"Ps\")) + \"</li>\"\r\n + \"<li title=\\\"Total Support\\\" class=\\\"metrics\\\">\" + String.format(\"%f%n\", resultSet.getExample(i).get(\"Total Support\")) + \"</li><li class=\\\"num_rules\\\">\" + num_rules + \"</li></ul>\";\r\n } else {\r\n break;\r\n }\r\n }\r\n } else {\r\n results = \"No results found.\";\r\n }\r\n\r\n results = results.replace(\"[\", \"\");\r\n results = results.replace(\"]\", \"\");\r\n\r\n\r\n } catch (OperatorException ex) {\r\n Logger.getLogger(Core.class.getName()).log(Level.SEVERE, null, ex);\r\n } catch (IOException ex) {\r\n Logger.getLogger(Core.class.getName()).log(Level.SEVERE, null, ex);\r\n } catch (XMLException ex) {\r\n Logger.getLogger(Core.class.getName()).log(Level.SEVERE, null, ex);\r\n }\r\n }", "public void Report() throws IOException {\n\t\tFile outputFile = new File(outputPath);\n\n\t\tif(!outputFile.exists()) {\n\t\t\toutputFile.createNewFile();\n\t\t}\n\t\t\n\t\tFileWriter writer = new FileWriter(outputPath);\n\t\tLinkedHashMap<Word, Integer> sortedResult = sortByValue();\n\t\tfloat frequency;\n\t\tStringBuilder sb = new StringBuilder();\n\t\t\n\t\tfor(Map.Entry<Word, Integer> entry: sortedResult.entrySet()) {\n\t\t\tsb.setLength(0);\n\t\t\t\n\t\t\tfor(char c: entry.getKey().getCharacters()) {\n\t\t\t\tsb.append(c + \", \");\n\t\t\t}\n\t\t\t\n\t\t\tsb.delete(sb.length()-2, sb.length());\n\t\t\tfrequency = (float)entry.getValue()/(float)total_targets;\n\t\t\twriter.write(\"{(\" + sb.toString() + \"), \" + entry.getKey().getLength() +\n\t\t\t\t\t\t\t\"} = \" + String.format(\"%.2f\",Math.round(frequency * 100.0) / 100.0) +\n\t\t\t\t\t\t\t\" (\" + entry.getValue() + \"/\" + total_targets + \")\\n\");\n\t\t\t\n\t\t\tSystem.out.println(\"{(\" + sb.toString() + \"), \" + entry.getKey().getLength() +\n\t\t\t\t\t\t\t\t\"} = \" + String.format(\"%.2f\",Math.round(frequency * 100.0) / 100.0) +\n\t\t\t\t\t\t\t\t\" (\" + entry.getValue() + \"/\" + total_targets + \")\");\n\t\t}\n\t\tfrequency = (float)total_targets/(float)total;\n\t\t\n\t\tSystem.out.println(\"TOTAL Frequency: \" + Math.round(frequency * 100.0) / 100.0 + \"(\" + total_targets + \"/\" + total + \")\");\n\t\twriter.write(\"TOTAL Frequency: \" + Math.round(frequency * 100.0) / 100.0 + \"(\" + total_targets + \"/\" + total + \")\\n\");\n\t\t\n\t\twriter.close();\n\t}", "private void outputResults()\n{\n try {\n PrintWriter pw = new PrintWriter(new FileWriter(output_file));\n pw.println(total_documents);\n for (Map.Entry<String,Integer> ent : document_counts.entrySet()) {\n String wd = ent.getKey();\n int ct = ent.getValue();\n pw.println(ct + \" \" + wd);\n }\n pw.println(START_KGRAMS);\n pw.println(total_kdocuments);\n for (Map.Entry<String,Integer> ent : kgram_counts.entrySet()) {\n String wd = ent.getKey();\n int ct = ent.getValue();\n pw.println(ct + \" \" + wd);\n } \n pw.close();\n }\n catch (IOException e) {\n IvyLog.logE(\"SWIFT\",\"Problem generating output\",e);\n }\n}", "public void evaluate ( String predictionFileName ) \n\t\t\t\tthrows IOException\t\n\t{\n\t\tdouble MAE = 0.0, RMSE = 0.0;\n\t\tint countRatings = 0, countTotal = 0;\n\t\t\t\t\n\t\tBufferedWriter wr = new BufferedWriter(new FileWriter(predictionFileName));\n\t\tfor (Integer user : dao.getTestUsers())\t{\n\t\t\tfor (Integer item : dao.getTestItems(user))\t{\n\t\t\t\tcountTotal++;\n\t\t\t\tdouble P = predict(user, item);\n\t\t\t\t// A prediction of -INF is used to indicate that the prediction cannot be made\n\t\t\t\tif (P == Double.NEGATIVE_INFINITY)\n\t\t\t\t\tcontinue;\n\t\t\t\tcountRatings++;\n\t\t\t\tdouble R = dao.getTestRating(user, item);\n\t\t\t\tdouble tmp = P - R;\n\t\t\t\tMAE += Math.abs(tmp);\n\t\t\t\tRMSE += tmp * tmp;\n\t\t\t\twr.write(String.format(\"%d %d %f %f\\n\", user, item, R, P));\n\t\t\t}\n\t\t}\n\t\twr.flush();\n\t\twr.close();\n\n\t\tSystem.out.println(\"Recommender evaluation on test data...\");\n\t\tif (countRatings == 0)\n\t\t\tSystem.out.println(\"Coverage : 0%\");\n\t\telse {\n\t\t\tMAE /= countRatings;\n\t\t\tRMSE = Math.sqrt(RMSE / countRatings);\n\t\t\tSystem.out.printf(\"Coverage %f%%\\n\", (countRatings * 100.0) / countTotal);\n\t\t\tSystem.out.printf(\"MAE : %f\\n\", MAE);\n\t\t\tSystem.out.printf(\"RMSE : %f\\n\", RMSE);\n\t\t}\t\t\n\t}", "private static void getResults() {\n\t\t//Variables\n\t\tFile directoryOfChunks = new File(\"output\");\n\t\tFile[] files = directoryOfChunks.listFiles();\n\t\tArrayList<String> filesInFolder = new ArrayList<>();\n\t\tArrayList<String> chunkResults = new ArrayList<>();\n\t\tBufferedReader br = null;\n\t\tReadFromFile rf = new ReadFromFile();\n\n\t\t//Get files from output folder\n\t\tif(directoryOfChunks.exists() && directoryOfChunks.isDirectory()){\n\t\t\tdirectoryName = \"output\";\n\t\t\t//Copy file names into arraylist\n\t\t\tfor (File f: files) {\n\t\t\t\t//Save file names into arraylist.\n\t\t\t\tfilesInFolder.add(f.getName());\n\t\t\t}\n\t\t}\n\t\t//if not a file or directory print error message\n\t\telse{\n\t\t\tSystem.out.println(\"No such file/directory: \" + directoryOfChunks);\n\t\t}\n\n\t\t//for loop to open and read each individual file\n\t\tfor (String file : filesInFolder) {\n\t\t\ttry {\n\n\t\t\t\tFileReader reader = new FileReader(directoryName + \"\\\\\" + file);\n\t\t\t\tbr = new BufferedReader(reader);\n\t\t\t} catch (FileNotFoundException e1) {\n\t\t\t\te1.printStackTrace();\n\t\t\t}\n\t\t\tchunkResults.addAll(rf.readFromChunk(br));\n\t\t}\n\n\t\t//Call sanitizeAndSplit\n\t\tsanitizeAndSplit(chunkResults);\n\t}", "private void SummaryReport()\n {\n System.out.println(\"\\n\\n***********************************************************************\");\n System.out.println(\"* CodeScanner Summary Report\");\n System.out.println(\"*\");\n System.out.println(\"* Run Date: \" + new SimpleDateFormat(\"yyyy.MM.dd HH:mm:ss\").format(new Date()));\n System.out.println(\"* Yaml File: \" + confFileName);\n System.out.println(\"* Code Path: \" + startPath);\n System.out.println(\"*\");\n System.out.println(\"* Dir include pattern: \" + dirIncludePattern.toString());\n System.out.println(\"* Dir exclude pattern: \" + dirExcludePattern.toString());\n System.out.println(\"* Directories scanned: \" + dirCount);\n System.out.println(\"* Directories matched: \" + dirMatchCount);\n System.out.println(\"* Dir Line matched: \" + dirLineMatchCount);\n System.out.println(\"*\");\n System.out.println(\"* File include pattern: \" + fileIncludePattern.toString());\n System.out.println(\"* File exclude pattern: \" + fileExcludePattern.toString());\n System.out.println(\"* Files scanned: \" + fileCount);\n System.out.println(\"* Files matched: \" + fileMatchCount);\n System.out.println(\"* Files Line matched: \" + fileLineMatchCount);\n System.out.println(\"*\");\n System.out.println(\"* Line replace pattern: \" + lineFindReplace.toString());\n System.out.println(\"* Line include pattern: \" + lineIncludePattern.toString());\n System.out.println(\"* Line exclude pattern: \" + lineExcludePattern.toString());\n System.out.println(\"* Lines replaced: \" + totalReplaceCount);\n System.out.println(\"* Lines scanned: \" + totalLineCount);\n System.out.println(\"* Lines matched: \" + lineMatchCount);\n System.out.println(\"*\");\n System.out.println(\"* Distinct Matching URLs Found\");\n\n for (String url : distinctURLs.values())\n {\n String ipAddress = \"\";\n try\n {\n InetAddress address = InetAddress.getByName(new URL(\"https://\" + url).getHost());\n ipAddress = address.getHostAddress();\n\n }\n catch(Exception ex)\n {\n ipAddress = \"not found\";\n }\n\n System.out.println(\"* \" + url + \" (\" + ipAddress + \")\");\n }\n\n System.out.println(\"*\");\n System.out.println(\"***********************************************************************\");\n }", "private void print(List<String> list, int fileNum, String dir){\n\n //controlling existance of results directory\n File resDir = new File(dir+\"/A_results/\");\n resDir.mkdir();\n\n try {\n PrintWriter resWriter = new PrintWriter(dir+\"/A_results/result\"+fileNum+\".\"+writeExtention, \"UTF-8\");\n for(String s : list) {\n resWriter.println(s);\n resWriter.flush();\n }\n\n resWriter.close();\n } catch (FileNotFoundException | UnsupportedEncodingException e) {\n e.printStackTrace();\n }\n }", "public static void printReport(List<String> files, String mode, int stacksize, int count, boolean lineNumbers) throws IOException {\n if (!\"cpu\".equals(mode) && !\"heap\".equals(mode)) {\n throw new IllegalArgumentException(\"tests.profile.mode must be one of (cpu,heap)\");\n }\n if (stacksize < 1) {\n throw new IllegalArgumentException(\"tests.profile.stacksize must be positive\");\n }\n if (count < 1) {\n throw new IllegalArgumentException(\"tests.profile.count must be positive\");\n }\n Map<String, SimpleEntry<String, Long>> histogram = new HashMap<>();\n int totalEvents = 0;\n long sumValues = 0;\n String framePadding = \" \".repeat(COLUMN_SIZE * 2);\n for (String file : files) {\n try (RecordingFile recording = new RecordingFile(Paths.get(file))) {\n while (recording.hasMoreEvents()) {\n RecordedEvent event = recording.readEvent();\n if (!isInteresting(mode, event)) {\n continue;\n }\n RecordedStackTrace trace = event.getStackTrace();\n if (trace != null) {\n StringBuilder stack = new StringBuilder();\n for (int i = 0; i < Math.min(stacksize, trace.getFrames().size()); i++) {\n if (stack.length() > 0) {\n stack.append(\"\\n\")\n .append(framePadding)\n .append(\" at \");\n }\n stack.append(frameToString(trace.getFrames().get(i), lineNumbers));\n }\n String line = stack.toString();\n SimpleEntry<String,Long> entry = histogram.computeIfAbsent(line, u -> new SimpleEntry<String, Long>(line, 0L));\n long value = getValue(event);\n entry.setValue(entry.getValue() + value);\n totalEvents++;\n sumValues += value;\n }\n }\n }\n }\n // print summary from histogram\n System.out.printf(Locale.ROOT, \"PROFILE SUMMARY from %d events (total: %s)\\n\", totalEvents, formatValue(sumValues));\n System.out.printf(Locale.ROOT, \" tests.profile.mode=%s\\n\", mode);\n System.out.printf(Locale.ROOT, \" tests.profile.count=%d\\n\", count);\n System.out.printf(Locale.ROOT, \" tests.profile.stacksize=%d\\n\", stacksize);\n System.out.printf(Locale.ROOT, \" tests.profile.linenumbers=%b\\n\", lineNumbers);\n System.out.printf(Locale.ROOT, \"%s%sSTACK\\n\", pad(\"PERCENT\"), pad(mode.toUpperCase(Locale.ROOT) + \" SAMPLES\"));\n List<SimpleEntry<String, Long>> entries = new ArrayList<>(histogram.values());\n entries.sort((u, v) -> v.getValue().compareTo(u.getValue()));\n int seen = 0;\n for (SimpleEntry<String, Long> c : entries) {\n if (seen++ == count) {\n break;\n }\n String percent = String.format(\"%2.2f%%\", 100 * (c.getValue() / (float) sumValues));\n System.out.printf(Locale.ROOT, \"%s%s%s\\n\", pad(percent), pad(formatValue(c.getValue())), c.getKey());\n }\n }", "void startFile() {\n writeToFile(defaultScore);\n for (int i = 0; i < 5; i++) {\n writeToFile(readFromFile() + defaultScore);\n }\n }", "public static void main(String[] args) { \n processDataFile();\n realtorLogImpl.traverseDisplay();\n System.out.println();\n propertyLogImpl.traverseDisplay();\n System.out.println();\n generateReport();\n }", "public void run() {\n // Initialize\n imports = new HashSet<>();\n lines = new ArrayList<>();\n\n // Read and merge source files\n final File folder = new File(\"src\");\n recurseOverFolder(folder);\n\n // Output to file\n outputFile();\n }", "public void processRun(int nr, boolean logAtomics) throws IOException {\r\n\t\tString out =\"\";\r\n\t\t\r\n\t\tif(logAtomics) {\r\n\t\t\tout = \"\"+data.getName()+\" run \"+nr;\r\n\t\t\twriter.write(out);\r\n\t\t\twriter.write(System.getProperty(\"line.separator\"));\r\n\t\t\tout = \"gen\"+SEP+\"fitness\"+SEP+\"pfm\"+SEP+\"f_full\"+SEP+\"f_1to1\"+SEP+\"dur\"+SEP+\"AUC_full\"+SEP+\"AUC_1to1\"+SEP+\"AUC_pfm\"+SEP+\"metric\"+SEP+\"prec\"+SEP+\"recall\";\r\n\t\t\twriter.write(out);\r\n\t\t\twriter.write(System.getProperty(\"line.separator\"));\r\n\t\t\t// write to file\r\n\t\t\twriter.flush();\r\n\t\t}\r\n\t\tdouble xBefore = 0;\r\n\t\t\r\n\t\tdouble aucFull = 0; double yFullBefore = 0;\r\n\t\t\r\n\t\tdouble auc1to1 = 0; double y1to1Before = 0;\r\n\t\t\r\n\t\tdouble aucpfm = 0; double ypfmBefore = 0;\r\n\t\t\r\n\t\tMapping reference = data.getReferenceMapping();\r\n\t\tfor(int i = 0; i<perRunAndDataSet.size(); i++) {\r\n\t\t\tEvaluationPseudoMemory mem = perRunAndDataSet.get(i);\r\n\t\t\tMapping map = fitness.getMapping(mem.metric.getExpression(), mem.metric.getThreshold(), true);\r\n\t\t\t// For real F-measures use best 1-to-1 mapping\r\n\t\t\tMapping map_1to1 = Mapping.getBestOneToOneMappings(map);\r\n\t\t\tdouble prec, recall, fMeasure, prec_1to1, recall_1to1, fMeasure_1to1;\r\n\t\t\tPRFCalculator prf = new PRFCalculator();\r\n\t\t\tprec = prf.precision(map, reference);\r\n\t\t\trecall = prf.recall(map, reference);\r\n\t\t\tfMeasure = prf.fScore(map, reference);\r\n\t\t\t\r\n\t\t\tif(Double.isNaN(fMeasure) || Double.isInfinite(fMeasure)) {\r\n\t\t\t\tSystem.err.println(\"NaN computation on Fmeasure, setting it to 0\");\r\n\t\t\t\tfMeasure = 0;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tmem.precision=prec;\r\n\t\t\tmem.recall=recall;\r\n\t\t\tmem.fmeasue=fMeasure;\r\n\t\t\t\r\n\t\t\tprec_1to1 = prf.precision(map_1to1, reference);\r\n\t\t\trecall_1to1 = prf.recall(map_1to1, reference);\r\n\t\t\tfMeasure_1to1 = prf.fScore(map_1to1, reference);\r\n\t\t\t\r\n\t\t\tif(Double.isNaN(fMeasure_1to1) || Double.isInfinite(fMeasure_1to1)) {\r\n\t\t\t\tSystem.err.println(\"NaN computation on Fmeasure 1-to-1, setting it to 0\");\r\n\t\t\t\tfMeasure_1to1 = 0;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tmem.precision_1to1=prec_1to1;\r\n\t\t\tmem.recall_1to1=recall_1to1;\r\n\t\t\tmem.fmeasue_1to1=fMeasure_1to1;\r\n\t\t\t// compute auc values\r\n\t\t\tdouble xNow=mem.generation;\r\n\t\t\taucFull += computeAUCSummand(xBefore, xNow, yFullBefore, fMeasure);\r\n\t\t\tauc1to1 += computeAUCSummand(xBefore, xNow, y1to1Before, fMeasure_1to1);\r\n\t\t\taucpfm += computeAUCSummand(xBefore, xNow, ypfmBefore, mem.pseudoFMeasure);\r\n\t\t\t//log\r\n\t\t\tif(logAtomics) {\r\n\t\t\t\tlogAtomic(mem, aucFull, auc1to1, aucpfm);\r\n\t\t\t}\r\n\t\t\txBefore = xNow;\r\n\t\t\tyFullBefore = fMeasure;\r\n\t\t\ty1to1Before = fMeasure_1to1;\t\r\n\t\t\typfmBefore = mem.pseudoFMeasure;\r\n\t\t}\r\n\t\t// log to statistics final fs,auc\r\n\t\tF_full.add(yFullBefore);\r\n\t\tF_1to1.add(y1to1Before);\r\n\t\tPFM.add(ypfmBefore);\r\n\t\tAUC_full.add(aucFull);\r\n\t\tAUC_1to1.add(auc1to1);\r\n\t\tAUC_pfm.add(aucpfm);\r\n\t\t\r\n\t\tout = data.getName()+\" run:\"+nr+\"\\n\"+\"gens\"+SEP+\"fit\"+SEP+\"pfm\"+SEP+\"f\"+SEP+\"f_1to1\"+SEP+\"dur\"+SEP+\"AUC\"+SEP+\"AUC_1to1\"+SEP+\"AUC_pfm\";\r\n\t\twriter.write(out);\r\n\t\twriter.write(System.getProperty(\"line.separator\"));\r\n\t\tlogAtomic(perRunAndDataSet.getLast(),aucFull,auc1to1,aucpfm);\r\n\t}", "public void main(String args[]) throws IOException{\n\t\tMetricData metric = new MetricData();\n\t\tMethodData method = new MethodData();\n\t\tFanOutTest fot = new FanOutTest();\n\t\t\n\t\tUtility.Test();\n\t\t\n\t\tfot.start();\n\t\t\n\t\tFileData fileData = new FileData();\n\t\t\n\t\tmetric.getName();\n\t\tmetric.getValue();\n\t\t\n\t}", "protected void storeAndWriteEvalResults(Evaluation aggregated,\n Instances headerNoSummary, int totalFolds, boolean testSetPresent,\n String seed, String outputPath) throws IOException {\n\n StringBuilder buff = new StringBuilder();\n String info = \"Summary - \";\n if (testSetPresent) {\n info += \"separate test set\";\n } else if (totalFolds == 1) {\n info += \"test on training\";\n } else {\n info +=\n totalFolds + \" fold cross-validation (seed=\" + seed + \"): \"\n + m_classifier.getClass().getCanonicalName() + \" \"\n + Utils.joinOptions(m_classifier.getOptions())\n + \"\\n(note: relative measures might be slightly \"\n + \"pessimistic due to the mean/mode of the target being computed on \"\n + \"all the data rather than on training folds)\";\n }\n info += \":\\n\";\n if (aggregated.predictions() != null) {\n info +=\n \"Number of predictions retained for computing AUC/AUPRC: \"\n + aggregated.predictions().size() + \"\\n\";\n }\n buff.append(info).append(\"\\n\\n\");\n buff.append(aggregated.toSummaryString()).append(\"\\n\");\n if (headerNoSummary.classAttribute().isNominal()) {\n try {\n buff.append(aggregated.toClassDetailsString()).append(\"\\n\");\n buff.append(aggregated.toMatrixString()).append(\"\\n\");\n } catch (Exception ex) {\n logMessage(ex);\n throw new IOException(ex);\n }\n }\n\n String evalOutputPath =\n outputPath\n + (outputPath.toLowerCase().contains(\"://\") ? \"/\" : File.separator)\n + \"evaluation.txt\";\n m_textEvalResults = buff.toString();\n PrintWriter writer = null;\n try {\n writer = openTextFileForWrite(evalOutputPath);\n writer.println(m_textEvalResults);\n } finally {\n if (writer != null) {\n writer.flush();\n writer.close();\n writer = null;\n }\n }\n\n OutputStream stream = null;\n try {\n Instances asInstances =\n WekaClassifierEvaluationReduceTask\n .evaluationResultsToInstances(aggregated);\n m_evalResults = asInstances;\n\n String arffOutputPath =\n outputPath\n + (outputPath.toLowerCase().contains(\"://\") ? \"/\" : File.separator)\n + \"evaluation.arff\";\n writer = openTextFileForWrite(arffOutputPath);\n writer.println(asInstances.toString());\n\n String csvOutputPath =\n outputPath\n + (outputPath.toLowerCase().contains(\"://\") ? \"/\" : File.separator)\n + \"evaluation.csv\";\n stream = openFileForWrite(csvOutputPath);\n CSVSaver saver = new CSVSaver();\n saver.setRetrieval(Saver.BATCH);\n saver.setInstances(asInstances);\n saver.setDestination(stream);\n saver.writeBatch();\n } catch (Exception ex) {\n logMessage(ex);\n throw new IOException(ex);\n } finally {\n if (writer != null) {\n writer.flush();\n writer.close();\n }\n if (stream != null) {\n stream.flush();\n stream.close();\n }\n }\n }", "public void execute() {\n\t\tfinal File toCheckDirectory = new File(toCheck);\n\t\tfinal File checkInDirectory = new File(checkIn);\n\t\tfinal List<File> toCheckFiles = new ArrayList<>();\n\t\tfinal List<File> checkInFiles = new ArrayList<>();\n\n\t\tline();\n\t\treadFiles(toCheckDirectory, toCheckFiles);\n\t\tSystem.out.println(\"Files to check : \" + toCheckFiles.size());\n\t\treadFiles(checkInDirectory, checkInFiles);\n\t\tSystem.out.println(\"Files for check: \" + checkInFiles.size());\n\t\tline();\n\t\tSystem.out.println(\"\");\n\t\ttoCheckFiles.stream().forEach(file -> {\n\t\t\tfinal String name = file.getName();\n\t\t\tfinal List<File> foundList = checkInFiles.stream().filter( //\n\t\t\t\t\tcheck -> check.getName().equalsIgnoreCase(name)).collect(Collectors.toList());\n\n\t\t\tif (foundList == null || foundList.isEmpty()) {\n\t\t\t\tSystem.out.println(\"Not found: \" + file.getAbsolutePath());\n\t\t\t\tnotFound++;\n\t\t\t} else {\n\t\t\t\tfinal int size = foundList.size();\n\n\t\t\t\tif (size > 1) {\n\t\t\t\t\tSystem.out.println(\"\" + size + \" \" + file.getAbsoluteFile());\n\t\t\t\t\tif (size < PRINT_EACH_FILE_IF_LESS_THAN_THIS_NUMBER) {\n\t\t\t\t\t\tfoundList.stream().forEach(foundFile -> {\n\t\t\t\t\t\t\tSystem.out.println(\"- \" + foundFile.getAbsolutePath());\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tSystem.out.println(\"\");\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tSystem.out.println(\"\");\n\t\tline();\n\t\tSystem.out.println(\"Not found: \" + notFound);\n\t\tSystem.out.println(\"Done.\");\n\t\tline();\n\t}", "private void run() {\n log.log(Level.INFO, \"Starting multiple evaluation of {0} tasks\", tasks.size());\n boolean done = tasks.isEmpty();\n while (!done) {\n boolean hasFreeTasks = true;\n while (hasCapacity() && hasFreeTasks) {\n File task = getFreeTask();\n if (task == null) {\n hasFreeTasks = false;\n } else {\n EvaluatorHandle handle = new EvaluatorHandle();\n if (handle.createEvaluator(task, log, isResume)) {\n log.fine(\"Created new evaluation handler\");\n evaluations.add(handle);\n }\n }\n }\n\n log.log(Level.INFO, \"Tasks in progress: {0}, Unfinished tasks: {1}\", new Object[]{evaluations.size(), tasks.size()});\n try {\n Thread.sleep(5000);\n } catch (InterruptedException ex) {\n //Bla bla\n }\n checkRunningEvaluations();\n done = tasks.isEmpty();\n }\n\n }", "public static void main(String[] args) throws Exception {\n\t\tfor(int i=200;i<=1200;i+=200){\n\t\t\tString inputPath=\"\";\n\t\t\t\n\t\t\t/*inputPath=\"/home/Hadoop/桌面/files/\"+i+\"/result-std-logSize\";\n\t\t\tSystem.out.println(\"Level:\"+i+\",std-LogSize:\");\n\t\t\tvalue(inputPath);*/\n\t\t\t/*inputPath=\"/home/Hadoop/桌面/files/\"+i+\"/result-origin\";\n\t\t\tSystem.out.println(\"origin:\");\n\t\t\tvalue(inputPath);*/\n\t\t\t\n\t\t\tinputPath=\"/home/Hadoop/桌面/files/\"+i+\"/result-mixedTime-test1\";\n\t\t\tSystem.out.println(\"level\"+i+\", mixedTime:\");\n\t\t\tvalue(inputPath);\n\t\t\tSystem.out.println();\n\t\t\t\n\t\t\t\n\t\t\t/*inputPath=\"/home/Hadoop/桌面/files/\"+i+\"/result-std-0\";\n\t\t\tSystem.out.println(\"std-0:\");\n\t\t\tvalue(inputPath);\n\t\t\tSystem.out.println();\n\t\t\t\n\t\t\tinputPath=\"/home/Hadoop/桌面/files/\"+i+\"/result-std\";\n\t\t\tSystem.out.println(\"Level:\"+i+\",std:\");\n\t\t\tvalue(inputPath);\n\t\t\t\n\t\t\tinputPath=\"/home/Hadoop/桌面/files/\"+i+\"/result-square\";\n\t\t\tSystem.out.println(\"Level:\"+i+\",square:\");\n\t\t\tvalue(inputPath);\n\t\t\t\n\t\t\tinputPath=\"/home/Hadoop/桌面/files/\"+i+\"/result-line\";\n\t\t\tSystem.out.println(\"Level:\"+i+\",line:\");\n\t\t\tvalue(inputPath);\n\t\t\t*/\n\t\t\t\n\t\t}\n \n }", "public static void Algorunner(String pathOfDataset,String reportPath) throws Exception\n\t{\n\t String path = pathOfDataset; //Map to pathOfDataset \n\t String files;\n\t File folder = new File(path);\n\t File[] listOfFiles = folder.listFiles(); \n\t \n\t int fileCounter=0;\n\t for (int i = 0; i < listOfFiles.length; i++) \n\t {\n\t \n\t \t if (listOfFiles[i].isFile()) \n\t \t {\n\t \t\t files = listOfFiles[i].getName();\n\t \t\t if (files.endsWith(\".arff\"))\n\t \t\t {\n\t \t\t\t fileCounter++;\n\t \t\t }\n\t \t }\n\t }\n\t File[] arffFiles = new File[fileCounter];\n\t fileCounter=0;\n\t for (int i = 0; i < listOfFiles.length; i++) \n\t {\n\t \n\t \t if (listOfFiles[i].isFile()) \n\t \t {\n\t \t\t files = listOfFiles[i].getName();\n\t \t\t if (files.endsWith(\".arff\"))\n\t \t\t {\n\t \t\t\t arffFiles[fileCounter] = listOfFiles[i];\n\t \t\t\t fileCounter++;\n\t \n\t \t\t }\n\t \t }\n\t }\n\t //Code For printing all file name\n\t System.out.println(\"Files for Testing :\");\n\t for (int i = 0; i < arffFiles.length; i++) \n\t {\n\t \t if (arffFiles[i].isFile()) \n\t \t {\n\t \t\t System.out.println((i+1)+\") \"+arffFiles[i].getName());\n\t \t }\n\t }\n\t \n\t Classifier[] models = { \tnew J48(),\n \t\t\t\t\t\tnew PART(),\n \t\t\t\t\t\tnew DecisionTable(),\n \t\t\t\t\t\tnew DecisionStump(),\n \t\t\t\t\t\tnew SimpleCart(),\n \t\t\t\t\t\tnew NaiveBayes(), // Naive Bayes Classifier\n \t\t\t\t\t\tnew Logistic(),\n \t\t\t\t\t\tnew Bagging(),\n \t\t\t\t\t\tnew WLSVM(),\t// SVM \n \t\t\t\t\t\tnew RandomForest(),\t// Random Forest\n \t\t\t\t\t\tnew IBk(), \t// K- nearest neighbour\t\n \t\t\t\t\t\tnew MultilayerPerceptron(), //Neural Network\n \t\t\t\t\t\tnew AdaBoostM1() //Ada boosting\n\t \t\t\t\t\t\t};\n\t //\n\t \n\t //Start writing about csv\n\t StringBuilder csv2 = new StringBuilder(\",\");\t \n\t StringBuilder csvFile = new StringBuilder(\",\");\n\t for(int k=0;k<models.length;k++)\n\t {\n\t\t csv2.append(models[k].getClass().getSimpleName());\n\t\t if(k!=models.length-1)\n\t\t\t csv2.append(\",\");\n\t\t else\n\t\t\t csv2.append(\"\\n\");\n\t }\n\t System.out.println(csvFile.toString());\n\n \t\n \tdouble[][] Comparision = new double[arffFiles.length][models.length];\n \tint[][] weight = new int[arffFiles.length][models.length];\n \tfor (int i = 0; i < arffFiles.length; i++) \n \t{\n \t\tBufferedReader datafile = readDataFile(arffFiles[i].getName().toString(),pathOfDataset);\n \t\tSystem.out.println(\"File Under Testing..... : \"+arffFiles[i].getName().toString());\n \t\tInstances data = new Instances(datafile);\n \t\tdata.setClassIndex(data.numAttributes() - 1);\n \n \t\t// Choose a type of validation split\n \t\t//Instances[][] split = crossValidationSplit(data, 10);\n \n \t\t// Separate split into training and testing arrays\n \t\t//Instances[] trainingSplits = split[0];\n \t\t//Instances[] testingSplits = split[1];\n \n \t\t// Choose a set of classifiers\n \n \t\t// Run for each classifier model\n \t\tfor(int j = 0; j < models.length; j++) \n \t\t{\n \t\t\t\n \t\t\t//Code For error rate\n \t\t\tEvaluation eval = new Evaluation(data);\n \t\t\tmodels[j].buildClassifier(data);\n \t\t\t//used when training and test set is given\n \t\t\t//eval.evaluateModel(svm, filedata2);\n \t\t\t//single data\n \t\t\teval.crossValidateModel(models[j], data,5, new Random(1));\n \t\t\tdouble recall = eval.fMeasure(0)+eval.fMeasure(1);\n \t\t\t//eval.areaUnderROC(arg0)\n \t\t\tdouble aoc = eval.areaUnderROC(0);\n \t\t\taoc = eval.areaUnderROC(1);\n \t\t\t\n \t\t\tdouble accuracy = 1-eval.errorRate();\n \t\t\t// System.out.println(\"SVM error rate : \"+errormid*100);\n \t\t\t// System.out.println(models[j].getClass().getSimpleName() + \": \" + String.format(\"%.2f%%\", (1-errormid)*100) + \"\\n=====================\");\n \t\t\n \t\t\t\n \t\t\t//double param2 = eval.fMeasure(1);\n \t\t\t\n \t\t\tComparision[i][j]= 1-eval.errorRate();\n \t\t\t\n \t\t\t}\n \n \t\t}\n \t\t\n \t\tSystem.out.println();\n \t\tSystem.out.println(\"Accuray of classifiers : Actual : \");\n \t\tfor(int k=0;k<arffFiles.length;k++)\n \t\t{\n \t\t\tcsv2.append(arffFiles[k].getName().toString());\n \t\t\tcsv2.append(\",\");\n \t\t\tfor(int l=0;l<models.length;l++)\n \t\t\t{\n \t\t\t\t//System.out.print(\" || \"+Comparision[k][l]);\n \t\t\t\t\n \t\t\t\tcsv2.append(Comparision[k][l]+\",\");\n \t\t\t\t\n \t\t\t}\n \t\t\tcsv2.deleteCharAt(csv2.length()-1);\n \t\t\tcsv2.append(\"\\n\");\n \t\t\t//System.out.println();\n \t\t\t//System.out.println(\"********************\");\n \t\t}\n \t\tcsv2.deleteCharAt(csv2.length()-1);\n \t\tfor(int k=0;k<arffFiles.length;k++)\n \t\t{\n \t\t\tdouble[][] sample = new double[2][models.length];\n \t\t\tfor(int l=0;l<models.length;l++)\n \t\t\t{\n \t\t\t\tsample[0][l]=Comparision[k][l];\n \t\t\t\tsample[1][l]=(l+1);\n \t\t\t}\n \t\t\t//test for work... working :)\n \t\t\t/*\n \t\t\tfor(int w=0;w<2;w++)\n \t\t\t{\n \t\t\t\tfor(int q=0;q<models.length;q++)\n \t\t\t\t{\n \t\t\t\tSystem.out.print(\" \"+sample[w][q]);\n \t\t\t\t}\n \t\t\t\tSystem.out.println(\"*******\");\n \t\t\t}\n */\n \t\t\tint n = models.length;\n \t\t\tdouble swap1,swap2;\n \t\t\tfor (int c = 0; c < ( n - 1 ); c++) \n \t\t\t{\n \t\t\t\tfor (int d = 0; d < n - c - 1; d++) \n \t\t\t\t{\n \t\t\t\t\tif (sample[0][d] > sample[0][d+1]) /* For descending order use < */\n \t\t\t\t\t{\n \t\t\t\t\t\tswap1 = sample[0][d];\n \t\t\t\t\t\tsample[0][d] = sample[0][d+1];\n \t\t\t\t\t\tsample[0][d+1] = swap1;\n \n \t\t\t\t\t\tswap2 = sample[1][d];\n \t\t\t\t\t\tsample[1][d] = sample[1][d+1];\n \t\t\t\t\t\tsample[1][d+1] = swap2;\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t\tfor(int l=0;l<models.length;l++)\n \t\t\t{\n \t\t\t\tDouble d = new Double(sample[1][l]);\n \t\t\t\tweight[k][d.intValue()-1] = models.length-l;\n \t\t\t}\n \t\t}\n \t\t//testing\n \t\tSystem.out.println(\"Rank Vector \");\n \t\tfor(int k=0;k<arffFiles.length;k++)\n \t\t{\n \t\t\tcsvFile.append(arffFiles[k].getName().toString());\n \t\t\tcsvFile.append(\",\");\n \t\t\tfor(int l=0;l<models.length;l++)\n \t\t\t{\n \t\t\t\tSystem.out.print(\" || \"+weight[k][l]);\n \t\t\t\tcsvFile.append(weight[k][l]);\n \t\t\t\tif(l!=models.length-1)\n \t\t\t\t\tcsvFile.append(\",\");\n \t\t\t\telse\n \t\t\t\t{\n \t\t\t\t\t//if(k!=arffFiles.length-1)\n \t\t\t\t\tcsvFile.append(\"\\n\");\n \t\t\t\t} \n \t\t\t}\n \t\t\tSystem.out.println();\n \n \t\t}\n \t\t\tcsvFile.append(\"\\n\");\n \t\t\tcsvFile.append(\"Sum of Ranks (Lower is Better)\");\n \t\t\tcsvFile.append(\",\");\n \n \t\t\tStringBuilder rank = new StringBuilder();\n \n \t\t\tfor(int l=0;l<models.length;l++)\n \t\t\t{\n \t\t\t\tint sum=0;\n \t\t\t\tfor(int k=0;k<arffFiles.length;k++)\n \t\t\t\t{\n \t\t\t\t\tsum+=weight[k][l];\n \t\t\t\t}\n \t\t\t\t\trank.append((double)sum/(double)arffFiles.length);\n \t\t\t\t\tcsvFile.append(sum);\n \t\t\t\t\tif(l!=models.length-1)\n \t\t\t\t\t{\n \t\t\t\t\t\tcsvFile.append(\",\");\n \t\t\t\t\t\trank.append(\",\");\n \t\t\t\t\t}\n \t\t\t\t\telse\n \t\t\t\t\t{\n \t\t\t\t\t\t//if(k!=arffFiles.length-1)\n \t\t\t\t\t\tcsvFile.append(\"\\n\");\n \t\t\t\t\t\trank.append(\"\\n\");\n \t\t\t\t\t} \n \t\t\t}\n \t \n \t\t\tcsvFile.append(\"\\n\");\n \t\t\tcsvFile.append(\"Avrage Ranks\");\n \t\t\tcsvFile.append(\",\");\n \t\t\tcsvFile.append(rank.toString());\n \t\t\t//Ranks of algorithms\n \n \n \t\t\tint sum=0;\n \t\t\tint series = models.length;\n \t\t\tseries = (series*(series+1))/2;\n \t\t\tseries = series*(arffFiles.length);\n \t\t\tfor(int l=0;l<models.length;l++)\n \t\t\t{\n \t\t\t\tfor(int k=0;k<arffFiles.length;k++)\n \t\t\t\t{\n \t\t\t\t\tsum += weight[k][l];\n \t\t\t\t}\n \t\t\t\tSystem.out.println(\"Parameter for \"+models[l].getClass().getSimpleName()+ \" : \"+sum+\"/\"+series );\n \t\t\t\tsum=0;\n \t\t\t\tSystem.out.println();\n \n \t\t\t}\n \n\t\t\t\t \t\t\t\n\t\t\t\t /*\n\t\t\t\t for(int w=0;w<2;w++)\n\t\t\t\t {\n\t\t\t\t \tfor(int q=0;q<models.length;q++)\n\t\t\t\t \t{\n\t\t\t\t \tSystem.out.print(\" \"+sample[w][q]);\n\t\t\t\t \t}\n\t\t\t\t \tSystem.out.println(\" \");\n\t\t\t\t \tSystem.out.println(\" \");\n\t\t\t\t \tSystem.out.println(\" \");\n\t\t\t\t }\n\t\t\t\t } \n\t\t\t */\n\t\t\t \n \t\t\t\t//arffFiles.length][models.length];\n \t\t\tSystem.out.println(\"Done\");\n \t\t\twriteCSVReport(csvFile.toString(),reportPath);\n \t\t\twriteCSVReport(csv2.toString(), reportPath);\n \t\t\tSystem.out.println(csvFile.toString());\n\t\t \n\t}", "public void readFile()\r\n\t{\r\n\t\t\r\n\t\ttry\r\n\t\t{\r\n\t\t\tx = new Scanner(new File(\"clean vipr measles results.txt\"));\r\n\t\t\t\r\n\t\t\twhile (x.hasNext())\r\n\t\t\t{\r\n\t\t\t\tString a = x.next();\r\n\t\t\t\tString b = x.next();\r\n\t\t\t\tString c = x.next();\r\n\t\t\t\t\r\n\t\t\t\tSystem.out.printf(\"%s %s %s \\n\\n\", a,b,c);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tx.close();\r\n\t\t}\r\n\t\tcatch (Exception e)\r\n\t\t{\r\n\t\t\tSystem.out.println(\"file not found\");\r\n\t\t}\r\n\t\r\n\t}", "public static void _generateStatistics() {\n\t\ttry {\n\t\t\t// Setup info\n\t\t\tPrintStream stats = new PrintStream(new File (_statLogFileName + \".txt\"));\n\n\t\t\tScanner scan = new Scanner(new File(_logFileName+\".txt\"));\n\t\t\twhile (scan.hasNext(SETUP.toString())) {\n\t\t\t\t// Append setup info\n\t\t\t\tstats.append(scan.nextLine()+\"\\n\");\n\t\t\t}\n\t\t\tstats.append(\"\\n\");\n\n\t\t\twhile (scan.hasNext(DETAILS.toString()) || scan.hasNext(RUN.toString())) {\n\t\t\t\t// Throw detailed info away\n\t\t\t\tscan.nextLine();\n\t\t\t}\n\n\t\t\twhile (scan.hasNext()) {\n\t\t\t\t// Append post-run info\n\t\t\t\tstats.append(scan.nextLine()+\"\\n\");\n\t\t\t}\n\t\t\tscan.close();\n\t\t\tstats.append(\"\\n\");\n\n\t\t\t// Perf4J info\n\t\t\tReader reader = new FileReader(_logFileName+\".txt\");\n\t\t\tLogParser parser = new LogParser(reader, stats, null, 10800000, true, new GroupedTimingStatisticsTextFormatter());\n\t\t\tparser.parseLog();\n\t\t\tstats.close();\n\t\t}\n\t\tcatch (FileNotFoundException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void runExample() throws FileNotFoundException {\n\t\tget_file_List();\r\n\t\t\r\n\t\t//display the list of files obtained\r\n\t\t//display_file_list();\r\n\t\t\r\n\t\t//parse each document\r\n\t\tparseDocument();\r\n\t\t\r\n\t\t//Iterate through the list and print the data\r\n\t\t//printData(); // not in use for now\r\n\t\t\r\n\t}", "public void dumpMyData() {\n\t PrintStream output=null;\n\t try{\n\t\t output=new PrintStream(new FileOutputStream(\"/Users/saigeetha/Documents/School Documents/Fall 2016/Assignments/CSCI_572_HW2/CrawlReport.txt\"));\n\t\t System.setOut(output);\n\t\t System.out.println(\"Name: Sai Geetha Kandepalli Cherukuru\");\n\t\t System.out.println(\"USC ID : 7283210853\");\n\t\t System.out.println(\"News site crawled: nytimes.com\");\n\t\t System.out.println();\n\t\t System.out.println(\"Fetch Statistics\");\n\t\t System.out.println(\"================\");\n\t\t System.out.println(\"# fetches attempted: \"+fetchesAttempted);\n\t\t System.out.println(\"# fetches succeeded: \"+fetchesSucceeded);\n\t\t System.out.println(\"# fetches aborted: \"+fetchesAborted);\n\t\t System.out.println(\"# fetches failed: \"+fetchesFailed);\n\t\t System.out.println();\n\t\t System.out.println(\"Outgoing URLs:\");\n\t\t System.out.println(\"================\");\n\t\t System.out.println(\"Total URLs extracted:\"+urlsExtracted);\n\t\t System.out.println(\"# unique URLs extracted: \"+uniqueUrlsExtracted.size());\n\t\t System.out.println(\"# unique URLs within News Site: \"+uniqueUrlsWithinNews.size());\n\t\t System.out.println(\"# unique URLs outside News Site: \"+uniqueUrlsOutsideNews.size());\n\t\t System.out.println();\n\t\t System.out.println(\"Status Codes:\");\n\t\t System.out.println(\"================\");\n\t\t \n\t\t for(Integer k: statusCodes.keySet()) {\n\t\t\t Integer value=statusCodes.get(k);\n\t\t\t System.out.println(k+\": \"+value);\n\t\t }\n\t\t \n\t\t System.out.println();\n\t\t System.out.println(\"File Sizes:\");\n\t\t System.out.println(\"================\");\n\t\t \n\t\t for(String k: fileSizes.keySet()) {\n\t\t\t Integer value=fileSizes.get(k);\n\t\t\t System.out.println(k+\": \"+value);\n\t\t }\n\t\t \n\t\t System.out.println();\n\t\t System.out.println(\"Content Types:\");\n\t\t System.out.println(\"================\");\n\t\t \n\t\t for(String k: contentTypes.keySet()) {\n\t\t\t Integer value=contentTypes.get(k);\n\t\t\t System.out.println(k+\": \"+value);\n\t\t }\n\t\t \n\t } catch(FileNotFoundException e) {\n\t\t e.printStackTrace();\n\t }\n }", "private static void printStats()\r\n\t{\r\n\t\tSystem.out.println(\"Keywords found: \" + keywordHits);\r\n\t\tSystem.out.println(\"Links found: \" + SharedLink.getLinksFound());\r\n\t\tSystem.out.println(\"Pages found: \" + SharedPage.getPagesDownloaded());\r\n\t\tSystem.out.println(\"Failed downloads: \" + SharedPage.getFailedDownloads());\r\n\t\tSystem.out.println(\"Producers: \" + fetchers);\r\n\t\tSystem.out.println(\"Consumers: \" + parsers);\r\n\t}", "private static void pdfFilesOutput() {\n\n // make output directory if it doesn't already exist\n new File(\"output\").mkdirs();\n\n Output airportFlightCounter = new AirportFlightCounter(airports);\n Output flightInventory = new FlightInventory(flights);\n Output flightPassengerCounter = new FlightPassengerCounter(flights);\n Output mileageCounter = new MileageCounter(flights, airports);\n\n try {\n airportFlightCounter.toPDFFile();\n flightInventory.toPDFFile();\n flightPassengerCounter.toPDFFile();\n mileageCounter.toPDFFile();\n } catch (DocumentException | FileNotFoundException e) {\n logger.error(\"Could not write to one or more PDF files - please close any open instances of that file\");\n e.printStackTrace();\n }\n\n logger.info(\"Output to PDF files completed\");\n }", "public void runTest() throws InterruptedException {\n //Run Tests using Threads\n List<Thread> threads= new LinkedList<>();\n\n for (int i=0;i<calculatorList.size();i++){\n Thread t= new MyThread(i) {\n @Override\n public void run() {\n testMethodList.get(getK()).runTest();\n }\n };\n threads.add(t);\n }\n\n for (Thread t: threads){\n t.run();\n }\n for (Thread t: threads){\n t.join();\n }\n //Calculate Accuracy\n // - String Calculator Name,\n // - accuracy rate\n //- tests print\n List<Object[]> info=new ArrayList<>();\n for (int i=0;i<calculatorList.size();i++){\n Object[] calculatorInfo=new Object[3];\n calculatorInfo[0]=calculatorList.get(i).getName();\n TestMethod testMethod= testMethodList.get(i);\n calculatorInfo[1]=formula.evaluate(testMethod.getSuccess(),testMethod.getFails());\n calculatorInfo[2]=testMethod.getTestsPrint().toString();\n info.add(calculatorInfo);\n }\n printer.printByFormat(info);\n }", "private void summarize() {\n System.out.println();\n System.out.println(totalErrors + \" errors found in \" +\n totalTests + \" tests.\");\n }", "private void summarize() {\n System.out.println();\n System.out.println(totalErrors + \" errors found in \" +\n totalTests + \" tests.\");\n }", "public void process()\n {\n for (int i = 0; i <= names.length-1; i++)\n {\n int x = 0;\n System.out.println(\"\");\n System.out.print(names[i] + \" had test scores of \");\n for (int j = 0; j <= scores[0].length-1; j++)\n {\n System.out.print(scores[i][j] + \", \");\n \n x += scores[i][j];\n \n }\n System.out.print(\" Test average is \" + x/4 + \".\");\n }\n System.out.println(\"\");\n findL();\n findH();\n findAvg();\n }", "public static void main(String [ ] args){\n\t\tScoreTrakker tracker = new ScoreTrakker();\n\t\ttracker.processFiles();\n\t}", "public void printMetrics() {\n System.out.println(\"\\nPROG_SIZE = \" + Metrics.getProgSize() + '\\n' + \"EXEC_TIME = \" + Metrics.getExecTime() + \" ms\" + '\\n' + \"EXEC_MOVE = \" + Metrics.getExecMove() + '\\n' + \"DATA_MOVE = \" + Metrics.getDataMove() + '\\n' + \"DATA_READ = \" + Metrics.getDataRead() + '\\n' + \"DATA_WRITE = \" + Metrics.getDataWrite() + '\\n');\n }", "public static void evaluation(List<Tweet> tweets){\n\t\tEvaluator eval = new Evaluator();\n\t\tint[][] confusionMatrix = eval.computeConfusionMatrix(tweets);\n\n\t\t// Variables for calculation of the micro and macro accuracy.\n\t\tint allTp = 0;\n\t\tint allFn = 0;\n\t\tint allFp = 0;\n\t\tint allTn = 0;\n\t\tdouble macroAccuracy = 0.0;\n double macroPrecision = 0.0;\n double macroRecall = 0.0;\n double macroFscore = 0.0;\n\n\n\t\t// System.out.println(confusionMatrix.keySet());\n\t\t// Outputting the evaluation for each label.\n\t\tfor (Labels label : Labels.values()) {\n\t\t\tint tp = eval.computeTP(confusionMatrix, label);\n\t\t\tallTp = allTp + tp;\n\t\t\tint fn = eval.computeFN(confusionMatrix, label);\n\t\t\tallFn = allFn + fn;\n\t\t\tint fp = eval.computeFP(confusionMatrix, label);\n\t\t\tallFp = allFp + fp;\n\t\t\tint tn = eval.computeTN(confusionMatrix, label);\n\t\t\tallTn = allTn + tn;\n\n\t\t\tdouble precision = eval.getPrecision(tp, fp);\n\t\t\tdouble recall = eval.getRecall(tp, fn);\n double fscore = eval.getFScore(precision, recall);\n\t\t\tmacroAccuracy = macroAccuracy + eval.getAccuracy(tp, fn, fp, tn);\n\n macroPrecision += precision;\n macroRecall += recall;\n macroFscore += fscore;\n\n\t\t\tSystem.out.println(\"********* Outputting the evaluation results for \" + label.toString() + \" *********\");\n\t\t\tSystem.out.println(label.toString() + \"\\t\\t TP: \" + tp + \"\\t FN: \" + fn + \"\\t FP: \" + fp + \"\\t TN: \" + tn);\n\t\t\tSystem.out.println(\"\\t\\t Precision: \" + precision);\n\t\t\tSystem.out.println(\"\\t\\t Recall: \" + recall);\n\t\t\tSystem.out.println(\"\\t\\t FScore: \" + fscore);\n\t\t\tSystem.out.println(\"\\t\\t Accuracy: \" + eval.getAccuracy(tp, fn, fp, tn));\n\t\t\tSystem.out.println(\"\\n\");\n\t\t}\n\t\t// Outputting the accuracy for all labels.\n\t\tSystem.out.println(\"********* Outputting the macro/micro accuracy for all labels *********\");\n\t\tSystem.out.println(\"Macro-Precision: \" + macroPrecision/Labels.getSize());\n System.out.println(\"Macro-Recall: \" + macroRecall/Labels.getSize());\n System.out.println(\"Macro-Fscore: \" + macroFscore/Labels.getSize());\n\t\tSystem.out.println(\"Macro-Accuracy: \" + macroAccuracy / Labels.getSize());\n\t}", "public void printDistance(int runNum, String dir){\n\n List<String[]> destinations = parseFileByName(dir+\"/destinations.\"+readExtention);\n List<Point2D> destination = new ArrayList<>();\n List<List<Double>> distances = new ArrayList<>();\n for(String[] strings : destinations)\n destination.add(new Point2D(Double.parseDouble(strings[0]),Double.parseDouble(strings[1])));\n\n for(int i = 0; i < runNum; i++) {\n List<String[]> receiverContent = parseFileByName(dir+\"/receivers_placement_\"+i+\".\"+readExtention);\n List<Point2D> receiverValues = new ArrayList<>();\n for(String[] strings : receiverContent)\n receiverValues.add(new Point2D(Double.parseDouble(strings[1]),Double.parseDouble(strings[2])));\n List<Double> distanceFromDestination = new ArrayList<>();\n for(Point2D receiverPosition : receiverValues)\n distanceFromDestination.add(receiverPosition.distance(destination.get(i)));\n distances.add(distanceFromDestination);\n }\n\n try {\n PrintWriter resWriter = new PrintWriter(dir+\"/A_results/distances\"+\".\"+writeExtention, \"UTF-8\");\n for(int i = 0;i < distances.get(0).size(); i++){\n String s = \"\";\n for(List<Double> distanceFromDestination : distances)\n s = s + distanceFromDestination.get(i) + \",\";\n int n = i+1;\n\n int nLastChar = numberOfTests%26;\n\n char lastChar = 'A';\n\n lastChar+=nLastChar-1;\n int nFirstChar = 0;\n if(numberOfTests>26){\n nFirstChar= numberOfTests/26;\n }\n\n String avg;\n String var;\n\n if(nFirstChar==0){\n avg = \"=AVERAGE(A\"+n+(\":\"+lastChar)+n+\"),\";\n var = \"=VAR(A\"+n+(\":\"+lastChar)+n+\")\";\n }\n else {\n char firstChar = 'A';\n firstChar += nFirstChar;\n avg = \"=AVERAGE(A\"+n+(\":\"+firstChar+\"\"+lastChar)+n+\"),\";\n var = \"=VAR(A\"+n+(\":A\"+firstChar+\"\"+lastChar)+n+\")\";\n }\n\n s += avg + var;\n resWriter.println(s);\n resWriter.flush();\n\n }\n\n resWriter.close();\n } catch (FileNotFoundException e) {\n e.printStackTrace();\n } catch (UnsupportedEncodingException e) {\n e.printStackTrace();\n }\n\n }", "private static void runCalculations()\n {\n // TODO Create two different empty concurrent histograms\n\n // Create a sleep time simulator, it will sleep for 10 milliseconds in each call\n BaseSyncOpSimulator syncOpSimulator = new SyncOpSimulSleep(10);\n\n // List of threads\n List<Runner> runners = new LinkedList<>();\n\n // Create the threads and start them\n for (int i = 0; i < NUM_THREADS; i ++)\n {\n // TODO Pass the proper histograms\n final Runner runner = new Runner(syncOpSimulator, null, null);\n runners.add(runner);\n new Thread(runner).start();\n }\n\n // Wait for runners to finish\n runners.forEach(Runner::waitToFinish);\n\n // TODO Show the percentile distribution of the latency calculation of each executeOp call for all threads\n }", "public void score(List<String> modelFiles, String testFile, String outputFile) {\n/* 1180 */ List<List<RankList>> trainingData = new ArrayList<>();\n/* 1181 */ List<List<RankList>> testData = new ArrayList<>();\n/* */ \n/* */ \n/* 1184 */ int nFold = modelFiles.size();\n/* */ \n/* 1186 */ List<RankList> samples = readInput(testFile);\n/* 1187 */ System.out.print(\"Preparing \" + nFold + \"-fold test data... \");\n/* 1188 */ FeatureManager.prepareCV(samples, nFold, trainingData, testData);\n/* 1189 */ System.out.println(\"[Done.]\");\n/* */ try {\n/* 1191 */ BufferedWriter out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), \"UTF-8\"));\n/* 1192 */ for (int f = 0; f < nFold; f++) {\n/* */ \n/* 1194 */ List<RankList> test = testData.get(f);\n/* 1195 */ Ranker ranker = this.rFact.loadRankerFromFile(modelFiles.get(f));\n/* 1196 */ int[] features = ranker.getFeatures();\n/* 1197 */ if (normalize)\n/* 1198 */ normalize(test, features); \n/* 1199 */ for (RankList l : test) {\n/* 1200 */ for (int j = 0; j < l.size(); j++) {\n/* 1201 */ out.write(l.getID() + \"\\t\" + j + \"\\t\" + ranker.eval(l.get(j)) + \"\");\n/* 1202 */ out.newLine();\n/* */ } \n/* */ } \n/* */ } \n/* 1206 */ out.close();\n/* */ }\n/* 1208 */ catch (IOException ex) {\n/* */ \n/* 1210 */ throw RankLibError.create(\"Error in Evaluator::score(): \", ex);\n/* */ } \n/* */ }", "public double classifyAll(String testDataFolder)\n\t{\n\t\tFile folder = new File(testDataFolder);\n\t\tFile[] listOfFiles = folder.listFiles();\n\t\tdouble accuracy = 0.0;\n\t\tint correct_classifications = 0;\n\t\tint testdata = 0;\n\t\tfor(int i=0;i<listOfFiles.length;i++){\n\t\t\tString doc = \"\";\n\t\t\ttry {\n\t\t\t\t\tBufferedReader reader = new BufferedReader(new FileReader(listOfFiles[i].getAbsoluteFile()));\n\t\t\t\t\tint count = 0;\n\t\t\t\t\tint actual_count = 0;\n\t\t\t\t\tint class_=0;\n\t\t\t\t\tint[] correct = new int[numClasses];\n\t\t\t\t\tint[] test = new int[numClasses];\n\t\t\t\t\tString line = \"\";\n\t\t\t\t\tint tabIndex=0;\n\t\t\t\t\tallDocs = new ArrayList<String>();\n\t\t\t\t\twhile((line=reader.readLine())!=null && !line.isEmpty()){\n\t\t\t\t\t\ttestdata++;\n\t\t\t\t\t\ttabIndex = line.indexOf('\\t');\n\t\t\t\t\t\tString type = line.substring(0, tabIndex);\n\t\t\t\t\t\tString msg = line.substring(tabIndex + 1);\n\t\t\t\t\t\tmsg = msg.toLowerCase();\n\t\t\t\t\t\tif(type.equals(\"ham\")){class_ = 0;}\n\t\t\t\t\t\telse{class_ = 1;}\n\t\t\t\t\t\ttest[class_]++;\n\t\t\t\t\t\tactual_count = actual_count + class_;\n\t\t\t\t\t\tint label = classify(msg);\n\t\t\t\t\t\tcount = count + label;\n\t\t\t\t\t\t//System.out.println(label+\"/\"+class_+\" \"+count);\n\t\t\t\t\t\tif(label-class_==0){\n\t\t\t\t\t\t\tcorrect_classifications++;\n\t\t\t\t\t\t\tcorrect[class_]++;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tint label = classify(doc);\n\t\t\t\tif(label - class_==0){correct[class_]++;}\n\t\t\t} \n\t\t\tcatch (IOException e){e.printStackTrace();}\n\t\t}\n\t\taccuracy = Math.round(correct_classifications * 1000.0 / testdata)/1000.0;\n\t\tSystem.out.println(\"Accuracy: \"+accuracy);\n\t\treturn accuracy;\n\t}", "public void print_metrics(){\n\t\tHashMap<Integer, HashSet<Integer>> pairs=return_pairs();\n\t\tint total=gold.data.getTuples().size();\n\t\ttotal=total*(total-1)/2;\n\t\tSystem.out.println(\"Reduction Ratio is: \"+(1.0-(double) countHashMap(pairs)/total));\n\t\tint count=0;\n\t\tfor(int i:pairs.keySet())\n\t\t\tfor(int j:pairs.get(i))\n\t\t\tif(goldContains(i,j))\n\t\t\t\tcount++;\n\t\tSystem.out.println(\"Pairs Completeness is: \"+(double) count/gold.num_dups);\n\t}", "private static void textFilesOutput() {\n\n // make output directory if it doesn't already exist\n new File(\"output\").mkdirs();\n\n Output airportFlightCounter = new AirportFlightCounter(airports);\n Output flightInventory = new FlightInventory(flights);\n Output flightPassengerCounter = new FlightPassengerCounter(flights);\n Output mileageCounter = new MileageCounter(flights, airports);\n\n try {\n airportFlightCounter.toTextFile();\n flightInventory.toTextFile();\n flightPassengerCounter.toTextFile();\n mileageCounter.toTextFile();\n } catch (FileNotFoundException e) {\n logger.error(\"Could not write to one or more text files - please close any open instances of that file\");\n e.printStackTrace();\n }\n\n logger.info(\"Output to text files completed\");\n }", "private void runAllTests(){\n System.out.println(\"------ RUNNING TESTS ------\\n\");\n testAdd(); // call tests for add(int element)\n testGet(); // tests if the values were inserted correctly\n testSize(); // call tests for size()\n testRemove(); // call tests for remove(int index)\n testAddAtIndex(); // call tests for add(int index, int element)\n\n // This code below will test that the program can read the file\n // and store the values into an array. This array will then be sorted\n // by the insertionSort and it should write the sorted data back into the file\n\n testReadFile(); // call tests for readFile(String filename)\n testInsertionSort(); // call tests for insertionSort()\n testSaveFile(); // call tests for saveFile(String filename)\n System.out.println(\"\\n----- TESTING COMPLETE ----- \");\n }", "public void calculateMetrics(){\n //precision\n precisionFinal = precision.stream().mapToDouble(f -> f).sum()/precision.size();\n System.out.print(\"Precision: \");\n System.out.println(precisionFinal);\n //recall\n recallFinal = recall.stream().mapToDouble(f -> f).sum()/recall.size();\n System.out.print(\"Recall: \");\n System.out.println(recallFinal);\n //fMeasures\n fMeausureFinal = fMeasures.stream().mapToDouble(f -> f).sum()/fMeasures.size();\n System.out.print(\"Fmeasure: \");\n System.out.println(fMeausureFinal);\n\n //MAP\n mapFinal = apRes.stream().mapToDouble(d->d).sum()/apRes.size();\n System.out.print(\"Mean Avarage Precision: \");\n System.out.println(mapFinal);\n \n mapLimitedFinal = apResRankedTopLimited.stream().mapToDouble(d->d).sum()/apResRankedTopLimited.size();\n System.out.print(\"Mean Precision at rank 10: \");\n System.out.println(mapLimitedFinal);\n \n //NDCG\n ndcgResultsFinal =0;\n ndcgResults.stream().forEach(l-> {\n //it is always true, only added to ensure that doesnt' break with another examples where some queries doens't have results.\n if(l.size()>0){\n ndcgResultsFinal= l.get(l.size()-1)+ndcgResultsFinal;\n }\n });\n ndcgResultsFinal=ndcgResultsFinal/ndcgResults.size();\n \n System.out.print(\"NDCG: \");\n System.out.println(ndcgResultsFinal);\n }", "public static void files(Scanner input) throws FileNotFoundException { \n File inputName = inputVerify(input); // call inputVerify method to get the name of the input file \n\n System.out.print(\"Output file name: \"); // ask user for output file name and save it to outputFile variable \n\t\tString outputName = input.next();\n\n Scanner inputFile = new Scanner(inputName); // reads input file\n\n // creates a new PrintStream object to print to the output file\n PrintStream output = new PrintStream(new File(outputName)); \n\n // while loop that runs as long as the input file has another line\n while (input.hasNextLine()){\n String line = inputFile.nextLine(); // reads entire line\n output.println(line + \":\"); // prints name to file\n String scoreLine = inputFile.nextLine(); // reads next line\n abCount(scoreLine, output); // call abCount method\n }\n }", "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 static void doInstrumentation(File in_dir, File out_dir) {\n\n String filelist[] = in_dir.list();\n\n for (int i = 0; i < filelist.length; i++) {\n String filename = filelist[i];\n if (filename.endsWith(\".class\")) {\n String in_filename = in_dir.getAbsolutePath() + System.getProperty(\"file.separator\") + filename;\n String out_filename = out_dir.getAbsolutePath() + System.getProperty(\"file.separator\") + filename;\n ClassInfo ci = new ClassInfo(in_filename);\n for (Enumeration e = ci.getRoutines().elements(); e.hasMoreElements(); ) {\n Routine routine = (Routine) e.nextElement();\n routine.addBefore(\"bitTools.Instrumentation\", \"dynMethodCount\", new Integer(1));\n\n for (Enumeration b = routine.getBasicBlocks().elements(); b.hasMoreElements(); ) {\n BasicBlock bb = (BasicBlock) b.nextElement();\n bb.addBefore(\"bitTools.Instrumentation\", \"dynInstrCount\", new Integer(bb.size()));\n }\n }\n // This instruction must be executed by the WebServer because only it knows\n // when a request has finished processing\n //ci.addAfter(\"Instrumentation\", \"writeMetricsToFile\", \"null\");\n ci.write(out_filename);\n }\n }\n }", "public static void main(String[] args) {\n\t\tSystem.out.println(\"Enter filename: \");\n\t\tScanner scanner = new Scanner(System.in);\n\t\tString filename = scanner.nextLine();\n\t\tBufferedReader fileReader = null;\n\t\tint[] counts = new int[10];\n\t\tint total = 0;\n\t\ttry {\n\t\t\tfileReader = new BufferedReader(new FileReader(filename));\n\t\t\tString line;\n\t\t\twhile ((line = fileReader.readLine()) != null) {\n\t\t\t\tif(line.length() > 0) {\n\t\t\t\t\tString[] parts = line.split(\" \");\n\t\t\t\t\tint num;\n\t\t\t\t\tif(parts.length > 0) {\n\t\t\t\t\t\tnum = Integer.parseInt(parts[parts.length - 1]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnum = Integer.parseInt(line); \n\t\t\t\t\t}\n\t\t\t\t\tint firstDigit = firstDigit(num);\n\t\t\t\t\tcounts[firstDigit]++;\n\t\t\t\t\ttotal++;\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\tfor(int i = 1; i < counts.length; i++) {\n\t\t\tSystem.out.printf(\"%d : %d : %.2f%%\\n\", i, counts[i], counts[i] * 100. / total);\n\t\t}\n\t}", "private static void printToFile(FrequencyCounter<Integer> freqCounter, ArrayList<Pair<Integer, Float>> plot) {\r\n\t\tPrintWriter writer;\r\n\t\ttry {\r\n\t\t\tString fName = \"experimentalResults\" + File.separator + \"results\" + freqCounter.getname() + \".txt\";\r\n\t\t\twriter = new PrintWriter(new File(fName));\r\n\t\t\tfor (Pair<Integer, Float> p : plot)\r\n\t\t\t\twriter.println(p);\r\n\r\n\t\t\twriter.close();\r\n\t\t} catch (FileNotFoundException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public void accumulateDetailedLogFiles(){\r\n\t\tString filter2 = \"_advanced_detail_analyzed\";\r\n\t\tString filter1 = \"_standard_detail_analyzed\";\r\n\r\n\t\tArrayList<File> files1 = new ArrayList<File>();\r\n\t\tArrayList<File> files2 = new ArrayList<File>();\r\n\t\t\r\n\t\t//begin with creation of new file\r\n\t\tJFileChooser fc = new JFileChooser();\r\n\t\t\r\n\t\t//set directory and \".log\" filter\r\n\t\tfc.setMultiSelectionEnabled(true);\r\n\t\tfc.setCurrentDirectory(new File(System.getProperty(\"user.dir\")));\r\n\t\tfc.setFileSelectionMode(JFileChooser.FILES_ONLY);\r\n\t\t\r\n\t\tint status = fc.showDialog(this, Messages.getString(\"EditLogControlPanel.approveButton\"));\r\n\t\t\r\n\t\tif(status == JFileChooser.APPROVE_OPTION){\r\n\t\t\tFile[] tmpFiles = fc.getSelectedFiles();\r\n\t\t\t//sort the files\r\n\t\t\tArrayList<File> sortedFiles = new ArrayList<File>();\r\n\t\t\t\r\n\t\r\n\t\t\tfor(int i = 0; i < tmpFiles.length; i++){\r\n\t\t\t\tif(sortedFiles.size() == 0) sortedFiles.add(tmpFiles[i]);\r\n\t\t\t\telse{\r\n\t\t\t\t\tboolean sorted = false;\r\n\t\t\t\t\tfor(File f:sortedFiles){\r\n\t\t\t\t\t\tif(compare(tmpFiles[i].getName().split(\"_\"),f.getName().split(\"_\")) < 0) {\r\n\t\t\t\t\t\t\tsorted = true;\r\n\t\t\t\t\t\t\tsortedFiles.add(sortedFiles.indexOf(f), tmpFiles[i]);\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\tif(!sorted) sortedFiles.add(tmpFiles[i]);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tFileWriter fstream1;\r\n\t\t\tFileWriter fstream2;\r\n\t\t\ttry {\r\n\t\t\t\tif(!(new File(tmpFiles[0].getParent() + \"/diagramms/\")).exists()) (new File(tmpFiles[0].getParent() + \"/diagramms/\")).mkdir();\r\n\t\t\t\tfstream1 = new FileWriter(tmpFiles[0].getParent() + \"/diagramms/standardAttackedDetailedDiagramm.txt\", false);\r\n\t\t\t\tBufferedWriter out1 = new BufferedWriter(fstream1);\r\n\t\t\t\t\r\n\t\t\t\tfstream2 = new FileWriter(tmpFiles[0].getParent() + \"/diagramms/advancedAttackedDetailedDiagramm.txt\", false);\r\n\t\t\t\tBufferedWriter out2 = new BufferedWriter(fstream2);\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tfloat[][] standardArray = new float[100][100];\r\n\t\t\t\tfloat[][] advancedArray = new float[100][100];\r\n\t\t\t\t\r\n\t\t\t\tfor(int i = 0; i < standardArray.length; i++){\r\n\t\t\t\t\tfor(int j = 0; j < standardArray[0].length; j++){\r\n\t\t\t\t\t\tstandardArray[i][j] = -1;\r\n\t\t\t\t\t\tadvancedArray[i][j] = -1;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tint counter = 0;\r\n\t\t\t\tfor(File file:sortedFiles){\r\n\t\t\t\t\t//get log names\r\n\t\t\t\t\tArrayList<File> files = getFileList(file);\r\n\t\t\t\t\r\n\t\t\t\t\tfiles1 = new ArrayList<File>();\r\n\t\t\t\t\tfiles2 = new ArrayList<File>();\r\n\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor(File f:files){\r\n\t\t\t\t\t\tif(f.getName().contains(filter1)) files1.add(f);\r\n\t\t\t\t\t\telse if(f.getName().contains(filter2)) files2.add(f);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tfloat [] accu1 = accumulateDetailFiles(files1);\r\n\t\t\t\t\tfloat [] accu2 = accumulateDetailFiles(files2);\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor(int i = 0; i < accu1.length; i++){\r\n\t\t\t\t\t\tstandardArray[i][counter] = accu1[i];\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tfor(int i = 0; i < accu2.length; i++){\r\n\t\t\t\t\t\tadvancedArray[i][counter] = accu2[i];\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tcounter++;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tfor(int j = 0; j < tmpFiles.length; j++) {\r\n\t\t\t\t\tout1.write(\"1 \");\r\n\t\t\t\t\tout2.write(\"1 \");\r\n\t\t\t\t}\r\n\t\t\t\tout1.write(\"\\n\");\r\n\t\t\t\tout2.write(\"\\n\");\r\n\t\t\t\tfor(int i = 1; i < standardArray.length; i++) {\r\n\t\t\t\t\tif(standardArray[i][0] == -1) break;\r\n\t\t\t\t\tfor(int j = 0; j < tmpFiles.length; j++){\r\n\t\t\t\t\t\tif(standardArray[i][j] == -1) out1.write(\"0 \");\r\n\t\t\t\t\t\telse out1.write(standardArray[i][j] + \" \");\r\n\t\t\t\t\t}\r\n\t\t\t\t\tout1.write(\"\\n\");\r\n\t\t\t\t}\r\n\t\t\t\tfor(int i = 1; i < advancedArray.length; i++) {\r\n\t\t\t\t\tif(advancedArray[i][0] == -1) break;\r\n\t\t\t\t\tfor(int j = 0; j < tmpFiles.length; j++){\r\n\t\t\t\t\t\tif(advancedArray[i][j] == -1) out2.write(\"0 \");\r\n\t\t\t\t\t\telse out2.write(advancedArray[i][j] + \" \");\r\n\t\t\t\t\t}\r\n\t\t\t\t\tout2.write(\"\\n\");\r\n\t\t\t\t}\r\n\r\n\t\t\t\tout1.close();\r\n\t\t\t\tout2.close();\r\n\t\t\t} catch (Exception e) {\r\n\t\t\t e.printStackTrace();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t}\r\n\t}", "public static void main(String[] args) throws IOException{\n Tree tree = new Tree(new DoubleString(0, \"M\"));\n \n for(int x = 0; x < fileCount; x ++) {\n \t//inserts every line from every input file into the tree\n \tBufferedReader input = new BufferedReader(new FileReader(x + \".txt\"));\n \t\n \tfor(int y = 0; y < 5; y ++) {\n \t\tinput.readLine();\n \t}\n \t\n \tString line = input.readLine();\n \t\n \twhile(line != null) {\n \t\tif(line.contains(\"----\")) {\n \t\t\tbreak;\n \t\t}\n \t\t\n \t\ttree.insert(new DoubleString(Double.parseDouble(betweenPipes(line, 3).trim().substring(0, betweenPipes(line, 3).trim().length() - 1)), betweenPipes(line, 2).trim()));\n \t\tline = input.readLine();\n \t}\n \t\n \tinput.close();\n }\n \n //converts the tree into an array and sorts the array\n DoubleString[] array = Tree.toArray(tree);\n DoubleString.sort(array, true);\n //creates (or overwrites, if it's already created) the output file\n PrintWriter output = new PrintWriter(new BufferedWriter(new FileWriter(\"output.txt\")));\n output.println(\"[hide=\" + format + \" stats)][code]Combined usage for \" + format + \" stats)\\n\" + \n \t\t\"+ ---- + ------------------ + ------- +\\n\" + \n \t\t\"| Rank | Pokemon | Percent |\\n\" + \n \t\t\"+ ---- + ------------------ + ------- +\");\n \n for(int i = 0; i < array.length; i ++) {\n \t//divides every stat from the array by the number of months and prints it into the output file\n \tarray[i].divideEquals(fileCount);\n \toutput.print(\"| \");\n \tString rank = i + \"\";\n \t\n \twhile(rank.length() < 3) {\n \t\trank = ' ' + rank;\n \t}\n \t\n \toutput.print(rank + \" | \");\n \tString name = array[i].toString();\n \t\n \twhile(name.length() < 19) {\n \t\tname = name + ' ';\n \t}\n \t\n \toutput.print(name + \"| \");\n \tString integer = (array[i].getNumber() + \"\").substring(0, (array[i].getNumber() + \"\").indexOf('.'));\n \tString fraction = (array[i].getNumber() + \"000\").substring((array[i].getNumber() + \"\").indexOf('.')).substring(0, 4);\n \t\n \twhile(integer.length() < 2) {\n \t\tinteger = ' ' + integer;\n \t}\n \t\n \toutput.println(integer + fraction + \"% |\");\n }\n \n //line of code I have to include to prevent weird things\n output.close();\n\t}", "public static void main(String[] args) {\r\n\t\tList<String> tracklist = TracklistCreator.readTrackList(\"work\\\\all_wav.txt\");\r\n\t\tint filesProcessed = 0;\r\n\t\tfor (String wavFilePath : tracklist) {\r\n\t\t\ttry {\r\n\t\t\t\tString track = StringUtils.substringAfterLast(wavFilePath, File.separator);\r\n\t\t\t\tString beatFilePath = TARGET_DIR + track + PathConstants.EXT_BEAT;\r\n\t\t\t\tnew VampBeatTimesProvider(wavFilePath, beatFilePath, new Configuration().pre);\r\n\t\t\t} catch (Exception e) {\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t if (++filesProcessed % 10 == 0) {\r\n\t \tLOG.info(filesProcessed + \" files were processed\");\r\n\t }\r\n\t\t}\r\n\t\tLOG.info(\"Done. \" + filesProcessed + \" files were saved to '\" + TARGET_DIR + \"'\");\r\n\t}", "public void report() throws IOException {\n\t\tBufferedWriter writer = new BufferedWriter(new FileWriter(\"comparisons.txt\", false));\n\t\tfor (Integer[] data : this.comparisons)\n\t\t\twriter.append(data[0] + \" \" + data[1] + \"\\n\");\n\t\twriter.close();\n\t}", "static void getReport(String root) throws Exception {\n\t\tint k = 7;\n\t\twhile (k <= 7) {\n\t\t\tint i = 1;\n\t\t\twhile (i <= 10) {\n\t\t\t\tlong startTime = System.currentTimeMillis();\n\t\t\t\tif (k == 1) {\n\t\t\t\t\tSystem.out.println(root + \"M1/M1.1//Testbeds-\" + i);\n\t\t\t\t\tConfigManager.filePath = root + \"M1/M1.1//Testbeds-\" + i + \"/Generated/\";\n\t\t\t\t\tSemCPSMain main2 = new SemCPSMain();\n\t\t\t\t\tmain2.readConvertStandardFiles();\n\t\t\t\t\tmain2.generatePSLDataModel();\n\t\t\t\t\tmain2.executePSLAproach();\n\n\t\t\t\t} else {\n\n\t\t\t\t\tSystem.out.println(root + \"M\" + k + \"/Testbeds-\" + i);\n\t\t\t\t\tConfigManager.filePath = root + \"M\" + k + \"/Testbeds-\" + i + \"/Generated/\";\n\t\t\t\t\tSemCPSMain main = new SemCPSMain();\n\t\t\t\t\tmain.readConvertStandardFiles();\n\t\t\t\t\tmain.generatePSLDataModel();\n\t\t\t\t\tmain.executePSLAproach();\n\t\t\t\t}\n\t\t\t\tlong endTime = System.currentTimeMillis();\n\t\t\t\tlong totalTime = endTime - startTime;\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tFileWriter fw = new FileWriter(ConfigManager.getFilePath()+\"PSL/test/Precision/F1NoTraining.txt\",true);\n\t\t\t\tfw.write(\"Time:\" + totalTime);//appends the string to the file\n\t\t\t fw.close();\n\t\t\t\t\n\t\t\t\ti++;\n\t\t\t}\n\t\t\tk++;\n\t\t}\n\t}", "public void runIndividualSpreadsheetTests() {\r\n\r\n\t\t// Make a list of files to be analyzed\r\n\t\tString[] inputFiles = new String[] {\r\n//\t\t\t\t\"salesforecast_TC_IBB.xml\",\r\n//\t\t\t\t\"salesforecast_TC_2Faults.xml\",\r\n//\t\t\t\t\t\t\t\"salesforecast_TC_2FaultsHeavy.xml\",\r\n\t\t\t\t\"SemUnitEx1_DJ.xml\",\r\n\t\t\t\t\"SemUnitEx2_1fault.xml\",\r\n\t\t\t\t\"SemUnitEx2_2fault.xml\",\r\n//\t\t\t\t\"VDEPPreserve_1fault.xml\",\r\n//\t\t\t\t\"VDEPPreserve_2fault.xml\",\r\n//\t\t\t\t\t\t\t\"VDEPPreserve_3fault.xml\",\r\n//\t\t\t\t\"AZA4.xml\",\r\n//\t\t\t\t\"Consultant_form.xml\",\r\n//\t\t\t\t\"Hospital_Payment_Calculation.xml\",\r\n//\t\t\t\t\"Hospital_Payment_Calculation_v2.xml\",\r\n//\t\t\t\t\"Hospital_Payment_Calculation_C3.xml\",\r\n//\t\t\t\t\"11_or_12_diagnoses.xml\",\r\n//\t\t\t\t\"choco_loop.xml\",\r\n//\t\t\t\t\"Paper2.xml\",\r\n//\t\t\t\t\"Test_If.xml\",\r\n//\t\t\t\t\"Test_If2.xml\",\r\n\r\n\t\t};\r\n\r\n\t\tscenarios.add(new Scenario(executionMode.singlethreaded, pruningMode.on, PARALLEL_THREADS, CHOCO3));\r\n//\t\tscenarios.add(new Scenario(executionMode.levelparallel, pruningMode.on, 2, CHOCO3));\r\n//\t\tscenarios.add(new Scenario(executionMode.fullparallel, pruningMode.on, 1, CHOCO3));\r\n\t\tscenarios.add(new Scenario(executionMode.fullparallel, pruningMode.on, 2, CHOCO3));\r\n//\t\tscenarios.add(new Scenario(executionMode.fullparallel, pruningMode.on, 4, CHOCO3));\r\n//\t\tscenarios.add(new Scenario(executionMode.heuristic, pruningMode.on, 1, CHOCO3));\r\n\t\tscenarios.add(new Scenario(executionMode.heuristic, pruningMode.on, 2, CHOCO3));\r\n//\t\tscenarios.add(new Scenario(executionMode.heuristic, pruningMode.on, 4, CHOCO3));\r\n//\t\tscenarios.add(new Scenario(executionMode.heuristic, pruningMode.on, PARALLEL_THREADS, true));\r\n//\t\tscenarios.add(new Scenario(executionMode.hybrid, pruningMode.on, 1, CHOCO3));\r\n\t\tscenarios.add(new Scenario(executionMode.hybrid, pruningMode.on, 2, CHOCO3));\r\n//\t\tscenarios.add(new Scenario(executionMode.hybrid, pruningMode.on, 4, CHOCO3));\r\n//\t\tscenarios.add(new Scenario(executionMode.levelparallel, pruningMode.on, PARALLEL_THREADS, false));\r\n//\t\tscenarios.add(new Scenario(executionMode.fullparallel, pruningMode.on, PARALLEL_THREADS, false));\r\n//\t\tscenarios.add(new Scenario(executionMode.fullparallel, pruningMode.on, PARALLEL_THREADS, false));\r\n//\t\tscenarios.add(new Scenario(executionMode.heuristic,pruningMode.on,PARALLEL_THREADS*2));\r\n//\t\tscenarios.add(new Scenario(executionMode.heuristic,pruningMode.on,0));\r\n\r\n//\t\tinputFiles = new String[]{\"VDEPPreserve_3fault.xml\"};\r\n\r\n\r\n\t\t// Go through the files and run them in different scenarios\r\n\t\tfor (String inputfilename : inputFiles) {\r\n\t\t\trunScenarios(inputFileDirectory, inputfilename, logFileDirectory, scenarios);\r\n\t\t}\r\n\t}", "public float[] accumulateDetailFiles(ArrayList<File> files){\r\n\t\tfloat[] values = new float[100];\r\n\t\tint counter = 0;\r\n\r\n\t for(File file:files){\t\t\r\n\t \tSystem.out.println(file.getName());\r\n\t \tcounter = 0;\r\n\t BufferedReader reader;\r\n\t try{\r\n\t reader = new BufferedReader(new FileReader(file));\r\n\t String line = reader.readLine(); \r\n\t while(line != null){\t\r\n\t \tif(!line.substring(0,1).equals(\"#\")){\r\n\t \t\tString[] values2 = line.split(\" \");\r\n\t \t\tvalues[counter] += Float.valueOf(values2[values2.length-1]);\r\n\t\t \tcounter++;\r\n\t \t}\r\n\t \tline = reader.readLine();\r\n\t }\r\n\t \r\n\t\t\t} catch (FileNotFoundException e) {\r\n\t\t\t System.err.println(\"FileNotFoundException: \" + e.getMessage());\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t System.err.println(\"Caught IOException: \" + e.getMessage());\r\n\t\t\t}\r\n\t }\r\n\r\n\t float[] returnValues = new float[counter];\r\n\t \r\n\t for(int j = 0; j < returnValues.length; j++) \treturnValues[j] = ((float)values[j]/files.size());\r\n\t\r\n\t \r\n \treturn returnValues;\r\n\t}", "@Override\n\tprotected void saveResults(){\n\t\tDateFormat dateFormat = new SimpleDateFormat(\"_yyyy_MM_dd_HH:mm:ss\");\n\t\tDate date = new Date();\n\t\ttry(BufferedWriter bw=new BufferedWriter(new FileWriter(\"/home/daniel/results/\"+this.mAffinityType+\"/\"+this.getClass().getSimpleName()+\"/\"+MAX_TASK_AGE+\"/\"+mOutputFileName+dateFormat.format(date)))){\n\t\t\tbw.write(this.getClass().getSimpleName()+\" with max age=\"+MAX_TASK_AGE+\"\\n\");\n\t\t\tbw.write(\"Total processing time: \"+cycles+\" TU\\n\");\n\t\t\tint count=0;\n\t\t\tfor(Task t : mTasks){\n\t\t\t\tbw.write(++count + \":\");\n\t\t\t\tif(t.getmAge()>=MAX_TASK_AGE){\n\t\t\t\t\tbw.write(\"Aging used\\n\");\n\t\t\t\t}else{\n\t\t\t\t\tbw.write(\"Aging not used\\n\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tbw.write(\"###############################################################\\n\");\n\t\t\tfor(int i=0;i<Task.TYPES_OF_TASK_NUMBER;++i){\n\t\t\t\tfor(int j=0;j<Task.TYPES_OF_TASK_NUMBER;++j){\n\t\t\t\t\tfor(int k=0;k<Task.TYPES_OF_TASK_NUMBER;++k){\n\t\t\t\t\t\t DecimalFormat df = new DecimalFormat(\"0.0\");\n\t\t\t\t\t\tbw.write(\"[\"+df.format(AFFINITY3[i][j][k])+\"]\");\n\t\t\t\t\t}\n\t\t\t\t\tbw.write(\"\\n\");\n\t\t\t\t}\n\t\t\t\tbw.write(\"###############################################################\\n\");\n\t\t\t}\n\t\t\t\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void run() {\n doProcessDocuments();\n //doReport();\n\n }", "private void printStatistics(int i){\n\t\tdouble mean=0;\n\t\tdouble min=999999999;\n\t\tdouble max=-999999999;\n\t\tint cnt=0;\n\t\tfor (String[] rCode:GMSValues.keySet()){\n\t\t\tdouble x=GMSValues.get(rCode);\n\t\t\tif (x==0)System.out.println(\"NULL\");\n\t\t\tmean=mean+x;\n\t\t\tif (x<min)min=x;\n\t\t\tif (x>max)max=x;\n\t\t\tcnt++;\n\t\t}\n\t\tmean=mean/(double)cnt;\n\t\tSystem.out.println(\"Minimum: \"+min);\n\t\tSystem.out.println(\"Maximum: \"+max);\n\t\tSystem.out.println(\"Mean Value: \"+mean);\n\t\ttry {\n\t \t FileWriter fw = new FileWriter(new File(\"data/GreedyResults.log\"), true);\n\t \t if (i==0)fw.write(\"Date, Run, Minimum, Maximum, Mean \"+\"\\n\");\n\t \t fw.write(new SimpleDateFormat(\"dd.MM.yyyy HH:mm:ss\").format(new Date())+\", \"+i+\", \");\n\t \t fw.write(min+\", \"+max+\", \"+mean+\"\\n\");\n\t \t fw.close();\n\t } catch (IOException e) {\n\t\t\tSystem.out.println(\"Filewriter Error\");\n\t\t\te.printStackTrace();\n\t\t}\n\t\tif(mean<min){\n\t\t\tSystem.out.println(\"FEHLER: Mean too small\");\n\t\t\tSystem.exit(0);\n\t\t}\n\t\t\n\t}", "public void writeResultMetricsToFile(String metricsFilePath) {\n String metricsOutputStr = utilityConstants.AVG_NO_OF_WORDS_STRING + avgNoOfWrds\n + utilityConstants.NEW_LINE_STRING + utilityConstants.AVG_NO_OF_CHARACTERS_STRING + avgNoOfChars\n + utilityConstants.NEW_LINE_STRING + utilityConstants.MAX_FREQUENCY_WORDS_STRING + maxFreqWrd\n + utilityConstants.NEW_LINE_STRING + utilityConstants.LONGEST_WORDS_STRING + longstWrd;\n writeDataToFile(metricsOutputStr.toCharArray(), metricsFilePath);\n }", "private void convertTestCaseResults(ArrayList<String> realIds,String file, ArrayList<String> tests) {\n \t\t\ttry {\t\t\n \t\t\t\tFileWriter writer = new FileWriter(file);\n \t\t\t\tlistener.getLogger().println(\"inizio ad aggiungere test case\"); \t\t\t \n \t\t\t\twriter.write(\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\\n\");\n \t\t\t\twriter.write(\"<testsuite>\\n\");\n \t\t\t\tIterator<String> itreal = realIds.iterator();\n \t\t\t\tIterator<String> ittest = tests.iterator();\n \t\t\t\twhile (itreal.hasNext() && ittest.hasNext()) {\n\t \t\t\t\t//Legge il file mxlog\n\t \t\t\t\tFile tr = new File(\"C:/Users/utente/Desktop/InvertSample/ScenariosAndTestCases/\"+itreal.next()+\".mxlog\");\t \n\t \t \tDocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();\n\t \t\t DocumentBuilder db;\n\t \t\t\ttry {\n\t \t\t\t\tdb = dbf.newDocumentBuilder();\n\t \t\t\t\tDocument doc = db.parse(tr);\n\t \t\t\t doc.getDocumentElement().normalize();\n\t \t\t\t XPath xpath = XPathFactory.newInstance().newXPath();\n\t \t\t\t XPathExpression xExpress = xpath.compile(\"//Str\");\n\t \t\t\t NodeList nl = (NodeList) xExpress.evaluate(doc, XPathConstants.NODESET);\n\t \t\t\t int index = nl.getLength()-1; \n\t \t\t\t if(nl != null){\n\t\t \t\t\t\t\twriter.write(\"\\t<testcase classname=\\\"TC\\\" name=\\\"\"+ittest.next()+\"\\\">\\n\");\n\t\t \t\t\t\t\tString esito=nl.item(index).getTextContent();\n\t\t \t\t\t\t\tesito=esito.substring(esito.lastIndexOf(\" \")+1);\n\t\t \t\t\t\t\tlistener.getLogger().println(esito); \n\t\t \t\t\t\t\tif(esito.equals(\"PASS\")){\n\t\t \t\t\t\t\t\twriter.write(\"\\t</testcase>\\n\");\n\t\t \t\t\t\t\t}\n\t\t \t\t\t\t\telse if(esito.equals(\"FAILURE\")){\n\t\t \t\t\t\t\t\twriter.write(\"\\t\\t<failure>\\n\\t\\t\\tProva testo difetto failure (4-7)\\n\\t\\t</failure>\\n\");\n\t\t \t\t\t\t\t\twriter.write(\"\\t</testcase>\\n\");\n\t\t \t\t\t\t\t}else{\n\t\t \t\t\t\t\t\twriter.write(\"\\t\\t<error>\\n\\t\\t\\tProva testo difetto errore(5-9)\\n\\t\\t</error>\\n\");\n\t\t \t\t\t\t\t\twriter.write(\"\\t</testcase>\\n\");\n\t\t \t\t\t\t\t}\n\t\t \t\t\t }else{\n\t\t\t \t\t\t \tlistener.getLogger().println(\"nl vuota\");\n\t\t\t \t\t\t }\n\t \t\t\t} catch (ParserConfigurationException | SAXException | IOException | XPathExpressionException e) {\n\t \t\t\t\tContactPolarion(listener);\n\t \t\t\t\tlistener.getLogger().println(e.getMessage());\n\t \t\t\t}\n \t\t\t\t}\n \t\t\twriter.write(\"</testsuite>\\n\");\n \t\t\t\twriter.flush();\n \t\t\t\twriter.close();\n \t\t\t\n \t\t\t} catch (Exception e) {\n \t\t\t\tContactPolarion(listener);\n \t\t\t\tlistener.getLogger().println(e.getMessage());\n \t\t\t\tlistener.getLogger().println(\"dotest: \\n\"+e.getMessage());\n \t\t\t}\t\n\t\t\t}", "public void compareAllFiles(){\n\n // setting up objects for comparing files\n System.out.println(\"Start of checking process of all files\");\n String file = \"\";\n int fileErrors = 0;\n FileWriter logFile = null;\n BufferedWriter logFileOut = null;\n\n try {\n logFile = new FileWriter(\"java_20/server/logFile.txt\");\n logFileOut = new BufferedWriter(logFile);\n\n } catch (IOException e) {\n e.printStackTrace();\n }\n\n\n // for loop to check over all files and updates logfiles\n for (int currentFile = 1; currentFile <= fileCount; currentFile++) {\n file = \"java_20/server/receivedFiles/receivedFile\"+currentFile+\".txt\";\n\n try {\n if (compareFile(file,\"java_20/server/standardFile.txt\") == false ){\n fileErrors++;\n logFileOut.write(\"ReceivedFile\"+currentFile+\":\\tERROR!!!!\\n\");\n }\n else\n logFileOut.write(\"ReceivedFile\"+currentFile+\":\\tpassed\\n\");\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n }\n\n // closing files and messages\n try {\n logFileOut.close();\n } catch (IOException e) {\n e.printStackTrace();\n }\n System.out.println(\"Number of errors found: \" + fileErrors);\n System.out.println(\"check \\'logFile.txt\\' for details\");\n\n }", "private void output(FileWriter outputFile, Map<Query, List<Evaluation>> evalData, FactDatabase source, FactDatabase target) {\n\t\tPrintWriter out = new PrintWriter(outputFile, true);\n\t\tif(source != null && target != null){\n\t\t\tfor(Query rule: evalData.keySet()){\n\t\t\t\tfor(Evaluation eval: evalData.get(rule)){\n\t\t\t\t\tout.print(rule.getRuleString());\n\t\t\t\t\tout.print(\"\\t\");\n\t\t\t\t\tout.print(eval.fact.first);\n\t\t\t\t\tout.print(\"\\t\");\n\t\t\t\t\tout.print(eval.fact.second);\n\t\t\t\t\tout.print(\"\\t\");\n\t\t\t\t\tout.print(eval.fact.third);\n\t\t\t\t\tout.print(\"\\t\");\n\t\t\t\t\tdetermineSource(eval, source, target);\n\t\t\t\t\tout.print(eval.source.toString());\n\t\t\t\t\tout.print(\"\\t\");\n\t\t\t\t\tout.println(eval.result.toString());\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\tfor(Query rule: evalData.keySet()){\n\t\t\t\tfor(Evaluation eval: evalData.get(rule)){\n\t\t\t\t\tout.print(rule.getRuleString());\n\t\t\t\t\tout.print(\"\\t\");\n\t\t\t\t\tout.print(eval.fact.first);\n\t\t\t\t\tout.print(\"\\t\");\n\t\t\t\t\tout.print(eval.fact.second);\n\t\t\t\t\tout.print(\"\\t\");\n\t\t\t\t\tout.println(eval.fact.third);\n\t\t\t\t}\n\t\t\t}\t\t\t\n\t\t}\n\t\t\n\t\tout.close();\n\t}", "public static void main(String[] args) throws IOException {\n\t\tint numSets = 10000;//10000;//500\r\n\t\tint numElements = 1000;//1000; //50\r\n\t\t\r\n//\t\tint[] betas = {2, 4, 8, 16, 32};\r\n//\t\tString[] probfiles = {\"scpnrg1.txt\", \"scpnrg2.txt\", \"scpnrg5.txt\"};\r\n//\t\tString[] probfiles = {\"scpnrh1.txt\", \"scpnrh3.txt\", \"scpnrh5.txt\"};\r\n\t\tint[] betas = {5};\r\n\t\tString[] probfiles = {\"scpnrg1.txt\", \"scpnrg5.txt\"};\r\n\t\tint numTimesRun = 1;\r\n\t\tint runningTime = 10;\r\n\t\tPrintWriter printWriter = new PrintWriter(new File(\"tuning_testIII.csv\"));\r\n\t\tfor(String dataset: probfiles){\r\n\t\t\tStringBuilder stringBuilder = new StringBuilder();\r\n\t\t\tfor(int beta: betas){\r\n\t\t\t\tfor(int i =0 ; i<numTimesRun; i++){\r\n\t\t\t\tDataObject data = new DataObject((\"src/\" + dataset), numSets);\r\n\t\t\t\tGRASP1 grasp = new GRASP1(numElements, numSets, data.getSets());\r\n\t\t\t\tint solution = grasp.run(runningTime, beta);\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t\tstringBuilder.append(\"Profiles: \" + \";\" + dataset + \";\");\r\n\t\t\t\tstringBuilder.append(\"The beta value: \" + \";\" + beta + \";\");\r\n\t\t\t\tstringBuilder.append(\"ItrationCount\" + \";\" + grasp.itrationCount + \";\");\r\n\t\t\t\tstringBuilder.append(\"Solution value: \" + \";\" + solution + \"\\n\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tprintWriter.write(stringBuilder.toString());\r\n\t\t}\r\n\t\tprintWriter.close();\r\n\t\tSystem.out.println(\"done!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\");\r\n\r\n\t}", "void collect() throws SQLException, IOException {\n\t\t// Open connection to the evaluation db with query classifications\n\t\tconn = DriverManager.getConnection(connectionString, user, pwd);\n\t\tconn.setCatalog(database);\n\t\t\n\t\t/*\nSELECT DISTINCT system, processNo\nFROM evaluationAverage\nWHERE algorithm = 'evosql' AND coverage < 1\n\t\t */\n\t\tPreparedStatement stmt = conn.prepareStatement(\"SELECT DISTINCT system, processNo FROM evaluationAverage WHERE algorithm = 'evosql' AND coverage < 1\");\n\t\tResultSet result = stmt.executeQuery();\n\t\t\n\t\tString lastSystem = \"\";\n\t\tPrintStream output = null;\n\t\twhile (result.next()) {\n\t\t\tString system = result.getString(1);\n\t\t\tint processNo = result.getInt(2);\n\t\t\t\n\t\t\tif (!system.equals(lastSystem)) {\n\t\t\t\tif (output != null) output.close();\n\t\t\t\toutput = new PrintStream(outputPrefix + system + \".sql\");\n\t\t\t\tlastSystem = system;\n\t\t\t}\n\t\t\tcollectScenario(system, processNo, output);\n\t\t}\n\t\toutput.close();\n\t\t\n\t\tconn.close();\n\t\t\n\t\tSystem.out.println(queriesExists);\n\t\tSystem.out.println(pathsExists);\n\t}", "public static void main(String[] args) {\n readFile(moviesFile, movies);\n movies.forEach((key, value) -> {\n int[] ratings = (int[])value;\n double average = ratings[1]/(double)ratings[0];\n System.out.println(key);\n System.out.println(\"Reviews \" + ratings[0] + \" Average Rating \" +average +\"/5\");\n });\n\n }", "public static double allFile() {\n\t\tint allCount = 0;\n\t\tdouble allSalary = 0;\n\t\tString professor = \"Unknown\";\n\t\tdouble salary = 0.0;\n\t\topenURL(); //open dataset\n\t\twhile(input.hasNext()) {\n\t\t\tprofessor = input.next();\n\t\t\tprofessor = input.next();\n\t\t\tprofessor = input.next();\n\t\t\tsalary = input.nextDouble();\n\t\t\tallSalary += salary;\n\t\t\tallCount++;\n\t\t\tprofessor = \"all\";\t\n\t\t}\t\t\n\t\t//display all professor total salary\n\t\tSystem.out.println(\"Total salary for \" + professor + \" professors is $\" + dF.format(allSalary));\n\t\t\n\t\treturn allSalary / allCount;\n\t}", "public void summaryReport() {\r\n\r\n\t\tString strTimeStamp = new SimpleDateFormat(\"yyyy-MM-dd-HH-mm-ss\").format(new Date());\r\n\t\tString reportPath = new File(\"Report\").getAbsolutePath();\r\n\t\tint stepPassed = 0;\r\n\t\tint stepFailed = 0;\r\n\t\tString cssData = \"\";\r\n\r\n\t\ttry {\r\n\t\t\tString cssPath = new File(\"Report\\\\Style\\\\style.css\").getAbsolutePath();\r\n\t\t\tbufferedReader = new BufferedReader(new FileReader(cssPath));\r\n\r\n\t\t\tStringBuilder stringBuilder = new StringBuilder();\r\n\t\t\tString line = bufferedReader.readLine();\r\n\t\t\twhile (line != null) {\r\n\t\t\t\tstringBuilder.append(line);\r\n\t\t\t\tstringBuilder.append(System.lineSeparator());\r\n\t\t\t\tline = bufferedReader.readLine();\r\n\t\t\t}\r\n\t\t\tcssData = stringBuilder.toString();\r\n\t\t} catch (Exception ex) {\r\n\t\t\tLog.error(\"Exception occure in reading file\" + ex.getMessage());\r\n\t\t\tex.printStackTrace();\r\n\t\t} finally {\r\n\t\t\ttry {\r\n\t\t\t\tbufferedReader.close();\r\n\t\t\t} catch (IOException e) {\r\n\t\t\t\tLog.error(\"Exception occure in reading file\");\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\r\n\t\t}\r\n\t\tFile HTMLDir = new File(reportPath + \"\\\\HTMLReport\");\r\n\t\tif (!HTMLDir.exists()) {\r\n\t\t\ttry {\r\n\t\t\t\tHTMLDir.mkdir();\r\n\t\t\t} catch (SecurityException ex) {\r\n\t\t\t\tLog.error(\"Error in creating HTMLReport directory\" + ex.getMessage());\r\n\t\t\t\t// log.error(\"Error in creating Detail directory\");\r\n\t\t\t}\r\n\t\t}\r\n\t\tString htmlname = HTMLDir + \"\\\\\" + strTimeStamp + \".html\";\r\n\t\tString logoPath = new File(\"Report\\\\Style\\\\logo.png\").getAbsolutePath();\r\n\t\tfor (ReportBean reportValue : GlobalVariables.getReportList()) {\r\n\t\t\tif (reportValue.getStatus().equalsIgnoreCase(\"Failed\")) {\r\n\t\t\t\tstepFailed++;\r\n\t\t\t} else if (reportValue.getStatus().equalsIgnoreCase(\"Passed\")) {\r\n\t\t\t\tstepPassed++;\r\n\t\t\t}\r\n\t\t}\r\n\t\tstrBufferReportAppend = new StringBuffer();\r\n\t\ttry {\r\n\t\t\tbufferedWriter = new BufferedWriter(new FileWriter(htmlname));\r\n\t\t} catch (IOException e) {\r\n\t\t\tLog.error(\"Error in wrinting the file\" + e.getMessage());\r\n\t\t\t// TODO Auto-generated catch block\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\tstrBufferReportAppend.append(\r\n\t\t\t\t\"<html><head><script type=\\\"text/javascript\\\" src=\\\"https://www.gstatic.com/charts/loader.js\\\"></script>\");\r\n\t\tstrBufferReportAppend.append(\"<script src=\\\"https://www.google.com/jsapi\\\"></script>\");\r\n\t\tstrBufferReportAppend.append(\"<style>\" + cssData);\r\n\t\tstrBufferReportAppend.append(\"</style>\");\r\n\t\tstrBufferReportAppend.append(\"</head><body>\");\r\n\t\tstrBufferReportAppend.append(\"<table class=\\\"width100\\\">\");\r\n\t\tstrBufferReportAppend.append(\"<tr><td>\");\r\n\t\tstrBufferReportAppend.append(\"<table class=\\\"width100\\\">\");\r\n\t\tstrBufferReportAppend.append(\"<tr><td><img src=file:\\\\\\\\\" + logoPath + \"></td>\" + \"<td class=\\\"headertext\\\">\"\r\n\t\t\t\t+ reportHeader + \"</td>\");\r\n\r\n\t\tstrBufferReportAppend.append(\"</tr></table><hr></hr>\");\r\n\t\tstrBufferReportAppend.append(\"</td></tr>\");\r\n\t\tstrBufferReportAppend.append(\"<tr><td>\");\r\n\t\tstrBufferReportAppend.append(\"<table class=\\\"width100\\\">\");\r\n\t\tstrBufferReportAppend.append(\"<tr><td class=\\\"width50\\\">\");\r\n\t\tstrBufferReportAppend.append(\"<table cellpadding=3 cellspacing=1>\");\r\n\t\tstrBufferReportAppend\r\n\t\t.append(\"<tr><td class=\\\"width50 bold\\\">Execution Start Time</td><td class=\\\"width50 bold\\\">\"\r\n\t\t\t\t+ GlobalVariables.getStrStartTime() + \"</td></tr>\");\r\n\t\tstrBufferReportAppend\r\n\t\t.append(\"<tr><td class=\\\"width50 bold\\\">Execution End Time</td><td class=\\\"width50 bold\\\">\"\r\n\t\t\t\t+ GlobalVariables.getStrEndTime() + \"</td></tr>\");\r\n\t\tstrBufferReportAppend\r\n\t\t\t\t.append(\"<tr><td class=\\\"width50 bold\\\">Total TestSteps Executed</td><td class=\\\"width50 bold\\\">\"\r\n\t\t\t\t\t\t+ (stepFailed + stepPassed) + \"</td></tr>\");\r\n\t\tstrBufferReportAppend.append(\r\n\t\t\t\t\"<tr><td class=\\\"width50 green\\\">Passed</td><td class=\\\"width50 green\\\">\" + stepPassed + \"</td></tr>\");\r\n\t\tstrBufferReportAppend.append(\r\n\t\t\t\t\"<tr><td class=\\\"width50 red\\\">Failed</td><td class=\\\"width50 red\\\">\" + stepFailed + \"</td></tr>\");\r\n\t\tstrBufferReportAppend.append(\"</table></td>\");\r\n\t\tstrBufferReportAppend.append(\"<td class=\\\"width50\\\">\");\r\n\t\tstrBufferReportAppend.append(\"<table>\");\r\n\t\tstrBufferReportAppend.append(\"<tr><td class=\\\"width25\\\">\");\r\n\t\tstrBufferReportAppend.append(\"</td>\");\r\n\t\tstrBufferReportAppend.append(\"<td class=\\\"width25\\\">\");\r\n\t\tstrBufferReportAppend.append(\"<script type=\\\"text/javascript\\\">\");\r\n\t\tstrBufferReportAppend.append(\"google.charts.load('current', {'packages':['corechart']});\");\r\n\t\tstrBufferReportAppend.append(\"google.charts.setOnLoadCallback(drawDetailsChart);\");\r\n\t\tstrBufferReportAppend.append(\"function drawDetailsChart() {\");\r\n\t\tstrBufferReportAppend.append(\"var data = new google.visualization.DataTable();\");\r\n\t\tstrBufferReportAppend.append(\"data.addColumn('string', 'Test Execution Detail Graph');\");\r\n\t\tstrBufferReportAppend.append(\"data.addColumn('number', 'Count');\");\r\n\t\tstrBufferReportAppend.append(\"data.addRows([\");\r\n\t\tstrBufferReportAppend.append(\"['Passed',\" + stepPassed + \"],\");\r\n\t\tstrBufferReportAppend.append(\"['Failed',\" + stepFailed + \"]]);\");\r\n\t\tstrBufferReportAppend\r\n\t\t\t\t.append(\"var options = {'title':'Test Step Details Graph',colors: ['#12C909', '#C3100A'],pieHole: 0.3,\");\r\n\t\tstrBufferReportAppend.append(\"'width':300,\");\r\n\t\tstrBufferReportAppend.append(\"'height':170};\");\r\n\t\tstrBufferReportAppend\r\n\t\t\t\t.append(\"var chart = new google.visualization.PieChart(document.getElementById('detailsChart_div'));\");\r\n\t\tstrBufferReportAppend.append(\"chart.draw(data, options); } </script>\");\r\n\t\tstrBufferReportAppend.append(\"<div id=\\\"detailsChart_div\\\"></div>\");\r\n\t\tstrBufferReportAppend.append(\"</td></tr></table>\");\r\n\t\tstrBufferReportAppend.append(\"</td></tr></table><hr></hr></td></tr>\");\r\n\t}", "public boolean testCase5()\n {\n String flavor = null;\n final String DESC = \"Simple performance measurement \";\n reporter.testCaseInit(DESC);\n // Reset the counting for outputNames for this testcase\n outNames = new OutputNameManager(baseOutName + \"Perf\", \".out\");\n try\n {\n long[] times = null;\n Vector streamTimes = new Vector();\n Vector domTimes = new Vector();\n TransformWrapper transformWrapper = null;\n\n flavor = \"trax.stream\";\n transformWrapper = TransformWrapperFactory.newWrapper(flavor);\n transformWrapper.newProcessor(testProps);\n reporter.logHashtable(Logger.TRACEMSG, transformWrapper.getProcessorInfo(), \"wrapper.getProcessorInfo() for next transforms\");\n\n // Repeat a few times with streams\n for (int i = 1; i <= 5; i++)\n {\n perfFileInfo.outputName = outNames.nextName();\n reporter.logInfoMsg(\"perf-stream transform into \" + perfFileInfo.outputName);\n times = transformWrapper.transform(perfFileInfo.xmlName, perfFileInfo.inputName, perfFileInfo.outputName);\n logPerfElem(times, perfFileInfo, flavor);\n streamTimes.addElement(new Long(times[TransformWrapper.IDX_OVERALL]));\n }\n // Only bother checking the *last* iteration of perfs\n fileChecker.check(reporter, \n new File(perfFileInfo.outputName), \n new File(perfFileInfo.goldName), \n DESC + flavor + \" into: \" + perfFileInfo.outputName);\n \n flavor = \"trax.dom\";\n transformWrapper = TransformWrapperFactory.newWrapper(flavor);\n transformWrapper.newProcessor(testProps);\n reporter.logHashtable(Logger.TRACEMSG, transformWrapper.getProcessorInfo(), \"wrapper.getProcessorInfo() for next transforms\");\n\n // Repeat a few times with DOMs\n for (int i = 1; i <= 5; i++)\n {\n perfFileInfo.outputName = outNames.nextName();\n reporter.logInfoMsg(\"perf-dom transform into \" + perfFileInfo.outputName);\n times = transformWrapper.transform(perfFileInfo.xmlName, perfFileInfo.inputName, perfFileInfo.outputName);\n logPerfElem(times, perfFileInfo, flavor);\n domTimes.addElement(new Long(times[TransformWrapper.IDX_OVERALL]));\n }\n // Only bother checking the *last* iteration of perfs\n fileChecker.check(reporter, \n new File(perfFileInfo.outputName), \n new File(perfFileInfo.goldName), \n DESC + flavor + \" into: \" + perfFileInfo.outputName);\n\n // Log a big message at the very end to make it easier to see\n StringBuffer buf = new StringBuffer(\"Minitest.testCase5 PERFORMANCE NUMBERS\\n\");\n buf.append(\" STREAM OVERALL TIMES: \");\n for (Enumeration elements = streamTimes.elements();\n elements.hasMoreElements(); /* no increment portion */ )\n {\n buf.append(elements.nextElement());\n buf.append(\", \");\n }\n buf.append(\"\\n\");\n buf.append(\" DOM OVERALL TIMES: \");\n for (Enumeration elements = domTimes.elements();\n elements.hasMoreElements(); /* no increment portion */ )\n {\n buf.append(elements.nextElement());\n buf.append(\", \");\n }\n buf.append(\"\\n\");\n reporter.logArbitrary(Logger.CRITICALMSG, buf.toString());\n } \n catch (Throwable t)\n {\n reporter.logThrowable(reporter.ERRORMSG, t, DESC + flavor + \" threw: \");\n reporter.checkErr(DESC + flavor + \" threw: \" + t.toString());\n }\n reporter.testCaseClose();\n return true;\n }", "public static void main(String args[]) throws IOException{\n\t\t\n\t\t\n\t\tfor (int fold = 0; fold<10; fold++) {\n\t\t\t//triples_result(\"holders_\"+fold, \"test_holders_\"+fold+\"_result\"); //file, result_file\n\t\t\t//sentence_triples_word(\"holders_\"+fold, \"holders_gold_\"+fold, 0, \"holders_\"+fold); //crf_output\n\t\t\t\n\t\t\ttriples_result(\"holders_full_t_\"+fold, \"test_holders_t_\"+fold+\"_result\"); //file, result_file\n\t\t\tsentence_triples_hard_word(\"holders_\"+fold, \"holders_gold_\"+fold, 0, \"holders_t_\"+fold); //crf_output\n\n\t\t\t\n\t\t\tholder_triples = new LinkedList<Triples>();\n\t\t\tholder_prob = new LinkedList<Double>();\n\t\t\tgold_holders = new HashMap<String, Entries>();\n\n\t\t}\n\t\t\n\n\t\t\n\t\tfor (int fold = 0; fold<10; fold++) {\n\t\t\ttriples_result(\"targets_full_t_\"+fold, \"test_targets_t_\"+fold+\"_result\"); //file, result_file\n\t\t\tsentence_triples_hard_word(\"targets_\"+fold, \"targets_gold_\"+fold, 0, \"targets_t_\"+fold); //crf_output\n\t\t\t\n\t\t\tholder_triples = new LinkedList<Triples>();\n\t\t\tholder_prob = new LinkedList<Double>();\n\t\t\tgold_holders = new HashMap<String, Entries>();\n\n\t\t}\n\n\t\t\n\n\t\t\n\t\t//triples_result(\"targets_0\", \"test_targets_0_result\"); //file, result_file\n\t\t//sentence_triples_word(\"targets_0\", \"targets_gold_0\", 0, \"targets_0\"); //crf_output\n\t\t\n\t\t//triples_result(\"targets_1\", \"test_targets_1_result\"); //file, result_file\n\t\t//sentence_triples_word(\"targets_1\", \"targets_gold_1\", 1, \"targets_1\"); //crf_output\n\t}", "public void runForEachSample(String dirName, String fnamePattern){\n System.out.println(\"Getting all files with reads per transcripts counts. Files names finish with \" + fnamePattern);\n File dir = new File(dirName);\n for (File ch : dir.listFiles()) {\n if (ch.isDirectory())\n for (File child : ch.listFiles()){\n if (child.getName().matches(fnamePattern)){\n try {\n getSNPStatisticsPerSample(child.getPath());\n } catch (IOException ex) {\n Logger.getLogger(GetAllStatisticsRNAseq.class.getName()).log(Level.SEVERE, null, ex);\n }\n }\n }\n }\n }", "private void parse() throws IOException {\n\n\t\tStats statsObject = new Stats();\n\n\t\tstatsObject.setProcessName(process);\n\n\t\tList<String> lines = Files.readAllLines(Paths.get(filename), Charset.defaultCharset());\n\n\t\tPattern timePattern = Pattern.compile(\"((\\\\d+)-)*(\\\\d+)\\\\W((\\\\d+):)*(\\\\d+)\\\\.(\\\\d+)\");\n\n\t\tSystem.out.println(filename+\" \"+lines.get(0));\n\t\tMatcher matcher = timePattern.matcher(lines.get(0));\n\t\twhile (matcher.find()) {\n\t\t\tstatsObject.setStartTime(matcher.group(0));\n\t\t\tbreak;\n\t\t}\n\n\t\tmatcher = timePattern.matcher(lines.get(lines.size() - 1));\n\t\twhile (matcher.find()) {\n\t\t\tstatsObject.setEndTime(matcher.group(0));\n\t\t\tbreak;\n\t\t}\n\t\tString error = new String();\n\t\tfor (String line : lines) {\n\n\t\t\tif (line.startsWith(\"[\")) {\n\t\t\t\tif (!error.isEmpty()) {\n\t\t\t\t\tstatsObject.addError(error);\n\t\t\t\t\terror = \"\";\n\t\t\t\t}\n\n\t\t\t\tif (line.contains(\"Number of records processed: \")) {\n\n\t\t\t\t\tPattern numberPattern = Pattern.compile(\"\\\\d+\");\n\t\t\t\t\tmatcher = numberPattern.matcher(line);\n\t\t\t\t\t\n\t\t\t\t\tString numberOfRecordsProcessed = \"N/A\";\n\t\t\t\t\t\n\t\t\t\t\twhile (matcher.find()) {\n\t\t\t\t\t\tnumberOfRecordsProcessed = matcher.group();\n\t\t\t\t\t}\n\t\t\t\t\tstatsObject.setRecordsProcessed(numberOfRecordsProcessed);\n\n\t\t\t\t}\n\n\t\t\t\telse if (line.contains(\"WARNING\")) {\n\t\t\t\t\tif (line.contains(\"MISSING Property\")) {\n\t\t\t\t\t\tstatsObject.incrementErrorCounter();\n\t\t\t\t\t\tstatsObject.addError(line);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstatsObject.incrementWarningCounter();\n\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t} else if (line.contains(\"Exception\") || (line.contains(\"Error\"))) {\n\t\t\t\tif (!error.isEmpty()) {\n\t\t\t\t\tstatsObject.addError(error);\n\t\t\t\t\terror = \"\";\n\t\t\t\t}\n\t\t\t\tstatsObject.incrementErrorCounter();\n\t\t\t\terror = error + line;\n\t\t\t} else {\n\t\t\t\terror = error + line ;\n\t\t\t}\n\n\t\t}\n\t\t// reader.close();\n\t\tif (statsObject.getErrorCounter() > 0) {\n\t\t\tstatsObject.setStatus(\"Failure\");\n\t\t}\n\n\t\tPattern pattern = Pattern.compile(\"\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\\\\d\");\n\t\tmatcher = pattern.matcher(filename);\n\t\tString date = null;\n\t\twhile (matcher.find()) {\n\t\t\tdate = matcher.group(0);\n\t\t\tbreak;\n\t\t}\n\t\tboolean saveSuccessful = OutputManipulator.addToStatFile(username, process, date, statsObject);\n\n\t\tif (saveSuccessful) {\n\t\t\tFileParseScheduler.addSuccessfulParsedFileName(username, process, filename);\n\t\t}\n\n\t\tFileParseScheduler.removeLatestKilledThreads(process + filename);\n\t}", "private static void analyzeData(Instances inputData, \n\t\t\tClassifierID method, String outputFileName) throws Exception\n\t{\n\t\tPrintWriter pw = null;\n\t\t\n\t\ttry\n\t\t{\n\t\t\tSystem.out.println(\"Method: \" + method.name());\n\t\t\t\n\t\t\tint[] results = new int[inputData.size()];\n\n\t\t\t// Load the local resource\n\t\t\t// This allows the file to be packaged inside the Jar\t\n\t\t\tInputStream is = SimpleSpamAnalysisApp.class.\n\t\t\t\t\tgetResourceAsStream(classifiers[method.ordinal()]);\n\t\t\n\t\t\t// Generate the classifier from model\n\t\t\tClassifier classifier = (Classifier) SerializationHelper.read(is);\n\t\t\t\n\t\t\tint numInstances = inputData.size();\n\t\t\t\n\t\t\t// Compute the expected value of each instance\n\t\t\tfor(int i=0; i<numInstances; i++)\n\t\t\t{\n\t\t\t\tresults[i] = (int)classifier.classifyInstance(inputData.get(i));\n\t\t\t}\n\n\t\t\t// Output the results to the file\n\t\t\tpw = new PrintWriter(outputFileName);\n\t\t\tfor(int r : results)\n\t\t\t\tpw.println(r);\n\t\t}\n\t\tcatch(Exception e)\n\t\t{\n\t\t\tthrow e;\n\t\t}\n\t\tfinally\n\t\t{\n\t\t\t// Make sure the file stream is closed\n\t\t\tif(pw != null)\n\t\t\t\tpw.close();\n\t\t}\n\t}", "public static void main(String[] args) throws FileNotFoundException {\n\t\tString file = \"/home/mllab/Desktop/CS140/Grading_Scripts/exam02-a52/report.txt\";\n\t\tout = new PrintStream(new FileOutputStream(new File(file), true));\n\t\ttestQ1();\n\t\tout.println(\"--------------------\");\n\t\tout.println(numWrong[0] + \" tests 1-\" + testNum + \" failed\");\n\t\tout.println(\"lost \" + (4.0*numWrong[0]/q1Count) + \" points\");\n\t\tdouble grade = 10.0 - 4.0*numWrong[0]/q1Count;\n\t\ttestQ2();\n\t\tout.println(\"--------------------\");\n\t\tout.println(numWrong[1] + \" tests \" + (q1Count+1)+ \"-\" + testNum + \" failed\");\n\t\tout.println(\"lost \" + (3.0*(numWrong[1])/q2Count) + \" points\");\n\t\tgrade = grade - 3.0*numWrong[1]/q2Count;\n\t\ttestQ3();\n\t\tout.println(\"--------------------\");\n\t\tout.println(numWrong[2] + \" tests \" + (q2Count+q1Count+1)+ \"-\" + testNum + \" failed\");\n\t\tout.println(\"lost \" + (3.0*(numWrong[2])/q3Count) + \" points\");\n\t\tgrade = grade - 3.0*numWrong[2]/q3Count;\n\t\tout.println(\"--------------------\");\n\t\tout.println(\"Grade = \" + grade);\n\t}", "public static void main(String[] args) {\n\n\t\tString urlClassification = \"http://www.hep.ucl.ac.uk/undergrad/0056/exam-data/2018-19/classification.txt\";\n\t\tString urlExpert = \"http://www.hep.ucl.ac.uk/undergrad/0056/exam-data/2018-19/expert.txt\";\n\t\tString urlLocations = \"http://www.hep.ucl.ac.uk/undergrad/0056/exam-data/2018-19/locations.txt\";\n\n\t\tArrayList<ImageData> classification = ImageData.classificationFromURL(urlClassification);\n\t\tArrayList<ImageData> expert = ImageData.expertFromURL(urlExpert);\n\t\tArrayList<ImageData> locations = ImageData.locationsFromURL(urlLocations);\n\t\t\n\t\t// For part 2. we need to print the number of images\n\t\t// This will be the length of expert list\n\n\t\tSystem.out.println(expert.size());\n\t\t\n\t\t// For part 3. we need to print the number of images classified by at least 1\n\t\t// volunteer. We will utilise the properties of Sets in java.\n\t\t\n\t\tHashSet<Integer> idsClassifiedByOne = new HashSet<Integer>();\n\t\tfor (ImageData image : classification) {\n\t\t\tidsClassifiedByOne.add(image.getIdentifier());\n\t\t}\n\t\tSystem.out.println(idsClassifiedByOne.size());\n\t\t\n\t\t// For part 4. we need to print details of the images classified by at least 10\n\t\t// volunteers. \n\t\t\n\t\tArrayList<ImageData> atLeast10Vols = new ArrayList<ImageData>();\n\t\tatLeast10Vols = ImageData.atLeast10(classification);\n\t\t\n\t\t// Must merge the information from classification, locations and expert lists\n\t\tArrayList<ImageData> atLeast10CompleteList = new ArrayList<ImageData>();\n\t\tatLeast10CompleteList = ImageData.collectAll(atLeast10Vols, expert, locations);\n\t\tArrayList<ImageData> clean10CompleteList = ImageData.clean(atLeast10CompleteList);\n\t\t\n\t\t// Printing out the data\n\t\t\n\t\tSystem.out.println(clean10CompleteList);\n\n\t}", "private static void digestPythonSummaries(String inputDir,\n Collection<String> summarizers,\n String docParsedFile,\n String outputDir) {\n for (String summarizer : summarizers) {\n final Map<Integer, Map<String, List<String>>> kToDocSummaries = importSummaries(inputDir,\n summarizer);\n final Map<Integer, Map<String, List<SetResult>>> kToDocSentences = inferSummaries(\n docParsedFile, kToDocSummaries);\n exportSummaries(kToDocSentences, outputDir, summarizer);\n }\n }", "public void aggregateResults()\n\t{\n\t\ttry {\n\t\t\tAggregateableEvaluation aggContNaive = new AggregateableEvaluation(this.evalNaiveBayesList.get(0));\n\t\t\tAggregateableEvaluation aggContSMO = new AggregateableEvaluation(this.evalSMOList.get(0));\n\t\t\tAggregateableEvaluation aggDonaNaive = new AggregateableEvaluation(this.evalNaiveBayesList.get(15));\n\t\t\tAggregateableEvaluation aggDonaSMO = new AggregateableEvaluation(this.evalSMOList.get(15));\n\t\t\tAggregateableEvaluation aggOffiNaive = new AggregateableEvaluation(this.evalNaiveBayesList.get(30));\n\t\t\tAggregateableEvaluation aggOffiSMO = new AggregateableEvaluation(this.evalSMOList.get(30));\n\t\t\tAggregateableEvaluation aggAdviNaive = new AggregateableEvaluation(this.evalNaiveBayesList.get(45));\n\t\t\tAggregateableEvaluation aggAdviSMO = new AggregateableEvaluation(this.evalSMOList.get(45));\n\t\t\tAggregateableEvaluation aggMultNaive = new AggregateableEvaluation(this.evalNaiveBayesList.get(60));\n\t\t\tAggregateableEvaluation aggMultSMO = new AggregateableEvaluation(this.evalSMOList.get(60));\n\t\t\tAggregateableEvaluation aggGoodNaive = new AggregateableEvaluation(this.evalNaiveBayesList.get(75));\n\t\t\tAggregateableEvaluation aggGoodSMO = new AggregateableEvaluation(this.evalSMOList.get(75));\n\t\t\t\n\n\t\t\tfor (int i = 1; i < 15; i++)\n\t\t\t{\n\t\t\t\taggContNaive.aggregate(this.evalNaiveBayesList.get(i));\n\t\t\t\taggContSMO.aggregate(this.evalSMOList.get(i));\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tfor (int i = 16; i < 30; i++)\n\t\t\t{\n\t\t\t\taggDonaNaive.aggregate(this.evalNaiveBayesList.get(i));\n\t\t\t\taggDonaSMO.aggregate(this.evalSMOList.get(i));\t\t\t\t\n\t\t\t}\n\n\t\t\tfor (int i = 31; i < 45; i++)\n\t\t\t{\n\t\t\t\taggOffiNaive.aggregate(this.evalNaiveBayesList.get(i));\n\t\t\t\taggOffiSMO.aggregate(this.evalSMOList.get(i));\t\t\t\t\n\t\t\t}\n\n\t\t\tfor (int i = 46; i < 60; i++)\n\t\t\t{\n\t\t\t\taggAdviNaive.aggregate(this.evalNaiveBayesList.get(i));\n\t\t\t\taggAdviSMO.aggregate(this.evalSMOList.get(i));\n\t\t\t}\n\n\t\t\tfor (int i = 61; i < 75; i++)\n\t\t\t{\n\t\t\t\taggMultNaive.aggregate(this.evalNaiveBayesList.get(i));\n\t\t\t\taggMultSMO.aggregate(this.evalSMOList.get(i));\n\t\t\t}\n\n\t\t\tfor (int i = 76; i < 90; i++)\n\t\t\t{\n\t\t\t\taggGoodNaive.aggregate(this.evalNaiveBayesList.get(i));\n\t\t\t\taggGoodSMO.aggregate(this.evalSMOList.get(i));\n\t\t\t}\n\n\t\t\tfor (int a = 0; a < 6; a++)\n\t\t\t{\n\t\t\t\tString aggregateText;\n\t\t\t\tswitch (a)\n\t\t\t\t{\n\t\t\t\tcase 0: aggregateText = \"ContinuingNewsAggregateResults.txt\"; break;\n\t\t\t\tcase 1: aggregateText = \"DonationsAggregateResults.txt\"; break;\n\t\t\t\tcase 2: aggregateText = \"OfficialAggregateResults.txt\"; break;\n\t\t\t\tcase 3: aggregateText = \"AdviceAggregateResults.txt\"; break;\n\t\t\t\tcase 4: aggregateText = \"MultimediaAggregateResults.txt\"; break;\n\t\t\t\tcase 5: aggregateText = \"GoodsAggregateResults.txt\"; break;\n\t\t\t\tdefault: aggregateText = \"CompleteAggregateResults.txt\";\n\t\t\t\t}\n\n\t\t\t\tBufferedWriter bw = new BufferedWriter(new FileWriter(aggregateText));\n\t\t\t\tbw.write(\"=== Summary of Naive Bayes ===\");\n\n\t\t\t\tswitch (a)\n\t\t\t\t{\n\t\t\t\tcase 0:\tbw.write(aggContNaive.toSummaryString());\n\t\t\t\tbw.write(aggContNaive.toClassDetailsString());\n\t\t\t\tbw.write(aggContNaive.toMatrixString()); break;\n\t\t\t\tcase 1:\tbw.write(aggDonaNaive.toSummaryString());\n\t\t\t\tbw.write(aggDonaNaive.toClassDetailsString());\n\t\t\t\tbw.write(aggDonaNaive.toMatrixString()); break;\n\t\t\t\tcase 2:\tbw.write(aggOffiNaive.toSummaryString());\n\t\t\t\tbw.write(aggOffiNaive.toClassDetailsString());\n\t\t\t\tbw.write(aggOffiNaive.toMatrixString()); break;\n\t\t\t\tcase 3:\tbw.write(aggAdviNaive.toSummaryString());\n\t\t\t\tbw.write(aggAdviNaive.toClassDetailsString());\n\t\t\t\tbw.write(aggAdviNaive.toMatrixString()); break;\n\t\t\t\tcase 4:\tbw.write(aggMultNaive.toSummaryString());\n\t\t\t\tbw.write(aggMultNaive.toClassDetailsString());\n\t\t\t\tbw.write(aggMultNaive.toMatrixString()); break;\n\t\t\t\tdefault:\tbw.write(aggGoodNaive.toSummaryString());\n\t\t\t\tbw.write(aggGoodNaive.toClassDetailsString());\n\t\t\t\tbw.write(aggGoodNaive.toMatrixString()); \n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tbw.write(\"=== Summary of SMO ===\");\n\n\t\t\t\tswitch (a)\n\t\t\t\t{\n\t\t\t\tcase 0:\tbw.write(aggContSMO.toSummaryString());\n\t\t\t\tbw.write(aggContSMO.toClassDetailsString());\n\t\t\t\tbw.write(aggContSMO.toMatrixString()); break;\n\t\t\t\tcase 1:\tbw.write(aggDonaSMO.toSummaryString());\n\t\t\t\tbw.write(aggDonaSMO.toClassDetailsString());\n\t\t\t\tbw.write(aggDonaSMO.toMatrixString()); break;\n\t\t\t\tcase 2:\tbw.write(aggOffiSMO.toSummaryString());\n\t\t\t\tbw.write(aggOffiSMO.toClassDetailsString());\n\t\t\t\tbw.write(aggOffiSMO.toMatrixString()); break;\n\t\t\t\tcase 3:\tbw.write(aggAdviSMO.toSummaryString());\n\t\t\t\tbw.write(aggAdviSMO.toClassDetailsString());\n\t\t\t\tbw.write(aggAdviSMO.toMatrixString()); break;\n\t\t\t\tcase 4:\tbw.write(aggMultSMO.toSummaryString());\n\t\t\t\tbw.write(aggMultSMO.toClassDetailsString());\n\t\t\t\tbw.write(aggMultSMO.toMatrixString()); break;\n\t\t\t\tdefault:\tbw.write(aggGoodSMO.toSummaryString());\n\t\t\t\tbw.write(aggGoodSMO.toClassDetailsString());\n\t\t\t\tbw.write(aggGoodSMO.toMatrixString()); \t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tbw.close();\n\t\t\t}\n\n\n\t\t} catch (Exception e) {\n\n\t\t\te.printStackTrace();\n\t\t}\n\t}", "public void readResult() {\n File dirXml = new File(System.getProperty(\"user.dir\") + \"/target/classes/\");\n /// Get Parent Directory\n String parentDirectory = dirXml.getParent();\n File folder = new File(parentDirectory + \"/jbehave\");\n File[] listOfFiles = folder.listFiles();\n\n if (listOfFiles != null) {\n for (File listOfFile : listOfFiles) {\n if (listOfFile.isFile()) {\n String filePath = folder.getPath() + \"/\" + listOfFile.getName();\n System.out.println(\"File \" + filePath);\n if (filePath.contains(\".xml\") && !filePath.contains(\"AfterStories\") && !filePath.contains(\n \"BeforeStories\")) {\n readXML(filePath);\n }\n }\n }\n }\n }", "public static void main(String[] args) {\n\t\tTestingPerformanceCalculator obj= new TestingPerformanceCalculator(\"./data/gitInfoNew.txt\", \"data/Results/FinalResultSidTest1.txt\");\n\t\t//Read Gold set\n\t\tobj.goldStMap=obj.LoadGoldSet();\n\t\t//MiscUtility.showResult(10, obj.goldStMap);\n\t\t//Resd output file/ test result file\n\t\tobj.finalResult=obj.LoadTestingResult();\n\t\t//MiscUtility.showResult(20, obj.finalResult);\n\t\t\n\t\t\n\t\t//Create a ranked list\n\t\t//obj.produceRankedResult(10);\n\t\tArrayList<String> rankedFinalTestingResult=obj.produceRankedResult(10);\n\t\tContentWriter.writeContent(\"./data/testing1RankedResult.txt\", rankedFinalTestingResult);\n\t\t//call another class BLPerformanceCalc to compute\n\t\t\n\t\t\n\t}", "public static void processFilesForValidation() {\r\n\t\t// Process each file one at a time.\r\n\t\tfor (int i = 0; i < inScanners.length; i++) {\r\n\t\t\tScanner sc = inScanners[i];\r\n\t\t\tint articleCount = 1;\r\n\t\t\t// Read the input file.\r\n\t\t\ttry {\r\n\t\t\t\twhile(sc.hasNextLine()) {\r\n\t\t\t\t\tString s = sc.nextLine();\r\n\t\t\t\t\t// If we come across an article, read its contents and add it to the file.\r\n\t\t\t\t\tif(s.startsWith(\"@ARTICLE{\")) {\r\n\t\t\t\t\t\tauthor = journal = title = year = volume = number = pages = doi = ISSN = month = \"\";\r\n\t\t\t\t\t\twhile (!s.equals(\"}\")) {\r\n\t\t\t\t\t\t\ts = sc.nextLine();\r\n\t\t\t\t\t\t\tparseValue(s);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// Throw an exception if a field is missing.\r\n\t\t\t\t\t\tif (author.isEmpty() || journal.isEmpty() || title.isEmpty() || year.isEmpty() || volume.isEmpty() \r\n\t\t\t\t\t\t\t\t|| number.isEmpty() || pages.isEmpty() || doi.isEmpty() || ISSN.isEmpty() || month.isEmpty()) {\r\n\t\t\t\t\t\t\tthrow new FileInvalidException(\"One or more fields are missing.\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t// Add the article to the file if valid.\r\n\t\t\t\t\t\tString author1 = author.replaceAll(\" and\", \",\");\r\n\t\t\t\t\t\tint andIndex = author.indexOf(\"and\");\r\n\t\t\t\t\t\tString author2 = andIndex != -1 ? author.replaceAll(author.substring(andIndex,author.length()), \"et al\") : author;\r\n\t\t\t\t\t\tString author3 = author.replaceAll(\"and\", \"&\");\r\n\t\t\t\t\r\n\t\t\t\t\t\t// IEEE\r\n\t\t\t\t\t\toutWriters[i][0].println(author1+\". \\\"\"+title+\"\\\", \"+journal+\", vol. \"+volume+\", no. \"+number+\", p. \"+pages+\", \"+month+\" \"+year+\".\\r\\n\");\r\n\t\t\t\t\t\t// ACM\r\n\t\t\t\t\t\toutWriters[i][1].println(\"[\"+articleCount+\"]\\t\"+author2+\". \"+year+\". \"+title+\". \"+journal+\". \"+volume+\", \"+number+\" (\"+year+\"), \"+pages+\". DOI:https://doi.org/\"+doi+\".\\r\\n\");\r\n\t\t\t\t\t\t// NJ\r\n\t\t\t\t\t\toutWriters[i][2].println(author3+\". \"+title+\". \"+journal+\". \"+volume+\", \"+pages+\"(\"+year+\").\\r\\n\");\r\n\t\t\t\t\t\tarticleCount++;\r\n\t\t\t\t\t}\t\r\n\t\t\t\t}\r\n\t\t\t\t// Close output writers once file has been read.\r\n\t\t\t\tfor (int j = 0; j < 3; j++) {\r\n\t\t\t\t\toutWriters[i][j].close();\r\n\t\t\t\t}\r\n\t\t\t\tnumValidFiles++;\r\n\t\t\t}\r\n\t\t\t// If file is invalid, close and delete the output files.\r\n\t\t\tcatch (FileInvalidException e) {\r\n\t\t\t\tSystem.out.println(\"Error: Detected Empty Field!\" \r\n\t\t\t\t\t\t + \"\\n============================\"\r\n\t\t\t + \"\\nProblem detected with input file: Latex\" + (i + 1) + \".bib\"\r\n\t\t\t\t\t\t + \"\\nFile is invalid: \" + e.getMessage() + \" Processing stopped at this point. \"\r\n\t\t\t\t\t\t + \"Other empty/missing fields may be present as well.\\n\");\r\n\t\t\t\tfor (int j = 0; j < 3; j++) {\r\n\t\t\t\t\toutWriters[i][j].close();\r\n\t\t\t\t\toutFiles[i][j].delete();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t// Close input file after reading.\r\n\t\t\tsc.close();\r\n\t\t}\r\n\t}", "void mainOutput(int[][] matrixCID, int[][] valuesChunk, int SLOC, int TCL, int refactoredSize, float PR, String fileName){\n\t\tif(output){\t\n\t\t\tString outputName = \"Results-\";\n\t\t\tif(verbose)\n\t\t\t\toutputName = \"VerboseResults-\";\n\t\t\tString[] temp = fileName.split(\"\\\\\\\\\");\n\t\t\ttemp = temp[temp.length-1].split(\"\\\\.nw\");\n\t\t\toutputName += temp[0] + \".tsv\";\n\t\t\ttry {\n\t\t\t\tsetOutput(outputName);\n\t\t\t} catch (FileNotFoundException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\t\n\t\tif(verbose){\n\t\t\t//print out full table\n\t\t\tdisplayValues(matrixCID);\n\t\t\tSystem.out.println(\"--------------------------------------------------------------\");\n\t\t\tSystem.out.println(\"Initial Size:\\t\\t\" + SLOC + \"\\t|S|\");\n\t\t\tSystem.out.println(\"Total Clone Length:\\t\" + TCL + \"\\tTCL\");\n\t\t\tSystem.out.println(\"Refactored Size:\\t\" + refactoredSize + \"\\t|S'|\");\n\t\t\tSystem.out.println(\"Percent Refactored:\\t\" + PR + \"\\tPR\");\n\t\t}\n\t\telse{\n\t\t\tSystem.out.println(\"|S|\\tTCL\\t|S'|\\tPR\");\n\t\t\tSystem.out.println(SLOC + \"\\t\" + TCL + \"\\t\" + refactoredSize + \"\\t\" + PR);\n\t\t}\n\t\t\n\t\tif(calc){\n\t\t\tSystem.out.println(\"--------------------------------------------------------------\");\n\t\t\tshowCalculation(valuesChunk, SLOC, TCL, matrixCID);\n\t\t\tSystem.out.println(\"--------------------------------------------------------------\");\n\t\t}\n\t\t\n\t\tresetOutput();\n\t}", "public static void main(String[] args) throws IOException {\n FileWriter fw = new FileWriter(new File(\"src/output_files/threesumA.txt\"));\n StringBuilder sb = new StringBuilder();\n // the rest input files\n String[] inputFiles = {\"src/input_files/8ints.txt\", \"src/input_files/1Kints.txt\", \"src/input_files/2Kints.txt\",\n \"src/input_files/2Kints.txt\", \"src/input_files/4Kints.txt\", \"src/input_files/8Kints.txt\",\n \"src/input_files/16Kints.txt\", \"src/input_files/32Kints.txt\"};\n int i = 8;\n for (String file : inputFiles) {\n In in = new In(file);\n int[] a = in.readAllInts();\n long startTime = System.nanoTime();\n int result = count(a);\n long elapsedTime = System.nanoTime() - startTime;\n sb.append(String.format(\"%d %d\\n\", i, elapsedTime));\n System.out.println(result);\n if (i == 8) {\n i = 1000;\n } else {\n i *= 2;\n }\n }\n fw.write(sb.toString());\n fw.close();\n }", "public void testSummaryStatsPartialLog() {\n\n // TODO: Create File in platform independent way.\n File testFile = new File(\"src/test/data/dataset98.txt\");\n GcManager gcManager = new GcManager();\n File preprocessedFile = gcManager.preprocess(testFile, null);\n gcManager.store(preprocessedFile, false);\n JvmRun jvmRun = gcManager.getJvmRun(new Jvm(null, null), Constants.DEFAULT_BOTTLENECK_THROUGHPUT_THRESHOLD);\n Assert.assertEquals(\"GC event type count not correct.\", 2, jvmRun.getEventTypes().size());\n Assert.assertEquals(\"GC blocking event count not correct.\", 2, jvmRun.getBlockingEventCount());\n Assert.assertEquals(\"GC pause total not correct.\", 61, jvmRun.getTotalGcPause());\n Assert.assertEquals(\"GC first timestamp not correct.\", 1002192, jvmRun.getFirstGcEvent().getTimestamp());\n Assert.assertEquals(\"GC last timestamp not correct.\", 1002847, jvmRun.getLastGcEvent().getTimestamp());\n Assert.assertEquals(\"GC last duration not correct.\", 41, jvmRun.getLastGcEvent().getDuration());\n Assert.assertEquals(\"Stopped Time event count not correct.\", 6, jvmRun.getStoppedTimeEventCount());\n Assert.assertEquals(\"Stopped time total not correct.\", 1064, jvmRun.getTotalStoppedTime());\n Assert.assertEquals(\"Stopped first timestamp not correct.\", 1000964,\n jvmRun.getFirstStoppedEvent().getTimestamp());\n Assert.assertEquals(\"Stopped last timestamp not correct.\", 1003884,\n jvmRun.getLastStoppedEvent().getTimestamp());\n Assert.assertEquals(\"Stopped last duration not correct.\", 1000688, jvmRun.getLastStoppedEvent().getDuration());\n Assert.assertEquals(\"JVM first event timestamp not correct.\", 1000964, jvmRun.getFirstEvent().getTimestamp());\n Assert.assertEquals(\"JVM last event timestamp not correct.\", 1003884, jvmRun.getLastEvent().getTimestamp());\n Assert.assertEquals(\"JVM run duration not correct.\", 3920, jvmRun.getJvmRunDuration());\n Assert.assertEquals(\"GC throughput not correct.\", 98, jvmRun.getGcThroughput());\n Assert.assertEquals(\"Stopped time throughput not correct.\", 73, jvmRun.getStoppedTimeThroughput());\n Assert.assertTrue(Analysis.WARN_GC_STOPPED_RATIO + \" analysis not identified.\",\n jvmRun.getAnalysis().contains(Analysis.WARN_GC_STOPPED_RATIO));\n }", "private static void searchThroughFiles(String[] files, String[] keywords) {\n int noOfFiles = files.length;\n HashMap<String, int[]> fileResults = new HashMap<String, int[]>();\n for (int i = 0; i < noOfFiles; i++) {\n try {\n fileResults.put(files[i], countWordsInFile(files[i], keywords));\n } catch (Exception e) {\n System.out.println(\"File not found: \" + files[i]);\n }\n }\n\n for (int i = 0; i < files.length; i++) {\n writeOutput(\"\\n\" + files[i] + \"\\n\");\n int[] test = fileResults.get(files[i]);\n for (int j = 0; j < test.length; j++) {\n writeOutput(keywords[j] + \": \" + test[j] + \"\\n\");\n }\n }\n }", "private static void writeResults() {\n\t\t//Sort hashMap before sending to file\n\t\tTreeSet<Word> mySet = new TreeSet<>(hm.values());\n\n\t\t//Create result.txt file and write treeMap out to it\n\t\tWriter writer = null;\n\t\ttry {\n\t\t\t//System.out.println(\"Here\");\n\t\t\twriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(\"output\\\\results.txt\")));\n\t\t\tfor (Word word : mySet) {\n\t\t\t\twriter.write(word.getValue() + \"\\t\" + word.getCount() + \"\\n\");\n\t\t\t}\n\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t} finally {\n\t\t\ttry {\n\t\t\t\twriter.close();\n\t\t\t} catch (Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t}" ]
[ "0.63030785", "0.6199326", "0.619724", "0.607292", "0.60275763", "0.59314257", "0.5924799", "0.5897387", "0.5886385", "0.58571476", "0.58431345", "0.57948214", "0.57406366", "0.57268286", "0.5709052", "0.57031214", "0.569583", "0.56823415", "0.56443846", "0.5635499", "0.5605084", "0.560322", "0.5596774", "0.55883086", "0.5561243", "0.5553328", "0.55423415", "0.554125", "0.55297625", "0.549409", "0.5493819", "0.54702044", "0.54697967", "0.54673225", "0.5449905", "0.542804", "0.542479", "0.5411603", "0.5409222", "0.54051375", "0.53645533", "0.5358607", "0.535845", "0.5352453", "0.53426695", "0.5342623", "0.5342623", "0.5340742", "0.53237617", "0.53222054", "0.5319233", "0.5318109", "0.5301248", "0.5300201", "0.5300022", "0.5295496", "0.5291186", "0.5288256", "0.5284038", "0.5276833", "0.52764314", "0.5276119", "0.527073", "0.52650404", "0.52620816", "0.5260867", "0.52514803", "0.5249069", "0.52406037", "0.5240022", "0.523679", "0.52348924", "0.5231935", "0.52318174", "0.5228449", "0.5225169", "0.521999", "0.52173203", "0.5215134", "0.5203477", "0.5191481", "0.5188405", "0.5182617", "0.5182282", "0.51816654", "0.51796466", "0.5178677", "0.5175636", "0.5173458", "0.51679796", "0.5161298", "0.5152804", "0.51521695", "0.5150953", "0.51348025", "0.5131244", "0.51297635", "0.5128429", "0.5124397", "0.5119939" ]
0.52930933
56
Write your code here
public static TreeNode<Integer> maxSumNode(TreeNode<Integer> root){ if(root==null) { return null; } int sumRoot = sum(root); int max=Integer.MIN_VALUE; TreeNode<Integer> maxNode = null; for(int i=0;i<root.children.size();i++) { TreeNode<Integer> maxNode1 =maxSumNode(root.children.get(i)); int sum = sum(maxNode1); if( max < sum ) { max = sum; maxNode = maxNode1; } } if( sumRoot > max ) { return root; } return maxNode; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void generateCode()\n {\n \n }", "public void logic(){\r\n\r\n\t}", "@Override\n\tprotected void logic() {\n\n\t}", "private static void cajas() {\n\t\t\n\t}", "void pramitiTechTutorials() {\n\t\n}", "public void ganar() {\n // TODO implement here\n }", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "CD withCode();", "public void mo38117a() {\n }", "private stendhal() {\n\t}", "public void mo4359a() {\n }", "@Override\n public void perish() {\n \n }", "@Override\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\r\n\tpublic void runn() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "public static void main(String[] args) {\n // write your code here - this is called comment and it always starts with double slash\n // and comlier will ignore this because of the // sign.\n // I am gonna say hello\n // JAVA IS CASE SENSITIVE LANGUAGE\n // System and system are very different things in java\n //Hello AND hello are different for java\n // System.out.println(\"Hello Batch 15!\");\n // System.out.println(\"I am still here.\");\n // System.out.println(\"I love Java.\");\n\n // Write a program to display your information.\n // When you run it, it should have this outcome.\n // I am your name here\n // I am from batch 15\n // I am from your city here\n // I love Java\n\n System.out.println(\"I am Sevim.\");\n System.out.println(\"I am from Batch 15.\");\n System.out.println(\"I'm from New Jersey.\");\n System.out.println(\"I love Java.\");\n\n\n\n }", "public void gored() {\n\t\t\n\t}", "@Override\n\tpublic void anular() {\n\n\t}", "public void genCode(CodeFile code) {\n\t\t\n\t}", "@Override\n\tpublic void gravarBd() {\n\t\t\n\t}", "Programming(){\n\t}", "public void smell() {\n\t\t\n\t}", "@Override\r\n\tprotected void doF4() {\n\t\t\r\n\t}", "public void furyo ()\t{\n }", "@Override\n public void function()\n {\n }", "@Override\n public void function()\n {\n }", "public void hello(){\n\t\t\r\n \t\r\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}", "public void working()\n {\n \n \n }", "@Override\r\n\t\tpublic void doDomething() {\r\n\t\t\tSystem.out.println(\"I am here\");\r\n\t\t\t\r\n\t\t}", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "public void baocun() {\n\t\t\n\t}", "public final void mo51373a() {\n }", "@Override\r\n\tpublic void code() {\n\t\tus.code();\r\n\t\tSystem.out.println(\"我会java...\");\r\n\t}", "@Override\r\n\tpublic void code() {\n\t\tSystem.out.println(\"我会C语言....\");\r\n\t}", "@Override\n\tpublic void function() {\n\t\t\n\t}", "private void strin() {\n\n\t}", "public void edit() {\n\t\tSystem.out.println(\"编写java笔记\");\r\n\t}", "private void kk12() {\n\n\t}", "public void mo55254a() {\n }", "public void gen(CodeSeq code, ICodeEnv env) {\n\r\n\t}", "public void mo9848a() {\n }", "protected void mo6255a() {\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 }", "public void mo55254a() {\n }", "public void themesa()\n {\n \n \n \n \n }", "private void yy() {\n\n\t}", "@Override\n\t\t\tpublic void run() {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void run() {\n\t\t\t\t\n\t\t\t}", "public void perder() {\n // TODO implement here\n }", "void rajib () {\n\t\t \n\t\t System.out.println(\"Rajib is IT Eng\");\n\t }", "public static void main(String[] args) {\n\t// write your code here\n }", "private static void oneUserExample()\t{\n\t}", "@Override\r\n\t\tprotected void run() {\n\t\t\t\r\n\t\t}", "public void mo3376r() {\n }", "public void mo97908d() {\n }", "@Override\r\n\tvoid func04() {\n\t\t\r\n\t}", "public void cocinar(){\n\n }", "private void getStatus() {\n\t\t\n\t}", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "public void mo5382o() {\n }", "@Override\n public void memoria() {\n \n }", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\r\n\tprotected void doF6() {\n\t\t\r\n\t}", "private static void ThridUmpireReview() {\n\t\tSystem.out.println(\" Umpier Reviews the Score Board\");\n\t\t \n\t\t\n\t}", "@Override\n\tpublic void dosomething() {\n\t\t\n\t}", "protected void execute() {\n\t\t\n\t}", "@Override\n public void execute() {\n \n \n }", "public static void main(String args[]) throws Exception\n {\n \n \n \n }", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "public void mo21793R() {\n }", "public void mo12930a() {\n }", "private void test() {\n\n\t}", "public void mo6081a() {\n }", "static void feladat5() {\n\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\n\tvoid output() {\n\t\t\n\t}", "public void run() {\n\t\t\t\t\n\t\t\t}", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "void berechneFlaeche() {\n\t}", "public void mo3749d() {\n }", "@Override\n\tpublic void orgasm() {\n\t\t\n\t}", "public void mo21791P() {\n }", "public final void cpp() {\n }", "@Override\r\n\tprotected void doF8() {\n\t\t\r\n\t}", "void kiemTraThangHopLi() {\n }", "@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 skystonePos5() {\n }", "@Override\n protected void execute() {\n \n }", "@Override\n\tprotected void postRun() {\n\n\t}", "@Override\n\tpublic void HowtoEat() {\n\t\tSystem.out.println(\"Fırında Ye!!\");\n\t}", "@Override\n protected void codeGenMain(DecacCompiler compiler, Registres regs, Pile p) {\n }", "@Override\n\tpublic void view() {\n\t\t\n\t}" ]
[ "0.6385292", "0.62825674", "0.6094859", "0.59705144", "0.59174407", "0.5879631", "0.58751583", "0.58699447", "0.5869017", "0.58553624", "0.5826625", "0.5825323", "0.58233553", "0.577183", "0.576982", "0.5769503", "0.57691693", "0.5748044", "0.57379705", "0.573767", "0.57285726", "0.57275313", "0.5722168", "0.5715661", "0.5709839", "0.5709839", "0.5704307", "0.5681891", "0.5681891", "0.5673934", "0.5651873", "0.56415623", "0.5629833", "0.56136686", "0.560722", "0.5603319", "0.55986965", "0.55838263", "0.55780625", "0.55713314", "0.55659115", "0.55621606", "0.5556605", "0.5549954", "0.55463374", "0.55463374", "0.55463374", "0.55463374", "0.55463374", "0.55463374", "0.55463374", "0.55281407", "0.5525562", "0.55151445", "0.55151445", "0.55058944", "0.5503766", "0.55010456", "0.5500997", "0.5495365", "0.54874974", "0.5482034", "0.5477928", "0.54772", "0.5475188", "0.5473774", "0.54694617", "0.54655695", "0.54646754", "0.5460583", "0.54583234", "0.54577816", "0.5457681", "0.54538816", "0.5452503", "0.54493356", "0.54453313", "0.5444872", "0.5440357", "0.54393566", "0.54381615", "0.5435557", "0.54309005", "0.5428512", "0.54260683", "0.5423332", "0.5419551", "0.5419505", "0.5419252", "0.54156613", "0.5414246", "0.54133856", "0.5403345", "0.5401036", "0.5401036", "0.5394768", "0.53913885", "0.5389031", "0.5386461", "0.5383817", "0.5380636" ]
0.0
-1
/ Show confirmation dialog that prompts user to log in.
private void showMustLogInMessage(String message, String dialogTag) { ConfirmationDialogFragment dialog = ConfirmationDialogFragment.getInstance(message, getString(R.string.log_in), REQUEST_CONFIRM_LOG_IN, true); dialog.show(getSupportFragmentManager(), dialogTag); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "protected void confirmLogin() {\n String nameString1 = this.adminName.getText();\n String passwordString1 = this.adminPassword.getText();\n UserType userType = (UserType) this.user_type_combobox.getSelectedItem();\n if (\"系统管理员\".equals(userType.getName())) {\n AdminDao adminDao = new AdminDao();\n SystemAdmin admin = adminDao.selectAdmin(nameString1, passwordString1);\n if (admin == null) {\n JOptionPane.showMessageDialog(this, \"用户名或者密码错误!!\");\n return;\n }\n IndexFrame indexFrame = new IndexFrame(userType, admin, passwordString1);\n indexFrame.setVisible(true);\n this.dispose();\n }\n }", "private void showConfirmSignOutDialog() {\n\t\tConfirmationDialogFragment dialog = ConfirmationDialogFragment.getInstance(getString(R.string.log_out_confirm),\n\t\t\t\tgetString(R.string.log_out_confirm_option_yes), REQUEST_CONFIRM_LOG_OUT, true);\n\t\tdialog.show(getSupportFragmentManager(), DIALOG_CONFIRM_LOG_OUT);\n\t}", "public void showPasswordPrompt();", "public void loginAlert() {\n\t\tDialog<Pair<String, String>> dialog = new Dialog<>();\n\t\tdialog.setTitle(\"Login Dialog\");\n\t\tdialog.setHeaderText(\"Look, a Custom Login Dialog\");\n\n\t\t// Set the icon (must be included in the project).\n\t\tdialog.setGraphic(new ImageView(this.getClass().getResource(\"file:src/vista/img/usuario.png\").toString()));\n\n\t\t// Set the button types.\n\t\tButtonType loginButtonType = new ButtonType(\"Login\", ButtonData.OK_DONE);\n\t\tdialog.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);\n\n\t\t// Create the username and password labels and fields.\n\t\tGridPane grid = new GridPane();\n\t\tgrid.setHgap(10);\n\t\tgrid.setVgap(10);\n\t\tgrid.setPadding(new Insets(20, 150, 10, 10));\n\n\t\tTextField username = new TextField();\n\t\tusername.setPromptText(\"Username\");\n\t\tPasswordField password = new PasswordField();\n\t\tpassword.setPromptText(\"Password\");\n\n\t\tgrid.add(new Label(\"Username:\"), 0, 0);\n\t\tgrid.add(username, 1, 0);\n\t\tgrid.add(new Label(\"Password:\"), 0, 1);\n\t\tgrid.add(password, 1, 1);\n\n\t\t// Enable/Disable login button depending on whether a username was entered.\n\t\tNode loginButton = dialog.getDialogPane().lookupButton(loginButtonType);\n\t\tloginButton.setDisable(true);\n\n\t\t// Do some validation (using the Java 8 lambda syntax).\n\t\tusername.textProperty().addListener((observable, oldValue, newValue) -> {\n\t\t loginButton.setDisable(newValue.trim().isEmpty());\n\t\t});\n\n\t\tdialog.getDialogPane().setContent(grid);\n\n\t\t// Request focus on the username field by default.\n\t\tPlatform.runLater(() -> username.requestFocus());\n\n\t\t// Convert the result to a username-password-pair when the login button is clicked.\n\t\tdialog.setResultConverter(dialogButton -> {\n\t\t if (dialogButton == loginButtonType) {\n\t\t return new Pair<>(username.getText(), password.getText());\n\t\t }\n\t\t return null;\n\t\t});\n\n\t\tOptional<Pair<String, String>> result = dialog.showAndWait();\n\n\t\tresult.ifPresent(usernamePassword -> {\n\t\t System.out.println(\"Username=\" + usernamePassword.getKey() + \", Password=\" + usernamePassword.getValue());\n\t\t});\n\t}", "private void displayProgressDialog() {\n pDialog.setMessage(\"Logging In.. Please wait...\");\n pDialog.setIndeterminate(false);\n pDialog.setCancelable(false);\n pDialog.show();\n }", "@FXML\n private void handleOKPressed() {\n\n if (Authenticator.validatePassword(accountId.getText(), password.getText())) {\n application.accountLogging(accountId.getText());\n confirmLogin = true;\n dialogStage.close();\n } else {\n errorMessage.setVisible(true);\n }\n }", "private void displayProgressDialog() {\n pDialog.setMessage(\"Logging in.. Please wait...\");\n pDialog.setIndeterminate(false);\n pDialog.setCancelable(false);\n pDialog.show();\n\n }", "private void formDashboardMainButtonLogoutActionPerformed(java.awt.event.ActionEvent evt) {\n try {\n int action = JOptionPane.showConfirmDialog(null,\n Constanta.Messages.MESSAGE_CONFIRM_LOGOUT,\n Constanta.Messages.BANNER_CONFIRM,\n JOptionPane.YES_NO_OPTION,\n JOptionPane.QUESTION_MESSAGE);\n\n if (action == JOptionPane.YES_OPTION) {\n Login login = new Login();\n login.show();\n this.dispose();\n }\n } catch (HeadlessException e) {\n JOptionPane.showMessageDialog(null, Constanta.Messages.MESSAGE_ERROR + e.getMessage());\n }\n }", "public boolean confirmLoginClicked() {\n return confirmLogin;\n }", "private void okEvent() {\n\t\tYAETMMainView.PRIVILEGE = (String)loginBox.getSelectedItem();\n\t\tshowMain();\n\t\tcloseDialog();\n\t}", "private void btnLogInActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLogInActionPerformed\n if(mngr!=null){\n if(mngr.LogIn(txtUsername.getText(), new String(txtPassword.getPassword()))){\n this.dispose();\n } else {\n JOptionPane.showConfirmDialog(this, \"Could not log you in. Check login, password or connection.\");\n }\n }\n }", "public void logoutDialog() {\n new AlertDialog.Builder(this)\n .setIcon(android.R.drawable.ic_dialog_alert)\n .setTitle(\"Logout\")\n .setMessage(\"Are you sure you want to logout?\")\n .setPositiveButton(\"Yes\", new DialogInterface.OnClickListener()\n {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n finish();\n }\n\n })\n .setNegativeButton(\"No\", null)\n .show();\n }", "public void actionPerformed(ActionEvent e) {\r\n\t\t\t\tint selection=JOptionPane.showConfirmDialog(mainWin,\"Are you sure you want to log out\",\"Choose\",JOptionPane.YES_NO_OPTION);\r\n\t\t\t\tif( selection==JOptionPane.YES_OPTION) {\r\n\t\t\t\t\tmainWin.dispose();\r\n\t\t\t\t\tMainLoginPage returntologin=new MainLoginPage();\r\n\t\t\t\t\treturntologin.display();\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}", "public Optional<Pair<String,String>> showLogin( final Pair<String,String> initialUserInfo, final Callback<Pair<String,String>, Void> authenticator ) {\n \t\n \tfinal CustomTextField txUserName = (CustomTextField) TextFields.createClearableTextField();\n \ttxUserName.setLeft(new ImageView( DialogResources.getImage(\"login.user.icon\")) ); //$NON-NLS-1$\n \t\n \tfinal CustomPasswordField txPassword = (CustomPasswordField) TextFields.createClearablePasswordField();\n \ttxPassword.setLeft(new ImageView( DialogResources.getImage(\"login.password.icon\"))); //$NON-NLS-1$\n\t\t\n\t\tfinal Label lbMessage= new Label(\"\"); //$NON-NLS-1$\n\t\tlbMessage.getStyleClass().addAll(\"message-banner\"); //$NON-NLS-1$\n\t\tlbMessage.setVisible(false);\n\t\tlbMessage.setManaged(false);\n\t\t\n\t\tfinal VBox content = new VBox(10);\n\t\tcontent.getChildren().add(new Label(\"User name\"));\n\t\tcontent.getChildren().add(txUserName);\n\t\tcontent.getChildren().add(txPassword);\n\t\t\n\t\tfinal Action actionLogin = new DialogAction(\"Connect\", null, false, false, true) { //$NON-NLS-1$\n\t\t\t{\n\t\t\t\tButtonBar.setType(this, ButtonType.OK_DONE);\n\t\t\t\tsetEventHandler(this::handleAction);\n\t\t\t}\n\t\t\t\n\t\t\tprotected void handleAction(ActionEvent ae) {\n\t\t\t\tDialog dlg = (Dialog) ae.getSource();\n\t\t\t\ttry {\n\t\t\t\t\tif ( authenticator != null ) {\n\t\t\t\t\t\tauthenticator.call(new Pair<>(txUserName.getText(), txPassword.getText()));\n\t\t\t\t\t}\n\t\t\t\t\tlbMessage.setVisible(false);\n\t\t\t\t\tlbMessage.setManaged(false);\n\t\t\t\t\tdlg.hide();\n\t\t\t\t\tdlg.setResult(this);\n\t\t\t\t} catch( Throwable ex ) {\n\t\t\t\t\tlbMessage.setVisible(true);\n\t\t\t\t\tlbMessage.setManaged(true);\n\t\t\t\t\tlbMessage.setText(ex.getMessage());\n\t\t\t\t\tdlg.sizeToScene();\n\t\t\t\t\tdlg.shake();\n\t\t\t\t\tex.printStackTrace();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t@Override public String toString() {\n\t\t\t\treturn \"LOGIN\"; //$NON-NLS-1$\n\t\t\t};\n\t\t};\n\t\t\n\t\tfinal Dialog dlg = buildDialog(Type.LOGIN);\n dlg.setContent(content);\n \n dlg.setResizable(false);\n\t\tdlg.setIconifiable(false);\n\t\tif ( dlg.getGraphic() == null ) { \n\t\t\tdlg.setGraphic( new ImageView( DialogResources.getImage(\"login.icon\"))); //$NON-NLS-1$\n\t\t}\n\t\tdlg.getActions().setAll(actionLogin, ACTION_CANCEL);\n\t\tfinal String userNameCation = getString(\"login.dlg.user.caption\"); //$NON-NLS-1$\n\t\tfinal String passwordCaption = getString(\"login.dlg.pswd.caption\"); //$NON-NLS-1$\n\t\ttxUserName.setPromptText(userNameCation);\n\t\ttxUserName.setText( initialUserInfo.getKey());\n\t\ttxPassword.setPromptText(passwordCaption);\n\t\ttxPassword.setText(new String(initialUserInfo.getValue()));\n\n\t\tfinal ValidationSupport validationSupport = new ValidationSupport();\n\t\tPlatform.runLater(new Runnable()\n\t\t{\n\t\t@Override\n\t\tpublic void run()\n\t\t{\n\t\t\tString requiredFormat = \"'%s' is required\"; //$NON-NLS-1$\n\t\t\tvalidationSupport.registerValidator(txUserName, Validator.createEmptyValidator( String.format( requiredFormat, userNameCation )));\n\t\t\tactionLogin.disabledProperty().bind(validationSupport.invalidProperty());\n\t\t\ttxUserName.requestFocus();\t\t\t\n\t\t}});\n\n\t\tdlg.sizeToScene();\n \treturn Optional.ofNullable( \n \t\t\tdlg.show() == actionLogin? \n \t\t\t\t\tnew Pair<>(txUserName.getText(), txPassword.getText()): \n \t\t\t\t\tnull);\n }", "void confirm();", "private void showAuthenticationScreen() {\n if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {\n mKeyguardManager = (KeyguardManager) getActivity().getSystemService(Context.KEYGUARD_SERVICE);\n\n if (mKeyguardManager.isKeyguardSecure()) {\n Intent authIntent = mKeyguardManager.createConfirmDeviceCredentialIntent(null, null);\n startActivityForResult(authIntent, REQUEST_CODE_CONFIRM_DEVICE_CREDENTIALS);\n }\n }\n }", "public boolean displayPrompt(String msg);", "private static void JGUI4() {\n\t\tint n = JOptionPane.showConfirmDialog(\n\t\tnull,\n\t\t\"Would you like green eggs and ham?\",\n\t\t\"An Inane Question\",\n\t\tJOptionPane.YES_NO_OPTION);\n\t}", "static void acceptLogin() throws IOException\n\t{\n\t\tboolean validLogin = false, loginAccepted=false, emptyInput=false;;\n\t\tint dialogButton, attempts = 0,option;\n\t\tString info, title = \"Registration\";\n\t\tdialogButton = JOptionPane.showConfirmDialog (null, \"Are you an existing user?\",\"Login\", JOptionPane.YES_NO_OPTION);\n \n JTextField email = new JTextField(); //A text field is a basic text control that enables the user to type a small amount of text.\n JTextField password = new JPasswordField();\n JTextField confirmEmail = new JTextField(); //A text field is a basic text control that enables the user to type a small amount of text.\n JTextField confirmPassword = new JPasswordField();\n \n if(dialogButton == JOptionPane.YES_OPTION)//Executes only if the user is already an existing user\n\t\t{\n\t\t\tSystem.out.println(\"User selected yes..\");\n //Creates an object that accepts both username and password using JTextField\n \n Object[]message = {\"Username:\", username,\"Password:\", password};\n String attempted=\"***\";\n System.out.println(attempted);\n //Loop will keep running until three attempts are made or a valid input is entered\n\t\t\twhile(attempts<3 && !validLogin && !emptyInput)\n\t\t\t{\n\n\t\t\t\toption = JOptionPane.showConfirmDialog(null, message, \"Login\", JOptionPane.OK_CANCEL_OPTION);\n System.out.println(username.getText()+\"\\n\"+password.getText());\n\n //if user presses Cancel button the program loops through acceptLogin Method\n if(option == JOptionPane.CANCEL_OPTION)\n {\n acceptLogin();\n validLogin = true;\n }\n\n else \n\t\t\t\t{\n\t\t\t\t validLogin = validLoginEntered(username.getText(), password.getText());\n\t\t\t\t if(!validLogin)\n {\n\t\t\t\t JOptionPane.showMessageDialog(null, \"User Could Not Be Found!\\nAttempt \"+(attempts+1)+\" of 3\", title, 2);\n\t\t\t\t attempts++;\t\n\t\t\t\t if (attempts==3) \n\t\t\t\t {\n\t\t\t\t \tSystem.out.println(\"Login Failed\");\n\t\t\t\t \tdialogButton= JOptionPane.showConfirmDialog (null, \"Do you want to Login Again?\",\"Login Failed\", JOptionPane.YES_NO_OPTION);\n\t\t\t\t \t if(dialogButton==JOptionPane.YES_OPTION)\n\t\t\t\t \t \t{acceptLogin();System.out.println(\"Reseting Login...\");\n\t\t\t\t \t \tvalidLogin=true;}\n\t\t\t\t \t else {\n\t\t\t\t \t \tSystem.out.println(\"Terminating Login...\");\n\t\t\t\t \t \tJOptionPane.showMessageDialog(null,\"Goodbye!!\");\n\t\t\t\t \t }\n\t\t\t\t }\n\t\t\t\t attempted=attempted.substring(0,attempted.length()-1);\n\t\t\t\t System.out.println(attempted);\n\t\t\t\t }\n else\n {\n loggedin = true;\n user(username.getText());\n getUsername(username.getText());\n }\n\t\t\t\t}\n }\n }\n //if user presses NO option then the user is asked to create a new user\n else if(dialogButton == JOptionPane.NO_OPTION)\n\t\t{ \n boolean userExists = false;\n\t\t\tFile fileReader = new File(\"loginDetails.txt\");\n\t\t\tObject[] message= {\"Email:\",email,\"Username:\", username,\"Password:\", password,\"Confirm Password:\", confirmPassword};\n JOptionPane.showMessageDialog(null, message, \"Create user\",1);\n info = username.getText()+\",\"+password.getText()+\",\"+email.getText()+\"\\n\"; \n //this is used to check if the user already exists. If user already exists then the user is asked to try logging in \n if (validpassword(password.getText())==true) {\n \t\n \n if(validemail(email.getText())==true)\n {\n if(loginDetails.get(0).contains(username.getText()) || username.getText().equals(\"\"))\n {\n JOptionPane.showMessageDialog(null,\"Username Taken or Empty Input, Try Again\",\"Registration Error!\",0);\n userExists = true;\n acceptLogin();\n }\n //if user doesn't exist then a new user is created\n if(!userExists&&confirmPassword.getText().matches(password.getText()))\n {\n \tSystem.out.println(\"New user Added to log...\");\n writeToFile(fileReader, info);\n writeUserFile(username.getText()+\".txt\",\"\");\n userDetails(username.getText()+\".txt\");\n loginDetails.get(0).add(username.getText());\n loginDetails.get(1).add(password.getText());\n loginDetails.get(2).add(\"0\");\n userIndex = loginDetails.get(0).indexOf(username.getText());\n validLogin=true;\n loggedin = true;\n }else{JOptionPane.showMessageDialog(null,\"Password does not match, Try again\",\"Password Error\",0);acceptLogin();}\n \t}else \n \t{\n \t\t\n \t\t acceptLogin();\n \t}\n }else\n {\n\n \t\t acceptLogin();\n }\n \n }\n //if the login is not succesfull then the program exists \n\t}", "public void promptUser(String string) {\n\t\tJOptionPane.showMessageDialog(frame,string);\n\t\t\n\t}", "private void showLogin() {\n \t\tLogin.actionHandleLogin(this);\n \t}", "private void showPasswordChooserDialog(){\n if (getFragmentManager().findFragmentByTag(PASSWORD_FRAGMENT_TAG) != null){\n return;\n }\n PasswordDialogFragment fragment = PasswordDialogFragment.createFragment(R.string.box_sharesdk_password, R.string.box_sharesdk_set_password, R.string.box_sharesdk_ok, R.string.box_sharesdk_cancel );\n fragment.show(getFragmentManager(), PASSWORD_FRAGMENT_TAG);\n }", "public void showJRAuthenticateDialog(final Context context, JRAuthenticateDelegate delegate, String title) {\n\t\t\n\t\tboolean isAlreadyExists = false;\n\t\tfor (JRAuthenticateDelegate delegate1 : delegates) {\n\t\t\tif (delegate1 == delegate) {\n\t\t\t\tisAlreadyExists = true;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (!isAlreadyExists)\n\t\t\tdelegates.add(delegate);\n\t\t\n\t\tif (theBaseUrl == null) {\n\t\t\tstartGetBaseUrl();\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (sessionData == null) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (sessionData.configedProviders == null) {\n\t\t\treturn;\n\t\t}\n\t\t\n\t\tif (jrModalNavController == null)\n\t\t\tjrModalNavController = new JRModalNavController(sessionData);\n\t\t\n\t\tAlertDialog.Builder builder = new AlertDialog.Builder(context);\n\t\tbuilder.setTitle(title);\n\t\t\n\t\tbuilder.setAdapter(new AccountsAdapter(context, sessionData.configedProviders), \n\t\t\t\tnew DialogInterface.OnClickListener() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onClick(DialogInterface dialog, int which) {\n\t\t\t\t\t\t/* Let sessionData know which provider the user selected */\n\t\t\t\t\t\tString provider = sessionData.configedProviders[which];\n\t\t\t\t\t\tsessionData.setProvider(provider);\n\t\t\t\t\t\t\n\t\t\t\t\t\tif (sessionData.currentProvider.getProviderRequiresInput() || (sessionData.returningProvider != null && provider.equals(sessionData.returningProvider.getName()))) {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//TODO: myUserLandingController\n\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} else {\n\t\t\t\t\t\t\tIntent intent = new Intent(context, JRWebViewActivity.class);\n\t\t\t\t\t\t\tintent.putExtra(\"provider\", provider);\n\t\t\t\t\t\t\t((Activity) context).startActivityForResult(intent, 0);\n\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\tbuilder.create().show();\n\t}", "private void showDialog() {\n AlertDialog.Builder builder = new AlertDialog.Builder(this);\n builder.setTitle(\"User created successfully\");\n builder.setIcon(R.drawable.ic_shield);\n builder.setCancelable(true);\n builder.setPositiveButton(\n \"Continue\",\n new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int id) {\n finish();\n }\n });\n AlertDialog alert11 = builder.create();\n alert11.show();\n Window window = alert11.getWindow();\n assert window != null;\n WindowManager.LayoutParams wlp = window.getAttributes();\n wlp.gravity = Gravity.CENTER;\n wlp.y = 270;\n wlp.flags &= ~WindowManager.LayoutParams.FLAG_DIM_BEHIND;\n window.setAttributes(wlp);\n }", "@Override\n public void onClick(View v) {\n final Dialog login = new Dialog(MainActivity.this);\n // Set GUI of login screen\n login.setContentView(R.layout.login_dialog);\n login.setTitle(\"Login to your Snap account\");\n\n // Init button of login GUI\n Button btnLogin = (Button) login.findViewById(R.id.btnLogin);\n Button btnCancel = (Button) login.findViewById(R.id.btnCancel);\n final EditText txtUsername = (EditText)login.findViewById(R.id.txtUsername);\n final EditText txtPassword = (EditText)login.findViewById(R.id.txtPassword);\n txtPassword.setTypeface(Typeface.SANS_SERIF);\n txtUsername.setTypeface(Typeface.SANS_SERIF);\n\n SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(MainActivity.this);\n //String strSavedMem1 = sharedPreferences.getString(\"username\",\"d\");\n txtUsername.setText( sharedPreferences.getString(\"username\",\"@walk.com\") );\n txtPassword.setText( sharedPreferences.getString(\"password\",\"password\"));\n\n\n\n // Attached listener for login GUI button\n btnLogin.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n if(txtUsername.getText().toString().trim().length() > 0 && txtPassword.getText().toString().trim().length() > 0)\n {\n // Validate Your login credential here than display message\n checkCredentials(txtUsername.getText().toString().trim(),txtPassword.getText().toString().trim());\n login.dismiss();\n }\n else\n {\n Toast.makeText(getApplicationContext(),\n \"Please enter Username and Password\", Toast.LENGTH_LONG).show();\n }\n }\n });\n btnCancel.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n login.dismiss();\n }\n });\n\n // Make dialog box visible.\n login.show();\n\n }", "private void usernameTakenDialog() {\n Dialog dialog = new Dialog(\"Username taken\", cloudSkin, \"dialog\") {\n public void result(Object obj) {\n System.out.println(\"result \" + obj);\n }\n };\n dialog.text(\"This username has already been taken, try a new one.\");\n dialog.button(\"OK\", true);\n dialog.show(stage);\n }", "private void promptPlayerTurn(Player player) {\r\n JOptionPane.showMessageDialog(\r\n null,\r\n player.getName() + \", it's your turn!\",\r\n \"Player Confirmation\",\r\n JOptionPane.INFORMATION_MESSAGE);\r\n }", "@Override\n public void show()\n {\n boolean loginOK; // true if good user info was entered\n // multithreaded code does not execute properly in IDEs; true if IDE run detected\n boolean runningFromIDE = false;\n\n do // continue login process while user chooses to stay in login menu\n {\n loginOK = false;\n while(!loginOK) // do this while no good login info acquired, or user choose to bail.\n {\n System.out.println(splashStrings.LOGIN); // SPLASH WELCOME\n\n String userName = GET.getString(\"Indtast venligst bruger navn:\\n\\t|> \");\n\n char[] password;\n\n if(!runningFromIDE) // getPassword does not work in IDE\n {\n password = PasswordField.getPassword(System.in, \"Indtast venligst password:\\n\\t|> \");\n\n if(password == null)\n {\n // getPassword returns a null array reference, if no chars were captured, thus this.\n runningFromIDE = true;\n\n System.out.println(\"MELDING:\\nDet ser ud til at du kører programmet fra en IDE:\\t\" +\n \"Password masking slås fra.\" +\n \"\\nKør shorttest.jar, for at opnå den fulde bruger-oplevelse.\\n\");\n\n continue;\n }\n\n loginOK = checkCredentials(userName, new String(password));\n\n } else // option is chosen if IDE-execution detected\n {\n String passw = GET.getString(\"Indtast venligst password:\\n\\t|> \");\n loginOK = checkCredentials(userName, passw);\n }\n\n if(!loginOK) // if user input were no good, and ONLY if info were no good\n {\n System.out.println(\"De indtastede informationer fandtes ikke i systemet.\");\n if(GET.getConfirmation(\"Vil du prøve igen?\\n\\tja / nej\\n\\t|> \", \"nej\", \"ja\"))\n {\n System.out.println(\"Du valgte ikke at prøve igen, login afsluttes.\");\n break;\n }\n }\n }\n\n if(loginOK)\n {\n System.out.println(\"Login var en success. Fortsætter til første menu.\\n\");\n menuLoggedInto.show();\n }\n\n // when user returns from main menu, they get to choose if they want to log in again\n } while(GET.getConfirmation(\"Skal en anden logge ind?\\n\\t ja / nej\\n\\t|> \", \"ja\", \"nej\"));\n }", "private void createAccountButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createAccountButtonActionPerformed\n na.setVisible(true);\n boolean isLoggedInNew = uL.isLoggedIn();\n boolean isLoggedIn = na.isLoggedIn();\n if (isLoggedInNew || isLoggedIn) {\n dm.messageMustLogOut();\n na.dispose();\n }\n }", "private void showAlertDialog(String message) {\n AlertDialog alertDialog = new AlertDialog.Builder(LoginActivity.this).create();\n alertDialog.setTitle(\"Authentication\");\n alertDialog.setMessage(message);\n alertDialog.setCancelable(false);\n alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, \"OK\",\n new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) {\n dialog.dismiss();\n }\n });\n\n alertDialog.show();\n }", "public abstract boolean showLogin();", "public void onClick(DialogInterface dialog,int id) {\n sharedPrefManager.saveSPBoolean(SharedPrefManager.SP_SUDAH_LOGIN, false);\n finish();\n }", "public void buttonSingIn(ActionEvent event) throws IOException {\n\n\t\tif (!txtSystemUserUsername.getText().equals(\"\") && !passFieldSystemUserPassword.getText().equals(\"\")) {\n\n\t\t\tString username = txtSystemUserUsername.getText();\n\t\t\tString password = passFieldSystemUserPassword.getText();\n\n\t\t\tboolean openWindow = restaurant.logInUser(username, password);\n\t\t\tboolean active = restaurant.conditionUser(username, password);\n\n\t\t\tif (openWindow == true && active == true) {\n\t\t\t\tif (username.equals(\"ADMINISTRATOR\")) {\n\t\t\t\t\tFXMLLoader optionsFxml = new FXMLLoader(\n\t\t\t\t\t\t\tgetClass().getResource(\"Administrator-Options-window.fxml\"));\n\t\t\t\t\toptionsFxml.setController(this);\n\t\t\t\t\tParent opWindow = optionsFxml.load();\n\t\t\t\t\tmainPaneLogin.getChildren().setAll(opWindow);\n\n\t\t\t\t} else {\n\t\t\t\t\tFXMLLoader optionsFxml = new FXMLLoader(getClass().getResource(\"Options-window.fxml\"));\n\t\t\t\t\toptionsFxml.setController(this);\n\t\t\t\t\tParent opWindow = optionsFxml.load();\n\t\t\t\t\tmainPaneLogin.getChildren().setAll(opWindow);\n\n\t\t\t\t}\n\t\t\t\tsetEmpleadoUsername(username);\n\t\t\t\tingredientsOptions.clear();\n\t\t\t\tingredientsOptions.addAll(restaurant.getStringIngredients());\n\t\t\t\ttypeOptions.clear();\n\t\t\t\ttypeOptions.addAll(restaurant.getStringProductTypes());\n\t\t\t\tproductOptions.clear();\n\t\t\t\tproductOptions.addAll(restaurant.getStringReferencedIdsProducts());\n\n\t\t\t} else {\n\n\t\t\t\tDialog<String> dialog = createDialog();\n\t\t\t\tdialog.setContentText(\n\t\t\t\t\t\t\"Este usuario no ha sido encontrado y/o se encuentra inactivo. Si desea crear uno ingrese a sign up o active su usuario\");\n\t\t\t\tdialog.setTitle(\"Usuario no encontrado\");\n\t\t\t\tdialog.show();\n\n\t\t\t}\n\t\t} else {\n\t\t\tDialog<String> dialog = createDialog();\n\t\t\tdialog.setContentText(\"Todos los campos deben ser llenados\");\n\t\t\tdialog.setTitle(\"Error al cargar datos\");\n\t\t\tdialog.show();\n\t\t}\n\n\t}", "public login() {\n initComponents();\n setLocationRelativeTo(null);\n this.setDefaultCloseOperation(login.DO_NOTHING_ON_CLOSE);\n }", "private void ConnectDialog(){\n\t\tAlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);\n\t\tbuilder.setIcon(R.mipmap.ic_launcher);\n\t\tbuilder.setTitle(\"请输入主机名称和密码\");\n\t\t// 通过LayoutInflater来加载一个xml的布局文件作为一个View对象\n\t\tView view = LayoutInflater.from(MainActivity.this).inflate(R.layout.dialog, null);\n\t\t// 设置我们自己定义的布局文件作为弹出框的Content\n\t\tbuilder.setView(view);\n\n\t\tfinal EditText username = (EditText)view.findViewById(R.id.username);\n\t\tfinal EditText password = (EditText)view.findViewById(R.id.password);\n\n\t\tbuilder.setPositiveButton(\"确定\", new DialogInterface.OnClickListener()\n\t\t{\n\t\t\t@Override\n\t\t\tpublic void onClick(DialogInterface dialog, int which)\n\t\t\t{\n\t\t\t\tString a = username.getText().toString().trim();\n\t\t\t\tString b = password.getText().toString().trim();\n\n\t\t\t\tSwitchToSlaveRemoteController(a,b);\n\t\t\t}\n\t\t});\n\t\tbuilder.setNegativeButton(\"取消\", new DialogInterface.OnClickListener()\n\t\t{\n\t\t\t@Override\n\t\t\tpublic void onClick(DialogInterface dialog, int which)\n\t\t\t{\n\n\t\t\t}\n\t\t});\n\t\tbuilder.show();\n\t}", "public void actionPerformed(ActionEvent e) {\n\t\t\t\tString user = userInput.getText();\r\n\t\t\t\tString password = passwordInput.getText();\r\n\t\t\t\tnew controlador.Login().checkUser(user, password);\t\r\n\t\t\t\tdispose();\r\n\t\t\t\t//if (usr.checkUserAndPass(user, password)) { \r\n\t\t\t\t//Login atras1 = new Login(); \r\n\t\t\t\t//atras1.setVisible(true); \r\n\t\t\t\t//setVisible(false); \r\n//} else { \r\n\t//JOptionPane.showMessageDialog(null, \"Usuario no reconocido\"); }\r\n\t\t\t\t//new vista.ElegirEquipo().setVisible(true);\r\n\t\t\t\t\r\n\t\t\t}", "private void showWrongPasswordDialog()\r\n\t{\t\r\n\t\t// Create and show dialog\r\n\t\tfinal WrongPasswordDialogBuilder loginDialogBuilder = new WrongPasswordDialogBuilder(this);\r\n\t\tfinal AlertDialog alert = loginDialogBuilder.create( );\r\n\t\talert.show( );\r\n\t}", "private Dialog<Pair<String, String>> getLoginDialog() {\n Dialog<Pair<String, String>> dialog = new Dialog<>();\n dialog.setTitle(\"Login\");\n dialog.setHeaderText(\"Look, a Custom Login Dialog\");\n\n ButtonType loginButtonType = new ButtonType(\"Login\", ButtonBar.ButtonData.OK_DONE);\n dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);\n\n // Create the username and password labels and fields.\n GridPane grid = new GridPane();\n grid.setHgap(10);\n grid.setVgap(10);\n grid.setPadding(new Insets(20, 150, 10, 10));\n\n TextField username = new TextField();\n username.setPromptText(\"Username\");\n PasswordField password = new PasswordField();\n password.setPromptText(\"Password\");\n\n grid.add(new Label(\"Username:\"), 0, 0);\n grid.add(username, 1, 0);\n grid.add(new Label(\"Password:\"), 0, 1);\n grid.add(password, 1, 1);\n\n // Enable/Disable login button depending on whether a username was entered.\n Node loginButton = dialog.getDialogPane().lookupButton(loginButtonType);\n loginButton.setDisable(true);\n\n // Do some validation (using the Java 8 lambda syntax).\n username.textProperty().addListener((observable, oldValue, newValue) -> {\n loginButton.setDisable(newValue.trim().isEmpty());\n });\n\n dialog.getDialogPane().setContent(grid);\n\n // Request focus on the username field by default.\n Platform.runLater(username::requestFocus);\n\n // Convert the result to a username-password-pair when the login button is clicked.\n dialog.setResultConverter(dialogButton -> {\n if (dialogButton == loginButtonType) {\n return new Pair<>(username.getText(), password.getText());\n }\n return null;\n });\n return dialog;\n }", "void SubmitButton() {\r\n\t\tint checker = Accounts.checkUser(username.getText(), password.getText());\r\n\t\tif(checker == -1) {\r\n\t\t\tsetVisible(false);\r\n\t\t\tdispose();\r\n\t\t\tAdminScreen adminScreen = new AdminScreen();\r\n\t\t}\r\n\t\telse if(checker >= 0) {\r\n\t\t\tsetVisible(false);\r\n\t\t\tdispose();\r\n\t\t\tStudentScreen studentScreen = new StudentScreen(checker);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tJOptionPane.showMessageDialog(null, \"Error: username \"\r\n\t\t\t\t\t+ \"and/or password is incorrect.\");\r\n\t\t\tpassword.setText(\"\");\r\n\t\t\tusername.setText(\"\");\r\n\t\t}\r\n\t\t\r\n\t}", "public String confirm()\n\t{\n\t\tconfirm = true;\n\t\treturn su();\n\t}", "void login() {\r\n\t\t// to show the window and the data input\r\n\t\td = new Dialog(f, true);\r\n\t\thost = new TextField(10);\r\n\t\ttf_name = new TextField(10);\r\n\t\td.setLayout(new GridLayout(3, 2));\r\n\t\td.add(new Label(\"host:\"));\r\n\t\td.add(host);\r\n\t\td.add(new Label(\"name:\"));\r\n\t\td.add(tf_name);\r\n\t\tButton b = new Button(\"OK\");\r\n\t\tb.addActionListener(new ActionListener() {\r\n\t\t\t// if the input is ended, then use the realLogin method to login the server\r\n\t\t\tpublic void actionPerformed(ActionEvent e) {\r\n\t\t\t\trealLogin(host.getText(), tf_name.getText());\r\n\t\t\t\td.dispose();\r\n\t\t\t}\r\n\t\t});\r\n\t\td.add(b);\r\n\t\td.setResizable(true);\r\n\t\td.setSize(200, 150);\r\n\t\td.show();\r\n\t\t(new Thread(this)).start();\r\n\t}", "private void basicInfoDialogPrompt() {\n if(!prefBool){\n BasicInfoDialog dialog = new BasicInfoDialog();\n dialog.show(getFragmentManager(), \"info_dialog_prompt\");\n }\n }", "public void onClick(DialogInterface dialog, int id) {\n prefs.edit().putBoolean(\"Islogin\", false).commit();\n prefs.edit().putString(\"role\", \"\").commit();\n item.setTitle(\"Login\");\n }", "private void openExitWindowConfirmation() {\n\t\t// int opcion = JOptionPane.showConfirmDialog(this, \"Desea salir del\n\t\t// Chat\", \"Confirmación\",\n\t\t// JOptionPane.YES_NO_OPTION);\n\t\t// if (opcion == JOptionPane.YES_OPTION) {\n\t\tthis.setVisible(false);\n\t\t// }\n\t}", "private void logout() {\n Utils.showConfirmationDialogCallBack(MainActivity.this, getString(R.string.logout_sure), this);\n }", "public void openLogin(String message, boolean sameName) {\t\n\t\t\n\t\t//RegisterLoginPopup.disposeWindow();\n\t\tWindow[] windows = Window.getWindows();\n for (Window window : windows) {\n if (window instanceof JDialog) {\n JDialog dialog = (JDialog) window;\n if (dialog.getContentPane().getComponentCount() == 1\n && dialog.getContentPane().getComponent(0) instanceof JOptionPane){\n dialog.dispose(); \n }\n }\n }\n\t\t\n\t}", "private static void JGUI5() {\n\t\tint response = JOptionPane.showConfirmDialog(null,\n\t\t\t\t\"Do you want to continue?\", \"Confirm\",\n\t\t\t\tJOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE); \n\t\tif (response == JOptionPane.NO_OPTION) {\n\t\t\tSystem.out.println(\"No button clicked\");\n\t\t} else if (response == JOptionPane.YES_OPTION) {\n\t\tSystem.out.println(\"Yes button clicked\");\n\t\t} else if (response == JOptionPane.CLOSED_OPTION) {\n\t\t\tSystem.out.println(\"JOptionPane closed\");\n\t\t}\n\t}", "public void dialogoAgregarUsuario() {\n vAgregarUsuario = new V_AgregarUsuario(new JFrame(), true);\n vAgregarUsuario.setVisible(true);\n }", "public void loginAsUser() {\n vinyardApp.navigateToUrl(\"http://localhost:8080\");\n vinyardApp.fillUsername(\"user\");\n vinyardApp.fillPassord(\"123\");\n vinyardApp.clickSubmitButton();\n }", "@Override\r\n\t\tpublic boolean promptYesNo(String message) {\n\t\t\treturn true;\r\n\t\t}", "public void login() {\n\t\tUser user = new User(\"admin\", \"12345678\", Role.ADMIN);\n\t\tuser.setEmail(\"[email protected]\");\n\t\t\n\t\tif(user != null) {\n\t\t\tuserBean.setLoggedInUser(user);\n\t\t\tFacesContext context = FacesContext.getCurrentInstance();\n\t\t\tHttpServletRequest req = (HttpServletRequest)context.getExternalContext().getRequest();\n\t\t\treq.getSession().setAttribute(ATTR_USER, user);\n\t\t}else{\n\t\t\tkeepDialogOpen();\n\t\t\tdisplayErrorMessageToUser(\"Wrong Username/Password. Try again\");\n\t\t}\n\t\t\n\t}", "@Override\n\tpublic void start(Stage primaryStage)\n\t{\t\n\t\tOptional<Pair<String, String>> result = (new LogonDialog(\"Logowanie\", \"Logowanie do systemu STYLEman\")).showAndWait();\n\t\t\n\t\tif(result.isPresent())\n\t\t{\n\t\t\tSystem.out.println(\"Zalogowano użytkownika: \" + result.get().getValue() + \" do srodowiska: \" + result.get().getKey());\n\t\t}\n\t\telse\n\t\t{\n\t\t\tSystem.out.println(\"Nie udalo sie zalogowac\");\n\t\t}\n\t}", "protected void doAdminLogin() {\n\t\tif (et_pin.getText().toString().trim().equals(\"\")) {\r\n//\t\t\td.dialogShow(v, AdminLoginActivity.this, \"Sorry\",\r\n//\t\t\t\t\t\"Please enter your master pin\");\r\n\t\t\t\r\n\t\t\td.showSingleButtonDialog( AdminLoginActivity.this,\r\n\t\t\t\t\t\"Please enter your master pin\");\r\n\t\t\t\r\n\t\t\t\r\n\t\t} else {\r\n\r\n\t\t\tGlobalVariable.adminMasterPin = et_pin.getText().toString().trim();\r\n\t\t\tIntent i = new Intent(AdminLoginActivity.this,\r\n\t\t\t\t\tAdminConfirmLoginActivity.class);\r\n\t\t\tstartActivity(i);\r\n\t\t\toverridePendingTransition(R.anim.open_translate,\r\n\t\t\t\t\tR.anim.close_translate);\r\n\r\n\t\t}\r\n\t}", "public RegisterUserDialog(Admin admin) { \n\t\tthis.admin = admin;\n\t\tUserDialog dialog = new UserDialog(this);\n\t\tsetLayout(new FlowLayout()); \n\t\tpack();\n\t\t// Set window location in middle of screen\n\t\tdialog.setLocationRelativeTo(null);\n\t\t// Display window\n\t\tdialog.setVisible(true);\n\t }", "public boolean getUserConfirmation() {\n Alert alert = new Alert(Alert.AlertType.CONFIRMATION);\n alert.setTitle(\"Confirmation Box\");\n alert.setHeaderText(\"Are you sure you want to delete?\");\n alert.setResizable(false);\n Optional<ButtonType> result = alert.showAndWait();\n ButtonType button = result.orElse(ButtonType.CANCEL);\n\n if (button == ButtonType.OK) {\n return true;\n } else {\n return false;\n }\n }", "private void confirmationAlert() {\n\t\tAlert confirm = new Alert( AlertType.CONFIRMATION, \"You Will Not Be Able To Change Your Name\\nAfter You Press 'OK'.\");\n\t\tconfirm.setHeaderText(\"Are You Sure?\");\n confirm.setTitle(\"Confirm Name\");\n confirm.showAndWait().ifPresent(response -> {\n if (response == ButtonType.OK) {\n \tbackground.remove( pointer );\n \tkeyStrokes = keyStrokes.replace(\" \", \"-\");\n\t\t\t\tinsertNewHiScore();\n\t\t\t\tnewHighScore = false;\n }\n });\n\t}", "private void logInBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_logInBtnActionPerformed\n User theUser = null;\n String[] options = {\"OK\"};\n String userName = userNameTF.getText();\n String password = passwordTF.getText();\n\n theUser = HF.findUser(userName);\n\n if (userNameTF.getText().equals(\"\") || passwordTF.getText().equals(\"\")){\n JOptionPane.showOptionDialog(this, \"Please fill in your username \"\n + \"and password!\",\n \"\", JOptionPane.ERROR_MESSAGE, JOptionPane.INFORMATION_MESSAGE,\n null, options, options[0] );\n }\n else if (theUser == null) {\n JOptionPane.showOptionDialog(this, \"No such username!\",\n \"\", JOptionPane.ERROR_MESSAGE, JOptionPane.INFORMATION_MESSAGE,\n null, options, options[0] );\n }\n else if (!theUser.getPassword().equals(password)) {\n JOptionPane.showOptionDialog(this, \"Invalid password!\",\n \"\", JOptionPane.ERROR_MESSAGE, JOptionPane.INFORMATION_MESSAGE,\n null, options, options[0] );\n }\n else {\n if (theUser instanceof Trainer){\n TrainerMenu tm = new TrainerMenu(this, (Trainer)theUser);\n tm.setVisible(true);\n this.setVisible(false);\n }\n else if (theUser instanceof Member){\n MemberMenu mm = new MemberMenu(this, (Member)theUser);\n mm.setVisible(true);\n this.setVisible(false);\n }\n userNameTF.setText(\"\");\n passwordTF.setText(\"\");\n }\n }", "public void showLoginAlertDialog(Context context, String message, Boolean status) {\r\n alertDialog.setCanceledOnTouchOutside(false);\r\n alertDialog.setMessage(message);\r\n alertDialog.setButton(getResources().getString(R.string.text_ok), new DialogInterface.OnClickListener() {\r\n public void onClick(DialogInterface dialog, int which) {\r\n dismissProgressDialog();\r\n mLoginEmailView.setText(\"\");\r\n et_One.setText(\"\");\r\n et_two.setText(\"\");\r\n et_three.setText(\"\");\r\n et_four.setText(\"\");\r\n et_five.setText(\"\");\r\n et_six.setText(\"\");\r\n et_One.requestFocus();\r\n alertDialog.dismiss();\r\n }\r\n });\r\n if (!isFinishing()) {\r\n alertDialog.show();\r\n TextView textView = (TextView) alertDialog.findViewById(android.R.id.message);\r\n textView.setTextSize(18);\r\n } else {\r\n alertDialog.dismiss();\r\n }\r\n }", "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 }", "public static void showDialog() {\n\t\tdialog.setLocationRelativeTo(Cytoscape.getDesktop());\n\t\tdialog.setVisible(true);\n\t}", "private void menu_lable_4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menu_lable_4MouseClicked\n // TODO add your handling code here:\n int x = JOptionPane.showConfirmDialog(this, \"You are not yet log out to current account, are yousure want to exit without logout!! and exit the system. Yes exit, No logout !\", \"Not logged out!!\", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);\n switch (x) {\n case JOptionPane.YES_OPTION:\n this.dispose();\n System.exit(0);\n break;\n case JOptionPane.CANCEL_OPTION:\n break;\n default:\n this.log_out();\n new SubInterface_Login_Staff().setVisible(true);\n this.dispose();\n break;\n }\n }", "@Override\n\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\n\t\t\t\tboolean approved = showLoginScreen();\n\t\t\t\tif(approved) {\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tGUIDriver.goToScreen(\"welcome\");\n\t\t\t\t} else {\n\t\t\t\t\tshowIncorrectMessage();\n\t\t\t\t}\n\t\t}", "private void auto_log_in()\n {\n jtf_username.setText(Config.USERNAME);\n jpf_password.setText(Config.PASSWORD);\n jb_prijavi.doClick();\n\n }", "public void login() {\n presenter.login(username.getText().toString(), password.getText().toString());\n }", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tif (JOptionPane.showConfirmDialog(null, \"Are you sure want to log out?\", \"WARNING\",\n\t\t\t\t\t\tJOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {\n\t\t\t\t\tclient.sendCloseRequest();\n\t\t\t\t\tMainUI.this.dispose();\n\t\t\t\t\tLoginBox loginBox = new LoginBox();\n\n\t\t\t\t} else {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t}", "private void showInputDialog() {\n AlertDialog.Builder builder = new AlertDialog.Builder(this);\n builder.setTitle(\"App info\");\n builder.setMessage(message);\n builder.setPositiveButton(\" Done \", new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int id) {\n dialog.dismiss();\n }\n });\n builder.show();\n }", "private void showAlert() {\n AlertDialog.Builder alert = new AlertDialog.Builder(this);\n alert.setMessage(\"Error al autenticar usuario\");\n alert.setPositiveButton(\"Aceptar\", null);\n AlertDialog pop = alert.create();\n alert.show();\n }", "public void actionPerformed(ActionEvent e){\n if (e.getSource() == login_var){\r\n String username_input = userInp.getText();\r\n login_username = username_input;\r\n \r\n String password_input = passInp.getText();\r\n status = systemssoftwareproject.Authentication.login.login(username_input, password_input);\r\n \r\n // If credentials are a match - login successfully\r\n if(status) {\r\n setVisible(false);\r\n }\r\n \r\n // Else - display error\r\n else{\r\n JOptionPane.showMessageDialog(c, \"Incorrect Credentials! Try again.\", \"ERROR\", JOptionPane.ERROR_MESSAGE);\r\n }\r\n }\r\n \r\n // Send user to SignupForm\r\n if (e.getSource() == signup){\r\n setVisible(false);\r\n SignupForm signupForm = new SignupForm();\r\n signupForm.getLoginInstance(this);\r\n }\r\n }", "DialogResult show();", "public void clickLogin() {\n\t\tcontinueButton.click();\n\t}", "public static void main(String[] args) {\n\t// 1. Ask for an initial password, and store it in a variable\n String answer1 = JOptionPane.showInputDialog(null, \"What is the secret message?\"); \n\t// 2. Ask for a message and store it in a variable\n String answer2 = JOptionPane.showInputDialog(null, \"What is your password?\");\n\t// 3. Ask your friend for the password and store it in a variable\n String answer3 = JOptionPane.showInputDialog(\"Do you know the password?\");\n\t// 4. If the password matches,\n if (answer1.equals(answer3))\n {\n\tJOptionPane.showMessageDialog(null, \"\" + answer2);\t\n\t}\n else\n {\n \tJOptionPane.showMessageDialog(null, \"Your wrong.\");\n }\n\t\t// show the secret message\n\t// *5. OPTIONAL: let your friend keep guessing even if they are wrong\n\n}", "private void prompt() {\n System.out.print(Strings.MAIN_PROMPT);\n System.out.flush();\n }", "private void loginButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_loginButtonActionPerformed\n uL.setVisible(true);\n boolean isLoggedInNew = uL.isLoggedIn();\n boolean isLoggedIn = na.isLoggedIn();\n if (isLoggedInNew || isLoggedIn) {\n dm.messageMustLogOut();\n uL.dispose();\n }\n }", "@FXML\n\tprivate void handleLogin() {\n\t \n\t\t\t\ttry {\n\t\t\t\t\tmain.showHomePageOverview(username.getText(),password.getText());\n\t\t\t\t} catch (SQLException 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}", "private void signInEvt() {\n // Retrieve Details\n String email = this.view.getWelcomePanel().getSignInPanel().getEmailText().getText().trim();\n String password = new String(this.view.getWelcomePanel().getSignInPanel().getPasswordText().getPassword()).trim();\n if (!email.equals(\"\") && !password.equals(\"\")) {\n if (model.getSudokuDB().checkLogin(email, password)) {\n // Set Player\n Player player = model.getSudokuDB().loadPlayer(email, password);\n if (player != null) {\n model.setPlayer(model.getSudokuDB().loadPlayer(email, password));\n // Clear Fields\n view.getWelcomePanel().getSignInPanel().clear();\n // Show Home Screen\n refreshHomePanel();\n view.getCardLayoutManager().show(view.getContent(), \"home\");\n } else {\n Object[] options = {\"OK\"};\n JOptionPane.showOptionDialog(this, \"An error occured during sign in, please try again.\", \"Sign In Error\", JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE, null, options, null);\n }\n } else {\n Object[] options = {\"Let me try again\"};\n JOptionPane.showOptionDialog(this, \"The credentials you have provided are invalid, please enter them correctly or create a new account.\", \"Invalid Credentials\", JOptionPane.OK_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, null);\n }\n } else {\n Object[] options = {\"Alright\"};\n JOptionPane.showOptionDialog(this, \"In order to sign in, all fields must be filled out.\", \"Empty Fields\", JOptionPane.OK_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, null);\n }\n }", "@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\t\t\t\tpublic void confirm() {\n\t\t\t\t\tdialog.dismiss();\n\t\t\t\t}", "public void loginMenu(){\n\t\tstate = ATM_State.LOGINID;\n\t\tgui.setDisplay(\"Enter your account ID: \\n\");\n\t}", "private void showRequestLoginForm() {\n final LayoutInflater li = LayoutInflater.from(FinishGameActivity.this);\n final View loginView = li.inflate(R.layout.popup_login_confirm, null);\n final AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(FinishGameActivity.this);\n final ImageView loginBtn = (ImageView) loginView.findViewById(R.id.login_confirm_button);\n mUsernameView = (EditText) loginView.findViewById(R.id.login_confirm_username);\n mPasswordView = (EditText) loginView.findViewById(R.id.login_confirm_password);\n final AlertDialog loginAlertDialog = alertDialogBuilder.create();\n loginAlertDialog.setView(loginView);\n loginBtn.setOnTouchListener(motionButtonListener);\n loginBtn.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n v.postOnAnimation(new Runnable() {\n @Override\n public void run() {\n if (GeneralHelper.hasConnection()) {\n attemptLogin(loginAlertDialog);\n } else {\n final AlertDialog alertDialog = new AlertDialog.Builder(FinishGameActivity.this, AlertDialog.THEME_HOLO_DARK).create();\n // Setting Dialog Title\n alertDialog.setTitle(\"ASEAN Game\");\n alertDialog.setMessage(\"No Internet connection!\");\n alertDialog.setButton(DialogInterface.BUTTON_NEGATIVE, \"Close\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialogInterface, int i) {\n // Invokes inserting bundled data into the database.\n alertDialog.cancel();\n }\n });\n alertDialog.show();\n }\n }\n });\n }\n });\n loginAlertDialog.show();\n }", "public void login(ActionEvent e) throws IOException {\r\n\t\t\r\n \tString username = loginuser.getText().trim();\r\n \t//if user is admin, change to userlist screen\r\n \tif (username.equals(\"admin\")) {\r\n \tPhotos.userlistscreen();\r\n \t} else {\r\n \t\tUser user = currentAdmin.findUser(username);\r\n \t\t//if user is found, log into that user and show the album view for that user specifically\r\n \t\tif (user!=null) {\r\n \t\t\tAlbumController.currentUser = (NonAdmin) user;\r\n \t\t\tCopyController.currentUser = (NonAdmin) user;\r\n \t\t\tMoveController.currentUser = (NonAdmin) user;\r\n \t\t\tPhotos.albumscreen(user);\r\n \t\t}\r\n \t\telse {\r\n \t\t\tAlert alert = new Alert(Alert.AlertType.ERROR);\r\n \t\t\talert.setTitle(\"Error\");\r\n \t\t\talert.setHeaderText(\"Invalid username\");\r\n \t\t\talert.setContentText(\"Please try again\");\r\n \t\t\talert.showAndWait();\r\n \t\t\tloginuser.setText(\"\");\r\n \t\t}\r\n \t}\r\n\t}", "private void loginAsAdmin() {\n vinyardApp.navigateToUrl(\"http://localhost:8080\");\n vinyardApp.fillUsername(\"admin\");\n vinyardApp.fillPassord(\"321\");\n vinyardApp.clickSubmitButton();\n }", "private void confirmacion(String P, String T) {\n int n = JOptionPane.showConfirmDialog(\n null,\n P,\n T,\n JOptionPane.YES_NO_OPTION);\n if (n == JOptionPane.YES_OPTION) {\n N_Cupon ventana = new N_Cupon(conexion);\n ventana.setVisible(true);\n this.setVisible(false);\n //Abrir nueva ventana para insertar Ticket en cupon\n } else {\n this.setVisible(false);\n }\n }", "public Optional<String> showPasswordDialog() {\n Dialog<String> passwordDialog = new Dialog<>();\n try {\n FXMLLoader loader = new FXMLLoader(getClass().getResource(\"/dialog/password_dialog.fxml\"));\n passwordDialog.setTitle(\"Password\");\n passwordDialog.getDialogPane().setContent(loader.load());\n passwordDialog.getDialogPane().getButtonTypes().addAll(ButtonType.OK, ButtonType.CANCEL);\n PasswordDialogController controller = loader.getController();\n passwordDialog.setResultConverter(buttonType -> {\n ButtonBar.ButtonData data = buttonType == null ? null : buttonType.getButtonData();\n return data == ButtonBar.ButtonData.OK_DONE ? controller.getPassword() : null;\n });\n return passwordDialog.showAndWait();\n } catch (IOException e) {\n throw new CryptoEditorException(\"Unable to load view-resource\", e);\n }\n }", "private void alertMessage() {\n //remove friend confirmation dialog\n //taken from: http://www.androidhub4you.com/2012/09/alert-dialog-box-or-confirmation-box-in.html\n DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) {\n switch (which) {\n case DialogInterface.BUTTON_POSITIVE:\n // Yes button clicked\n logout();\n break;\n\n case DialogInterface.BUTTON_NEGATIVE:\n // No button clicked\n // do nothing\n break;\n }\n }\n };\n\n //Show \"warning\" Dialog, if user is sure about deleting friend.\n AlertDialog.Builder builder = new AlertDialog.Builder(context);\n builder.setMessage(\"Are you sure you want to log out from this app?\")\n .setTitle(\"Logout\")\n .setPositiveButton(\"Yes\", dialogClickListener)\n .setNegativeButton(\"No\", dialogClickListener).show();\n }", "private static void JGUI2() {\n\t\tint n = JOptionPane.showConfirmDialog(\n\t\tnull,\n\t\t\"Would you like green eggs and ham?\",\n\t\t\"An Inane Question\",\n\t\tJOptionPane.YES_NO_OPTION);\n\t}", "public String login() {\r\n FacesContext context = FacesContext.getCurrentInstance();\r\n HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();\r\n System.out.println(\"Username: \" + email);\r\n System.out.println(\"Password: \" + password);\r\n try {\r\n //this method will actually check in the realm for the provided credentials\r\n request.login(this.email, this.password);\r\n\r\n } catch (ServletException e) {\r\n context.addMessage(null, new FacesMessage(\"Login failed.\"));\r\n return \"error\";\r\n }\r\n return \"/faces/users/index.xhtml\";\r\n }", "public static void showPrompt() {\r\n \r\n System.out.print(\"> \");\r\n \r\n }", "public login() {\n initComponents();\n setTitle(\"COLLAGE MANAGEMENT SYSTEM\");\n }", "private void jConfirmActionPerformed(final ActionEvent evt)\n {\n if (jAdmin.getText().length() == 0)\n {\n JOptionPane.showMessageDialog(null, \"用户名不能为空!\");\n return;\n }\n if (DA.checkAdmin(jAdmin.getText()))\n {\n JOptionPane.showMessageDialog(null, \"用户名已经被使用!\");\n return;\n }\n if (jPassWord.getPassword().length == 0\n || jPassWordRepeat.getPassword().length == 0)\n {\n JOptionPane.showMessageDialog(null, \"密码不能为空!\");\n jPassWord.setText(\"\");\n jPassWordRepeat.setText(\"\");\n return;\n }\n final String password = new String(jPassWord.getPassword());\n final String passwordRepeat = new String(jPassWordRepeat.getPassword());\n // System.out.println(password+\" \"+passwordRepeat);\n if (password.equals(passwordRepeat) == false)\n {\n JOptionPane.showMessageDialog(null, \"两次密码输入不匹配,请重新输入!\");\n jPassWord.setText(\"\");\n jPassWordRepeat.setText(\"\");\n return;\n }\n\n final MD5 md5 = new MD5(password);\n final AdminData admin = new AdminData();\n admin.setAdmin(jAdmin.getText());\n admin.setPassWord(md5.get());\n\n DA.addAdmin(admin);\n JOptionPane.showMessageDialog(null, \"注册成功!\");\n dispose();\n }", "public boolean onOkClicked() {\n try {\n if (form.isValid()) {\n String userName = form.getFieldValue(SysUser.USER_NAME_PROPERTY);\n String userAccount = form.getFieldValue(SysUser.USER_ACCOUNT_PROPERTY);\n String passWord = form.getFieldValue(SysUser.USER_PASSWORD_PROPERTY);\n String cPassWord = form.getFieldValue(\"cPassWord\");\n if (!passWord.equals(cPassWord)) {\n form.getField(SysUser.USER_PASSWORD_PROPERTY).setValue(\"\");\n form.getField(\"cPassWord\").setValue(\"\");\n form.getField(SysUser.USER_PASSWORD_PROPERTY).setFocus(true);\n addModel(\"msg\", \"密码不一致\");\n } else if (SysUserDao.getInstance().canCreate(getSysUser().getObjectContext(), userAccount)) {\n if (SysUserDao.getInstance().createSysUser(getSysUser().getObjectContext(), userName, userAccount, passWord)) {\n setRedirect(UserListPage.class);\n } else {\n addModel(\"msg\", \"失败\");\n }\n } else {\n form.getField(SysUser.USER_ACCOUNT_PROPERTY).setFocus(true);\n addModel(\"msg\", \"账号已存在\");\n }\n }\n } catch (Exception e) {\n logger.error(e.getLocalizedMessage(), e);\n }\n return true;\n }", "public static void showLogin() throws IOException {\n Main.FxmlLoader(LOGINPAGE_PATH);\n }", "@Override\n public void actionPerformed(ActionEvent e) { // Acionado qnd aperta ENTER\n String string = \"\";\n // Fechar janela de login\n setVisible(false);\n\n String usuario = textField.getText();\n String senha = passwordField.getText();\n\n // Usuário pressionou ENTER no JTextField textField[0]\n if (e.getSource() == textField || e.getSource() == passwordField) {\n if (usuario.equals(\"Daniel\")) {\n if (senha.equals(\"Daniel21\")) {\n JOptionPane.showMessageDialog(null, \"Entrou no sistema!\", \"Usuário: \" + usuario,\n JOptionPane.INFORMATION_MESSAGE);\n } else {\n JOptionPane.showMessageDialog(null, \"Senha Incorreta!\", \"ERRO\", JOptionPane.ERROR_MESSAGE);\n }\n } else {\n JOptionPane.showMessageDialog(null, \"Usuário Inválido!\", \"ERRO\", JOptionPane.ERROR_MESSAGE);\n }\n }\n\n // mostrar janela de login\n setVisible(true);\n }", "private void signUpLblMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_signUpLblMouseClicked\n String[] options = {\n \"Trainer\", \"Member\"\n };\n userNameTF.setText(\"\");\n passwordTF.setText(\"\");\n int opt = JOptionPane.showOptionDialog(this,\n \"What would you wish to sign up as? \",\n \"Trainer or Member?\",\n JOptionPane.DEFAULT_OPTION,\n JOptionPane.QUESTION_MESSAGE,\n null,\n options,\n options[1]);\n this.setVisible(false);\n if(opt == 0){\n SignUpDialogTrainer tDialog = new SignUpDialogTrainer(this, true);\n tDialog.setVisible(true);\n }\n else if(opt == 1){\n SignUpDialogMember mDialog = new SignUpDialogMember(this, true);\n mDialog.setVisible(true);\n }\n this.setVisible(true);\n }", "public boolean enterPasswordDialog(){\n final Dialog login = new Dialog(this);\n // Set GUI of login screen\n login.setContentView(R.layout.alertbox);\n login.setTitle(\"Please Login\");\n Button btnLogin = (Button) login.findViewById(R.id.btnLogin);\n Button btnCancel = (Button) login.findViewById(R.id.btnCancel);\n final EditText txtUsername = (EditText)login.findViewById(R.id.txtUsername);\n final EditText txtPassword = (EditText)login.findViewById(R.id.txtPassword);\n btnLogin.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v){\n String username_string = txtUsername.getText().toString().trim();\n String password_string = txtPassword.getText().toString().trim();\n if(username_string.equals(\"123\") && password_string.equals(\"123\"))\n {\n // Validate Your login credential here than display message\n Toast.makeText(DrawerActivity.this,\n \"Login Successful\", Toast.LENGTH_SHORT).show();\n loginflag=true;\n Intent i = new Intent(DrawerActivity.this, SaveTimingsActivity.class);\n startActivity(i);\n // Redirect to dashboard / home screen.\n login.dismiss();\n\n }\n else if(!username_string.equals(\"123\") && !password_string.equals(\"123\")){\n Toast.makeText(DrawerActivity.this,\n \"Invalid Credentials\", Toast.LENGTH_SHORT).show();\n loginflag=false;\n }\n\n }\n });\n btnCancel.setOnClickListener(new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n login.dismiss();\n }\n });\n login.show();\n return loginflag;\n}", "private void showDeleteConfirmationDialog() {\n // Create an AlertDialog.Builder and set the message, and click listeners\n // for the postive and negative buttons on the dialog.\n AlertDialog.Builder builder = new AlertDialog.Builder(this);\n builder.setMessage(R.string.delete_dialog_msg);\n builder.setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int id) {\n // User clicked the \"Delete\" button, so delete the goal.\n deleteGoal();\n }\n });\n builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int id) {\n // User clicked the \"Cancel\" button, so dismiss the dialog\n // and continue editing the product.\n if (dialog != null) {\n dialog.dismiss();\n }\n }\n });\n\n // Create and show the AlertDialog\n AlertDialog alertDialog = builder.create();\n alertDialog.show();\n }", "public void onDismiss(DialogInterface dialog) {\r\n\t\tSystem.out.println(error);\r\n\t\tif (error) {\r\n\t\t\t//new AlertMessage(context, \"Incorrect username and/or password\");\r\n\t\t}\r\n\t}", "@Override\n\t\t\tpublic void onClick(View v)\n\t\t\t{\n\t\t\t\tToast.makeText(getApplicationContext(), \"Please Sign in to continue.\", Toast.LENGTH_SHORT).show();\n\t\t\t}", "void ShowWaitDialog(String title, String message);", "public static void openConfirm(Shell parent, String title, String message)\n {\n open(MessageDialog.CONFIRM, parent, title, message, SWT.NONE);\n }", "public void onClick(DialogInterface dialog, int which) {\n Toast.makeText(getApplicationContext(), \"Please Enter Correct User Name And Password\", Toast.LENGTH_SHORT).show();\n }" ]
[ "0.69781506", "0.6585632", "0.64603776", "0.640116", "0.62673175", "0.62477654", "0.62228596", "0.62027925", "0.599699", "0.59799665", "0.5921426", "0.5881411", "0.5860122", "0.5801773", "0.57983494", "0.57957804", "0.57792985", "0.57557595", "0.5755726", "0.57458955", "0.5738166", "0.5703031", "0.5700742", "0.5679884", "0.56790537", "0.5671243", "0.5669585", "0.56679153", "0.56655544", "0.56643164", "0.5651533", "0.5644839", "0.562837", "0.56219625", "0.5620775", "0.56206053", "0.56147665", "0.55965054", "0.5594855", "0.5593007", "0.55916816", "0.55888987", "0.558643", "0.5586185", "0.55784", "0.5578362", "0.55700564", "0.55670154", "0.55511045", "0.55486625", "0.5546517", "0.5541986", "0.5537838", "0.5536417", "0.5535275", "0.5527241", "0.5527101", "0.5525394", "0.55206096", "0.55190516", "0.5518506", "0.5511863", "0.55099124", "0.5508553", "0.5499579", "0.5474045", "0.5473632", "0.54667753", "0.54659194", "0.54626715", "0.5461065", "0.54537106", "0.5445851", "0.54458165", "0.544524", "0.5425042", "0.54170126", "0.5406988", "0.5398644", "0.53891045", "0.5382726", "0.5375979", "0.53742856", "0.53692436", "0.53667176", "0.53662217", "0.53505766", "0.5350126", "0.5346601", "0.5345622", "0.5341617", "0.53405744", "0.5327894", "0.5326003", "0.5321125", "0.5316016", "0.5310252", "0.53081197", "0.5304564", "0.53023845" ]
0.5659769
30
/ Update menu item for user logging in/out according to user's current status.
private void updateLogInMenuItem() { if (mLogInMenuItem != null) { if (mUserService.isSignedIn()) mLogInMenuItem.setTitle(R.string.board_menu_my_profile); else mLogInMenuItem.setTitle(R.string.menu_log_in); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void checkMenuItemStatus() {\n\t\tif (VozCache.instance().getCookies() == null) { // not logged in yet\n\t\t\tlogoutMenu.setVisible(false);\t\t\t\n\t\t\tloginMenu.setVisible(true);\n\t\t\tloginWithPresetMenu.setVisible(true);\n\t\t} else { // logged in\n\t\t\tlogoutMenu.setVisible(true);\t\t\t\n\t\t\tloginMenu.setVisible(false);\n\t\t\tloginWithPresetMenu.setVisible(false);\n\t\t}\t\t\n\t\tif (VozCache.instance().canShowReplyMenu()) {\n\t\t\tif(VozCache.instance().getCookies() != null) {// logged in\n\t\t\t\tquickRepMenu.setVisible(true);\n\t\t\t} else {\n\t\t\t\tquickRepMenu.setVisible(false);\n\t\t\t}\n\t\t} else {\n\t\t\tquickRepMenu.setVisible(false);\n\t\t}\n\t\t\n\t\tif (canShowPinnedMenu()) {\n\t\t\tpinMenu.setVisible(true);\n\t\t} else {\n\t\t\tpinMenu.setVisible(false);\n\t\t}\n\t\t\n\t\tif (canShowUnpinnedMenu()) {\n\t\t\tunpinMenu.setVisible(true);\n\t\t} else {\n\t\t\tunpinMenu.setVisible(false);\n\t\t}\n\t}", "@Override\r\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.main_menu, menu);\r\n FirebaseUser currentUser = mAuth.getCurrentUser();\r\n MenuItem itemLogin = menu.findItem(R.id.login);\r\n MenuItem itemLogout = menu.findItem(R.id.logout);\r\n if (currentUser != null) {\r\n itemLogin.setVisible(false);\r\n itemLogout.setVisible(true);\r\n } else {\r\n itemLogin.setVisible(true);\r\n itemLogout.setVisible(false);\r\n }\r\n return true;\r\n }", "public void setlogUserIn() {\n\t\tmenu1.setOnAction(event -> {\n\t\t\topenUserSettings();\n\t\t});\n\t\tmenu2.setOnAction(event -> {\n\t\t\tsetlogUserOut();\n\t\t});\n\t\tuserMenuButton.setText(controller.loggedIn());\n\t\tuserMenuButton.setStyle(\"-fx-font-size: 10pt; -fx-text-fill:black;\"); // MUOTOILU CSSSSSÄÄÄÄN\n\t\tuserMenuButton.getItems().addAll(menu1, menu2);\n\t\tloggedinuser.setVisible(true);\n\t\tloggedinuser.setText(bundle.getString(\"mVloggedin\"));\n\t\tloggedinuser.setGraphic(userMenuButton);\n\t\tloggedinuser.setContentDisplay(ContentDisplay.RIGHT);\n\t\tuserSettings.setVisible(true);\n\t\tloginoption.setVisible(false);\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_update) {\n Intent sucessIntent = new Intent(HomeActivity.this, UpdateActivity.class);\n HomeActivity.this.startActivity(sucessIntent);\n overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_left);\n finish();\n return true;\n }\n if (id == R.id.action_logout) {\n ParseUser.logOutInBackground();\n mCurrentUser = ParseUser.getCurrentUser();\n Intent sucessIntent = new Intent(HomeActivity.this, LoginActivity.class);\n HomeActivity.this.startActivity(sucessIntent);\n overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_right);\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n\t\t\t\tpublic boolean onMenuItemClick(MenuItem item) {\n\t\t\t\t\tint id = item.getItemId();\n\t\t\t\t\tIntent i;\n\t\t\t\t\tswitch (item.getItemId()) {\n\t\t\t\t\tcase R.id.menu_add_new_list:\n\t\t\t\t\t\tif (task.getString(\"user_id\", null) != null) {\n\t\t\t\t\t\t\ti = new Intent(getBaseContext(), MyMap.class);\n\t\t\t\t\t\t\tstartActivity(i);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tToast.makeText(MyMap.this, \"Please Login first\", Toast.LENGTH_LONG).show();\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn true;\n\t\t\t\t\tcase R.id.menu_dashboard:\n\t\t\t\t\t\tif (task.getString(\"user_id\", null) != null) {\n\t\t\t\t\t\t\ti = new Intent(MyMap.this, dashboard_main.class);\n\t\t\t\t\t\t\ti.putExtra(\"edit\", \"12344\");\n\t\t\t\t\t\t\tstartActivity(i);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tToast.makeText(MyMap.this, \"Please Login first\", Toast.LENGTH_LONG).show();\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn true;\n\t\t\t\t\tcase R.id.menu_login:\n\t\t\t\t\t\tif (bedMenuItem.getTitle().equals(\"Logout\")) {\n\t\t\t\t\t\t\tSharedPreferences.Editor editor = getSharedPreferences(\"user\", MODE_PRIVATE).edit();\n\t\t\t\t\t\t\teditor.clear();\n\t\t\t\t\t\t\teditor.commit();\n\t\t\t\t\t\t\tbedMenuItem.setTitle(\"Login/Register\");\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tIntent i_user = new Intent(getBaseContext(), user_login.class);\n\t\t\t\t\t\t\tstartActivity(i_user);\n\t\t\t\t\t\t}\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}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == android.R.id.home) {\n\n update_status = \"false\";\n Intent intent = new Intent();\n intent.putExtra(\"status\",update_status);\n setResult(6, intent);\n finish();\n //finish();\n }\n\n return super.onOptionsItemSelected(item);\n }", "void updateUserActivateStatus(User user, int newStatus);", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.log_out) {\n\n Intent intent = new Intent(ActivityMain.this,ActivityLogin.class);\n SharedPreferences sharedPreferences = getSharedPreferences(Constants.USER_PREFERENCES,MODE_PRIVATE);\n SharedPreferences.Editor editor = sharedPreferences.edit();\n editor.putBoolean(\"LOGGED\",false);\n editor.apply();\n startActivity(intent);\n finish();\n return true;\n }\n if (id == R.id.privacy_policy){\n Intent intent = new Intent(ActivityMain.this,ActivityPrivacyPolicy.class);\n startActivity(intent);\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == R.id.menuLogout) {\n //calling logout method when the logout button is clicked\n logout();\n }\n else if (id == R.id.updateInfo) {\n Intent intent = new Intent(Exam.this,UpdateAccount.class);\n startActivity(intent);\n }\n return super.onOptionsItemSelected(item);\n }", "public static void updateMainMenu() {\n instance.updateMenu();\n }", "@Override\r\n\tpublic boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.new_food, menu);\r\n //Change profile button to login/register if they are not logged in\r\n if(SaveSharedPreference.getUserId(NewFoodActivity.this) == 0)\r\n {\r\n MenuItem profileItem = menu.findItem(R.id.action_profile);\r\n \tprofileItem.setTitle(R.string.login);\r\n //Toast.makeText(this,\"Not logged in\",Toast.LENGTH_SHORT).show();\r\n }\r\n else {\r\n \tMenuItem signout = menu.findItem(R.id.action_signout);\r\n \tsignout.setVisible(true);\r\n signout.setOnMenuItemClickListener(new OnMenuItemClickListener() {\r\n \tpublic boolean onMenuItemClick(MenuItem item) { \t\t \t\r\n \t\t\tAlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context);\r\n \t\t\talertDialogBuilder.setTitle(R.string.logout_msg);\r\n \t\t\talertDialogBuilder.setCancelable(false).setPositiveButton(\"Yes\", new DialogInterface.OnClickListener() {\r\n \t\t\t\tpublic void onClick(DialogInterface dialog,int id) { \t\t\t\t\t \t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t//int tempUserName = SaveSharedPreference.getUserId(context); \t\t\t \t\t\r\n\t\t\t \t\tdialog.cancel(); \t\t\t \t\t\r\n\t\t\t \t\tSaveSharedPreference.setUserId(context, 0);\r\n \t\t\t\t\tToast.makeText(context , \"Logged out\" , Toast.LENGTH_SHORT).show();\r\n \t\t\t\t\tinvalidateOptionsMenu();\r\n\t\t\t\t\t\t} \t\t\t\t\t\t\r\n\t\t\t\t\t}).setNegativeButton(\"No\", new DialogInterface.OnClickListener() {\r\n \t\t\t\t\tpublic void onClick(DialogInterface dialog,int id) { \t\t\t\t\t\t\r\n \t\t\t\t\t\tdialog.cancel(); \t\t\t\t\t\r\n \t\t\t\t\t}}\r\n \t\t\t\t ); \t\t\r\n \t\tAlertDialog alertDialog = alertDialogBuilder.create();\r\n \t\talertDialog.show(); \r\n \t\treturn true; \t\t\r\n \t} \t\r\n }); \t\r\n } \r\n return true;\r\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tint id = item.getItemId();\n\t\tif (id == R.id.logout) {\n\t\t\tUtility.prefs(this).edit().putString(\"username\", \"\").commit();\n\t\t\tstartActivity(new Intent(this, Login.class));\n\t\t\tfinish();\n\t\t\treturn true;\n\t\t}\n\t\treturn super.onOptionsItemSelected(item);\n\t}", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n int vid = item.getItemId();\r\n\r\n //noinspection SimplifiableIfStatement\r\n if (vid == R.id.action_logout) {\r\n Intent intent=new Intent(Dashboard.this,MainActivity.class);\r\n startActivity(intent);\r\n return true;\r\n }else if (vid == R.id.action_changepassword) {\r\n Intent intent=new Intent(Dashboard.this,StudentChangePassword.class);\r\n intent.putExtra(\"userid\",userid);\r\n startActivity(intent);\r\n return true;\r\n }\r\n\r\n return super.onOptionsItemSelected(item);\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n SharedPreferences shrae = this.getSharedPreferences(\"userInfo\", Context.MODE_PRIVATE);\n final SharedPreferences.Editor edit = shrae.edit();\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_settings) {\n edit.putInt(\"ISLOGIN\",0);\n edit.commit();\n Constants.ISLOGIN = false;\n // 清空单例数据\n Singleton.cleanUserMessage();\n onResume();\n Toast.makeText(MainActivity.this,\"退出登录\",Toast.LENGTH_SHORT).show();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.menu_main, menu);\n\n if(loadFinish==true) {\n if (loggedin == true) {\n menu.findItem(R.id.login).setVisible(false);\n menu.findItem(R.id.signout).setVisible(true);\n } else {\n menu.findItem(R.id.login).setVisible(true);\n menu.findItem(R.id.signout).setVisible(false);\n }\n }\n\n return true;\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n switch (id) {\n case R.id.updateStatus:\n break;\n case R.id.profil:\n //takeUser to Profil Activity\n Intent takeUsertoProfil = new Intent(ProfilActivity.this, ProfilDatenActivity.class);\n startActivity(takeUsertoProfil);\n break;\n case R.id.AddPlace:\n Intent place = new Intent(ProfilActivity.this, AddPlaceActivity.class);\n startActivity(place);\n break;\n case R.id.Home:\n Intent home = new Intent(ProfilActivity.this, MainActivity.class);\n startActivity(home);\n break;\n case R.id.action_map:\n Intent map = new Intent(ProfilActivity.this, MapActivity.class);\n startActivity(map);\n break;\n case R.id.action_fb_profil:\n Intent fb = new Intent(ProfilActivity.this, UserDetailsActivity.class);\n startActivity(fb);\n break;\n case R.id.action_settings:\n\n break;\n case R.id.logoutUser:\n //logout User\n ParseUser.logOut();\n StaticKlasse.status = 0;\n //take User Back to the login screen\n Intent takeUsertoLogin = new Intent(ProfilActivity.this, LoginActivity.class);\n startActivity(takeUsertoLogin);\n break;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\r\n public boolean onOptionsItemSelected(@NonNull MenuItem item) {\r\n int id=item.getItemId();\r\n if(id == R.id.action_logout)\r\n {\r\n firebaseAuth.signOut();\r\n checkuserstatus();\r\n }\r\n return super.onOptionsItemSelected(item);\r\n }", "private void updateMenuItems(){\n String awayState = mStructure.getAway();\n MenuItem menuAway = menu.findItem(R.id.menu_away);\n if (KEY_AUTO_AWAY.equals(awayState) || KEY_AWAY.equals(awayState)) {\n menuAway.setTitle(R.string.away_state_home);\n } else if (KEY_HOME.equals(awayState)) {\n menuAway.setTitle(R.string.away_state_away);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.add_profile_menu) {\n\n\n preferences1 = getBaseContext().getSharedPreferences(\"person_id_update\", MODE_PRIVATE);\n SharedPreferences.Editor editor1 = preferences1.edit();\n editor1.putString(\"person_id_update\", \"\");\n editor1.apply();\n editor1.commit();\n\n Intent intent=new Intent(ProfileListActivity.this,AddProfileActivity.class);\n startActivity(intent);\n\n\n\n\n return true;\n }\n if (id == R.id.menu_change_user_info) {\n\n Intent intent=new Intent(ProfileListActivity.this,UpdateUserActivity.class);\n startActivity(intent);\n\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "public void updateMenu() {\n updateMenuGroupError = true;\n if (menu.updateMenu()) {\n deleteMenuError = false;\n createMenuError = false;\n updateMenuError = true;\n } else {\n setName(menu.name);\n updateMenuError = false;\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_settings) {\n addFuel();\n return true;\n } else if (id == R.id.action_log_out){\n Toast.makeText(getApplication(), \"Logged out successfully.\", Toast.LENGTH_SHORT).show();\n SharedPreferences sharedPreferences = getApplicationContext().getSharedPreferences(\"com.tryagain.com.fleetmanagmentsystem.prefs\", Context.MODE_PRIVATE);\n SharedPreferences.Editor editor = sharedPreferences.edit();\n editor.putString(\"logged_driver\", \"\");\n editor.apply();\n\n Intent j = new Intent(getApplicationContext(), LoginActivity.class);\n startActivity(j);\n finish();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_current_order) {\n Intent intent=new Intent(getBaseContext(),ViewCurrentOrders.class);\n intent.putExtra(\"resid\",resid);\n startActivity(intent);\n return true;\n }\n\n if (id == R.id.action_past_order) {\n Intent intent=new Intent(getBaseContext(),ViewPastOrders.class);\n intent.putExtra(\"resid\",resid);\n startActivity(intent);\n } if (id == R.id.action_logout) {\n preferences.edit().remove(\"resid\").commit();\n Intent intent=new Intent(getBaseContext(),ResLogin.class);\n startActivity(intent);\n finish();\n }\n\n return super.onOptionsItemSelected(item);\n }", "public void updateItem(Item item) {\n if (LoginActivity.USERLOGIN.getInventory().contains(item)) {\n Thread updateUserThread = userController.new UpdateUserThread(LoginActivity.USERLOGIN);\n updateUserThread.start();\n synchronized (updateUserThread) {\n try {\n updateUserThread.wait();\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n Thread getUserLoginThread = userController.new GetUserLoginThread(LoginActivity.USERLOGIN.getUsername());\n getUserLoginThread.start();\n synchronized (getUserLoginThread) {\n try {\n getUserLoginThread.wait();\n } catch (InterruptedException e) {\n e.printStackTrace();\n }\n }\n }\n } else {\n addItem(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_settings) {\n Intent intent = new Intent(getApplicationContext(), SettingsActivity.class);\n startActivity(intent);\n } else if (id == R.id.action_logout) {\n sharedpreferences = getSharedPreferences(UserSession.userInfoSession, Context.MODE_PRIVATE);\n SharedPreferences.Editor editor = sharedpreferences.edit();\n editor.clear();\n editor.commit();\n\n Intent intent = new Intent(getApplicationContext(), com.mehme.menuexample.LoginActivity.class);\n startActivity(intent);\n }\n\n return super.onOptionsItemSelected(item);\n }", "private void buildMenu() {\n try {\n\n\n HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();\n Users user = this.getUserPrincipal(request);\n StringBuilder tempBuilder = new StringBuilder();\n HttpSession session = request.getSession(false);\n tempBuilder.append(\"<div>\");\n tempBuilder.append(\"\\n\").append(\"<b>Welcome</b>\");\n tempBuilder.append(\"\\n\").append(\"<p><br/>\").append(session.getAttribute(\"empName\")).append(\"</p>\");\n tempBuilder.append(\"\\n\").append(\"</div><br/>\");\n tempBuilder.append(\"\\n\").append(\"<hr width=\\\"\").append(\"100%\").append(\"\\\"\").append(\" noshade=\\\"\").append(\"noshade\").append(\"\\\">\");\n tempBuilder.append(\"\\n\").append(\"<div class=\\\"\").append(\"glossymenu\").append(\"\\\"\").append(\" style=\\\"\").append(\"width:100%\").append(\"\\\">\");\n // java.util.Date dateLogin = user.getDateLogin();\n // java.util.Date lastDate = user.getLastLoginDate();\n \n //String lastLoginDate = org.tenece.web.common.DateUtility.getDateAsString(lastDate, \"dd/MM/yyyy\");\n //user should be prompted to change password after 30 days\n// Calendar c = Calendar.getInstance();\n// c.setTime(user.getDateUpdated()); \n// c.add(Calendar.DATE, 30); // Adding 30 days\n// Date currentDate = new Date();\n// if (dateLogin == null ||currentDate.after(c.getTime()) ) {\n// tempBuilder.append(\"<a class=\\\"\").append(\"menuitem\").append(\"\\\"\").append(\" target=\\\"\").append(\"content\").append(\"\\\"\").append(\" href=\\\"\").append(\"./changepassword_user.html\").append(\"\\\">\").append(\"Change Password\").append(\"</a>\");\n// tempBuilder.append(\"<a class=\\\"\").append(\"menuitem\").append(\"\\\"\").append(\" href=\\\"\").append(\"./user_logout.html\").append(\"\\\"\").append(\" style=\\\"\").append(\"border-bottom-width: 0\").append(\"\\\">\").append(\"Sign Out\").append(\"</a>\");\n//\n//\n// } else {\n\n MenuSubMenuInfo menuSubmenuInfo = getUserService().getMenu(user.getId());\n List<MenuData> menuList = menuSubmenuInfo.getMenuList();\n Multimap<String, MenuData> subMenuMap = menuSubmenuInfo.getSubMenuMap();\n\n for (MenuData menu : menuList) {\n\n if (menu.getDivClass().trim().equals(\"menuitem\")) {\n tempBuilder.append(\"<a class=\\\"\").append(menu.getDivClass()).append(\"\\\"\").append(\" target=\\\"\").append(menu.getTarget()).append(\"\\\"\").append(\" href=\\\"\").append(menu.getURL()).append(\"\\\">\").append(menu.getMenuTitle()).append(\"</a>\");\n\n } else if (menu.getDivClass().trim().equals(\"submenuheader\")) {\n tempBuilder.append(\"<a class=\\\"\").append(\"menuitem \").append(menu.getDivClass()).append(\"\\\"\").append(\"\\n\").append(\"href=\\\"#\").append(\"\\\">\").append(menu.getMenuTitle()).append(\"</a>\");\n tempBuilder.append(\"\\n\").append(\"<div class=\\\"\").append(\"submenu\").append(\"\\\">\");\n tempBuilder.append(\"\\n\\t\").append(\"<ul>\");\n // get the submenu \n List<MenuData> subMenuList = (List<MenuData>) subMenuMap.get(menu.getMenuTitle());\n Collections.sort(subMenuList);\n for (MenuData submenu : subMenuList) {\n\n tempBuilder.append(\"\\n\").append(\"<li> <a target=\\\"\").append(submenu.getTarget()).append(\"\\\"\").append(\"href=\\\"\").append(submenu.getURL()).append(\"\\\">\").append(submenu.getSubmenutitle()).append(\"</a></li>\");\n\n }\n tempBuilder.append(\"\\n\\t\").append(\"</ul>\");\n tempBuilder.append(\"\\n\").append(\"</div>\");\n }\n }\n\n //}\n tempBuilder.append(\"\\n\").append(\"</div>\");\n tempBuilder.append(\"\\n\").append(\"<br/>\");\n // tempBuilder.append(\"\\n\").append(\"<p>Last Login Date:<br/>\").append(lastLoginDate).append(\"</p>\");\n tempBuilder.append(\"\\n\").append(\"<br/>\");\n pageContext.getOut().write(tempBuilder.toString());\n pageContext.getOut().flush();\n } catch (Exception ex) {\n ex.printStackTrace();\n }\n }", "private void updateMenu() {\n\n\t\t\tblockActionsStart();\n\n\t\t\tArrayList<OutputConfig> theConfigs = OutputConfig.getConfigs(getDbID(), type);\n\t\t\ttheConfigs.add(0, OutputConfig.getDefaultObject(type));\n\t\t\tif (!theConfigs.contains(config)) {\n\t\t\t\ttheConfigs.add(0, config);\n\t\t\t}\n\t\t\tif (showNullObject && !config.isNull()) {\n\t\t\t\ttheConfigs.add(0, OutputConfig.getNullObject(type));\n\t\t\t}\n\n\t\t\tconfigMenu.removeAllItems();\n\t\t\tfor (OutputConfig theConfig : theConfigs) {\n\t\t\t\tconfigMenu.addItem(theConfig);\n\t\t\t}\n\t\t\tconfigMenu.setSelectedItem(config);\n\n\t\t\tupdateConfig();\n\n\t\t\tblockActionsEnd();\n\t\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n Intent intentPurchase = new Intent(MonitorActivity.this, SalesActivity.class);\n if (mAuth.getCurrentUser() != null ) {\n if (item.getItemId() == R.id.menuLogout) {\n mAuth.signOut();\n\n } else if (item.getItemId() == R.id.menuMonitor) {\n Toast.makeText(this, \"You are in Monitor Page Already\", Toast.LENGTH_SHORT).show();\n\n } else if (item.getItemId() == R.id.menuPurchase) {\n startActivity(intentPurchase);\n\n }\n } else {\n Toast.makeText(this, \"Nobody Logged In\", Toast.LENGTH_SHORT).show();\n }\n\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item){\n switch(item.getItemId()){\n case R.id.menu_refresh_ui:\n Log.v(TAG,\"clicked Refresh UI\");\n updateUIMode();\n updateViews();\n break;\n case R.id.menu_settings:\n Log.v(TAG,\"clicked Settings\");\n Intent intent = new Intent(this, SettingsActivity.class);\n// String UID = FirebaseAuth.getInstance().getCurrentUser().getUid();\n// intent.putExtra(\"UID\", UID);\n startActivity(intent);\n break;\n case R.id.menu_away:\n Log.v(TAG,\"clicked home/away\");\n String awayState = mStructure.getAway();\n // Sets awayState\n if (KEY_AUTO_AWAY.equals(awayState) || KEY_AWAY.equals(awayState)) {\n awayState = KEY_HOME;\n } else if (KEY_HOME.equals(awayState)) {\n awayState = KEY_AWAY;\n } else {\n break;\n }\n\n // Change away status\n mNest.structures.setAway(mStructure.getStructureId(), awayState, new Callback() {\n @Override\n public void onSuccess() {\n Log.d(TAG, \"Successfully set away state.\");\n }\n\n @Override\n public void onFailure(NestException exception) {\n Log.d(TAG, \"Failed to set away state: \" + exception.getMessage());\n }\n });\n break;\n case R.id.menu_logout:\n Auth.signOut();\n Auth.saveAuthToken(this, null);\n mNest.launchAuthFlow(this, AUTH_TOKEN_REQUEST_CODE);\n break;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.my_profile) {\n goBack();\n Intent i = new Intent(this, UserProfileActivity.class);\n i.putExtra(\"user_id\", LoginControl.getPrefUserName(this));\n startActivity(i);\n finish();\n }\n else if(id == R.id.voice_upload){\n goBack();\n Intent i = new Intent(this, UploadActivity.class);\n startActivity(i);\n finish();\n }\n else if (id == R.id.logout){\n\n LoginControl.logout(this);\n goBack();\n Intent i = new Intent(this, AccountActivity.class);\n startActivity(i);\n finish();\n\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\r\n public boolean onNavigationItemSelected(@NonNull MenuItem item) {\n item.setChecked(true);\r\n // close drawer when item is tapped\r\n drawer.closeDrawers();\r\n switch (item.getItemId()){\r\n case R.id.nav_out:\r\n Logout();\r\n return true;\r\n case R.id.nav_choice:\r\n Intent choiceIntent = new Intent(getApplicationContext(), ChoiceMaker.class);\r\n choiceIntent.putExtra(\"username\", user.getUsername());\r\n startActivity(choiceIntent);\r\n return true;\r\n case R.id.nav_pref:\r\n Intent prefIntent = new Intent(getApplicationContext(), CarePreference.class);\r\n prefIntent.putExtra(\"username\", user.getUsername());\r\n startActivity(prefIntent);\r\n return true;\r\n case R.id.nav_display:\r\n Intent displayIntent = new Intent(getApplicationContext(), AcpResultDisplay.class);\r\n displayIntent.putExtra(\"username\", user.getUsername());\r\n startActivity(displayIntent);\r\n return true;\r\n\r\n }\r\n return false;\r\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_settings) {\n return true;\n }\n if(id== R.id.action_logout){\n setToken(INVALID_TOKEN);\n setUserId(INVALID_UID);\n checkLogin();\n //finish();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()){\n case R.id.logIn:\n Intent login = new Intent(this, SigninActivity.class);\n startActivity(login);\n Toast.makeText(getApplicationContext(),\"Log in\", Toast.LENGTH_SHORT).show();\n\n break;\n case R.id.SignUp:\n Intent signupIntent = new Intent(this, SignupActivity.class);\n startActivity(signupIntent);\n break;\n case R.id.logOut:\n\n if(helper.logout()){\n finish();\n Intent toSignin = new Intent(this, SigninActivity.class);\n startActivity(toSignin);\n }\n\n break;\n\n case R.id.profile:\n int user = helper.getCurrentUser();\n Intent toProfile;\n if(user == 0){\n toProfile = new Intent(MainActivity.this, BarberProfileMenu.class);\n\n toProfile.putExtra(\"EMAIL\", helper.getEMAIL());\n startActivity(toProfile);\n }\n else if(user == 1){\n System.out.println(\"It's User\");\n toProfile = new Intent(this, UserProfile.class);\n startActivity(toProfile);\n }\n else\n Toast.makeText(this,\"Invalid User\", Toast.LENGTH_SHORT).show();\n\n break;\n\n default:\n break;\n }\n return super.onOptionsItemSelected(item);\n }", "public void changeLoginStatus(Integer userId, Integer loginStatus);", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n Intent intent = null;\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_settings) {\n return true;\n }\n if (id == R.id.logout) {\n context.getSharedPreferences(ApplicationConstants.USER_PREFS_NAME,\n Context.MODE_PRIVATE).edit().clear().commit();\n intent = new Intent(context, Login.class);\n startActivity(intent);\n finish();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "private static void updateUser() {\n\t currentUser = Structure.User(currentUser);\n\t CRUDUsers.compareWithRemote(currentUser).subscribe(new SingleSubscriber<User>() {\n\t\t @Override\n\t\t public void onSuccess(User value) {\n\t\t\t\tConnection.logIn(value);\n\t\t }\n\t\t\n\t\t @Override\n\t\t public void onError(Throwable error) {\n\t\t\t logOff();\n\t\t\t App.showMessage(error.getMessage());\n\t\t }\n\t });\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_login) {\n AppConstant.REFRESH = true;\n AppConstant.REFRESH1 = true;\n Intent intent = new Intent(activity, LoginActivity.class);\n startActivity(intent);\n return true;\n } else if (id == R.id.action_logout) {\n activity.invalidateOptionsMenu();\n if (Utilities.getNOsend())\n postPuzzleDataLogout();\n else {\n Utilities.setLoginSuccess(false, \"\", \"\", \"\");\n activity.invalidateOptionsMenu();\n Utilities.showAlertDailog(activity, \"PunnyFuzzles\", \"Logout Successfully\", \"Ok\",\n new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface arg0, int arg1) {\n Intent intent = new Intent(getApplicationContext(), MainActivity.class);\n intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n startActivity(intent);\n }\n }, true);\n }\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "private void updateMenuItems()\r\n\t {\r\n\t\t setListAdapter(new ArrayAdapter<String>(this,\r\n\t\t android.R.layout.simple_list_item_1, home_menu));\r\n\t\t \t \r\n\t }", "public void loginMenu(){\n\t\tstate = ATM_State.LOGINID;\n\t\tgui.setDisplay(\"Enter your account ID: \\n\");\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_new) {\n new_user();\n return true;\n }\n if (id == R.id.action_exit) {\n verify_close();\n return true;\n }\n if (id == R.id.action_login) {\n user_login();\n return true;\n }\n if (id == R.id.action_view) {\n view_user();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item)\n {\n\n\n switch (item.getItemId())\n {\n case R.id.action_home:\n Intent i=new Intent(Admin_control_panel.this,search.class);\n startActivity(i);\n return true;\n case R.id.action_profile:\n whoLogin=test_name.getString(\"login\", \"\").toString();\n Toast.makeText(getBaseContext(), \"profile \", Toast.LENGTH_LONG).show();\n\n Toast.makeText(getBaseContext(), \"Hello admin \", Toast.LENGTH_LONG).show();\n Intent i3=new Intent(Admin_control_panel.this,Admin_control_panel.class);\n startActivity(i3);\n return true;\n case R.id.action_log_out:\n\n whoLogin=\"empty\";\n editor.putString(\"name\",\"empty\");\n editor.putString(\"login\",\"empty\");\n editor.commit();\n bedMenuItem.setTitle(\"Log In\");\n this.finish();\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.title_activity_mainactivity) {\n Intent intent = new Intent(User_Score.this, MainActivity.class);\n startActivity(intent);\n return true;\n }\n\n if (id == R.id.title_activity_home) {\n if(isAdmin.equals(\"false\")) {\n Intent intent = new Intent(User_Score.this, StudentDashboard.class);\n intent.putExtra(\"UserId\", userId);\n intent.putExtra(\"IsAdmin\", isAdmin);\n startActivity(intent);\n }\n else if(isAdmin.equals(\"professor\")) {\n Intent intent = new Intent(User_Score.this, ProfessorDashboard.class);\n intent.putExtra(\"UserId\", userId);\n intent.putExtra(\"IsAdmin\", isAdmin);\n startActivity(intent);\n }\n else{\n Intent intent = new Intent(User_Score.this, Adminchoice.class);\n intent.putExtra(\"UserId\", userId);\n intent.putExtra(\"IsAdmin\", isAdmin);\n startActivity(intent);\n }\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.menu_main, menu);\n this.menu = menu;\n publicMenuItem = menu.findItem(R.id.action_public_invites);\n privateMenuItem = menu.findItem(R.id.action_private_invites);\n if(savedDbQuery){\n publicMenuItem.setVisible(true);\n privateMenuItem.setVisible(false);\n }else{\n publicMenuItem.setVisible(false);\n privateMenuItem.setVisible(true);\n }\n publicMenuItem = menu.findItem(R.id.action_public_invites);\n privateMenuItem = menu.findItem(R.id.action_private_invites);\n return true;\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_sign_out) {\n AuthUI.getInstance().signOut(this);\n return true;\n }\n if(id == R.id.action_public_invites){\n savedDbQuery = false;\n if(!privateMenuItem.isVisible()) {\n privateMenuItem.setVisible(true);\n }\n if(publicMenuItem.isVisible()){\n publicMenuItem.setVisible(false);\n }\n mEventAdapter.clear();\n queryPrivateEvents(savedDbQuery);\n return true;\n }\n if(id == R.id.action_private_invites){\n savedDbQuery = true;\n if(!publicMenuItem.isVisible()) {\n publicMenuItem.setVisible(true);\n }\n\n if(privateMenuItem.isVisible()){\n privateMenuItem.setVisible(false);\n }\n mEventAdapter.clear();\n queryPrivateEvents(savedDbQuery);\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.main, menu);\n TextView navTitle = findViewById(R.id.nav_title);\n TextView navSubtitle = findViewById(R.id.nav_subtitle);\n User user = new CloudPreferences(mainActivity).getUser();\n navTitle.setText(user.getUsername());\n navSubtitle.setText(user.getEmail());\n return true;\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n Intent intent;\n //noinspection SimplifiableIfStatement\n switch (id) {\n case R.id.log_out:\n SharedUtil.clearTeam(ctx);\n intent = new Intent(MainPagerActivity.this, SignActivity.class);\n startActivity(intent);\n finish();\n return true;\n case R.id.about_us:\n intent = new Intent(MainPagerActivity.this, AboutActivity.class);\n startActivity(intent);\n return true;\n /*case R.id.setting:\n intent = new Intent(MainPagerActivity.this, SettingsActivity.class);\n startActivity(intent);\n break;*/\n }\n /* switch (id) {\n case R.id.add_member:\n break;\n case R.id.log_out:\n break;\n default:\n\n };*/\n\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.menu_commonone, menu);\n MenuItem item3 = menu.findItem(R.id.messager);\n MenuItem item4 = menu.findItem(R.id.search);\n item3.setIcon(R.drawable.openmessage);\n item4.setIcon(R.drawable.search);\n try{\n if (loggedIn.equals(\"noValue\")) {\n\n\n item3.setVisible(false);\n\n } else {\n\n item3.setVisible(true);\n\n }}\n catch (Exception e){\n\n }\n return true;\n }", "private void displayMenu() {\r\n\t\tif (this.user instanceof Administrator) {\r\n\t\t\tnew AdminMenu(this.database, (Administrator) this.user);\r\n\t\t} else {\r\n\t\t\tnew BorrowerMenu(this.database);\r\n\t\t}\r\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (user != null) {\n if (id == R.id.action_add) {\n Intent intent = new Intent();\n intent.setClass(MainActivity.this, EditFoodActivity.class);\n startActivity(intent);\n } else if (id == R.id.action_logout) {\n BmobUser.logOut();\n user = BmobUser.getCurrentUser(CaiNiaoUser.class);\n app = (CustomApplication) getApplication();\n app.setUser(user);\n mViewPager.setCurrentItem(0);\n bottomNavigation.setSelectedIndex(0, true);\n } else if (id == R.id.action_info){\n Intent intent = new Intent(MainActivity.this, EditInfoActivity.class);\n startActivityForResult(intent,101);\n }\n }else {\n Utils.toastShow(getApplicationContext(),\"请先登录!\");\n }\n return super.onOptionsItemSelected(item);\n }", "public void onClick(DialogInterface dialog, int id) {\n prefs.edit().putBoolean(\"Islogin\", false).commit();\n prefs.edit().putString(\"role\", \"\").commit();\n item.setTitle(\"Login\");\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item)\n {\n \n switch (item.getItemId())\n {\n case R.id.viewAccount:\n Intent intent = new Intent(this, ViewAccountActivity.class);\n Integer targetAccountID = FMSApplication.getInstance().getCurrentAccount().getAccountId();\n intent.putExtra(\"targetAccount\", targetAccountID);\n startActivity(intent);\n Toast.makeText(getApplicationContext(), \"\\\"Viewing your account.\\\"\", Toast.LENGTH_SHORT).show();\n return true;\n \n case R.id.logoutButton:\n Toast.makeText(getApplicationContext(), \"\\\"See you next time!\\\"\", Toast.LENGTH_SHORT).show();\n FMSApplication.getInstance().setCurrentAccount(null);\n startLoginActivity();\n return true;\n \n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.edit_profile_menu, menu);\n mSaveItem = menu.getItem(0);\n\n mSaveItem.setIcon(getDrawable(R.drawable.ic_done_black_24dp));\n\n updateUI();\n return true;\n }", "private void updateUI() {\n user = mAuth.getCurrentUser();\n if (user != null) {\n user.reload().addOnCompleteListener(userReloadListener);\n }\n }", "@Override\n\tpublic void modifyMenuItem(MenuItem menuItem) \n\t{\n\t\tList<MenuItem> list=this.menuItemList;\n\t\tfor(MenuItem m:list)\n\t\t{\n\t\t\tif(m.getId()==menuItem.getId())\n\t\t\t{\n\t\t\t\tm.setName(menuItem.getName());\n\t\t\t\tm.setPrice(menuItem.getPrice());\n\t\t\t\tm.setCategory(menuItem.getCategory());\n\t\t\t\tm.setDateOfLaunch(menuItem.getDateOfLaunch());\n\t\t\t\tm.setFreeDelivery(menuItem.isFreeDelivery());\n\t\t\t\tm.setActive(menuItem.isActive());\n\t\t\t}\n\t\t}\n\t}", "public void update() {\n String foodName, description;\n int stockAvailable, calories, price;\n Boolean isVegan, isDiabetic, isGluttenFree;\n\n menuItems.clear();\n\n databaseGargoyle.createConnection();\n ResultSet rs = databaseGargoyle.executeQueryOnDatabase(\"SELECT * FROM MENUITEM\");\n try {\n while (rs.next()){\n foodName = rs.getString(\"FOODNAME\");\n description = rs.getString(\"DESCRIPTION\");\n stockAvailable = rs.getInt(\"STOCKAVAILABLE\");\n calories = rs.getInt(\"CALORIES\");\n if (rs.getString(\"ISVEGAN\").equalsIgnoreCase(\"true\")){\n isVegan = true;\n } else isVegan = false;\n if (rs.getString(\"ISDIABETIC\").equalsIgnoreCase(\"true\")){\n isDiabetic = true;\n } else isDiabetic = false;\n if (rs.getString(\"ISGLUTTENFREE\").equalsIgnoreCase(\"true\")){\n isGluttenFree = true;\n } else isGluttenFree = false;\n price = rs.getInt(\"PRICE\");\n menuItems.add(new MenuItem(foodName, description, stockAvailable, calories, isVegan, isDiabetic, isGluttenFree, price));\n }\n } catch (SQLException e) {\n System.out.println(\"Failed to get Menu Items from database!\");\n e.printStackTrace();\n }\n databaseGargoyle.destroyConnection();\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_settings) {\n return true;\n }\n if (id == R.id.menuLogout){\n extras = null;\n prefSetDefaults();\n launchLoginActivity();\n }\n return super.onOptionsItemSelected(item);\n }", "private void updateMenuTitles() {\n boolean isFollow = MainActivity.discussionsImIn.contains(discussionTableName);\n menu.findItem(R.id.settings_follow).setVisible(!isFollow);\n menu.findItem(R.id.settings_unfollow).setVisible(isFollow);\n }", "public static void processUserMenu(User logInUser) {\n\t\t// Prevents the user from logging in without a username\n\t\tif (logInUser == null) {\n\t\t\tthrow new IllegalArgumentException();\n\t\t}\n\t\t\n\t\tString userPrompt = \"[\" + logInUser.getName() + \"@root\" + \"]: \";\n\t\tboolean execute = true;\n\t\t//A loop over the user menu\n\t\twhile (execute) {\n\t\t\t//Asks the user for commands\n\t\t\tString[] words = prompt(userPrompt);\n\t\t\t//gets the first two characters from the input to turn into a command\n\t\t\tCmd cmd = stringToCmd(words[0]);\n\n\t\t\tswitch (cmd) {\n\t\t\t//This case adds a repository if there is no existing repository with the same name\n\t\t\tcase AR:\n\t\t\t\tif (validateInput2(words)) { \n\t\t\t\t\tif(VersionControlDb.findRepo(words[1]) != null) { //If the repo exists\n\t\t\t\t\t\tSystem.out.println(ErrorType.REPONAME_ALREADY_EXISTS);\n\t\t\t\t\t}\n\t\t\t\t\telse { \n\t\t\t\t\t\tVersionControlDb.addRepo(words[1], logInUser); //adds the repository\n\t\t\t\t\t\tlogInUser.subscribeRepo(words[1]); //automatically subscribes the user\n\t\t\t\t\t\tSystem.out.println(ErrorType.SUCCESS);\n\t\t\t\t\t}\n\t\t\t\t} \n\t\t\t\tbreak;\n\t\t\t\t//This case deletes a repository if the repository exists\n\t\t\tcase DR:\n\t\t\t\tif (validateInput2(words)) {\n\t\t\t\t\tif(VersionControlDb.findRepo(words[1]) != null) { //If the repository exists\n\t\t\t\t\t\tif(VersionControlDb.findRepo(words[1]).getAdmin().getName() != \n\t\t\t\t\t\t\t\tlogInUser.getName()) { //If the current user is not the admin of the repo\n\t\t\t\t\t\t\tSystem.out.println(ErrorType.ACCESS_DENIED);\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t//Deletes the repo\n\t\t\t\t\t\t\tVersionControlDb.delRepo(VersionControlDb.findRepo(words[1]));\n\t\t\t\t\t\t\tSystem.out.println(ErrorType.SUCCESS);\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\tSystem.out.println(ErrorType.REPO_NOT_FOUND);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\t//This case lists the repositories of the logged in user\n\t\t\tcase LR:\n\t\t\t\tif (validateInput1(words)) {\n\t\t\t\t\tSystem.out.println(logInUser);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\t//This case opens a repository specified by the user\n\t\t\tcase OR:\n\t\t\t\tif (validateInput2(words)) {\n\t\t\t\t\tif(VersionControlDb.findRepo(words[1]) == null) { //If the repo exists\n\t\t\t\t\t\tSystem.out.println(ErrorType.REPO_NOT_FOUND);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif(!logInUser.getAllSubRepos().contains(words[1])) { //If the user is subscribed to the repo\n\t\t\t\t\t\tSystem.out.println(ErrorType.REPO_NOT_SUBSCRIBED);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tif(logInUser.getWorkingCopy(words[1]) == null) { //gets a copy of the repo\n\t\t\t\t\t\tlogInUser.checkOut(words[1]);\n\t\t\t\t\t}\n\t\t\t\t\tSystem.out.println(ErrorType.SUCCESS);\n\t\t\t\t\tprocessRepoMenu(logInUser, words[1]); //Enters the repo menu\n\t\t\t\t\tSystem.out.println(ErrorType.SUCCESS);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\t//This case logs out the user\n\t\t\tcase LO:\n\t\t\t\tif (validateInput1(words)) {\n\t\t\t\t\texecute = false;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\t//This case displays the help menu\n\t\t\tcase HE:\n\t\t\t\tif (validateInput1(words)) {\n\t\t\t\t\tdisplayUserMenu();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t\t//This will trigger if the user types in an invalid command\n\t\t\tdefault:\n\t\t\t\tSystem.out.println(ErrorType.UNKNOWN_COMMAND);\n\t\t\t}\n\n\t\t}\n\t}", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\tint id = item.getItemId();\n\t\tif (id == R.id.action_sair) {\n\t\t\tprefs = getSharedPreferences(\"ulcerasPrefs\", Context.MODE_PRIVATE);\n\t\t\ted = prefs.edit();\n\t\t\t// salvando informações de login do usuario na memoria interna para\n\t\t\t// saber q ele esta logado\n\t\t\ted.clear();\n\t\t\t// Grava efetivamente as alterações.\n\t\t\ted.commit();\n\t\t\tfinish();\n\t\t\treturn true;\n\t\t}\n\n\t\t\t\n\t\treturn super.onOptionsItemSelected(item);\n\t}", "private static void displayUserMenu() {\n\t\tSystem.out.println(\"\\t User Menu Help \\n\" \n\t\t\t\t+ \"====================================\\n\"\n\t\t\t\t+ \"ar <reponame> : To add a new repo \\n\"\n\t\t\t\t+ \"dr <reponame> : To delete a repo \\n\"\n\t\t\t\t+ \"or <reponame> : To open repo \\n\"\n\t\t\t\t+ \"lr : To list repo \\n\"\n\t\t\t\t+ \"lo : To logout \\n\"\n\t\t\t\t+ \"====================================\\n\");\n\t}", "private static void userMenuLogic() {\n\n\t\tboolean onMenu = true;\n\n\t\twhile(onMenu) {\n\n\t\t\tmenuHandler.clrscr();\n\t\t\tint maxChoice = menuHandler.userMenu();\n\t\t\t\n\t\t\tint intChoice = menuHandler.intRangeInput(\"Please input a number in range [1, \" + maxChoice + \"]\", 1, maxChoice);\n\n\t\t\tswitch(intChoice) {\n\t\t\tcase 1:\n\t\t\t\t// Create user\n\t\t\t\tdouble initBalance = menuHandler.doubleGTEInput(\"Please input an initial balance for the user (must be >= 0.0)\", 0);\n\t\t\t\tusers.put(\"User\" + users.size(), objectHandler.createUser(initBalance));\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t// List users\n\t\t\t\t\n\t\t\t\t// Check users exist\n\t\t\t\tif(users.size() == 0) {\n\t\t\t\t\tSystem.out.println(\"No users created! Please create one before using this menu.\");\n\t\t\t\t} else {\n\t\t\t\t\tmenuHandler.prettyPrintUsers(users, numColumns);\n\t\t\t\t}\n\t\t\t\tmenuHandler.waitOnKey(keyMsg);\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t// Add balance to user\n\t\t\t\t\n\t\t\t\t// Check users exist\n\t\t\t\tif(users.size() == 0) {\n\t\t\t\t\tSystem.out.println(\"No users created! Please create one before using this menu.\");\n\t\t\t\t\tmenuHandler.waitOnKey(keyMsg);\n\t\t\t\t} else {\n\t\t\t\t\t\n\t\t\t\t\tmenuHandler.prettyPrintUsers(users, numColumns);\n\t\t\t\t\tint userChoice = menuHandler.intRangeInput(\"Please input a number in range [0, \" + (users.size() - 1) + \"]\", 0, users.size() - 1);\n\t\t\t\t\t\n\t\t\t\t\tdouble addBal = menuHandler.doubleGTInput(\"Please input balance to add (must be > 0.0)\", 0);\n\t\t\t\t\t\n\t\t\t\t\t// Add balance to chosen user\n\t\t\t\t\tusers.get(\"User\" + userChoice).deposit(addBal);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tcase 4:\n\t\t\t\t// List user documents\n\t\t\t\t\n\t\t\t\tint userChoice;\n\t\t\t\t// Check users exist\n\t\t\t\tif(users.size() == 0) {\n\t\t\t\t\tSystem.out.println(\"No users created! Please create one before using this menu.\");\n\t\t\t\t\tmenuHandler.waitOnKey(keyMsg);\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tmenuHandler.prettyPrintUsers(users, numColumns);\n\t\t\t\t\tuserChoice = menuHandler.intRangeInput(\"Please input a number in range [0, \" + (users.size() - 1) + \"]\", 0, users.size() - 1);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tVDMSet documentSet = users.get(\"User\" + userChoice).getDocumentList();\n\t\t\t\tif(documentSet.size() == 0) {\n\t\t\t\t\tSystem.out.println(\"User selected has no documents! Please select another user.\");\n\t\t\t\t} else {\n\t\t\t\t\tmenuHandler.prettyPrintDocumentsSet(documents, users.get(\"User\" + userChoice).getDocumentList(), numColumns);\n\t\t\t\t}\n\t\t\t\tmenuHandler.waitOnKey(keyMsg);\n\t\t\t\tbreak;\n\t\t\tcase 5:\n\t\t\t\t// Add document to user\n\n\t\t\t\t// Check users exist\n\t\t\t\tif(users.size() == 0) {\n\t\t\t\t\tSystem.out.println(\"No users created! Please create one before using this menu.\");\n\t\t\t\t\tmenuHandler.waitOnKey(keyMsg);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tmenuHandler.prettyPrintUsers(users, numColumns);\n\t\t\t\tuserChoice = menuHandler.intRangeInput(\"Please input a number in range [0, \" + (users.size() - 1) + \"]\", 0, users.size() - 1);\n\t\t\t\t\n\t\t\t\t// Create document to add\n\t\t\t\tDocument toAdd = createDocumentMenuLogic(users.get(\"User\" + userChoice));\n\t\t\t\t\n\t\t\t\t// User backed out of menu\n\t\t\t\tif(toAdd == null) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tusers.get(\"User\" + userChoice).addDocument(toAdd);\n\t\t\t\t\n\t\t\t\tbreak;\n\t\t\tcase 6:\n\t\t\t\tonMenu = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_changepassword) {\n Intent j = new Intent(Rounds.this, CHANGE_PASSWORD.class);\n j.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n startActivity(j);\n return true;\n }\n\n if (id == R.id.action_logout) {\n\n if(isInternetOn())\n {\n String currentdate = new SimpleDateFormat(\"dd-MM-yyyy HH:mm:ss\").format(new Date());\n serverLogout(myHelper.getUserID(), replaceSpace(currentdate));\n return true;\n }\n else\n {\n AlertDialog.Builder builder = new AlertDialog.Builder(Rounds.this);\n builder.setTitle(\"No Internet Connection\");\n builder.setMessage(\"Check your network and Retry\");\n builder.setPositiveButton(\"Ok\", new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int id) {\n //do things\n }\n });\n AlertDialog alert = builder.create();\n alert.show();\n }\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n switch (id) {\n case R.id.logout:\n sharedPreferences.edit().putBoolean(LoginActivity.IS_ALREADY_LOGGED_IN_KEY, false).apply();\n startActivity(new Intent(this, LoginActivity.class).addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP));\n break;\n }\n return true;\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if(id == R.id.nav2_logout){\n Fragment fr=changeFrg();\n if(fr==null){\n sh=getSharedPreferences(\"user\", Context.MODE_PRIVATE);\n shed=sh.edit();\n shed.clear();\n shed.apply();\n\n logOut();\n Toast.makeText(this,\"You are logged out\", Toast.LENGTH_SHORT).show();\n\n return true;\n }else {\n reqCancelAlert(fr);\n }\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(@NonNull MenuItem item) {\n switch (item.getItemId()) {\n case (R.id.action_about):\n // Go to the About page\n Intent aboutIntent = new Intent(this, AboutActivity.class);\n startActivity(aboutIntent);\n return true;\n\n case (R.id.action_logout):\n if (Constants.getToken() != null) { // check if has already login\n resetConstants();\n // successfully logged out - go back to Log in page\n Intent mainIntent = new Intent(this, MainActivity.class);\n startActivity(mainIntent);\n }\n return true;\n\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.admin_login, menu);\n if(sharedPreferences.getString(\"clearanceLevel\",\"\")!=null){\n menu.removeItem(R.id.action_admin_login);\n }else{\n menu.removeItem(R.id.action_admin_logout);\n }\n return true;\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == R.id.messager) {\n\n if (loggedIn.equals(\"noValue\")) {\n Toast.makeText(this, \"Please log in to continue.\", Toast.LENGTH_SHORT).show();\n } else {\n Notifications not = new Notifications();\n Log.d(\"value\", \"bookname1\");\n Intent in = new Intent(getBaseContext(), Notifications.class);\n startActivity(in);\n }\n }\n if (id == R.id.search) {\n Intent intent = new Intent(this, SearchAllData.class);\n startActivity(intent);\n }\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_settings) {\n return true;\n }\n switch (item.getItemId()) {\n case android.R.id.home:\n onBackPressed();\n return true;\n\n }\n\n return super.onOptionsItemSelected(item);\n }", "public String choosenMenu() {\n String value = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get(\"menu_id\");\n menu_id = Integer.parseInt(value);\n String user = FacesContext.getCurrentInstance().getExternalContext().getRemoteUser();\n if (user == null) {\n return \"choosenMenu\";\n } else {\n return \"chooseMenuUser\";\n }\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n if (isLoggedIn()) {\n getMenuInflater().inflate(R.menu.main, menu);\n return true;\n } else {\n return false;\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_settings) {\n return true;\n }\n\n if (id == R.id.logout) {\n session.logoutUser();\n }\n\n return super.onOptionsItemSelected(item);\n }", "private void setMenu(String user_id) {\n FirebaseDatabase database = FirebaseDatabase.getInstance();\n Log.d(\"User id\", user_id);\n final String[] user_type = new String[1];\n DatabaseReference databaseReference = database.getReference(\"Users\").child(user_id).child(\"type\");\n databaseReference.addValueEventListener(new ValueEventListener() {\n @Override\n public void onDataChange(@NonNull DataSnapshot snapshot) {\n user_type[0] = snapshot.getValue().toString();\n Log.d(\"User Type \", user_type[0]);\n //done.set(true);\n switch (user_type[0]) {\n case \"residente\":\n navView.getMenu().findItem(R.id.navigation_notifications).setVisible(false);\n navView.getMenu().findItem(R.id.historyFragment).setVisible(false);\n navView.getMenu().findItem(R.id.userManagementFragment).setVisible(false);\n navView.getMenu().findItem(R.id.navigation_dashboard).setVisible(true);\n return;\n case \"admin\":\n navView.getMenu().findItem(R.id.navigation_notifications).setVisible(true);\n navView.getMenu().findItem(R.id.historyFragment).setVisible(true);\n navView.getMenu().findItem(R.id.userManagementFragment).setVisible(false);\n navView.getMenu().findItem(R.id.navigation_dashboard).setVisible(true);\n return;\n case \"guardia\":\n navView.getMenu().findItem(R.id.navigation_dashboard).setVisible(false);\n navView.getMenu().findItem(R.id.userManagementFragment).setVisible(false);\n navView.getMenu().findItem(R.id.navigation_notifications).setVisible(true);\n navView.getMenu().findItem(R.id.historyFragment).setVisible(true);\n return;\n case \"\":\n navView.getMenu().findItem(R.id.navigation_notifications).setVisible(false);\n navView.getMenu().findItem(R.id.historyFragment).setVisible(false);\n navView.getMenu().findItem(R.id.userManagementFragment).setVisible(false);\n navView.getMenu().findItem(R.id.navigation_dashboard).setVisible(true);\n return;\n }\n\n }\n\n @Override\n public void onCancelled(@NonNull DatabaseError error) {\n\n }\n });\n //while (user_type[0].isEmpty());\n //return user_type[0];\n }", "private void completeTodoMenu(User u) {\n\t\t\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n\n switch (item.getItemId()) {\n // Respond to the action bar's Up/Home button\n case R.id.action_settings:\n break;\n case R.id.logout:\n Utility.logout(getSharedPreferences(\"loginPrefs\", MODE_PRIVATE), this, LoginActivity.class);\n break;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_settings) {\n return true;\n }else if(id == R.id.action_refresh){\n mAPI.getData();\n// getCurrentFragment();\n return false;\n }\n\n else if(id == R.id.action_logout){\n onLogout();\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n\n // kalau menu sign out ditekan\n if (id == R.id.action_sign_out) {\n // Sign out\n Intent move = new Intent(this, LoginActivity.class);\n startActivity(move);\n AppConfig.saveLogin(GroupChatActivity.this, NetHelper.SINGED_OUT);\n AppConfig.saveAccount(GroupChatActivity.this, \"\", \"\");\n // finish supaya tidak bisa di back ke halaman home\n finish();\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(@NonNull MenuItem item) {\n if(item.getItemId() == R.id.calinsert){ //if user chooses to insert an activity\n Intent intent = new Intent(this, Calendar.class); //leads to calendar page\n startActivity(intent);\n return true;\n }\n else if(item.getItemId() == R.id.logout_menu){ //user chooses to log out\n AuthUI.getInstance()\n .signOut(this) //sign out\n .addOnCompleteListener(new OnCompleteListener<Void>() {\n public void onComplete(@NonNull Task<Void> task) {\n Intent intent = new Intent(getBaseContext(), HomePage.class); //goes back to the home page\n startActivity(intent);\n }\n });\n FirebaseUtil.detachListener(); //detaches the listener so that it doesn't have to keep checking for updates from database\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == R.id.profile_settings) {\n Intent newIntent = new Intent(getApplicationContext(), SettingsPage.class);\n startActivity(newIntent);\n return true;\n }\n else if (id == R.id.sign_in_out) {\n Intent newIntent = new Intent(getApplicationContext(), LandingSignIn.class);\n newIntent.putExtra(\"SIGN_OUT\",true);\n startActivity(newIntent);\n return true;\n }\n else if (id == R.id.sessions) {\n Intent newIntent = new Intent(getApplicationContext(), SessionActivity.class);\n startActivity(newIntent);\n return true;\n }\n else if (id == R.id.profilepage) {\n Intent newIntent = new Intent(getApplicationContext(), UserStats.class);\n startActivity(newIntent);\n return true;\n }\n else if (id == R.id.feedback) {\n Intent newIntent = new Intent(getApplicationContext(), FaqActivity.class);\n startActivity(newIntent);\n return true;\n }\n\n\n return super.onOptionsItemSelected(item);\n }", "void setMenuItem(MenuItem menuItem);", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n switch (id) {\n case R.id.action_settings:\n Toast.makeText(getApplicationContext(), \"Settings pressed\", Toast.LENGTH_LONG).show();\n return true;\n case R.id.action_logout:\n Log.d(\"PERFORM LOGOUT\", \"STARTED LOGGING OUT\");\n finish();\n Customer customer = new Select().from(Customer.class).executeSingle();\n\n performLogout();\n return true;\n\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "protected void onUserSettingsChanged(@Observes UserSettingsChangedEvent usc)\n {\n loadMenu();\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n\n switch (item.getItemId()) {\n case R.id.action_signout:\n AppConstant.signout = true;\n this.finish();\n return true;\n case R.id.action_main_menu:\n AppConstant.mainMenu = true;\n this.finish();\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_settings) {\n return true;\n }\n if (id == R.id.menuLogout) {\n extras = null;\n prefSetDefaults();\n launchLoginActivity();\n }\n\n return super.onOptionsItemSelected(item);\n }", "private void updateMenu() {\n if(customMenu || !menuDirty) {\n return;\n }\n \n // otherwise, reset up the menu.\n menuDirty = false;\n menu.removeAll();\n Icon emptyIcon = null; \n for(Action action : actions) {\n if(action.getValue(Action.SMALL_ICON) != null) {\n emptyIcon = new EmptyIcon(16, 16);\n break;\n }\n }\n \n selectedComponent = null;\n selectedLabel = null;\n \n for (Action action : actions) {\n \n // We create the label ourselves (instead of using JMenuItem),\n // because JMenuItem adds lots of bulky insets.\n\n ActionLabel menuItem = new ActionLabel(action);\n JComponent panel = wrapItemForSelection(menuItem);\n \n if (action != selectedAction) {\n panel.setOpaque(false);\n menuItem.setForeground(UIManager.getColor(\"MenuItem.foreground\"));\n } else {\n selectedComponent = panel;\n selectedLabel = menuItem;\n selectedComponent.setOpaque(true);\n selectedLabel.setForeground(UIManager.getColor(\"MenuItem.selectionForeground\"));\n }\n \n if(menuItem.getIcon() == null) {\n menuItem.setIcon(emptyIcon);\n }\n attachListeners(menuItem);\n decorateMenuComponent(menuItem);\n menuItem.setBorder(BorderFactory.createEmptyBorder(0, 6, 2, 6));\n\n menu.add(panel);\n }\n \n if (getText() == null) {\n menu.add(Box.createHorizontalStrut(getWidth()-4));\n } \n \n for(MenuCreationListener listener : menuCreationListeners) {\n listener.menuCreated(this, menu);\n }\n }", "public boolean onCreateOptionsMenu(Menu menu) {\n\t\tgetMenuInflater().inflate(R.menu.menu, menu);// Menu Resource, Menu\n\t\tMenuItem item_logout = menu.findItem(R.id.menu_logout);\n\t\tMenuItem item_login = menu.findItem(R.id.menu_login);\n\n\t\tif (AadhaarUtil.mCurrentUser == AadhaarUtil.USER_CUSTOMER) {\n\t\t\titem_login.setVisible(false);\n\t\t\titem_logout.setVisible(true);\n\t\t} else if (AadhaarUtil.mCurrentUser == AadhaarUtil.USER_PARTNER) {\n\t\t\titem_logout.setVisible(false);\n\t\t\titem_login.setVisible(true);\n\t\t}\n\t\t\n\t\tMenuItem item_my_profile = menu.findItem(R.id.menu_my_profile);\n\t\tif (null != AadhaarUtil.photo) {\n\t\t\titem_my_profile.setIcon(new BitmapDrawable(getResources(),BitmapFactory.decodeByteArray(AadhaarUtil.photo, 0, AadhaarUtil.photo.length)));\n\t\t}\n\t\treturn true;\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_home) {\n ParseUser currentUser = ParseUser.getCurrentUser();\n String typeUser = currentUser.getString(\"TypeUser\");\n if (typeUser.equals(\"Student\")) {\n Intent intent = new Intent(this, StudentHome.class);\n startActivity(intent);\n } else if (typeUser.equals(\"Company\")) {\n Intent intent = new Intent(this, CompanyHome.class);\n startActivity(intent);\n } else if (typeUser.equals(\"Teacher\")) {\n Intent intent = new Intent(this, ProfessorHome.class);\n startActivity(intent);\n }\n return true;\n } else if (id == R.id.action_profile) {\n ParseUser currentUser = ParseUser.getCurrentUser();\n String typeUser = currentUser.getString(\"TypeUser\");\n if (typeUser.equals(\"Student\")) {\n Intent intent = new Intent(this, ProfileStudent.class);\n startActivity(intent);\n } else if (typeUser.equals(\"Company\")) {\n Intent intent = new Intent(this, ProfileCompany.class);\n startActivity(intent);\n } else if (typeUser.equals(\"Teacher\")) {\n Intent intent = new Intent(this, ProfileProfessor.class);\n startActivity(intent);\n }\n return true;\n } else if (id == R.id.action_logout) {\n Utils.unsubscribeCourses();\n ParseUser.logOut();\n Intent intent = new Intent(this, LogIn.class);\n startActivity(intent);\n return true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n mOption = menu;\n getMenuInflater().inflate(R.menu.menu, menu);\n int menunya = sharedpreferences.getInt(\"menu\", 0);\n SharedPreferences.Editor editor = sharedpreferences.edit();\n if (menunya == 0) {\n editor.putInt(\"menu\", 2);\n editor.commit();\n f2.setVisibility(View.VISIBLE);\n f3.setVisibility(View.GONE);\n navigation.setSelectedItemId(R.id.navigation_dashboard);\n } else if (menunya == 2) {\n f2.setVisibility(View.VISIBLE);\n f3.setVisibility(View.GONE);\n navigation.setSelectedItemId(R.id.navigation_dashboard);\n } else if (menunya == 3) {\n f2.setVisibility(View.GONE);\n f3.setVisibility(View.VISIBLE);\n navigation.setSelectedItemId(R.id.navigation_notifications);\n } else {\n editor.putInt(\"menu\", 2);\n editor.commit();\n f2.setVisibility(View.VISIBLE);\n f3.setVisibility(View.GONE);\n }\n return true;\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n\n\n switch (item.getItemId()){\n case R.id.action_signout:\n signOut();\n Intent ii=new Intent(WelcomeCandidate.this,LoginUserType.class);\n startActivity(ii);\n return true;\n case R.id.action_passwordchange:\n return true;\n case R.id.action_settings:\n // Intent intent = new Intent(SignedInActivity.this, SettingsActivity.class);\n // startActivity(intent);\n return true;\n default:\n return super.onOptionsItemSelected(item);\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n switch (item.getItemId()) {\n case R.id.logout:\n Utils.clearUsernameAndPassword(this);\n startActivity(new Intent(this, LoginActivity.class));\n return true;\n case R.id.settings:\n startActivity(new Intent(this, SettingsActivity.class));\n return true;\n default:\n return false;\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_settings) {\n return true;\n }\n if (id == R.id.action_logout) {\n Intent intent = new Intent(ConstructReview.this, Login.class);\n intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);\n startActivity(intent);\n return true;\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n if (id == R.id.action_log_out) {\n \tnew AlertDialog.Builder(this)\n \t.setTitle(\"Utlogging\")\n .setMessage(\"Er du sikker p� at du vil logge ut?\")\n .setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {\n \tpublic void onClick(DialogInterface dialog, int which) { \n \t\tlogout();\n \t}\n })\n .setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) { \n // do nothing\n }\n })\n .show();\n \treturn true;\n }\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.menu, menu);\n //Reading the Preferences File\n SharedPreferences userDetails = this.getSharedPreferences(\"userdetails\", MODE_PRIVATE);\n String Uname = userDetails.getString(\"username\", \"\");\n String Utype = userDetails.getString(\"usertype\", \"\");\n\n TextView user_email = (TextView) findViewById(R.id.user_email);\n user_email.setText(Uname);\n\n if(Utype.equalsIgnoreCase(\"customer\")) {\n navigationView.getMenu().findItem(R.id.cook_home).setVisible(false);\n navigationView.getMenu().findItem(R.id.cook_profile).setVisible(false);\n navigationView.getMenu().findItem(R.id.view_customers).setVisible(false);\n navigationView.getMenu().findItem(R.id.add_food).setVisible(false);\n navigationView.getMenu().findItem(R.id.cook_bookings).setVisible(false);\n return true;\n }\n else {\n navigationView.getMenu().findItem(R.id.customer_home).setVisible(false);\n navigationView.getMenu().findItem(R.id.customer_profile).setVisible(false);\n navigationView.getMenu().findItem(R.id.make_booking).setVisible(false);\n navigationView.getMenu().findItem(R.id.view_bookings).setVisible(false);\n navigationView.getMenu().findItem(R.id.view_cooks).setVisible(false);\n return true;\n }\n }", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n Intent intent;\n\n switch (item.getItemId()) {\n case R.id.logout_menu:\n logout();\n intent = new Intent(MainActivity.this, WelcomeActivity.class);\n startActivity(intent);\n finish();\n return true;\n case R.id.profile_menu:\n intent = new Intent(MainActivity.this, ProfileActivity.class);\n startActivity(intent);\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.menu, menu);\n\n //Reading the Preferences File\n SharedPreferences userDetails = this.getSharedPreferences(\"userdetails\", MODE_PRIVATE);\n String Uname = userDetails.getString(\"username\", \"\");\n String Utype = userDetails.getString(\"usertype\", \"\");\n\n TextView user_email = (TextView) findViewById(R.id.user_email);\n user_email.setText(Uname);\n\n if(Utype.equalsIgnoreCase(\"customer\")) {\n navigationView.getMenu().findItem(R.id.cook_home).setVisible(false);\n navigationView.getMenu().findItem(R.id.cook_profile).setVisible(false);\n navigationView.getMenu().findItem(R.id.view_customers).setVisible(false);\n navigationView.getMenu().findItem(R.id.add_food).setVisible(false);\n navigationView.getMenu().findItem(R.id.cook_bookings).setVisible(false);\n return true;\n }\n else {\n navigationView.getMenu().findItem(R.id.customer_home).setVisible(false);\n navigationView.getMenu().findItem(R.id.customer_profile).setVisible(false);\n navigationView.getMenu().findItem(R.id.make_booking).setVisible(false);\n navigationView.getMenu().findItem(R.id.view_bookings).setVisible(false);\n navigationView.getMenu().findItem(R.id.view_cooks).setVisible(false);\n return true;\n }\n }", "private void onMainMenuLogin() {\n Intent intent = new Intent(this, MainMenu.class);\n intent.putExtra(Constants.SHOWNOTIFICATION, isNotification);\n startActivity(intent);\n }", "@Override\r\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\r\n\r\n //noinspection SimplifiableIfStatement\r\n if (id == R.id.action_logout) {\r\n ParseUser.logOut();\r\n Intent intent = new Intent(getApplicationContext(),LoginActivity.class);\r\n startActivity(intent);\r\n }\r\n\r\n return super.onOptionsItemSelected(item);\r\n }", "@Override\n public boolean onMenuItemSelected(int featureId, MenuItem item) {\n int id = item.getItemId();\n\n if(id == R.id.action_home){\n Intent intent = new Intent(this,Display.class);\n startActivity(intent);\n }\n\n else if(id == R.id.action_semester){\n Intent intent = new Intent(this,Semester.class);\n startActivity(intent);\n }\n\n else if(id == R.id.action_logout){\n Intent intent = new Intent(this, MainActivity.class);\n //To clear the current session\n intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n startActivity(intent);\n Toast.makeText(this,\"Logout Successful\", Toast.LENGTH_LONG).show();\n }\n return super.onMenuItemSelected(featureId, item);\n }", "@Override\n\tpublic boolean onOptionsItemSelected(MenuItem item) {\n\t\t// The action bar home/up action should open or close the drawer.\n\t\t// ActionBarDrawerToggle will take care of this.\n\n\t\tIntent i;\n\t\t// Handle action buttons\n\t\t// switch (item.getItemId()) {\n\t\t// case R.id.menu_add_new_list:\n\t\t// if (task.getString(\"user_id\", null) != null) {\n\t\t// i = new Intent(getBaseContext(), MyMap.class);\n\t\t// startActivity(i);\n\t\t// } else {\n\t\t// Toast.makeText(this, \"Please Login first\", Toast.LENGTH_LONG).show();\n\t\t// }\n\t\t// return true;\n\t\t// case R.id.menu_dashboard:\n\t\t// if (task.getString(\"user_id\", null) != null) {\n\t\t// i = new Intent(this, dashboard_main.class);\n\t\t// i.putExtra(\"edit\", \"12344\");\n\t\t// startActivity(i);\n\t\t// } else {\n\t\t// Toast.makeText(this, \"Please Login first\", Toast.LENGTH_LONG).show();\n\t\t// }\n\t\t// return true;\n\t\t// case R.id.menu_login:\n\t\t// if (bedMenuItem.getTitle().equals(\"Logout\")) {\n\t\t// SharedPreferences.Editor editor = getSharedPreferences(\"user\",\n\t\t// MODE_PRIVATE).edit();\n\t\t// editor.clear();\n\t\t// editor.commit();\n\t\t// bedMenuItem.setTitle(\"Login/Register\");\n\t\t// } else {\n\t\t// Intent i_user = new Intent(getBaseContext(), user_login.class);\n\t\t// startActivity(i_user);\n\t\t// }\n\t\t//\n\t\t// return true;\n\t\t//\n\t\t// // case R.id.menu_search:\n\t\t// // showSearchDialog();\n\t\t// // return true;\n\t\t//\n\t\t// case android.R.id.home:\n\t\t//\n\t\t// finish();\n\t\t//\n\t\t// return super.onOptionsItemSelected(item);\n\t\t// default:\n\t\treturn super.onOptionsItemSelected(item);\n\n\t}", "@Override\n public boolean onOptionsItemSelected(MenuItem item) {\n int id = item.getItemId();\n\n //noinspection SimplifiableIfStatement\n if (id == R.id.action_logout) {\n Toast.makeText(getApplicationContext(), \"Logout user!\", Toast.LENGTH_LONG).show();\n return true;\n }\n\n // user is in spams fragment\n // and selected 'Mark all as Read'\n if (id == R.id.action_mark_all_read) {\n Toast.makeText(getApplicationContext(), \"All spams marked as read!\", Toast.LENGTH_LONG).show();\n }\n\n // user is in spams fragment\n // and selected 'Clear All'\n if (id == R.id.action_clear_spams) {\n Toast.makeText(getApplicationContext(), \"Clear all spams!\", Toast.LENGTH_LONG).show();\n }\n\n return super.onOptionsItemSelected(item);\n }", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.profile_menu, menu);\n\n // Add username next to profile icon\n menu.findItem(R.id.username).setTitle(ParseUser.getCurrentUser().getUsername());\n // Make the username text unclickable\n menu.findItem(R.id.username).setEnabled(false);\n return true;\n }", "void changeMenuItemName(String itemId, String itemName);", "@Override\n public boolean onCreateOptionsMenu(Menu menu) {\n getMenuInflater().inflate(R.menu.main, menu);\n textUserName = findViewById(R.id.textUserName);\n textUserEmail = findViewById(R.id.textUserEmail);\n userProfilePic = findViewById(R.id.imageViewUserPic);\n try {\n textUserName.setText(FirebaseAuth.getInstance().getCurrentUser().getDisplayName());\n textUserEmail.setText(FirebaseAuth.getInstance().getCurrentUser().getEmail());\n } catch (NullPointerException e) {\n Log.d(\"d\", e.getMessage());\n }\n return true;\n }" ]
[ "0.6811728", "0.65876675", "0.65771437", "0.6548815", "0.65228707", "0.64740837", "0.64174956", "0.636971", "0.63619", "0.63436216", "0.63246435", "0.62814516", "0.6272906", "0.6239266", "0.6235069", "0.616676", "0.61647725", "0.61546785", "0.61522853", "0.6140179", "0.6133767", "0.607694", "0.6035185", "0.6033949", "0.6033615", "0.6031958", "0.602623", "0.6022737", "0.5998329", "0.5992385", "0.598697", "0.5981607", "0.5967311", "0.5958958", "0.5958023", "0.5956718", "0.595661", "0.59470606", "0.59416467", "0.59323317", "0.59256333", "0.59205264", "0.59129256", "0.5907392", "0.5901284", "0.58908385", "0.58882904", "0.5879832", "0.5879796", "0.5871304", "0.58647317", "0.5845375", "0.58390343", "0.58299416", "0.58094573", "0.5808116", "0.5789414", "0.5781699", "0.57730246", "0.57476676", "0.57472616", "0.5746225", "0.5745139", "0.574386", "0.5740394", "0.57399726", "0.57319766", "0.5724083", "0.572315", "0.57201964", "0.571601", "0.5712589", "0.57097363", "0.5702436", "0.5701375", "0.5699053", "0.56962293", "0.5694347", "0.5685097", "0.5684511", "0.56821567", "0.5681818", "0.5681282", "0.5681111", "0.5672904", "0.5672678", "0.5671956", "0.5661263", "0.5652466", "0.5651424", "0.5651337", "0.5650466", "0.56495863", "0.56485677", "0.56474775", "0.56360537", "0.56334525", "0.5630798", "0.5620515", "0.56192756" ]
0.78397703
0
/ Show confirmation dialog to confirm logging out.
private void showConfirmSignOutDialog() { ConfirmationDialogFragment dialog = ConfirmationDialogFragment.getInstance(getString(R.string.log_out_confirm), getString(R.string.log_out_confirm_option_yes), REQUEST_CONFIRM_LOG_OUT, true); dialog.show(getSupportFragmentManager(), DIALOG_CONFIRM_LOG_OUT); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void logout() {\n Utils.showConfirmationDialogCallBack(MainActivity.this, getString(R.string.logout_sure), this);\n }", "public void logoutDialog() {\n new AlertDialog.Builder(this)\n .setIcon(android.R.drawable.ic_dialog_alert)\n .setTitle(\"Logout\")\n .setMessage(\"Are you sure you want to logout?\")\n .setPositiveButton(\"Yes\", new DialogInterface.OnClickListener()\n {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n finish();\n }\n\n })\n .setNegativeButton(\"No\", null)\n .show();\n }", "public void ConfirmSignOut(){\n ReusableActionsPageObjects.clickOnElement(driver, ConfirmSignOut, logger, \"confirm log out\");\n }", "private void formDashboardMainButtonLogoutActionPerformed(java.awt.event.ActionEvent evt) {\n try {\n int action = JOptionPane.showConfirmDialog(null,\n Constanta.Messages.MESSAGE_CONFIRM_LOGOUT,\n Constanta.Messages.BANNER_CONFIRM,\n JOptionPane.YES_NO_OPTION,\n JOptionPane.QUESTION_MESSAGE);\n\n if (action == JOptionPane.YES_OPTION) {\n Login login = new Login();\n login.show();\n this.dispose();\n }\n } catch (HeadlessException e) {\n JOptionPane.showMessageDialog(null, Constanta.Messages.MESSAGE_ERROR + e.getMessage());\n }\n }", "public static void confirmLogout(final Activity act) {\n final Context ctx = act.getBaseContext();\n new AlertDialog.Builder(act).setTitle(R.string.action_logout)\n .setMessage(R.string.button_confirm_logout)\n .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) {\n\n //clear user data\n final Editor ed = PreferenceManager.getDefaultSharedPreferences(ctx).edit();\n\n ed.putString(LoginActivity.PREFS_USER_EMAIL, null);\n ed.putString(LoginActivity.PREFS_USER_FORENAME, null);\n ed.putString(LoginActivity.PREFS_USER_SURNAME, null);\n ed.putString(LoginActivity.PREFS_PASSWORD, null);\n ed.putString(LoginActivity.PREFS_AUTH_KEY, null);\n ed.putString(LoginActivity.PREFS_USER_ENTE, null);\n\n ed.commit();\n\n Toast.makeText(ctx, ctx.getString(R.string.logout_logged_out),Toast.LENGTH_LONG).show();\n \n if(act != null){\n act.startActivityForResult(\n new Intent(ctx, LoginActivity.class),\n LoginActivity.REQUEST_LOGIN);\n }\n\n }\n }).setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) {\n // do nothing\n }\n }).show();\n }", "private void alertMessage() {\n //remove friend confirmation dialog\n //taken from: http://www.androidhub4you.com/2012/09/alert-dialog-box-or-confirmation-box-in.html\n DialogInterface.OnClickListener dialogClickListener = new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) {\n switch (which) {\n case DialogInterface.BUTTON_POSITIVE:\n // Yes button clicked\n logout();\n break;\n\n case DialogInterface.BUTTON_NEGATIVE:\n // No button clicked\n // do nothing\n break;\n }\n }\n };\n\n //Show \"warning\" Dialog, if user is sure about deleting friend.\n AlertDialog.Builder builder = new AlertDialog.Builder(context);\n builder.setMessage(\"Are you sure you want to log out from this app?\")\n .setTitle(\"Logout\")\n .setPositiveButton(\"Yes\", dialogClickListener)\n .setNegativeButton(\"No\", dialogClickListener).show();\n }", "private void logout() {\n ProgressDialog logoutProgressDialog = new ProgressDialog(ContributionsGalleryActivity.this);\n logoutProgressDialog.setMessage(getResources().getString(R.string.logging_out));\n logoutProgressDialog.setCancelable(false);\n logoutProgressDialog.show();\n ParseUser.logOutInBackground(e -> {\n logoutProgressDialog.dismiss();\n if (e != null) { // Logout has failed\n Snackbar.make(contributionsGalleryRelativeLayout, getResources().getString(R.string.logout_failed), Snackbar.LENGTH_LONG).show();\n }\n else { // Logout has succeeded\n goLoginSignupActivity();\n finish();\n }\n });\n }", "public void actionPerformed(ActionEvent e) {\r\n\t\t\t\tint selection=JOptionPane.showConfirmDialog(mainWin,\"Are you sure you want to log out\",\"Choose\",JOptionPane.YES_NO_OPTION);\r\n\t\t\t\tif( selection==JOptionPane.YES_OPTION) {\r\n\t\t\t\t\tmainWin.dispose();\r\n\t\t\t\t\tMainLoginPage returntologin=new MainLoginPage();\r\n\t\t\t\t\treturntologin.display();\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t}", "public void onClick(DialogInterface dialog, int id) {\n session.logoutUser();\r\n }", "private void formWindowClosing(java.awt.event.WindowEvent evt) {\n int confirmed = JOptionPane.showConfirmDialog(null,\n \"On quittant le programme vous perdez toutes vos données actuelles. Voulez-vous quitter ?\", \"Exit Program Message Box\",\n JOptionPane.YES_NO_OPTION);\n if (confirmed == 0) {\n clearGui();\n logout();\n this.dispose();\n } else {\n setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);//no\n }\n }", "private void logout(){\n showLoadingDialog();\n TwitterController.getInstance().logout(logoutCallback);\n }", "private void logout(){\n Log.i(\"HHH\",\"disconnect\");\n AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(this);\n alertDialogBuilder.setMessage(\"Are you sure you want to log out ?\");\n alertDialogBuilder.setPositiveButton(\"YES\",\n new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface arg0, int arg1) {\n Intent intent1 = new Intent(ControlDiagnostic.this, HistoryActivity.class);\n startActivity(intent1);\n //Getting out sharedpreferences\n //SharedPreferences preferences = getSharedPreferences(Config.SHARED_PREF_NAME, Context.MODE_PRIVATE);\n //Getting editor\n /* SharedPreferences.Editor editor = preferences.edit();\n\n //Puting the value false for loggedin\n editor.putBoolean(Config.LOGGEDIN_SHARED_PREF, false);\n\n //Putting blank value to email\n editor.putString(Config.KEY_USER_EMAIL, \"\");\n\n //Saving the sharedpreferences\n editor.commit();*/\n\n //Starting login activity\n // Intent intent = new Intent(NavigationActivity.this, Login.class);\n // startActivity(intent);\n }\n });\n\n alertDialogBuilder.setNegativeButton(\"NO\",\n new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface arg0, int arg1) {\n\n }\n });\n\n //Showing the alert dialog\n AlertDialog alertDialog = alertDialogBuilder.create();\n alertDialog.show();\n\n }", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tif (JOptionPane.showConfirmDialog(null, \"Are you sure want to log out?\", \"WARNING\",\n\t\t\t\t\t\tJOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {\n\t\t\t\t\tclient.sendCloseRequest();\n\t\t\t\t\tMainUI.this.dispose();\n\t\t\t\t\tLoginBox loginBox = new LoginBox();\n\n\t\t\t\t} else {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t}", "private void onSignOutClicked() {\n new AlertDialog.Builder(this)\n .setCancelable(true)\n .setTitle(\"Sign Out\")\n .setMessage(\"Are you sure you want to sign out?\")\n .setPositiveButton(\"Confirm\", (dialog, which) -> onSignOutConfirmed())\n .setNegativeButton(android.R.string.cancel, ((dialog, which) -> dialog.dismiss()))\n .create()\n .show();\n }", "private void menu_lable_4MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_menu_lable_4MouseClicked\n // TODO add your handling code here:\n int x = JOptionPane.showConfirmDialog(this, \"You are not yet log out to current account, are yousure want to exit without logout!! and exit the system. Yes exit, No logout !\", \"Not logged out!!\", JOptionPane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE);\n switch (x) {\n case JOptionPane.YES_OPTION:\n this.dispose();\n System.exit(0);\n break;\n case JOptionPane.CANCEL_OPTION:\n break;\n default:\n this.log_out();\n new SubInterface_Login_Staff().setVisible(true);\n this.dispose();\n break;\n }\n }", "private void logoutHandler() {\n AlertDialog.Builder builder = new AlertDialog.Builder(context, android.R.style.Theme_DeviceDefault_Dialog);\n builder.setTitle(\"Logout?\");\n builder.setMessage(\"Are you sure you want to logout?\");\n builder.setPositiveButton(\"Yes\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n dialog.dismiss();\n Util.setLoggedInFlag(false);\n\n HPIApp.getAppContext().stopService(new Intent(HPIApp.getAppContext(), StepService.class));\n\n Intent intent = new Intent(HomeActivity.this, SplashActivity.class);\n startActivity(intent);\n HomeActivity.this.finish();\n }\n });\n\n builder.setNegativeButton(\"Cancel\", new DialogInterface.OnClickListener() {\n @Override\n public void onClick(DialogInterface dialog, int which) {\n dialog.dismiss();\n }\n });\n\n builder.show();\n }", "@Override\n public void windowClosing(java.awt.event.WindowEvent windowEvent) {\n JSONObject logout = Command.createLogout(Settings.getUsername(), Settings.getSecret());\n ClientSkeleton.getInstance().writeMsg(logout.toJSONString());\n log.info(\"User is going to log out....\");\n ClientSkeleton.getInstance().disconnect();\n }", "private void jLabel3MouseClicked(java.awt.event.MouseEvent evt) {\n frame1 = new JFrame(\"Logout\");\n if (JOptionPane.showConfirmDialog(frame1,\"Confirm if you want to Logout\",\"Home\",\n JOptionPane.YES_NO_OPTION) == JOptionPane.YES_NO_OPTION){\n this.dispose();//to close the current jframe\n new Admin().setVisible(true);\n };\n }", "public void logout(View v){\n SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);\n SharedPreferences.Editor editor = preferences.edit();\n editor.clear();\n editor.apply();\n Button view = findViewById(R.id.buttonView);\n view.setVisibility(View.INVISIBLE);\n Button logout = findViewById(R.id.buttonLogout);\n logout.setVisibility(View.INVISIBLE);\n EditText username = findViewById(R.id.username);\n username.setText(\"\");\n username.setHint(\"Username\");\n username.setVisibility(View.VISIBLE);\n EditText pass = findViewById(R.id.password);\n pass.setText(\"\");\n pass.setHint(\"Password\");\n pass.setVisibility(View.VISIBLE);\n Button login = findViewById(R.id.buttonLogin);\n login.setVisibility(View.VISIBLE);\n Button createAcc = findViewById(R.id.buttonCreateAccount);\n createAcc.setVisibility(View.VISIBLE);\n TextView accountName = findViewById(R.id.accountName);\n accountName.setVisibility(View.INVISIBLE);\n notification(this.getWindow().getDecorView(),\"You have been logged out!\");\n }", "@Override\r\n\tpublic void ShowLogout(Context _in_context) {\n\t\tTypeSDKLogger.e( \"ShowLogout\");\r\n\t\tthis.haimaLogout();\r\n\t}", "void successLogout();", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tdispose();\n\t\t\t\tUserHandler.logOut();\n\t\t\t}", "@FXML\r\n void ClickLogout(MouseEvent event) throws IOException {\r\n //Display confirmation alert\r\n Alert alert = new Alert(Alert.AlertType.CONFIRMATION);\r\n alert.setTitle(\"Exit Weechat\");\r\n alert.setHeaderText(\"Are you sure you want to Logout of Weechat\");\r\n //Add cancel button\r\n ButtonType confirmButton = new ButtonType(\"Don't Logout\", \r\n ButtonBar.ButtonData.CANCEL_CLOSE);\r\n //Wait for response\r\n Optional<ButtonType> result = alert.showAndWait();\r\n if(result.get() == ButtonType.OK)\r\n {\r\n //If user selects okay, go to login\r\n Parent root = FXMLLoader.load(getClass().getResource(\"Login.fxml\"));\r\n Scene scene = new Scene(root);\r\n Stage stage = (Stage)\r\n ((Node)event.getSource()).getScene().getWindow();\r\n stage.setScene(scene);\r\n stage.show();\r\n }\r\n }", "public void logOutFirebaseAccounts() {\n AuthUI.getInstance()\n .signOut(mAccountsFragment.getContext())\n .addOnCompleteListener(new OnCompleteListener<Void>() {\n public void onComplete(@NonNull Task<Void> task) {\n setNotLoggedInLayoutVisible();\n }\n });\n }", "public void onLogout() {\n ParseUser.logOut();\n\n promptForLogin();\n }", "public void onClick(DialogInterface dialog,int id) {\n\n activity.getAuthController().logout();\n Log.d(\"SettingsFragment\", \"Logout successful\");\n }", "@Override\r\n\tpublic void ShowLogout(Context _in_context) {\n\t\tTypeSDKLogger.e(\"ShowLogout\");\r\n\t\tthis.youkuLogout();\r\n\t}", "private void onSignOutConfirmed() {\n Login.logout(this, e -> {\n Toast.makeText(this, \"Logged out successfully\", Toast.LENGTH_SHORT).show();\n });\n\n Intent intent = new Intent(this, MainActivity.class);\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); // add this flag so that we return to an existing MainActivity if it exists rather than creating a new one\n Login.setManualLogin(true);\n Login.forceLogin(); // force re-login so that when we sign-out we are brought to the login screen. Login.logout() occurs asynchronously so without calling this, we may not go to the login screen\n\n startActivity(intent);\n }", "private void logout() {\n\t\tgetUI().get().navigate(\"login\");\r\n\t\tgetUI().get().getSession().close();\r\n\t}", "protected void confirmLogin() {\n String nameString1 = this.adminName.getText();\n String passwordString1 = this.adminPassword.getText();\n UserType userType = (UserType) this.user_type_combobox.getSelectedItem();\n if (\"系统管理员\".equals(userType.getName())) {\n AdminDao adminDao = new AdminDao();\n SystemAdmin admin = adminDao.selectAdmin(nameString1, passwordString1);\n if (admin == null) {\n JOptionPane.showMessageDialog(this, \"用户名或者密码错误!!\");\n return;\n }\n IndexFrame indexFrame = new IndexFrame(userType, admin, passwordString1);\n indexFrame.setVisible(true);\n this.dispose();\n }\n }", "public void onClick(DialogInterface dialog, int id) {\n\n dialog.cancel();\n Log.d(\"SettingsFragment\", \"Logout successfully blocked\");\n }", "private void LogoutButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_LogoutButtonActionPerformed\n //Leaves the DeputyCommissionerWindow and open the Login window\n this.dispose();\n lg.setVisible(true);\n }", "public static void handleLogoutGUI()\n\t{\n\t\tOp logOp = new Op(Operations.LOGOUT,userLogin);\n\t\tclient.handleMessageFromClientUI(logOp);\n\t}", "Boolean signOut();", "public void logout() {\n showLoginScreen();\n }", "public void Logout(){\n preferences.edit().remove(userRef).apply();\n }", "public String logout(){\r\n this.user = null;\r\n loggedIn = false;\r\n return \"/index?faces-redirect=true\";\r\n }", "private void signOutUser() {\n mAuth.signOut();\n LoginManager.getInstance().logOut();\n Toast.makeText(ChatMessage.this, \"You have been logout\", Toast.LENGTH_SHORT).show();\n finishAffinity();\n proceed();\n }", "private void logOut() {\n mApi.getSession().unlink();\n\n // Clear our stored keys\n clearKeys();\n // Change UI state to display logged out version\n setLoggedIn(false);\n }", "private void LogoutDialog() {\n\n AlertDialog.Builder alert;\n alert = new AlertDialog.Builder(this,R.style.Theme_MaterialComponents_Dialog_Alert);\n LayoutInflater inflater = getLayoutInflater();\n\n View view = inflater.inflate(R.layout.logout_dialog,null);\n\n s_cancel = view.findViewById(R.id.s_cancel);\n btnSignout = view.findViewById(R.id.btn_signout);\n\n alert.setView(view);\n alert.setCancelable(false);\n\n AlertDialog dialog = alert.create();\n dialog.getWindow().setBackgroundDrawableResource(R.color.transparent);\n\n dialog.show();\n\n btnSignout.setOnClickListener(v -> {\n FirebaseAuth.getInstance().signOut();\n startActivity(new Intent(UserActivity.this , LoginOrSignUpActivity.class));\n finish();\n\n Toast.makeText(UserActivity.this, \"Sign out is Successful\" , Toast.LENGTH_SHORT).show();\n });\n\n s_cancel.setOnClickListener(v -> dialog.dismiss());\n }", "public static void logout() {\n click(MY_ACCOUNT_DROPDOWN);\n click(LOGOUT_BUTTON);\n }", "public static void Logout() throws IOException {\n Socket client = ConnectionToServer();\n // Checks if the sever is online\n if (client.isConnected()) {\n OutputStream outputStream = client.getOutputStream();\n InputStream inputStream = client.getInputStream();\n\n ObjectOutputStream send = new ObjectOutputStream(outputStream);\n ObjectInputStream receiver = new ObjectInputStream(inputStream);\n\n send.writeUTF(\"Logout\"); // Send logout to server\n send.writeUTF(loggedInUser); // Send username to server\n send.flush();\n// End connections\n send.close();\n receiver.close();\n client.close();\n }\n// Resetting the application for the user on the client-side\n loggedInUser = \"\";\n Login.usernameText.setText(\"\");\n loginSuccessful = false;\n boolean[] falsePermission = {false, false, false, false};\n permission.SetUserPermission(falsePermission);\n token = \"\";\n ControlPanelFrameHandler.LogoutWindow();\n }", "@Step(\"Log out\")\n public void logOut() {\n open();\n sighOutButton.click();\n }", "public String logout()\n\t{\n\t\tsession.remove(\"user_name\");\n\t\tsession.remove(\"password\");\n\t\tsession.clear();\n\t\tsession.invalidate();\t\n\t\taddActionMessage(\"You Have Been Successfully Logged Out\");\n\t\treturn SUCCESS;\n\t}", "public void logout() {\n\n $(logOutNavigator).click();\n driver = commonMethods.waitForElement(driver, logOffBtn);\n $(logOffBtn).click();\n $(loadingProgressIcon).should(disappear);\n }", "public void Logout() {\n \t\t\t\n \t\t}", "void logoutDone();", "void logout();", "void logout();", "public void logout() {\n \n FacesContext.getCurrentInstance().getExternalContext().invalidateSession();\n try {\n FacesContext.getCurrentInstance().getExternalContext()\n .redirect(\"/BookStorePelikSangat/faces/admin/loginadmin.xhtml\");\n } \n catch (IOException e) {}\n\t}", "public void unauthorized() {\n super.unauthorized();\n LoginFragment.this.getTracker().send(new HitBuilders.EventBuilder().setCategory(\"sign_in\").setAction(\"incorrect\").setLabel(\"incorrect\").build());\n Answers.getInstance().logLogin(new LoginEvent().putSuccess(false));\n new AlertDialog.Builder(LoginFragment.this.getActivity()).setMessage(R.string.incorrect_email_or_password).setPositiveButton(17039370, (DialogInterface.OnClickListener) null).show();\n }", "private void signOut(){\n LoginSharedPreference.endLoginSession(this);\n Intent intent = new Intent(this,LoginActivity.class);\n startActivity(intent);\n finish();\n }", "@Override\n public void onCanceled() {\n\n logOutNow();\n\n }", "private void signOut () {\n mAuth.signOut();\n textViewStatus.setText(\"Signed Out\");\n }", "public void logOut() {\r\n\t\tthis.modoAdmin = false;\r\n\t\tthis.usuarioConectado = null;\r\n\t}", "public void doLogout() {\n loggedIn = false;\r\n HttpSession session = (HttpSession) FacesContext.getCurrentInstance()\r\n .getExternalContext().getSession(false);\r\n session.invalidate(); \r\n String pag= \"/login.xhtml\";\r\n redireccionar(pag);\r\n }", "public void attemptLogout() {\n spEditor.clear();\n spEditor.putBoolean(LOGGEDIN_KEY, false);\n spEditor.commit();\n }", "public Result logOut() {\n customerService().logout();\n return redirectToReturnUrl();\n }", "private void showToastOnSignOut() {\n final String signOutText = \"Signed Out.\";\n currentUserTextView.setText(\"\");\n Toast.makeText(getContext(), signOutText, Toast.LENGTH_SHORT)\n .show();\n }", "public void signOutOfDD()\n\t{\n\t\tclickAccountNameIcon();\n\t\tclickSignOutLink();\n\t\t\n\t}", "@Override\n\t\t\t\tpublic void confirm() {\n\t\t\t\t\tdialog.dismiss();\n\t\t\t\t}", "public boolean signOut(String username);", "public void logout() {\n \n }", "public String logout() {\n String destination = \"/index?faces-redirect=true\";\n\n // FacesContext provides access to other container managed objects,\n // such as the HttpServletRequest object, which is needed to perform\n // the logout operation.\n FacesContext context = FacesContext.getCurrentInstance();\n HttpServletRequest request = \n (HttpServletRequest) context.getExternalContext().getRequest();\n\n try {\n // added May 12, 2014\n HttpSession session = request.getSession();\n session.invalidate();\n \n // this does not invalidate the session but does null out the user Principle\n request.logout();\n } catch (ServletException e) {\n log.log(Level.SEVERE, \"Failed to logout user!\", e);\n destination = \"/loginerror?faces-redirect=true\";\n }\n\n return destination; // go to destination\n }", "public void onDismiss(DialogInterface dialog) {\r\n\t\tSystem.out.println(error);\r\n\t\tif (error) {\r\n\t\t\t//new AlertMessage(context, \"Incorrect username and/or password\");\r\n\t\t}\r\n\t}", "public void logout() {\n javafx.application.Platform.runLater(clientBar::logOut);\n }", "public void logOut(){\n Intent intent=new Intent( getApplicationContext(), Login.class );\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);\n startActivity( intent );\n progressDialog.dismiss();\n finish();\n }", "private void openExitWindowConfirmation() {\n\t\t// int opcion = JOptionPane.showConfirmDialog(this, \"Desea salir del\n\t\t// Chat\", \"Confirmación\",\n\t\t// JOptionPane.YES_NO_OPTION);\n\t\t// if (opcion == JOptionPane.YES_OPTION) {\n\t\tthis.setVisible(false);\n\t\t// }\n\t}", "public void logout(){\n logger.debug(\"logout from the application\");\n driver.findElement(oLogout).click();\n new WebDriverWait(driver,10).until(\n ExpectedConditions.titleIs(\"Sign-on: Mercury Tours\"));\n\n }", "private void dialogExit() {\n\t\tint result = showConfirmDialog(frmRentCalc, \"Вы действительно ходите выйти?\", \"Окно подтверждения\", YES_NO_OPTION, QUESTION_MESSAGE);\r\n\t\tif (result == YES_OPTION) {\r\n\t\t\tSystem.exit(0);\r\n\t\t} else {\r\n\t\t\tif (result == NO_OPTION) {\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public void logoutUser(final Activity a) {\n\n new LovelyStandardDialog(a)\n .setButtonsColorRes(R.color.colorPrimary)\n .setMessage(R.string.logOutAccountDialog)\n .setPositiveButton(android.R.string.ok, new View.OnClickListener() {\n @Override\n public void onClick(View v) {\n session.setLogin(false);\n\n db.deleteUsers();\n\n // Launching the login activity\n a.startActivity(new Intent(a, LoginActivity.class));\n a.finishAffinity();\n }\n })\n .setNegativeButton(android.R.string.no, null)\n .show();\n\n }", "public void signOut() {\n ReusableActionsPageObjects.clickOnElement(driver, signOut, logger, \"log out.\");\n }", "public void btnLogout(View view) {\n actionButton.collapse();\n\n SetSharedPreference setSharedPreference = new SetSharedPreference(this);\n // signout from app.\n setSharedPreference.setBooleanLogin(getString(R.string.boolean_login_sharedPref), \"false\");\n\n Intent intent = new Intent(this, StartupActivity.class);\n intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);\n intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);\n intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n finish();\n startActivity(intent);\n\n }", "private void logout() {\n\t\tParseUser.logOut();\n\n\t\t// Go to the login view\n\t\tstartLoginActivity();\n\t}", "public void logout() {\n // Mengambil method clear untuk menghapus data Shared Preference\n editor.clear();\n // Mengeksekusi perintah clear\n editor.commit();\n // Membuat intent untuk berpindah halaman\n Intent intent = new Intent(context, LoginActivity.class);\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);\n intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);\n context.startActivity(intent);\n }", "public void LogoutListener()\n {\n \tLogout.addActionListener(new ActionListener(){\n\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tString sql = \"UPDATE admin_login SET isLogedin = '0' WHERE isLogedin = '1'\";\n\t\t\t\n\t\t\t\tJOptionPane.showMessageDialog(card, \"You have logged Out from admin \");\n\n\t\t\t\ttry {\n\t\t\t\t\t\t\tdb.ExecuteStatement(sql);\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tLoginName.setText(\"\");\n\t\t\t\t\t\t\tLoginLabel.setForeground(Color.red);//disable logout button on login\n\t\t\t\t\t\t\tLogout.setEnabled(false);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//enable login button on logout\n\t\t\t\t\t\t\tLogIn.setEnabled(true);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t//Reset staff id and password here\n\t\t\t\t\t\t\t UserName.setText(\"\");\n\t\t\t\t\t\t\t Password.setText(\"\");\n\t\t\t\t\t\t\tresetPassword.setEnabled(true);\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t UserName.setEnabled(true);\n\t\t\t\t\t\t\t Password.setEnabled(true);\n\t\t\t\t\t} catch (SQLException e1) {}\n\t\t\t\t\n\t\t\t}\n \t\t\n \t});\n }", "public void Logout()\n {\n isLoggedIn = false;\n connection.Disconnect(); \n connection = null;\n }", "private void signOut() {\n mAuth.signOut();\n updateUI(null);\n }", "@Override\r\n\t\t\tpublic void onLogout() {\n\t\t\t\tshowToast(\"onLogout---\");\r\n\t\t\t}", "public void logOut() {\n\t\tToken.getIstance().setHashPassword(null);\n\t}", "public void doLogout() {\n mSingleton.getCookieStore().removeUser(mUser);\n mPreferences.setUser(null);\n new ActivityTable().flush();\n\n //update variables\n mUser = null;\n mLogin = false;\n\n //reset drawer\n restartActivity();\n }", "@Then(\"^Message displayed LogOut Successfully$\")\r\n\tpublic void message_displayed_LogOut_Successfully() throws Throwable {\n\t\tSystem.out.println(\"Logout Successfully\");\r\n\t\tdriver.quit();\r\n\t}", "public void logout(String username)throws java.rmi.RemoteException\n\t\t\t\t{\n\t\t\n\t\t\t\t// remove user from list of logged in users\n\t\t\t\tloggedIn.remove(username);\n\t\t\t\t// Display list of logged in users on Server console window\n\t\t\t\tSystem.out.println(loggedIn.toString());\n\t\t\t\t\n\t\t\t\t//Confirmation message.\n\t\t\t\tmessage = \"Logging out \"+ username;\n\t\t\t\tJOptionPane.showMessageDialog(null,message);\n\t\t\n\t\t\t\t}", "public void logout(){\n\t\t\n\t\tcurrentUser.logout();\n\t\tcurrentUser = null;\n\t\tchangeViewPort(new GUI_Logout(\"\", \"\", this));\n\t}", "@Override\n public void onClick(View v) {\n\n MainActivity.alertDialog = new AlertDialog.Builder(v.getContext());\n MainActivity.alertDialog .setTitle(\"Logout\");\n final TextView input = new TextView(getContext());\n input.setTextSize(18);\n input.setGravity(Gravity.CENTER | Gravity.BOTTOM);\n\n input.setText(\"Are you sure you want to logout?\");\n\n MainActivity.alertDialog.setView(input);\n MainActivity.alertDialog.setCancelable(true);\n MainActivity.alertDialog.setPositiveButton(\"Yes\", new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) {\n\n LoginActivity.restart(getContext(),0);\n\n }\n });\n\n MainActivity.alertDialog .setNegativeButton(\"No\", new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) {\n\n dialog.dismiss();\n }\n });\n MainActivity.alertDialog .show();\n\n }", "@When(\"^user should signout to exit from the loggedin page$\")\n\tpublic void user_should_signout_to_exit_from_the_loggedin_page() throws Throwable {\n\t\telementClick(pa.getAp().getLogout());\n\t\t\n\t \n\t}", "@FXML\r\n\tvoid logout_btn_clicked(MouseEvent event) {\r\n\t\tString quary = \"UPDATE users SET connection_status = 0 WHERE userID = \" + MainClientGUI.getUserID();\r\n\t\tMessage message = new Message(MessageType.LOGOUT, \"MarketingAgentSalesMainController_logout_clicked\", quary);\r\n\t\tMainClientGUI.client.handleMessageFromClientUI(message);\r\n\t}", "public LoginPage logUserOut() {\n if (browser.findElements(By.id(LOGOUT_BUTTON_ID)).isEmpty()) {\n throw new RuntimeException(\"Cannot log the user out because the logout button is not visible. Is user logged in?\");\n }\n\n browser.findElement(By.id(LOGOUT_BUTTON_ID)).click();\n\n LoginPage shown = new LoginPage(browser);\n shown.waitUntilPageIsOpen();\n return shown;\n }", "public String redirectToLogout() {\r\n\t\treturn \"/logout.xhtml?faces-redirect=true\";\r\n\t}", "@FXML\n void OnActionLogout(ActionEvent event) {\n System.exit(0);\n }", "public void logOut() {\n try {\n // getGlobalNavigation().clickSignOut();\n } catch (TimeoutException e) {\n Log.log(\"logOut\", \"page loads for more than 30 seconds\", true);\n }\n }", "public void performLogout(Context context) {\n AppMethodBeat.m2504i(92641);\n final LoginManager loginManager = getLoginManager();\n if (LoginButton.this.confirmLogout) {\n CharSequence string;\n String string2 = LoginButton.this.getResources().getString(C25738R.string.f8623a5);\n String string3 = LoginButton.this.getResources().getString(C25738R.string.f8620a1);\n Profile currentProfile = Profile.getCurrentProfile();\n if (currentProfile == null || currentProfile.getName() == null) {\n string = LoginButton.this.getResources().getString(C25738R.string.f8626a8);\n } else {\n string = String.format(LoginButton.this.getResources().getString(C25738R.string.f8625a7), new Object[]{currentProfile.getName()});\n }\n Builder builder = new Builder(context);\n builder.setMessage(string).setCancelable(true).setPositiveButton(string2, new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialogInterface, int i) {\n AppMethodBeat.m2504i(92638);\n loginManager.logOut();\n AppMethodBeat.m2505o(92638);\n }\n }).setNegativeButton(string3, null);\n builder.create().show();\n AppMethodBeat.m2505o(92641);\n return;\n }\n loginManager.logOut();\n AppMethodBeat.m2505o(92641);\n }", "public void confirmExit() {\n boolean confirmOnExit = getIntent().getExtras().getBoolean(MapsActivity.PARAMETERS.CONFIRM_ON_EXIT, true);\n if (confirmOnExit) {\n new AlertDialog.Builder(this).setTitle(R.string.button_confirm_exit_title)\n .setMessage(R.string.button_confirm_exit)\n .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) {\n finish();\n return;\n }\n }).setNegativeButton(android.R.string.no, new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) {\n // do nothing\n }\n }).show();\n } else {\n finish();\n }\n }", "public void onOK() {\n\t\t\t\t\t\t\tlogout();\n\t\t\t\t\t\t}", "private void confirmDeleteLog() {\n new AlertDialog.Builder(this)\n .setTitle(R.string.confirm_delete_log_title)\n .setMessage(R.string.confirm_delete_log_message)\n .setPositiveButton(R.string.btn_delete_log, (dialog, which) -> {\n service.deleteEntireAuditLog();\n dialog.dismiss();\n })\n .setNegativeButton(R.string.btn_cancel, (dialog, which) -> dialog.dismiss())\n .show();\n }", "@Override\n public void onAuthenticationCancelled() {\n // Hide the progress indicator\n this.mProgressDialog.hide();\n }", "public void confirmExit() {\n int resposta = JOptionPane.showConfirmDialog(this,\n \"Really exit?\", \"Exit\",\n JOptionPane.YES_NO_OPTION,\n JOptionPane.QUESTION_MESSAGE);\n if (resposta == JOptionPane.YES_OPTION) {\n System.exit(0);\n }\n }", "private void logoutUser() {\n session.setLogin(false);\n\n db.deleteUsers();\n\n // Launching the login activity\n Intent intent = new Intent(EscolhaProjeto.this, LoginActivity.class);\n startActivity(intent);\n finish();\n }", "protected void userLoggedOut() {\n\t\tRuvego.userLoggedOut();\n\t\tResultsActivityMenu.userLoggedOut();\n\t\tHistory.newItem(\"homePage\");\n\t}", "public void return_logout_success() {\r\n\t\tMainClientGUI.loggedIn = false;\r\n\t\tswitchScenes(\"/client/boundry/LoginForm.fxml\", \"/client/boundry/MainCss.css\");\r\n\t}" ]
[ "0.74362296", "0.738368", "0.72921884", "0.7183586", "0.68058383", "0.65120643", "0.646362", "0.64144045", "0.64113426", "0.6391181", "0.6344662", "0.6330394", "0.62265795", "0.6218855", "0.6203315", "0.6150747", "0.6150192", "0.6149658", "0.6144994", "0.6125998", "0.6123832", "0.6107559", "0.6100621", "0.6089919", "0.6068711", "0.60349065", "0.60261446", "0.60209376", "0.5990807", "0.5987008", "0.5980796", "0.59710747", "0.5969845", "0.5956924", "0.595651", "0.5941778", "0.5935349", "0.5921685", "0.59135354", "0.59032243", "0.5880041", "0.58766705", "0.5874106", "0.5833156", "0.58331233", "0.5817986", "0.5816491", "0.5816443", "0.5816443", "0.58042026", "0.5781744", "0.5772953", "0.57717305", "0.5759982", "0.5745814", "0.5745229", "0.5742643", "0.5740426", "0.57330173", "0.57274014", "0.57253623", "0.5717347", "0.5715095", "0.571159", "0.5700162", "0.5698306", "0.5697521", "0.5689491", "0.5686832", "0.5685982", "0.56817406", "0.56708974", "0.56653285", "0.56570226", "0.5647855", "0.5646353", "0.5646178", "0.564442", "0.56397027", "0.56229603", "0.56151867", "0.5612022", "0.5610531", "0.5602764", "0.5602588", "0.5600363", "0.5600179", "0.5600017", "0.55991954", "0.5598564", "0.55968416", "0.55958205", "0.559485", "0.5592405", "0.55801654", "0.55798334", "0.55791134", "0.5577847", "0.55771935", "0.55734646" ]
0.7561222
0
obj = () element; return obj.someMethod();
@Override public String getText(Object element) { return "test"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void element() {}", "SomeClass someClass();", "public void lambaAsObjectExample() {\n }", "public void method(){}", "Object element();", "Object element();", "void method();", "void method();", "void mo67921a(Object obj);", "public abstract Object mo26777y();", "public T caseElement(Element object)\n {\n return null;\n }", "FunCall createFunCall();", "SomePlus createSomePlus();", "public void andThisIsAMethodName(){}", "public void methodA();", "public interface AnonymousClass4O {\n}", "void m21805a(Object obj);", "ObjectElement createObjectElement();", "Element() {\n\t}", "public abstract Object mo1185b();", "public interface AnonymousClass0Y6 {\n void A3h();\n\n void A41();\n}", "public Object lambda49(Object elt, Object obj) {\n frame34 frame34;\n Object cons;\n Object ans = obj;\n new frame34();\n frame34 frame342 = frame34;\n frame342.staticLink = this;\n frame34 frame343 = frame342;\n frame343.elt = elt;\n if (srfi1.any$V(frame343.lambda$Fn33, ans, new Object[0]) != Boolean.FALSE) {\n cons = ans;\n } else {\n cons = C1259lists.cons(frame343.elt, ans);\n }\n return cons;\n }", "public abstract Object mo1771a();", "public T caseElement(Element object) {\n\t\treturn null;\n\t}", "public T caseElement(Element object) {\n\t\treturn null;\n\t}", "public T caseElement(Element object) {\n\t\treturn null;\n\t}", "@Override\n\tpublic void some() {\n\t\t\n\t}", "Element asElement();", "Exp\ngetReturnValue();", "public void amethod() {\n\t}", "public interface AnonymousClass1MS {\n void AHV();\n\n void AHo();\n}", "@Test\n public void testInstanceMethodReference() {\n final Car car = Car.create(Car::new);\n final List<Car> cars = Collections.singletonList(car);\n cars.forEach(Car::repair);\n cars.forEach(c -> c.repair()); // 等价于写成lambda表达式的形式\n }", "void mo6504by(Object obj);", "public T caseFunctionCall(FunctionCall object)\n {\n return null;\n }", "public T caseFunction(Function object) {\n\t\treturn null;\n\t}", "public T caseFunction(Function object) {\n\t\treturn null;\n\t}", "public void my_method();", "public interface AnonymousClass7l {\n void A48();\n\n void A4R(boolean z);\n}", "public void method4() {\n }", "public T caseFunctionRef(FunctionRef object)\n {\n return null;\n }", "void fun();", "void fun();", "public interface AnonymousClass05L {\n}", "Object getIf1();", "public void callit();", "void m21809e(Object obj);", "public Object caseElement(Element object) {\r\n\t\treturn null;\r\n\t}", "public void mo1774a(Object obj) {\n }", "void m21807c(Object obj);", "Exp\ngetExp2();", "Object produce();", "void mo3207a(Object obj);", "void call(Person obj);", "interface MyFirstVoidFunctionalInterface {\n\n public void methodOne();\n\n}", "void method25()\n {\n }", "void m21806b(Object obj);", "public T caseFnCallExpr(FnCallExpr object) {\n\t\treturn null;\n\t}", "public abstract void mo1184a(Object obj);", "Object peekABoo();", "public abstract String mo83558a(Object obj);", "Exp\ngetExp1();", "Method createMethod();", "Method createMethod();", "private Element get() {\n return new MockElement();\n }", "public interface AnonymousClass0RF {\n}", "public interface AnonymousClass1lE {\n void A7X(String str, String str2, String str3);\n\n void A7Z(String str, String str2, @Nullable Map<String, String> map);\n\n void A7b(String str, String str2, Throwable th, @Nullable Map<String, String> map);\n\n void A7d(String str, String str2, @Nullable Map<String, String> map);\n\n void A7f(String str, String str2);\n\n void A8G(String str, String str2, boolean z);\n\n boolean A9J(String str);\n}", "@Test\n\tpublic void test3() {\n\t\tFormula formula = new FormulaImpl(); \n\t\tdouble result = formula.calculate(100);\n\t\tSystem.out.println(result);\n\t\t\n\t\t// accessed from formula instance including anonymous objects.\n\t\tresult = new Formula() {\n\t\t\t@Override\n\t\t\tpublic double calculate(int n) {\n\t\t\t\treturn n * 2;\n\t\t\t}\n\t\t}.sqrt(100);\n\t\t\n\t\tSystem.out.println(result);\n\t\t\n\t}", "public scala.Function1 foo() { return null; }", "public Object call() throws Exception{\n return null;\n }", "Object getTest1();", "public void doSomething(){\n return;\n }", "Object create(Element element) throws IOException, SAXException, ParserConfigurationException;", "public b a()\r\n/* 12: */ {\r\n/* 13:13 */ return this.a;\r\n/* 14: */ }", "private RegularMethodInvocation getInvocation(Element statement) {\n return getNearestElement(statement, RegularMethodInvocation.class);\n }", "public interface AnonymousClass179 {\n void AEP(Status status);\n}", "private void doSomething(Object object) {\n\n }", "interface Interface{\n\tObject call(Object value);\n}", "public Object obj()\n\t{\n\t\treturn object;\n\t}", "public static void main(String[] args) {\n\n A obj = new A(){\n void fun1() {\n System.out.println(\"Anonumous Overidden method \");\n }\n // can't create \n // void fun2(){\n // System.out.println(\"fun2 method \");\n // }\n };\n obj.fun1(); // Anonymous Overidden method \n\n\n C obj2 = new C(){\n void funC1(){\n System.out.println(\"func1 \");\n }\n void funC2(){\n System.out.println(\"func2 \");\n }\n };\n obj2.funC1();//func1\n obj2.funC2(); //func2\n }", "public class_4 method_9() {\n return this.method_17();\n }", "public T caseUpperFunction(UpperFunction object)\n {\n return null;\n }", "public T caseNewExpression(NewExpression object)\n {\n return null;\n }", "void method1();", "Function createFunction();", "public static void main(String[] args) {\n\n String how = \"hard\";\n\n /*\n how = \"dd\";\n Company.letWork(new Person() {\n public void work(){\n System.out.println(String.format(\"I work %s!\", how));\n }\n });\n*/\n Company.letWork((() -> {\n System.out.println(String.format(\"I work %s!\", how));\n }));\n }", "public interface AnonymousClass0It {\n void A29(C04080Iy v, AbstractC27431Py v2);\n\n boolean A2R();\n\n boolean AAH();\n\n boolean AB6();\n}", "public void a(Object obj) {\n }", "private void someUtilityMethod() {\n }", "private void someUtilityMethod() {\n }", "public interface AnonymousClass04P {\n File A3x(Uri uri);\n\n Uri A5C(File file);\n}", "public static final String callMethodFor (final EFormElement element)\n {\n String value = null;\n\n switch (element)\n {\n /*\n * Order pane\n */\n case ORDER_ID:\n value = invoiceData.getInvoiceRecipient ().getOrderReference ().getOrderId ();\n break;\n\n /*\n * Special case order reference date, set to null\n */\n case ORDER_REFERENCEDATE:\n invoiceData.getInvoiceRecipient ().getOrderReference ().setReferenceDate (null);\n break;\n\n /*\n * Special case order reference description, set to null\n */\n case ORDER_DESCRIPTION:\n invoiceData.getInvoiceRecipient ().getOrderReference ().setDescription (null);\n break;\n\n case SUPPLIER_ID:\n value = invoiceData.getBiller ().getSupplierID ();\n break;\n\n /*\n * Special case invoice number, set to null\n */\n case INVOICE_NUMBER:\n invoiceData.setInvoiceNumber (null);\n break;\n\n /*\n * Special case invoice date, set to current date\n */\n case INVOICE_DATE:\n invoiceData.setInvoiceDate (resourceManager.getInvoiceDateManager ().getCurrentDateAsString ());\n break;\n\n /*\n * Special case delivery date / delivery period, set them to null\n */\n case FROM_DATE:\n invoiceData.getDelivery ().setDeliveryDate (null);\n invoiceData.getDelivery ().setDeliveryPeriod (null);\n break;\n\n case COMMENT:\n value = invoiceData.getComment ();\n break;\n\n /*\n * Contact pane - biller\n */\n case BILLER_NAME:\n value = invoiceData.getBiller ().getAddress ().getName ();\n break;\n\n case BILLER_STREET:\n value = invoiceData.getBiller ().getAddress ().getStreet ();\n break;\n\n case BILLER_ZIP:\n value = invoiceData.getBiller ().getAddress ().getZip ();\n break;\n\n case BILLER_TOWN:\n value = invoiceData.getBiller ().getAddress ().getTown ();\n break;\n\n case BILLER_COUNTRY:\n value = invoiceData.getBiller ().getAddress ().getCountry ();\n break;\n\n case BILLER_EMAIL:\n value = invoiceData.getBiller ().getAddress ().getEmail ();\n break;\n\n case BILLER_PHONE:\n value = invoiceData.getBiller ().getAddress ().getPhone ();\n break;\n\n case BILLER_CONTACT:\n value = invoiceData.getBiller ().getAddress ().getContact ();\n break;\n\n /*\n * Contact pane - invoice recipient\n */\n case INVOICERECIPIENT_NAME:\n value = invoiceData.getInvoiceRecipient ().getAddress ().getName ();\n break;\n\n case INVOICERECIPIENT_STREET:\n value = invoiceData.getInvoiceRecipient ().getAddress ().getStreet ();\n break;\n\n case INVOICERECIPIENT_ZIP:\n value = invoiceData.getInvoiceRecipient ().getAddress ().getZip ();\n break;\n\n case INVOICERECIPIENT_TOWN:\n value = invoiceData.getInvoiceRecipient ().getAddress ().getTown ();\n break;\n\n case INVOICERECIPIENT_COUNTRY:\n value = invoiceData.getInvoiceRecipient ().getAddress ().getCountry ();\n break;\n\n case INVOICERECIPIENT_EMAIL:\n value = invoiceData.getInvoiceRecipient ().getAddress ().getEmail ();\n break;\n\n case INVOICERECIPIENT_PHONE:\n value = invoiceData.getInvoiceRecipient ().getAddress ().getPhone ();\n break;\n\n case INVOICERECIPIENT_CONTACT:\n value = invoiceData.getInvoiceRecipient ().getAddress ().getContact ();\n break;\n\n /*\n * Contact pane - delivery\n */\n /*\n * Special case delivery id, set to null\n */\n case DELIVERY_ID:\n invoiceData.getDelivery ().setDeliveryID (null);\n break;\n\n case DELIVERY_NAME:\n value = invoiceData.getDelivery ().getAddress ().getName ();\n break;\n\n case DELIVERY_STREET:\n value = invoiceData.getDelivery ().getAddress ().getStreet ();\n break;\n\n case DELIVERY_ZIP:\n value = invoiceData.getDelivery ().getAddress ().getZip ();\n break;\n\n case DELIVERY_TOWN:\n value = invoiceData.getDelivery ().getAddress ().getTown ();\n break;\n\n case DELIVERY_COUNTRY:\n value = invoiceData.getDelivery ().getAddress ().getCountry ();\n break;\n\n case DELIVERY_EMAIL:\n value = invoiceData.getDelivery ().getAddress ().getEmail ();\n break;\n\n case DELIVERY_PHONE:\n value = invoiceData.getDelivery ().getAddress ().getPhone ();\n break;\n\n case DELIVERY_CONTACT:\n value = invoiceData.getDelivery ().getAddress ().getContact ();\n break;\n\n /*\n * Contact pane - delivery\n */\n case PAYMENT_BIC:\n value = invoiceData.getPaymentMethod ().getUniversalBankTransaction ().getBeneficiaryAccount ().getBic ();\n break;\n\n case PAYMENT_IBAN:\n value = invoiceData.getPaymentMethod ().getUniversalBankTransaction ().getBeneficiaryAccount ().getIban ();\n break;\n\n case PAYMENT_ACCOUNTOWNER:\n value = invoiceData.getPaymentMethod ()\n .getUniversalBankTransaction ()\n .getBeneficiaryAccount ()\n .getBankAccountOwner ();\n break;\n\n /*\n * Default return value\n */\n default:\n value = null;\n }\n\n return value;\n }", "public void doSomething() {\n\t}", "@Override\n\tpublic void visit(Function arg0) {\n\t\t\n\t}", "public T casePropertyCallOnSelfExpCS(PropertyCallOnSelfExpCS object) {\r\n return null;\r\n }", "void method_115();", "public WebElement apply(WebDriver arg0) //We are defining the function taking the WebDriver as input \n {\n WebElement ele = arg0.findElement(By.xpath(spath));\n return ele;\n }", "@FunctionalInterface\npublic interface ICorfuSMRUpcallTarget<R> {\n\n /** Do the upcall.\n * @param obj The upcall target.\n * @param args The arguments to the upcall.\n *\n * @return The return value of the upcall.\n */\n Object upcall(R obj, Object[] args);\n}", "@Override\n public Optional<ExecutableElement> factoryMethod() {\n return ElementFilter.methodsIn(element().getEnclosedElements()).stream()\n .filter(element -> element.getModifiers().contains(Modifier.STATIC))\n .filter(element -> element.getSimpleName().toString().equalsIgnoreCase(\"create\"))\n .filter(element -> element.getReturnType().equals(element().asType()))\n .findAny();\n }", "public abstract Member mo23408O();", "private Expr expression() {\n return assignment();\n }", "H create(Method method);" ]
[ "0.6052916", "0.59961116", "0.5737088", "0.5512692", "0.550904", "0.550904", "0.5508685", "0.5508685", "0.5472092", "0.5428739", "0.53995365", "0.5375618", "0.5340038", "0.53204834", "0.5318751", "0.52849615", "0.5237378", "0.5230123", "0.5215885", "0.520501", "0.52029234", "0.51974773", "0.5196401", "0.51802564", "0.51802564", "0.51802564", "0.517362", "0.51567703", "0.5144149", "0.5144071", "0.5131627", "0.5126412", "0.5121742", "0.5114948", "0.51122797", "0.51122797", "0.51089424", "0.51079696", "0.5100679", "0.51002276", "0.5099634", "0.5099634", "0.5083394", "0.5080434", "0.50676817", "0.5064062", "0.50589055", "0.5058175", "0.50504404", "0.5045337", "0.50295544", "0.50286597", "0.5025493", "0.5024611", "0.50229836", "0.5009523", "0.5008563", "0.50077146", "0.49979863", "0.4995576", "0.4995399", "0.49659535", "0.49659535", "0.49625528", "0.49566403", "0.4944181", "0.49416527", "0.49407405", "0.4932815", "0.49209452", "0.49129096", "0.49105722", "0.49094877", "0.48970827", "0.4888018", "0.488744", "0.4887276", "0.48746383", "0.48743492", "0.4871025", "0.48702127", "0.486209", "0.48613963", "0.48568854", "0.48526514", "0.48442203", "0.48415983", "0.48344538", "0.48344538", "0.48241132", "0.4814824", "0.48147318", "0.48146302", "0.48131666", "0.48123953", "0.48109436", "0.4809136", "0.48046497", "0.4800715", "0.48005342", "0.4798881" ]
0.0
-1
obj = () element; return obj.someMethod();
@Override public String getText(Object element) { return "test5"; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void element() {}", "SomeClass someClass();", "public void lambaAsObjectExample() {\n }", "public void method(){}", "Object element();", "Object element();", "void method();", "void method();", "void mo67921a(Object obj);", "public abstract Object mo26777y();", "public T caseElement(Element object)\n {\n return null;\n }", "FunCall createFunCall();", "SomePlus createSomePlus();", "public void andThisIsAMethodName(){}", "public void methodA();", "public interface AnonymousClass4O {\n}", "void m21805a(Object obj);", "ObjectElement createObjectElement();", "Element() {\n\t}", "public abstract Object mo1185b();", "public interface AnonymousClass0Y6 {\n void A3h();\n\n void A41();\n}", "public Object lambda49(Object elt, Object obj) {\n frame34 frame34;\n Object cons;\n Object ans = obj;\n new frame34();\n frame34 frame342 = frame34;\n frame342.staticLink = this;\n frame34 frame343 = frame342;\n frame343.elt = elt;\n if (srfi1.any$V(frame343.lambda$Fn33, ans, new Object[0]) != Boolean.FALSE) {\n cons = ans;\n } else {\n cons = C1259lists.cons(frame343.elt, ans);\n }\n return cons;\n }", "public abstract Object mo1771a();", "public T caseElement(Element object) {\n\t\treturn null;\n\t}", "public T caseElement(Element object) {\n\t\treturn null;\n\t}", "public T caseElement(Element object) {\n\t\treturn null;\n\t}", "@Override\n\tpublic void some() {\n\t\t\n\t}", "Element asElement();", "Exp\ngetReturnValue();", "public void amethod() {\n\t}", "public interface AnonymousClass1MS {\n void AHV();\n\n void AHo();\n}", "@Test\n public void testInstanceMethodReference() {\n final Car car = Car.create(Car::new);\n final List<Car> cars = Collections.singletonList(car);\n cars.forEach(Car::repair);\n cars.forEach(c -> c.repair()); // 等价于写成lambda表达式的形式\n }", "void mo6504by(Object obj);", "public T caseFunctionCall(FunctionCall object)\n {\n return null;\n }", "public T caseFunction(Function object) {\n\t\treturn null;\n\t}", "public T caseFunction(Function object) {\n\t\treturn null;\n\t}", "public void my_method();", "public interface AnonymousClass7l {\n void A48();\n\n void A4R(boolean z);\n}", "public void method4() {\n }", "public T caseFunctionRef(FunctionRef object)\n {\n return null;\n }", "void fun();", "void fun();", "public interface AnonymousClass05L {\n}", "Object getIf1();", "public void callit();", "void m21809e(Object obj);", "public Object caseElement(Element object) {\r\n\t\treturn null;\r\n\t}", "public void mo1774a(Object obj) {\n }", "void m21807c(Object obj);", "Exp\ngetExp2();", "Object produce();", "void mo3207a(Object obj);", "void call(Person obj);", "interface MyFirstVoidFunctionalInterface {\n\n public void methodOne();\n\n}", "void method25()\n {\n }", "void m21806b(Object obj);", "public T caseFnCallExpr(FnCallExpr object) {\n\t\treturn null;\n\t}", "public abstract void mo1184a(Object obj);", "Object peekABoo();", "public abstract String mo83558a(Object obj);", "Exp\ngetExp1();", "Method createMethod();", "Method createMethod();", "private Element get() {\n return new MockElement();\n }", "public interface AnonymousClass0RF {\n}", "public interface AnonymousClass1lE {\n void A7X(String str, String str2, String str3);\n\n void A7Z(String str, String str2, @Nullable Map<String, String> map);\n\n void A7b(String str, String str2, Throwable th, @Nullable Map<String, String> map);\n\n void A7d(String str, String str2, @Nullable Map<String, String> map);\n\n void A7f(String str, String str2);\n\n void A8G(String str, String str2, boolean z);\n\n boolean A9J(String str);\n}", "@Test\n\tpublic void test3() {\n\t\tFormula formula = new FormulaImpl(); \n\t\tdouble result = formula.calculate(100);\n\t\tSystem.out.println(result);\n\t\t\n\t\t// accessed from formula instance including anonymous objects.\n\t\tresult = new Formula() {\n\t\t\t@Override\n\t\t\tpublic double calculate(int n) {\n\t\t\t\treturn n * 2;\n\t\t\t}\n\t\t}.sqrt(100);\n\t\t\n\t\tSystem.out.println(result);\n\t\t\n\t}", "public scala.Function1 foo() { return null; }", "public Object call() throws Exception{\n return null;\n }", "Object getTest1();", "public void doSomething(){\n return;\n }", "Object create(Element element) throws IOException, SAXException, ParserConfigurationException;", "public b a()\r\n/* 12: */ {\r\n/* 13:13 */ return this.a;\r\n/* 14: */ }", "private RegularMethodInvocation getInvocation(Element statement) {\n return getNearestElement(statement, RegularMethodInvocation.class);\n }", "public interface AnonymousClass179 {\n void AEP(Status status);\n}", "private void doSomething(Object object) {\n\n }", "interface Interface{\n\tObject call(Object value);\n}", "public Object obj()\n\t{\n\t\treturn object;\n\t}", "public static void main(String[] args) {\n\n A obj = new A(){\n void fun1() {\n System.out.println(\"Anonumous Overidden method \");\n }\n // can't create \n // void fun2(){\n // System.out.println(\"fun2 method \");\n // }\n };\n obj.fun1(); // Anonymous Overidden method \n\n\n C obj2 = new C(){\n void funC1(){\n System.out.println(\"func1 \");\n }\n void funC2(){\n System.out.println(\"func2 \");\n }\n };\n obj2.funC1();//func1\n obj2.funC2(); //func2\n }", "public class_4 method_9() {\n return this.method_17();\n }", "public T caseUpperFunction(UpperFunction object)\n {\n return null;\n }", "public T caseNewExpression(NewExpression object)\n {\n return null;\n }", "void method1();", "Function createFunction();", "public static void main(String[] args) {\n\n String how = \"hard\";\n\n /*\n how = \"dd\";\n Company.letWork(new Person() {\n public void work(){\n System.out.println(String.format(\"I work %s!\", how));\n }\n });\n*/\n Company.letWork((() -> {\n System.out.println(String.format(\"I work %s!\", how));\n }));\n }", "public interface AnonymousClass0It {\n void A29(C04080Iy v, AbstractC27431Py v2);\n\n boolean A2R();\n\n boolean AAH();\n\n boolean AB6();\n}", "public void a(Object obj) {\n }", "private void someUtilityMethod() {\n }", "private void someUtilityMethod() {\n }", "public interface AnonymousClass04P {\n File A3x(Uri uri);\n\n Uri A5C(File file);\n}", "public static final String callMethodFor (final EFormElement element)\n {\n String value = null;\n\n switch (element)\n {\n /*\n * Order pane\n */\n case ORDER_ID:\n value = invoiceData.getInvoiceRecipient ().getOrderReference ().getOrderId ();\n break;\n\n /*\n * Special case order reference date, set to null\n */\n case ORDER_REFERENCEDATE:\n invoiceData.getInvoiceRecipient ().getOrderReference ().setReferenceDate (null);\n break;\n\n /*\n * Special case order reference description, set to null\n */\n case ORDER_DESCRIPTION:\n invoiceData.getInvoiceRecipient ().getOrderReference ().setDescription (null);\n break;\n\n case SUPPLIER_ID:\n value = invoiceData.getBiller ().getSupplierID ();\n break;\n\n /*\n * Special case invoice number, set to null\n */\n case INVOICE_NUMBER:\n invoiceData.setInvoiceNumber (null);\n break;\n\n /*\n * Special case invoice date, set to current date\n */\n case INVOICE_DATE:\n invoiceData.setInvoiceDate (resourceManager.getInvoiceDateManager ().getCurrentDateAsString ());\n break;\n\n /*\n * Special case delivery date / delivery period, set them to null\n */\n case FROM_DATE:\n invoiceData.getDelivery ().setDeliveryDate (null);\n invoiceData.getDelivery ().setDeliveryPeriod (null);\n break;\n\n case COMMENT:\n value = invoiceData.getComment ();\n break;\n\n /*\n * Contact pane - biller\n */\n case BILLER_NAME:\n value = invoiceData.getBiller ().getAddress ().getName ();\n break;\n\n case BILLER_STREET:\n value = invoiceData.getBiller ().getAddress ().getStreet ();\n break;\n\n case BILLER_ZIP:\n value = invoiceData.getBiller ().getAddress ().getZip ();\n break;\n\n case BILLER_TOWN:\n value = invoiceData.getBiller ().getAddress ().getTown ();\n break;\n\n case BILLER_COUNTRY:\n value = invoiceData.getBiller ().getAddress ().getCountry ();\n break;\n\n case BILLER_EMAIL:\n value = invoiceData.getBiller ().getAddress ().getEmail ();\n break;\n\n case BILLER_PHONE:\n value = invoiceData.getBiller ().getAddress ().getPhone ();\n break;\n\n case BILLER_CONTACT:\n value = invoiceData.getBiller ().getAddress ().getContact ();\n break;\n\n /*\n * Contact pane - invoice recipient\n */\n case INVOICERECIPIENT_NAME:\n value = invoiceData.getInvoiceRecipient ().getAddress ().getName ();\n break;\n\n case INVOICERECIPIENT_STREET:\n value = invoiceData.getInvoiceRecipient ().getAddress ().getStreet ();\n break;\n\n case INVOICERECIPIENT_ZIP:\n value = invoiceData.getInvoiceRecipient ().getAddress ().getZip ();\n break;\n\n case INVOICERECIPIENT_TOWN:\n value = invoiceData.getInvoiceRecipient ().getAddress ().getTown ();\n break;\n\n case INVOICERECIPIENT_COUNTRY:\n value = invoiceData.getInvoiceRecipient ().getAddress ().getCountry ();\n break;\n\n case INVOICERECIPIENT_EMAIL:\n value = invoiceData.getInvoiceRecipient ().getAddress ().getEmail ();\n break;\n\n case INVOICERECIPIENT_PHONE:\n value = invoiceData.getInvoiceRecipient ().getAddress ().getPhone ();\n break;\n\n case INVOICERECIPIENT_CONTACT:\n value = invoiceData.getInvoiceRecipient ().getAddress ().getContact ();\n break;\n\n /*\n * Contact pane - delivery\n */\n /*\n * Special case delivery id, set to null\n */\n case DELIVERY_ID:\n invoiceData.getDelivery ().setDeliveryID (null);\n break;\n\n case DELIVERY_NAME:\n value = invoiceData.getDelivery ().getAddress ().getName ();\n break;\n\n case DELIVERY_STREET:\n value = invoiceData.getDelivery ().getAddress ().getStreet ();\n break;\n\n case DELIVERY_ZIP:\n value = invoiceData.getDelivery ().getAddress ().getZip ();\n break;\n\n case DELIVERY_TOWN:\n value = invoiceData.getDelivery ().getAddress ().getTown ();\n break;\n\n case DELIVERY_COUNTRY:\n value = invoiceData.getDelivery ().getAddress ().getCountry ();\n break;\n\n case DELIVERY_EMAIL:\n value = invoiceData.getDelivery ().getAddress ().getEmail ();\n break;\n\n case DELIVERY_PHONE:\n value = invoiceData.getDelivery ().getAddress ().getPhone ();\n break;\n\n case DELIVERY_CONTACT:\n value = invoiceData.getDelivery ().getAddress ().getContact ();\n break;\n\n /*\n * Contact pane - delivery\n */\n case PAYMENT_BIC:\n value = invoiceData.getPaymentMethod ().getUniversalBankTransaction ().getBeneficiaryAccount ().getBic ();\n break;\n\n case PAYMENT_IBAN:\n value = invoiceData.getPaymentMethod ().getUniversalBankTransaction ().getBeneficiaryAccount ().getIban ();\n break;\n\n case PAYMENT_ACCOUNTOWNER:\n value = invoiceData.getPaymentMethod ()\n .getUniversalBankTransaction ()\n .getBeneficiaryAccount ()\n .getBankAccountOwner ();\n break;\n\n /*\n * Default return value\n */\n default:\n value = null;\n }\n\n return value;\n }", "public void doSomething() {\n\t}", "@Override\n\tpublic void visit(Function arg0) {\n\t\t\n\t}", "public T casePropertyCallOnSelfExpCS(PropertyCallOnSelfExpCS object) {\r\n return null;\r\n }", "void method_115();", "public WebElement apply(WebDriver arg0) //We are defining the function taking the WebDriver as input \n {\n WebElement ele = arg0.findElement(By.xpath(spath));\n return ele;\n }", "@FunctionalInterface\npublic interface ICorfuSMRUpcallTarget<R> {\n\n /** Do the upcall.\n * @param obj The upcall target.\n * @param args The arguments to the upcall.\n *\n * @return The return value of the upcall.\n */\n Object upcall(R obj, Object[] args);\n}", "@Override\n public Optional<ExecutableElement> factoryMethod() {\n return ElementFilter.methodsIn(element().getEnclosedElements()).stream()\n .filter(element -> element.getModifiers().contains(Modifier.STATIC))\n .filter(element -> element.getSimpleName().toString().equalsIgnoreCase(\"create\"))\n .filter(element -> element.getReturnType().equals(element().asType()))\n .findAny();\n }", "public abstract Member mo23408O();", "private Expr expression() {\n return assignment();\n }", "H create(Method method);" ]
[ "0.6052916", "0.59961116", "0.5737088", "0.5512692", "0.550904", "0.550904", "0.5508685", "0.5508685", "0.5472092", "0.5428739", "0.53995365", "0.5375618", "0.5340038", "0.53204834", "0.5318751", "0.52849615", "0.5237378", "0.5230123", "0.5215885", "0.520501", "0.52029234", "0.51974773", "0.5196401", "0.51802564", "0.51802564", "0.51802564", "0.517362", "0.51567703", "0.5144149", "0.5144071", "0.5131627", "0.5126412", "0.5121742", "0.5114948", "0.51122797", "0.51122797", "0.51089424", "0.51079696", "0.5100679", "0.51002276", "0.5099634", "0.5099634", "0.5083394", "0.5080434", "0.50676817", "0.5064062", "0.50589055", "0.5058175", "0.50504404", "0.5045337", "0.50295544", "0.50286597", "0.5025493", "0.5024611", "0.50229836", "0.5009523", "0.5008563", "0.50077146", "0.49979863", "0.4995576", "0.4995399", "0.49659535", "0.49659535", "0.49625528", "0.49566403", "0.4944181", "0.49416527", "0.49407405", "0.4932815", "0.49209452", "0.49129096", "0.49105722", "0.49094877", "0.48970827", "0.4888018", "0.488744", "0.4887276", "0.48746383", "0.48743492", "0.4871025", "0.48702127", "0.486209", "0.48613963", "0.48568854", "0.48526514", "0.48442203", "0.48415983", "0.48344538", "0.48344538", "0.48241132", "0.4814824", "0.48147318", "0.48146302", "0.48131666", "0.48123953", "0.48109436", "0.4809136", "0.48046497", "0.4800715", "0.48005342", "0.4798881" ]
0.0
-1
TODO Autogenerated method stub
@Override public Iterator<Word> iterator() { return new Iterator<Word>() { @Override public boolean hasNext() { return lword.hasNext(); } @Override public Word next() { return lword.next(); } @Override public void remove() { throw new UnsupportedOperationException(); } }; }
{ "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
Created by zhangye on 20151008.
public interface OtoCommand<R> { void execute(); void execute(IContext context); void execute(IContext context, Handler<R> resultHandler); void executeFuture(CommandContext context, Future<R> future); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void perish() {\n \n }", "private stendhal() {\n\t}", "@Override\n public void func_104112_b() {\n \n }", "@Override\n\tpublic void comer() {\n\t\t\n\t}", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "private static void cajas() {\n\t\t\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\r\n\tpublic void comer() \r\n\t{\n\t\t\r\n\t}", "@Override\n\tpublic void nadar() {\n\t\t\n\t}", "@Override\n\tprotected void interr() {\n\t}", "@Override\r\n\tpublic void tires() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void rozmnozovat() {\n\t}", "public final void mo51373a() {\n }", "public void gored() {\n\t\t\n\t}", "@Override\r\n\t\t\tpublic void annadir() {\n\r\n\t\t\t}", "public void mo38117a() {\n }", "@Override\r\n\tpublic void dormir() {\n\t\t\r\n\t}", "@Override\n\tpublic void anular() {\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\tpublic void gravarBd() {\n\t\t\n\t}", "@Override\n\tpublic void entrenar() {\n\t\t\n\t}", "protected boolean func_70814_o() { return true; }", "@Override\n\tprotected void getExras() {\n\n\t}", "@Override\n\tpublic void nghe() {\n\n\t}", "@Override\r\n\t\tpublic void init() {\n\t\t\t\r\n\t\t}", "@Override\r\n\t\t\tpublic void ayuda() {\n\r\n\t\t\t}", "@Override\n public void init() {\n\n }", "private void kk12() {\n\n\t}", "private void init() {\n\n\t}", "public void mo4359a() {\n }", "private void strin() {\n\n\t}", "private void m50366E() {\n }", "@Override\n\tpublic void ligar() {\n\t\t\n\t}", "Constructor() {\r\n\t\t \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\r\n\t}", "private void poetries() {\n\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 }", "private void init() {\n\n\n\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}", "@Override\n protected void initialize() {\n\n \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 zza.zza()\n\t\t{\n\t\t}", "@Override\n public void init() {\n }", "@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 void init() {\n }", "@Override\n public void init() {\n\n }", "@Override\n public void init() {\n\n }", "@Override\n\tpublic void sacrifier() {\n\t\t\n\t}", "public void mo6081a() {\n }", "@Override\r\n\tprotected void doF8() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void initialize() {\r\n\t\t\r\n\t\t\r\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "@Override\n\tprotected void initialize() {\n\t\t\n\t}", "public void mo55254a() {\n }", "@Override\n\tpublic void einkaufen() {\n\t}", "@Override\n\tpublic void jugar() {\n\t\t\n\t}", "@Override\r\n\tpublic void init()\r\n\t{\n\t}", "@Override\r\n\tpublic void init() {}", "public abstract void mo70713b();", "@Override\n\tpublic void init()\n\t{\n\n\t}", "public void mo12628c() {\n }", "@Override\n public void inizializza() {\n\n super.inizializza();\n }", "@Override\n protected void init() {\n }", "private Rekenhulp()\n\t{\n\t}", "@Override\n public void init() {}", "@Override\n\tpublic void one() {\n\t\t\n\t}", "public void mo21877s() {\n }", "@Override\n public void memoria() {\n \n }", "@Override\n\tpublic void init() {\n\t}", "public void skystonePos4() {\n }", "@Override\n\tpublic void nefesAl() {\n\n\t}", "@Override\n protected void initialize() \n {\n \n }", "@Override\n\tpublic void emprestimo() {\n\n\t}", "@Override\n\t\t\tpublic void ic() {\n\t\t\t\t\n\t\t\t}", "@Override\r\n\tvoid func04() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void anularFact() {\n\t\t\r\n\t}", "@Override\n protected void getExras() {\n }", "public abstract void mo56925d();", "public void mo21825b() {\n }", "public void m23075a() {\n }", "public void Exterior() {\n\t\t\r\n\t}", "@Override\r\n\tprotected void func03() {\n\t\t\r\n\t}", "public void mo21779D() {\n }" ]
[ "0.60607076", "0.6051254", "0.5994905", "0.59941316", "0.5957668", "0.594577", "0.5938891", "0.5938891", "0.5899588", "0.5880545", "0.5848571", "0.5833516", "0.5817947", "0.58174527", "0.581552", "0.5812191", "0.5807855", "0.5806288", "0.5800787", "0.57799935", "0.57799935", "0.57799935", "0.57799935", "0.57799935", "0.57733285", "0.5762021", "0.57586753", "0.5736261", "0.5734821", "0.5730084", "0.5725147", "0.5722678", "0.5720869", "0.57197076", "0.5716581", "0.5692782", "0.5683324", "0.5682529", "0.56698567", "0.56540424", "0.56540424", "0.56540424", "0.5642617", "0.5639041", "0.5639041", "0.5639041", "0.5639041", "0.5639041", "0.5639041", "0.5639041", "0.56203765", "0.56183684", "0.56183684", "0.56183684", "0.5617876", "0.5602658", "0.5602658", "0.5602658", "0.55999243", "0.55940527", "0.55923414", "0.55923414", "0.5585716", "0.55830836", "0.55830836", "0.5581449", "0.55813086", "0.5577842", "0.5564401", "0.55640596", "0.55640596", "0.55596864", "0.55583626", "0.5555629", "0.5552087", "0.55417943", "0.5537096", "0.5532495", "0.5523355", "0.5521665", "0.55200076", "0.5517722", "0.55151165", "0.5506182", "0.5502625", "0.54986393", "0.5498016", "0.54964006", "0.5495591", "0.5477013", "0.54761803", "0.54675174", "0.5466513", "0.5451388", "0.5450972", "0.54503715", "0.54443455", "0.5443889", "0.5442682", "0.54415804", "0.54400337" ]
0.0
-1
just change all string to integer as hout60 + minutes
public int findMinDifference(List<String> timePoints) { List<Integer> p = new ArrayList<>(); for(String time:timePoints){ String[] hm = time.split(":"); int h = Integer.parseInt(hm[0]); int m = Integer.parseInt(hm[1]); p.add(h*60 + m); if(h<12){ p.add((h+24)*60+m); } } int diff = Integer.MAX_VALUE; Collections.sort(p); for(int i=1; i<p.size(); i++){ diff = Math.min(p.get(i)-p.get(i-1), diff); } return diff; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private String getMinutesInTime(int time) {\n String hour = String.valueOf(time / 60);\n String minutes = String.valueOf(time % 60);\n\n if(minutes.length() < 2) {\n minutes = \"0\" + minutes;\n }\n\n return hour + \":\" + minutes;\n\n }", "public static int convert(int minutes) {\n return minutes * 60;\n }", "private static int getMinutes(String time) {\n\t\treturn (Character.getNumericValue(time.charAt(3)) * 10) + Character.getNumericValue(time.charAt(4));\n\t}", "private String intTime(long l){\r\n String s=\"\";\r\n s+=(char)(((l/1000)/60)+'0')+\":\"+(char)((((l/1000)%60)/10)+'0')+(char)((((l/1000)%60)%10)+'0'); \r\n return s;\r\n }", "protected int convertToMinutes() {\n\t\treturn this.getMinutes() + (this.getHours() * 60);\n\t}", "private void normalGmtStringToMinutes() {\n int i = Integer.parseInt(gmtString.substring(4, 6));\n offsetMinutes = i * 60;\n i = Integer.parseInt(gmtString.substring(7));\n offsetMinutes += i;\n if (gmtString.charAt(3) == MINUS) {\n offsetMinutes *= -1;\n }\n }", "public static String convert_minutes_to_hours(String minutess) {\n int hours = Integer.parseInt(minutess) / 60; //since both are ints, you get an int\n int minutes = Integer.parseInt(minutess) % 60;\n System.out.printf(\"%d:%02d\", hours, minutes);\n return hours + \":\" + minutes;\n }", "private static int convertTimeToSecs(String time){\n if (time == null) return 0;\n String hours = time.substring(0, 2);\n String mins = time.substring(3,5);\n return Integer.parseInt(hours)*3600 + Integer.parseInt(mins)*60;\n }", "public static int reformatTime(int time, int min) {\n int hours = Integer.parseInt(Integer.toString(time).substring(0, 2));\n int minutes = Integer.parseInt(Integer.toString(time).substring(2, 4)) + min;\n\n hours += minutes / 60;\n minutes = minutes % 60;\n\n return Integer.parseInt(hours + (minutes < 10 ? \"0\" + minutes : String.valueOf(minutes)));\n }", "private int toTime(int i) {\n int count = 0;\n\n //hours units\n count += toLeds((i / 6000) % 10);\n //hours tens\n count += toLeds(((i / 6000) % 100) / 10);\n\n //minutes units\n count += toLeds((i / 60) % 10);\n //minutes tens\n count += toLeds(((i / 60) % 100) / 10);\n\n //seconds units\n count += toLeds((i % 60) % 10);\n //seconds tens\n count += toLeds(((i % 60) % 100) / 10);\n\n return count;\n }", "private int convertToMinutes(String hourMinutes) {\n String[] tokens = hourMinutes.split(\":\");\n int hour = Integer.parseInt(tokens[0]);\n int minutes = Integer.parseInt(tokens[1]);\n if ((hour <= 0) || (hour > 12)) {\n throw new IllegalArgumentException(\"Incorrect value entered for hour, must be: 0 < H < 12\");\n }\n if ((minutes < 0) || (minutes > 59)) {\n throw new IllegalArgumentException(\"Incorrect value entered for minute, must be: 0 <= M < 60\");\n }\n\n if (hour == 12) {\n if (minutes == 0) {\n return MAX_MINUTES;\n } else {\n return minutes;\n }\n } else {\n return (hour * 60) + minutes;\n }\n }", "private static int computeTime(String time) {\n\t\tint ret = 0;\n\t\tint multiply = 1;\n\t\tint decimals = 1;\n\t\tfor (int i = time.length() - 1; i >= 0; --i) {\n\t\t\tif (time.charAt(i) == ':') {\n\t\t\t\tmultiply *= 60;\n\t\t\t\tdecimals = 1;\n\t\t\t} else {\n\t\t\t\tret += (time.charAt(i) - '0') * multiply * decimals;\n\t\t\t\tdecimals *= 10;\n\t\t\t}\n\t\t}\n\t\treturn ret;\n\t}", "static String timeConversion1(String s) {\n String[] timeSplit = s.split(\":\");\n String hours = timeSplit[0];\n String minutes = timeSplit[1];\n String seconds = timeSplit[2].substring(0, 2);\n String ampm = timeSplit[2].substring(2);\n\n int hour = Integer.parseInt(hours);\n\n int differential = 0;\n if (\"PM\".equals(ampm) && hour != 12) {\n differential = 12;\n }\n\n\n hour += differential;\n hour = hour % 24;\n\n hours = String.format(\"%02d\", hour);\n\n return hours + \":\" + minutes + \":\" + seconds;\n\n }", "private String readableTime(Integer minutes) {\r\n String time = \"\";\r\n if (minutes / 60.0 > 1) {\r\n time = (minutes / 60) + \" hrs, \"\r\n + (minutes % 60) + \" min\";\r\n } else {\r\n time = minutes + \" min\";\r\n }\r\n return time;\r\n }", "private void convertLabelsToInt(){\n String sec = tSec.getText();\n sec = sec.replaceAll(\"[^0-9\\\\s+]\", \"\");\n seconds = Integer.parseInt(sec.trim());\n \n String min = tMin.getText();\n min = min.replaceAll(\"[^0-9\\\\s+]\", \"\");\n minutes = Integer.parseInt(min.trim());\n \n String hour = tHours.getText();\n hour = hour.replaceAll(\"[^0-9\\\\s+]\", \"\");\n hours = Integer.parseInt(hour.trim());\n }", "public String secondsToMinutes(int seconds){\n int minutes = 0;\n while(seconds >= 60){\n seconds -= 60;\n minutes++;\n }\n String sec;\n if(seconds < 10){\n sec = \"0\" + seconds;\n }else{\n sec = seconds + \"\";\n }\n String time = minutes + \":\" + sec;\n return time;\n }", "public static String convertFromTime(int time){\n int hour = time/100;\n int min = time%100;\n String hourStr = String.format(\"%02d\", hour);\n String minStr = String.format(\"%02d\",min);\n return hourStr + \":\" + minStr;\n }", "private String getMinutes() {\n StringBuilder minutesSB = new StringBuilder();\n\n if (minutes > 0) {\n if (String.valueOf(minutes).length() < 2) {\n minutesSB.append(\"0\");\n }\n minutesSB.append(minutes);\n } else {\n minutesSB.append(\"0\");\n }\n\n return minutesSB.toString();\n }", "private Integer timeStringToInt(String time) {\n\t\t\n\t\tif(time.equals(\"TBA\")) {\n\t\t\treturn -1;\n\t\t}\n\t\t\n\t\tString[] t = time.split(\":\");\n\t\tInteger hours = Integer.parseInt(t[0]) * 100;\n\t\tInteger minutes = Integer.parseInt(t[1]);\n\t\treturn hours + minutes;\n\t}", "private int secToMin(int sec){\n return sec/60;\n }", "Integer getMinute();", "public String getTime(){\n String mt=\"\";\n String hr=\"\";\n if(minute<10){\n mt=0+(String.valueOf(minute));\n }\n\n else{\n mt=String.valueOf(minute);\n }\n\n if(hour<10){\n hr=0+(String.valueOf(hour));\n }\n else{\n hr=String.valueOf(hour);\n }\n //return hour:minute\n return (hr+\":\"+mt);\n }", "public String getMinutes();", "public int timeToMinute (int time){\n\t\tif (time<100){\n\t\t\treturn time;\n\t\t}\n\t\telse {\n\t\t\tint hour = time/100;\n\t\t\tint min = time %100;\n\t\t\treturn hour*60 + min;\n\t\t}\n\t\t\n\t}", "private int parseTime(String timeString){\n\n if(timeString != null) {\n String[] parseTime = timeString.split(\":|\\\\s\");\n String intTime = parseTime[0] + parseTime[1];\n int time = Integer.parseInt((intTime));\n if (time != 1200 && parseTime[2].equals(\"PM\")) {\n time += 1200;\n } else if (time == 1200 && parseTime[2].equals(\"AM\")) {\n time = 0;\n }\n return time;\n\n } else {\n return 0;\n }\n }", "public static String TimeConvert(int num) {\n\n int hours;\n int minutes;\n\n if (num < 60){\n\n return \"0:\" + num;\n }\n else {\n\n hours = num / 60;\n minutes = num % 60;\n\n return hours + \":\" + minutes;\n }\n }", "public static String hoursMinutesSeconds(double t) {\n int hours = (int) t/3600;\n int rem = (int) t - hours*3600;\n int mins = rem / 60;\n int secs = rem - mins*60;\n //return String.format(\"%2d:%02d:%02d\", hours, mins, secs);\n return String.format(\"%d:%02d:%02d\", hours, mins, secs);\n }", "public String getMinutesStr(){\n \n // return zero\n if (this.getMinutes()==0){\n return \"00\";\n }\n // pad single digit with zero\n else if (this.getMinutes() < 10){\n return '0' + Integer.toString(this.getMinutes()); \n }\n // return double digit\n else {\n return Integer.toString(this.getMinutes());\n }\n\n }", "public int getMinutes(){\n return (int) ((totalSeconds%3600)/60);\n }", "private int getMinute() {\n\t\tString time = getPersistedString(this.defaultValue);\n\t\tif (time == null || !time.matches(VALIDATION_EXPRESSION)) {\n\t\t\treturn -1;\n\t\t}\n\n\t\treturn Integer.valueOf(time.split(\":|/\")[1]);\n\t}", "private String secondsToMinutesAndSeconds(double seconds) {\n\t\tint numberOfminutes = (int) (seconds / 60);\n\t\tint numberOfSeconds = (int) (seconds % 60);\n\t\tif (numberOfSeconds < 10) {\n\t\t\treturn numberOfminutes + \":0\" + numberOfSeconds;\n\t\t} else {\n\t\t\treturn numberOfminutes + \":\" + numberOfSeconds;\n\t\t}\n\t}", "protected String mo3406c() {\n return \"Minute\";\n }", "static String timeConversion(String s) {\n String[] timeSplit = s.split(\":\");\n String hours = timeSplit[0];\n String minutes = timeSplit[1];\n String seconds = timeSplit[2].substring(0, 2);\n String ampm = timeSplit[2].substring(2, 4);\n\n String newHours;\n if (ampm.equals(\"AM\")) {\n newHours = hours.equals(\"12\") ? \"00\" : hours;\n\n } else {\n newHours = hours.equals(\"12\") ? hours : String.valueOf(Integer.parseInt(hours) + 12);\n }\n\n return newHours + \":\" + minutes + \":\" + seconds;\n\n }", "static String getTime(int time) {\r\n\t\tint hours = time / 60;\r\n\t\tint minutes = time % 60;\r\n\r\n\t\tString ampm;\r\n\t\tif (time >= 720) ampm = \"PM\";\r\n\t\telse ampm = \"AM\";\r\n\r\n\t\treturn (String.format(\"%d:%02d%s\", hours, minutes, ampm));\r\n\t}", "private static int getHours(String time) {\n\t\treturn (Character.getNumericValue(time.charAt(0)) * 10) + Character.getNumericValue(time.charAt(1));\n\t}", "static String timeConversion(String s) {\n if(s.indexOf('P') >= 0 && s.substring(0, 2).equals(\"12\")){\n }\n else if(s.indexOf('P') >= 0){\n Integer n = Integer.parseInt(s.substring(0, 2));\n s = removeHour(s);\n n += 12;\n String hour = Integer.toString(n);\n s = hour + s;\n }\n else if (s.indexOf('A') >= 0 && s.substring(0, 2).equals(\"12\")){\n s = \"00\" + s.substring(2);\n }\n return removeHourFormat(s);\n }", "static String timeCount_1(List<String> Arr){\n int timeHH = 0;\n int timeMI = 0;\n int timeSS = 0;\n \n String r_hh = \"\";\n String r_mi = \"\";\n String r_ss = \"\";\n\n for(int i = 0; i < Arr.size(); i++ ){\n \n if (Pattern.matches(\"\\\\d{2}:\\\\d{2}:\\\\d{2}\", Arr.get(i))){\n \n String[] s = Arr.get(i).split(\":\");\n int hh = Integer.parseInt(s[0]);\n int mi = Integer.parseInt(s[1]);\n int ss = Integer.parseInt(s[2]);\n \n timeHH += hh;\n timeMI += mi;\n timeSS += ss;\n \n }\n else{\n continue;\n }\n }\n \n timeMI += timeSS / 60;\n timeSS %= 60;\n \n timeHH += timeMI / 60;\n timeMI %= 60; \n\n \n if (timeHH < 10){\n r_hh = \"0\" + timeHH;\n }\n else{\n r_hh = Integer.toString(timeHH);\n }\n \n if (timeMI < 10){\n r_mi = \"0\" + timeMI;\n }\n else{\n r_mi = Integer.toString(timeMI);\n }\n \n if (timeSS < 10){\n r_ss = \"0\" + timeSS;\n }\n else{\n r_ss = Integer.toString(timeSS);\n }\n \n \n \n String result = r_hh + \":\" + r_mi + \":\" + r_ss;\n //String result = timeHH + \":\" + timeMI + \":\" + timeSS;\n \n return result;\n }", "public String countTime(int miliseconds) {\n \tString timeInMinutes = new String();\n \tint minutes = miliseconds / 60000;\n \tint seconds = (miliseconds % 60000)/1000;\n \ttimeInMinutes = minutes + \":\" + (seconds<10?\"0\" + seconds:seconds);\n\t\treturn timeInMinutes;\n }", "public static String trackDurationConverter(int secondsInput)\r\n {\r\n String result;\r\n if(secondsInput > 0)\r\n {\r\n String tmpSec = \"\"; \r\n int tmpMin = 0;\r\n\r\n String seconds = Integer.toString(secondsInput % 60);\r\n String minutes = Integer.toString((secondsInput/60) % 60);\r\n String hours = Integer.toString((secondsInput/60) / 60);\r\n\r\n seconds = Integer.parseInt(seconds) < 9 ? \"0\"+seconds : seconds;\r\n minutes = Integer.parseInt(minutes) < 9 ? \"0\"+minutes : minutes;\r\n hours = Integer.parseInt(hours) < 9 ? \"0\"+hours : hours;\r\n\r\n if(Integer.parseInt(seconds) <= 30)\r\n {\r\n tmpSec = \"30\";\r\n tmpMin = Integer.parseInt(minutes);\r\n }\r\n else\r\n {\r\n tmpSec = \"00\";\r\n tmpMin = Integer.parseInt(minutes) + 1;\r\n }\r\n String tmpResult = tmpMin < 9 ? \"0\"+Integer.toString(tmpMin) : Integer.toString(tmpMin);\r\n String typeOfTime = tmpResult.equals(\"00\") ? \" sec\" : \" min\";\r\n\r\n result = \"circa \" + tmpResult + \":\" + tmpSec + typeOfTime;\r\n return result;\r\n }\r\n else\r\n {\r\n return result = \"-1\";\r\n }\r\n }", "String formatTime(int time) {\r\n\t\tint h = time / 3600;\r\n\t\ttime %= 3600;\r\n\t\tint m = time / 60;\r\n\t\ttime %= 60;\r\n\t\tint s = time;\r\n\t\treturn String.format(\"%02d:%02d:%02d\", h, m, s);\r\n\t}", "public void setMinutes(String minutes) {\n this.minutes = parseMinutes(minutes);\n }", "static String timeConversion(String s) {\n /*\n * Write your code here.\n */\n String res = \"\";\n String hrs = s.substring(0, 2);\n String min = s.substring(3, 5);\n String sec = s.substring(6, 8);\n String ampm = s.substring(8);\n int hr = Integer.parseInt(hrs);\n if((ampm.equalsIgnoreCase(\"PM\")) && (hr != 12)) {\n hr += 12;\n if(hr >= 24) {\n hr = 24 - hr;\n }\n }\n else if(ampm.equalsIgnoreCase(\"AM\")) {\n if(hr == 12) {\n hr = 0;\n }\n }\n if(hr < 10) {\n res = res + \"0\" + Integer.toString(hr);\n }\n else {\n res += Integer.toString(hr);\n }\n res = res +\":\" +min +\":\" + sec;\n return res;\n }", "private int[] parseMinutes(String str) {\n try {\n return enumerate(str, 0, 59);\n } catch (IllegalArgumentException e) {\n throw new IllegalArgumentException(\"Error parsing minutes: \" + e.getMessage());\n }\n }", "private int convertProgressToMinutes(int progress) {\n return progress * MINUTE_PER_PROGRESS;\n }", "public void convertEndCivilianTimeToMilitaryTime(String endHour, String endMinute, String endAmOrPm) {\n String timeFormat = endHour + \" \" + endMinute + \" \" + endAmOrPm;\n DateFormat df = new SimpleDateFormat(\"hh mm aa\");\n String[] newTime = new String[3];\n newTime[0] = \"0\";\n newTime[1] = \"0\";\n\n Date date = null;\n try {\n date = df.parse(timeFormat);\n } catch (Exception e) {\n //pass\n\n }\n\n try {\n String time[] = date.toString().split(\" \");\n newTime = time[3].split(\":\");\n } catch (Exception e) {\n //pass\n }\n endMilitaryHour = Integer.parseInt(newTime[0]);\n endMilitaryMinute = Integer.parseInt(newTime[1]);\n this.endAmOrPm = endAmOrPm;\n\n }", "public int getMinutes(){\r\n return Minutes;\r\n }", "public String manipulateTimeForScore(String mins, String secs) {\n\n\t\tint min = -1;\n\t\tint sec = -1;\n\t\tif (mins != null && mins.trim().length() > 0) {\n\t\t\ttry {\n\t\t\t\tmin = Integer.parseInt(mins);\n\t\t\t} catch (Exception e) {\n\t\t\t\t \n\t\t\t}\n\t\t}\n\t\tif (secs != null && secs.trim().length() > 0) {\n\t\t\ttry {\n\t\t\t\tsec = Integer.parseInt(secs);\n\t\t\t} catch (Exception e) {\n\t\t\t\t \n\t\t\t}\n\t\t}\n\t\tString result = \"\";\n\t\tif (min != -1 && sec != -1) {\n\t\t\tif (min < 10) {\n\t\t\t\tresult = \"0\" + min + \":\";\n\t\t\t} else {\n\t\t\t\tresult = min + \":\";\n\t\t\t}\n\n\t\t\tif (sec < 10) {\n\t\t\t\tresult = result + \"0\" + sec;\n\t\t\t} else {\n\t\t\t\tresult = result + sec;\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}", "private String formatTime(int seconds){\n return String.format(\"%02d:%02d\", seconds / 60, seconds % 60);\n }", "private static String intToHour(int intHour) {\r\n\t\tswitch (intHour) {\r\n\t\tcase 1:\r\n\t\t\treturn \"6am\";\r\n\t\tcase 2:\r\n\t\t\treturn \"7am\";\r\n\t\tcase 3:\r\n\t\t\treturn \"8am\";\r\n\t\tcase 4:\r\n\t\t\treturn \"9am\";\r\n\r\n\t\tcase 5:\r\n\t\t\treturn \"10am\";\r\n\r\n\t\tcase 6:\r\n\t\t\treturn \"11am\";\r\n\r\n\t\tcase 7:\r\n\t\t\treturn \"12pm\";\r\n\r\n\t\tcase 8:\r\n\t\t\treturn \"1pm\";\r\n\r\n\t\tcase 9:\r\n\t\t\treturn \"2pm\";\r\n\r\n\t\tcase 10:\r\n\t\t\treturn \"3pm\";\r\n\r\n\t\tcase 11:\r\n\t\t\treturn \"4pm\";\r\n\r\n\t\tcase 12:\r\n\t\t\treturn \"5pm\";\r\n\r\n\t\tcase 13:\r\n\t\t\treturn \"6pm\";\r\n\r\n\t\tcase 14:\r\n\t\t\treturn \"7pm\";\r\n\r\n\t\tcase 15:\r\n\t\t\treturn \"8pm\";\r\n\t\tdefault:\r\n\t\t\treturn \"\";\r\n\t\t}// end switch\r\n\t}", "@Override\n\tpublic void get_time_int(ShortHolder heure, ShortHolder min) {\n\t\t\n\t}", "@Test public void shouldGive240MinFor950cent() {\r\n // Three hours: $1.5+2.0+3.0\r\n assertEquals( 4 * 60 /*minutes*/ , rs.calculateTime(950) ); \r\n }", "public static String millsToMinSec(long mills) {\n int min = (int) (mills / 1000 / 60);\n int second = (int) (mills / 1000 % 3600 % 60);\n String time = \"\";\n// if (hour < 10) {\n// time = \"0\" + hour;\n// } else {\n// time = \"\" + hour;\n// }\n if (min < 10) {\n time += \"0\" + min;\n } else {\n time += \"\" + min;\n }\n if (second < 10) {\n time += \":0\" + second;\n } else {\n time += \":\" + second;\n }\n return time;\n }", "public void addMinutes(int minutes)\n {\n\n int h = minutes / 60;\n int m = minutes - (h * 60);\n\n hour += h;\n\n if (minute == 30 && m == 30)\n {\n minute = 0;\n hour++;\n }\n else\n {\n minute += m;\n }\n }", "public static String getDurationString(long minutes, long seconds) {\n if(minutes>=0 && (seconds >=0 && seconds<=59)){\n// minutes = hours/60;\n// seconds = hours/3600;\n long hours = minutes / 60;\n long remainingMinutes = minutes % 60;\n\n return hours + \" h \" + remainingMinutes + \"m \" + seconds + \"s\";\n }\n else\n\n {\n return \"invalid value\";\n }\n }", "public String selectStartMinutes(String object, String data) {\n\t\tlogger.debug(\"Entering start Minutes\");\n\t\ttry {\n\n\t\t\tString allObjs[] = object.split(Constants.DATA_SPLIT);\n\t\t\tobject = allObjs[0];\n\t\t\tString hr = allObjs[1];\n\t\t\tString FinalNum = \"\";\n\t\t\tint num = 0;\n\t\t\tDate date = new Date();\n\t\t\tSimpleDateFormat timeFormat = new SimpleDateFormat(\"mm\");\n\t\t\ttimeFormat.setTimeZone(TimeZone.getTimeZone(\"US/Central\"));\n\t\t\tString Min = timeFormat.format(date.getTime());\n\t\t\tlogger.debug(Min);\n\t\t\tint Minutes = Integer.parseInt(Min);\n\t\t\tlogger.debug(\"Minutes=\" + Minutes);\n\t\t\tif ((Minutes % 5) == 0) {\n\t\t\t\tnum = Minutes + 5;\n\t\t\t\tif (num == 5) {\n\t\t\t\t\tString num3 = Constants.VALUE_0 + num;\n\t\t\t\t\tselectList(object, num3);\n\t\t\t\t\tlogger.debug(\"when num==5:--\" + num3);\n\t\t\t\t\treturn Constants.KEYWORD_PASS + \" Start Minutes has been Entered.. \";\n\n\t\t\t\t}\n\t\t\t\tif (num >= 60) {\n\t\t\t\t\tdata = String.valueOf(num);\n\t\t\t\t\tdata = \":\" + data;\n\t\t\t\t\tselectStartorDueHours(hr, data);\n\t\t\t\t\tif (!(data.equals(Constants.VALUE_12))) {\n\t\t\t\t\t\tFinalNum = Constants.VALUE_DOUBLE_ZERO;\n\t\t\t\t\t\tselectList(object, FinalNum);\n\t\t\t\t\t\treturn Constants.KEYWORD_PASS + \" Start Minutes has been Entered.. \";\n\t\t\t\t\t}\n\n\t\t\t\t\treturn Constants.KEYWORD_PASS + \" Start Minutes has been Entered.. \";\n\t\t\t\t}\n\t\t\t\tFinalNum = String.valueOf(num);\n\t\t\t\tFinalNum = \":\" + FinalNum;\n\t\t\t\tselectList(object, FinalNum);\n\t\t\t\treturn Constants.KEYWORD_PASS + \" Start Minutes has been Entered.. \";\n\t\t\t} else {\n\t\t\t\tint unitdigit = Minutes % 10;\n\t\t\t\tlogger.debug(\"Unitdigit=\" + unitdigit);\n\t\t\t\tnum = Minutes - unitdigit;\n\t\t\t\tlogger.debug(\"num=\" + num);\n\t\t\t\tif (unitdigit > 0 && unitdigit < 4) {\n\t\t\t\t\tnum = num + 5;\n\t\t\t\t\tif (num == 5) {\n\t\t\t\t\t\tString num3 = Constants.VALUE_0 + num;\n\t\t\t\t\t\tselectList(object, String.valueOf(num3));\n\t\t\t\t\t\tlogger.debug(\"when num==5:--\" + num3);\n\t\t\t\t\t\treturn Constants.KEYWORD_PASS + \" Start Minutes has been Entered.. \";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tString num3 = \":\" + num;\n\t\t\t\t\t\tselectList(object, String.valueOf(num3));\n\t\t\t\t\t\treturn Constants.KEYWORD_PASS + \" Start Minutes has been Entered.. \";\n\t\t\t\t\t}\n\t\t\t\t} else if (unitdigit == 4) {\n\t\t\t\t\tnum = num + 10;\n\t\t\t\t\tif (num >= 60) {\n\t\t\t\t\t\tdata = String.valueOf(num);\n\t\t\t\t\t\tdata = \":\" + data;\n\t\t\t\t\t\tselectStartorDueHours(hr, data);\n\t\t\t\t\t\tFinalNum = Constants.VALUE_DOUBLE_ZERO;\n\t\t\t\t\t\tselectList(object, FinalNum);\n\t\t\t\t\t\treturn Constants.KEYWORD_PASS + \" Start Minutes has been Entered.. \";\n\t\t\t\t\t}\n\t\t\t\t\tdata = String.valueOf(num);\n\t\t\t\t\tdata = \":\" + data;\n\t\t\t\t\tselectStartorDueHours(hr, data);\n\t\t\t\t\tString num8 = \":\" + num;\n\t\t\t\t\tselectList(object, String.valueOf(num8));\n\t\t\t\t\treturn Constants.KEYWORD_PASS + \" Start Minutes has been Entered.. \";\n\t\t\t\t} else if (unitdigit > 5 && unitdigit < 9) {\n\t\t\t\t\tnum = num + 10;\n\t\t\t\t\tif (num >= 60) {\n\t\t\t\t\t\tdata = String.valueOf(num);\n\t\t\t\t\t\tdata = \":\" + data;\n\t\t\t\t\t\tselectStartorDueHours(hr, data);\n\t\t\t\t\t\tFinalNum = Constants.VALUE_DOUBLE_ZERO;\n\t\t\t\t\t\tselectList(object, FinalNum);\n\t\t\t\t\t\treturn Constants.KEYWORD_PASS + \" Start Minutes has been Entered.. \";\n\t\t\t\t\t}\n\t\t\t\t} else if (unitdigit == 9) {\n\t\t\t\t\tnum = num + 15;\n\t\t\t\t\tif (num >= 60) {\n\t\t\t\t\t\tdata = String.valueOf(num);\n\t\t\t\t\t\tdata = \":\" + data;\n\t\t\t\t\t\tselectStartorDueHours(hr, data);\n\t\t\t\t\t\tnum = num - 60;\n\t\t\t\t\t\tif (num == 5) {\n\t\t\t\t\t\t\tString num3 = Constants.VALUE_0 + num;\n\t\t\t\t\t\t\tselectList(object, num3);\n\t\t\t\t\t\t\treturn Constants.KEYWORD_PASS + \" Start Minutes has been Entered.. \";\n\n\t\t\t\t\t\t}\n\t\t\t\t\t\tString num4 = String.valueOf(num);\n\t\t\t\t\t\tnum4 = \":\" + num4;\n\t\t\t\t\t\tselectList(object, num4);\n\t\t\t\t\t\treturn Constants.KEYWORD_PASS + \" Start Minutes has been Entered.. \";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tFinalNum = String.valueOf(num);\n\t\t\t\tFinalNum = \":\" + FinalNum;\n\t\t\t\tselectList(object, FinalNum);\n\t\t\t\treturn Constants.KEYWORD_PASS + \" Start Minutes has been Entered.. \";\n\t\t\t}\n\t\t} catch (Exception e) {\n\n\t\t\treturn Constants.KEYWORD_FAIL + e.getMessage();\n\t\t}\n\t}", "static String timeConversion(String s) {\n String[] sTime = s.split(\":\");\n\n int x = 0;\n\n // if PM and hours >12, add additional 12 to hours\n // for AM and hour = 12, set hour to 00\n if(sTime[sTime.length - 1].contains(\"PM\") && !sTime[0].equals(\"12\"))\n x = 12;\n\n String val1 = \"\";\n if(x == 12)\n val1 = (Integer.parseInt(sTime[0]) + x) + \"\";\n else {\n if(sTime[0].equals(\"12\") && sTime[sTime.length - 1].contains(\"AM\"))\n val1 = \"00\";\n else\n val1 = sTime[0];\n }\n\n // merge the string and return the result\n String result = val1 + \":\" + sTime[1] + \":\" + sTime[2].substring(0,2);\n return result;\n }", "public String getTimeInString() {\n int minutes = (time % 3600) / 60;\n int seconds = time % 60;\n String timeString = String.format(\"%02d:%02d\", minutes, seconds);\n\n return timeString;\n }", "private static String convertTime(String timeString) {\n try {\n int timeIn24hRepresentation = Integer.parseInt(timeString);\n int hours = timeIn24hRepresentation / 100;\n int minutes = timeIn24hRepresentation % 100;\n boolean isOutOfBounds = hours < 0 || hours > 24 || minutes < 0 || minutes > 60;\n boolean cannotConvertToTime = timeString.length() != 4;\n\n if (isOutOfBounds || cannotConvertToTime) {\n return timeString;\n } else {\n return convertTimeToStringRepresentation(hours, minutes);\n }\n } catch (NumberFormatException e) {\n return timeString;\n }\n }", "private static String minuteInWord(final int minute) {\n\t\tif( minute == 0 ) {\n\t\t\treturn \"o' clock\";\n\t\t}else if(minute == 15 || minute == 30) {\n\t\t\treturn getFromNumber(minute).getWord();\n\t\t} else {\n\t\t\treturn getFromNumber(minute).getWord() + (minute > 1 ? \" minutes\" : \" minute\");\n\t\t}\n\t}", "public void uneMinuteDePlus() {\n\t\tthis.m = m+1 > 59 ? 0 : m+1;\n\t}", "private String secsToTime(int secs) {\n String min = secs / 60 + \"\";\n String sec = secs % 60 + \"\";\n if(sec.length() == 1) {\n sec = \"0\" + sec;\n }\n\n return min + \":\" + sec;\n }", "@Test public void shouldGive60MinFor150cent() {\r\n // First hour: $1.5\r\n assertEquals( 60 /*minutes*/, rs.calculateTime(150) ); \r\n }", "private static long convertTimeToSeconds(String time) {\n\n\t\tString[] timeArray = time.split(\":\");\n\t\tint hours = Integer.parseInt(timeArray[0]);\n\t\tint minutes = Integer.parseInt(timeArray[1]);\n\t\tint seconds = Integer.parseInt(timeArray[2]);\n\n\t\treturn (hours * 3600) + (minutes * 60) + seconds;\n\t}", "public void setMinute(int value) {\n this.minute = value;\n }", "private double convertSecondsToMinutes(int seconds) {\r\n int sec = seconds;\r\n int min = 0;\r\n while (sec > 60) {\r\n sec -= 60;\r\n min++;\r\n }\r\n return Double.valueOf(min + \".\" + sec);\r\n }", "public static int parseTimeForDB(Calendar c){\n return Integer.parseInt(c.get(Calendar.HOUR_OF_DAY) + \"\"\n + (c.get(Calendar.MINUTE) < 10 ? 0 + \"\" + c.get(Calendar.MINUTE) : c.get(Calendar.MINUTE)));\n }", "private int normalizeTime() {\n int currentTimeSeconds = (int) (System.currentTimeMillis() / 1000);\n\n // The graphing interval in minutes\n // TODO not hardcoded :3\n int interval = 30;\n\n // calculate the devisor denominator\n int denom = interval * 60;\n\n return (int) Math.round((currentTimeSeconds - (denom / 2d)) / denom) * denom;\n }", "public String timeToFormat(int newSecondsTotal){\n String out = \"\";\n int minutes = newSecondsTotal/60;\n int seconds = newSecondsTotal-(minutes*60);\n out = minutes+\":\"+seconds;\n return out;\n }", "public void setMinute(int value) {\n this.minute = value;\n }", "public static String milToStandard(int milTime){\n\n String output;\n int tempHours = milTime / 100;\n String ampm;\n if(tempHours - 12 < 0){\n if(tempHours == 0){tempHours = 12;}\n ampm = \"AM\";\n }\n else{\n tempHours = tempHours - 12;\n if(tempHours == 0){tempHours = 12;}\n ampm = \"PM\";\n }\n output = tempHours+\":\";\n int tempMins = milTime % 100;\n if(tempMins < 10){ output = output + \"0\" + tempMins + ampm;}\n else{ output = output + tempMins + ampm;}\n\n return output;\n\n }", "public static String m34537a(long j) {\n Formatter format;\n if (j <= 0 || j >= LogBuilder.MAX_INTERVAL) {\n return \"00:00\";\n }\n long j2 = j / 1000;\n int i = (int) (j2 % 60);\n int i2 = (int) ((j2 / 60) % 60);\n int i3 = (int) (j2 / 3600);\n Formatter formatter = new Formatter(new StringBuilder(), Locale.getDefault());\n if (i3 > 0) {\n format = formatter.format(\"%d:%02d:%02d\", Integer.valueOf(i3), Integer.valueOf(i2), Integer.valueOf(i));\n } else {\n format = formatter.format(\"%02d:%02d\", Integer.valueOf(i2), Integer.valueOf(i));\n }\n return format.toString();\n }", "public int getMinutes() {\r\n return FormatUtils.uint8ToInt(mMinutes);\r\n }", "static String timeConversion(String s) {\n\n\t\tStringBuilder sb = new StringBuilder();\n\t\tboolean isAm = s.contains(\"AM\");\n\t\t\n\t\ts = s.replace(\"AM\", \"\");\n\t\ts = s.replace(\"PM\", \"\");\n\t\t\n\t\tString str[] = s.split(\":\");\n\t\tint time = Integer.parseInt(str[0]);\n\t\t\n\t\t\n\t\tif(time < 12 && !isAm) {\n\t\t\ttime = time + 12;\n\t\t\tsb.append(time).append(\":\");\n\t\t}else if(time == 12 && isAm) {\n\t\t\tsb.append(\"00:\");\n\t\t}else {\n\t\t\tif (time < 10) sb.append(\"0\").append(time).append(\":\");\n\t\t\telse sb.append(time).append(\":\");\n\t\t}\n\n\t\tsb.append(str[1]).append(\":\").append(str[2]);\n\t\treturn sb.toString();\n\t}", "private String parseStringtoInt(String welcome,Student s1){\n\n String time = TimeUitl.getTime(s1);\n\n String slogan = welcome + time;\n\n return slogan;\n }", "private String createTimeString(int value)\n\t {\n\t\tif(value<0){\n\t\t\treturn \"00:00:00,000\";\n\t\t}\n\t int sec = value % 60;\n\t int min = (value / 60) % 60;\n\t int hr = value / 3600;\n\t String fmtHr = \"\"+hr;\n\t String fmtMin = \"\"+min;\n\t String fmtSec = \"\" + sec;\n\t if(hr<10){\n\t \tfmtHr = \"0\"+hr;\n\t }\n\t if(min<10){\n\t \tfmtMin = \"0\"+min;\n\t }\n\t if(sec<10){\n\t \tfmtSec = \"0\"+sec;\n\t }\n\n\t return fmtHr+\":\"+fmtMin+\":\"+fmtSec+\",\"+\"000\";\n\t }", "public int getMinute() { return this.minute; }", "public int getMinuteFraction()\n {\n return (((int)(hours*100.0)%100)*60)/100;\n }", "public String getElapsedTimeHoursMinutesSecondsString(int milisec) {\n\t\t int time = milisec/1000;\n\t\t String seconds = Integer.toString((int)(time % 60)); \n\t\t String minutes = Integer.toString((int)((time % 3600) / 60)); \n\t\t String hours = Integer.toString((int)(time / 3600)); \n\t\t for (int i = 0; i < 2; i++) { \n\t\t if (seconds.length() < 2) { \n\t\t seconds = \"0\" + seconds; \n\t\t } \n\t\t if (minutes.length() < 2) { \n\t\t minutes = \"0\" + minutes; \n\t\t } \n\t\t if (hours.length() < 2) { \n\t\t hours = \"0\" + hours; \n\t\t } \n\t\t }\n\t\t String timeString = hours + \":\" + minutes + \":\" + seconds; \n\t\t return timeString;\n\t }", "public static String longToHHMM(long longTime)\r\n/* 150: */ {\r\n/* 151:219 */ SimpleDateFormat formatter = new SimpleDateFormat(\"HH:mm\");\r\n/* 152:220 */ Date strtodate = new Date(longTime);\r\n/* 153:221 */ return formatter.format(strtodate);\r\n/* 154: */ }", "public static int convertTimetoSec(String hour, String minute, String seconds)\n\t{\n\t\tint h, m, s;\n\t\tint timeinsec = 1000;\n\n\t\th = Integer.parseInt(hour);\n\t\tm = Integer.parseInt(minute);\n\t\ts = Integer.parseInt(seconds);\n\n\t\ttimeinsec = 3600*h + 60*m + s;\n\n\t\treturn timeinsec;\t\n\t}", "static String timeCount_2(List<String> Arr){\n int timeHH = 0;\n int timeMI = 0;\n int timeSS = 0;\n \n int timeSum_second = 0;\n \n String r_hh = \"\";\n String r_mi = \"\";\n String r_ss = \"\";\n\n for(int i = 0; i < Arr.size(); i++ ){\n \n if (Pattern.matches(\"\\\\d{2}:\\\\d{2}:\\\\d{2}\", Arr.get(i))){\n \n String[] s = Arr.get(i).split(\":\");\n int hh = Integer.parseInt(s[0]);\n int mi = Integer.parseInt(s[1]);\n int ss = Integer.parseInt(s[2]);\n\n timeSum_second += hh*60*60 + mi*60 + ss;\n \n }\n else{\n continue;\n }\n }\n \n timeHH = timeSum_second/60/60;\n timeMI = (timeSum_second%(60*60))/60;\n timeSS = timeSum_second%60;\n \n if (timeHH < 10){\n r_hh = \"0\" + timeHH;\n }\n else{\n r_hh = Integer.toString(timeHH);\n }\n \n if (timeMI < 10){\n r_mi = \"0\" + timeMI;\n }\n else{\n r_mi = Integer.toString(timeMI);\n }\n \n if (timeSS < 10){\n r_ss = \"0\" + timeSS;\n }\n else{\n r_ss = Integer.toString(timeSS);\n }\n \n String result = r_hh + \":\" + r_mi + \":\" + r_ss;\n \n return result;\n }", "void milestone4(int inputSeconds){\n int days = inputSeconds / 86400;\n int seconds = inputSeconds % 86400;\n int hours = seconds / 3600;\n seconds = seconds % 3600;\n int minutes = seconds / 60;\n seconds = seconds % 60;\n\n System.out.println(\"Day/s: \" + days);\n System.out.println(\"Hour/s: \" + hours);\n System.out.println(\"Minute/s: \" + minutes);\n System.out.println(\"Second/s: \" + seconds);\n }", "static String timeConversion(String s) throws ParseException {\n SimpleDateFormat to = new SimpleDateFormat(\"HH:mm:ss\");\n SimpleDateFormat from = new SimpleDateFormat(\"hh:mm:ssa\");\n Date parse = from.parse(s);\n return to.format(parse);\n\n }", "public String selectendMinutes(String object, String data) {\n\t\tlogger.debug(\"Entering End minutes\");\n\t\ttry {\n\n\t\t\tString allObjs[] = object.split(Constants.DATA_SPLIT);\n\t\t\tobject = allObjs[0];\n\t\t\tString hr = allObjs[1];\n\t\t\tString endFinalMin = \"\";\n\t\t\tint num = 0;\n\t\t\tDate date = new Date();\n\t\t\tSimpleDateFormat timeFormat = new SimpleDateFormat(\"mm\");\n\t\t\ttimeFormat.setTimeZone(TimeZone.getTimeZone(\"US/Central\"));\n\t\t\tString Min = timeFormat.format(date.getTime());\n\t\t\tlogger.debug(timeFormat);\n\t\t\tlogger.debug(Min);\n\t\t\tint Minutes = Integer.parseInt(Min);\n\t\t\tlogger.debug(\"Minutes=\" + Minutes);\n\t\t\tif ((Minutes % 5) == 0) {\n\t\t\t\tint endMint = Minutes + 10;\n\t\t\t\tif (endMint == 60) {\n\t\t\t\t\tdata = String.valueOf(endMint);\n\t\t\t\t\tdata = \":\" + data;\n\t\t\t\t\tselectStartorDueHours(hr, data);\n\t\t\t\t\tendFinalMin = Constants.VALUE_DOUBLE_ZERO;\n\t\t\t\t\tselectList(object, endFinalMin);\n\t\t\t\t\treturn Constants.KEYWORD_PASS + \" End Minutes has been Entered.. \";\n\n\t\t\t\t}\n\t\t\t\tif (endMint > 60) {\n\t\t\t\t\tdata = String.valueOf(endMint);\n\t\t\t\t\tdata = \":\" + data;\n\t\t\t\t\tselectStartorDueHours(hr, data);\n\t\t\t\t\tendFinalMin = Constants.VALUE_05;\n\t\t\t\t\tselectList(object, endFinalMin);\n\t\t\t\t\treturn Constants.KEYWORD_PASS + \" End Minutes has been Entered.. \";\n\n\t\t\t\t}\n\t\t\t\tString FinalEndMint = String.valueOf(endMint);\n\t\t\t\tFinalEndMint = \":\" + FinalEndMint;\n\t\t\t\tselectList(object, FinalEndMint);\n\t\t\t\treturn Constants.KEYWORD_PASS + \" End Minutes has been Entered.. \";\n\t\t\t} else {\n\t\t\t\tint unitdigit = Minutes % 10;\n\t\t\t\tlogger.debug(\"Unitdigit=\" + unitdigit);\n\t\t\t\tnum = Minutes - unitdigit;\n\t\t\t\tlogger.debug(\"num=\" + num);\n\t\t\t\tif (unitdigit > 0 && unitdigit < 4) {\n\t\t\t\t\tnum = num + 10;\n\t\t\t\t\tif (num >= 60) {\n\t\t\t\t\t\tdata = String.valueOf(num);\n\t\t\t\t\t\tdata = \":\" + data;\n\t\t\t\t\t\tselectStartorDueHours(hr, data);\n\t\t\t\t\t\tendFinalMin = Constants.VALUE_DOUBLE_ZERO;\n\t\t\t\t\t\tselectList(object, endFinalMin);\n\t\t\t\t\t\treturn Constants.KEYWORD_PASS + \" End Minutes has been Entered.. \";\n\n\t\t\t\t\t}\n\t\t\t\t\tString num5 = String.valueOf(num);\n\t\t\t\t\tnum5 = \":\" + num5;\n\t\t\t\t\tselectList(object, num5);\n\t\t\t\t\treturn Constants.KEYWORD_PASS + \" End Minutes has been Entered.. \";\n\n\t\t\t\t} else if (unitdigit == 4) {\n\t\t\t\t\tnum = num + 15;\n\t\t\t\t\tif (num >= 60) {\n\t\t\t\t\t\tdata = String.valueOf(num);\n\t\t\t\t\t\tdata = \":\" + data;\n\t\t\t\t\t\tselectStartorDueHours(hr, data);\n\t\t\t\t\t\tendFinalMin = Constants.VALUE_05;\n\t\t\t\t\t\tselectList(object, endFinalMin);\n\t\t\t\t\t\treturn Constants.KEYWORD_PASS + \" End Minutes has been Entered.. \";\n\n\t\t\t\t\t}\n\t\t\t\t\tdata = String.valueOf(num);\n\t\t\t\t\tdata = \":\" + data;\n\t\t\t\t\t// selectStartorDueHours(hr, data);\n\t\t\t\t\tselectList(object, data);\n\t\t\t\t\treturn Constants.KEYWORD_PASS + \" End Minutes has been Entered.. \";\n\t\t\t\t} else if (unitdigit > 5 && unitdigit < 9) {\n\t\t\t\t\tnum = num + 15;\n\t\t\t\t\tif (num >= 60) {\n\t\t\t\t\t\tdata = String.valueOf(num);\n\t\t\t\t\t\tdata = \":\" + data;\n\t\t\t\t\t\tselectStartorDueHours(hr, data);\n\t\t\t\t\t\tendFinalMin = Constants.VALUE_05;\n\t\t\t\t\t\tselectList(object, endFinalMin);\n\t\t\t\t\t\treturn Constants.KEYWORD_PASS + \" End Minutes has been Entered.. \";\n\n\t\t\t\t\t}\n\t\t\t\t\tString num6 = String.valueOf(num);\n\t\t\t\t\tnum6 = \":\" + num6;\n\t\t\t\t\tselectList(object, num6);\n\t\t\t\t\treturn Constants.KEYWORD_PASS + \" End Minutes has been Entered.. \";\n\n\t\t\t\t} else if (unitdigit == 9) {\n\t\t\t\t\tnum = num + 20;\n\t\t\t\t\tif (num >= 60) {\n\t\t\t\t\t\tdata = String.valueOf(num);\n\t\t\t\t\t\tdata = \":\" + data;\n\t\t\t\t\t\tselectStartorDueHours(hr, data);\n\t\t\t\t\t\tnum = num - 60;\n\t\t\t\t\t\tString num7 = Constants.VALUE_0 + num;\n\t\t\t\t\t\tString num12 = String.valueOf(num7);\n\t\t\t\t\t\tselectList(object, num12);\n\t\t\t\t\t\treturn Constants.KEYWORD_PASS + \" End Minutes has been Entered.. \";\n\t\t\t\t\t} else if (num < 60) {\n\t\t\t\t\t\tString num8 = String.valueOf(num);\n\t\t\t\t\t\tnum8 = \":\" + num8;\n\t\t\t\t\t\tselectList(object, num8);\n\t\t\t\t\t\treturn Constants.KEYWORD_PASS + \" End Minutes has been Entered.. \";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t} catch (Exception e) {\n\n\t\t\treturn Constants.KEYWORD_FAIL + e.getMessage();\n\t\t}\n\t\treturn Constants.KEYWORD_PASS + \"---End Minutes has been Entered..\";\n\t}", "public static int secondsAfterMidnight(String t) {\n int seconds; //initializing seconds, will be returned to main.\n t.toLowerCase(); //setting all input to lowercase so it is easier to handle.\n if (t.length() == 10){ //if input is 10 characters\n // if statement below checks whether each character is appropriate before continuing.\n if((t.startsWith(\"0\") || t.startsWith(\"1\"))&& Character.isDigit(t.charAt(1))&& \n t.charAt(2) == ':' && Character.isDigit(t.charAt(3))&& Character.isDigit(t.charAt(4))&&\n t.charAt(5) == ':' && Character.isDigit(t.charAt(6))&& Character.isDigit(t.charAt(7))&&\n (t.endsWith(\"am\") || t.endsWith(\"pm\"))){\n // Characters converted to numeric values and hours, minutes, and seconds are\n // calculated below.\n int hours = Character.getNumericValue(t.charAt(0))*10 \n + Character.getNumericValue(t.charAt(1));\n //if hours is equal to 12 such as 12:35, switched to 0:35, for easier calc.\n if(hours == 12){ \n hours = 0;\n }\n int minutes = Character.getNumericValue(t.charAt(3))*10 \n + Character.getNumericValue(t.charAt(4));\n seconds = Character.getNumericValue(t.charAt(6))*10 \n + Character.getNumericValue(t.charAt(7)); \n if(minutes < 60 && seconds < 60){//checks whether minute and second input is below 60.\n if(t.endsWith(\"pm\")){ //adding 43200 (12 hours in seconds) if time is pm.\n seconds = hours*3600 + minutes*60 + seconds + 43200;\n }else{\n seconds = hours*3600 + minutes*60 + seconds; \n }\n }else{\n seconds = -1; //if proper input is not given, seconds set to -1.\n }\n } else {\n seconds = -1; //improper input leads to seconds set to -1.\n }\n //below is for input that has 9 characters, such as 9:12:23am, instead of 09:12:23am. The code below\n // is very similar to to code for 10 characters above. \n }else if (t.length() == 9){\n if(Character.isDigit(t.charAt(0))&& t.charAt(1) == ':' && Character.isDigit(t.charAt(2))\n && Character.isDigit(t.charAt(3))&& t.charAt(4) == ':' && Character.isDigit(t.charAt(5))\n && Character.isDigit(t.charAt(6))&&(t.endsWith(\"am\") || t.endsWith(\"pm\"))){\n int hours = Character.getNumericValue(t.charAt(0));\n int minutes = Character.getNumericValue(t.charAt(2))*10 \n + Character.getNumericValue(t.charAt(3));\n seconds = Character.getNumericValue(t.charAt(5))*10 \n + Character.getNumericValue(t.charAt(6)); \n if(minutes < 60 && seconds < 60){\n if(t.endsWith(\"pm\")){\n seconds = hours*3600 + minutes*60 + seconds + 43200;\n }else{\n seconds = hours*3600 + minutes*60 + seconds; \n }\n }else{\n seconds = -1;\n }\n } else {\n seconds = -1;\n }\n }else{ // if input has neither 10 or 9 characters, input not proper.\n seconds = -1;\n }\n return seconds; //seconds is returned to main.\n}", "@Test public void shouldGive120MinFor350cent() {\r\n // Two hours: $1.5+2.0\r\n assertEquals( 2 * 60 /*minutes*/ , rs.calculateTime(350) ); \r\n }", "public int getHours(){\n return (int) totalSeconds/3600;\n }", "public String convertTimeSecondsToHoursMinSeconds(int totalSeconds) {\n\t\t\t\tint MINUTES_IN_AN_HOUR = 60;\n\t\t\t\tint SECONDS_IN_A_MINUTE = 60;\n\t\t\t\tint hours = totalSeconds / MINUTES_IN_AN_HOUR / SECONDS_IN_A_MINUTE;\n\t\t\t\tint minutes = (totalSeconds - (convertTimeHoursToSeconds(hours))) / SECONDS_IN_A_MINUTE;\n\t\t\t\tint seconds = totalSeconds\n\t\t\t\t\t\t- ((convertTimeHoursToSeconds(hours)) + (convertTimeMinutesToSeconds(minutes)));\n\t\t\t\treturn hours + \" hours \" + minutes + \" minutes \" + seconds + \" seconds\";\n\t\t\t}", "private String parseTime(TimePicker start){\n String time = \"\";\n if (start.getHour() < 10){\n time += \"0\" + start.getHour() + \":\";\n } else {\n time += start.getHour() + \":\";\n }\n if (start.getMinute() < 10){\n time += \"0\" + start.getMinute();\n } else {\n time += start.getMinute();\n }\n return time;\n }", "private String convertToDuration(Long songDuration){\n long seconds = songDuration/1000;\n long minutes = seconds / 60;\n seconds = seconds % 60;\n return minutes +\":\"+seconds;\n }", "private static int stringToHour(String stringDay) {\r\n\t\tswitch (stringDay) {\r\n\t\tcase \"6am\":\r\n\t\t\treturn 0;\r\n\t\tcase \"7am\":\r\n\t\t\treturn 1;\r\n\t\tcase \"8am\":\r\n\t\t\treturn 2;\r\n\t\tcase \"9am\":\r\n\t\t\treturn 3;\r\n\t\tcase \"10am\":\r\n\t\t\treturn 4;\r\n\t\tcase \"11am\":\r\n\t\t\treturn 5;\r\n\t\tcase \"12pm\":\r\n\t\t\treturn 6;\r\n\t\tcase \"1pm\":\r\n\t\t\treturn 7;\r\n\t\tcase \"2pm\":\r\n\t\t\treturn 8;\r\n\t\tcase \"3pm\":\r\n\t\t\treturn 9;\r\n\t\tcase \"4pm\":\r\n\t\t\treturn 10;\r\n\t\tcase \"5pm\":\r\n\t\t\treturn 11;\r\n\t\tcase \"6pm\":\r\n\t\t\treturn 12;\r\n\t\tcase \"7pm\":\r\n\t\t\treturn 13;\r\n\t\tcase \"8pm\":\r\n\t\t\treturn 14;\r\n\t\tdefault:\r\n\t\t\treturn -1;\r\n\t\t}// end switch\r\n\t}", "@Test\n public void testSplitTime(){\n \tCountDownTimer s = new CountDownTimer();\n \ts.splitTime(3975);\n \tassertEquals(s.toString(), \"1:06:15\");\n \t\n \ts.splitTime(45);\n \tassertEquals(s.toString(), \"0:00:45\");\n \t\n }", "public static String timeConversion(String s) {\n // Write your code here\n String end = s.substring(2, s.length() - 2);\n String ans = s.substring(0, s.length() - 2);\n if (s.charAt(8) == 'A') {\n return s.startsWith(\"12\") ? \"00\" + end : ans;\n }\n\n return s.startsWith(\"12\") ? ans : (Integer.parseInt(s.substring(0, 2)) + 12) + end;\n }", "public String formatTime() {\n if ((myGameTicks / 16) + 1 != myOldGameTicks) {\n myTimeString = \"\";\n myOldGameTicks = (myGameTicks / 16) + 1;\n int smallPart = myOldGameTicks % 60;\n int bigPart = myOldGameTicks / 60;\n myTimeString += bigPart + \":\";\n if (smallPart / 10 < 1) {\n myTimeString += \"0\";\n }\n myTimeString += smallPart;\n }\n return (myTimeString);\n }", "public static void main(String[] args) {\n\t\tint seconds = 3910 ; // 1 hour 5 minutes and 10 seconds \r\n\t\t\r\n\t\tint minutes , hours ; \r\n\t\t\r\n\t\tminutes = seconds / 60 ; \r\n\t\tSystem.out.println(\" The minutes is : \" + minutes );\r\n\t\t\r\n\t\t// how many seconds remaining after getting minutes part \r\n\t\t\r\n\t\tint remainingSecondsAfterMinute = seconds % 60 ; \r\n\t\tSystem.out.println(\" The remianing seconds after minute is : \" + remainingSecondsAfterMinute );\r\n\t\t\r\n\t\t// we can use minute as below \r\n\t\t// hours = minutes / 60 ; \r\n\t\t// or we can use seconds directly\r\n\t\thours = seconds / 3600 ; \r\n\t\t\r\n\t\t\r\n\t\tSystem.out.println(\" Hours is \" + hours);\r\n\t\t\r\n\t\t// Task : convert the seconds to real life example of \r\n\t\t// 3910 seconds is 1 hour 5 minute and 10 seconds \r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t}", "public interface ConversationalTimeFormatter {\n public String transform(Integer hour, Integer minutes);\n}", "private void setTime(int h, int m, int s) {\r\n\t\tString sHours = String.valueOf(h);\r\n\t\tString sMin = String.valueOf(m);\r\n\t\tString sSec = String.valueOf(s);\r\n\t\tif (sHours.length() > 1) {\r\n\t\t\tledDisplay[4] = Integer.parseInt(sHours.substring(1, 2));\r\n\t\t\tledDisplay[5] = Integer.parseInt(sHours.substring(0, 1));\r\n\t\t} else {\r\n\t\t\tledDisplay[4] = Integer.parseInt(sHours.substring(0, 1));\r\n\t\t\tledDisplay[5] = 0;\r\n\t\t}\r\n\r\n\t\tif (sMin.length() > 1) {\r\n\t\t\tledDisplay[2] = Integer.parseInt(sMin.substring(1, 2));\r\n\t\t\tledDisplay[3] = Integer.parseInt(sMin.substring(0, 1));\r\n\t\t} else {\r\n\t\t\tledDisplay[2] = Integer.parseInt(sMin.substring(0, 1));\r\n\t\t\tledDisplay[3] = 0;\r\n\t\t}\r\n\r\n\t\tif (sSec.length() > 1) {\r\n\t\t\tledDisplay[0] = Integer.parseInt(sSec.substring(1, 2));\r\n\t\t\tledDisplay[1] = Integer.parseInt(sSec.substring(0, 1));\r\n\t\t} else {\r\n\t\t\tledDisplay[0] = Integer.parseInt(sSec.substring(0, 1));\r\n\t\t\tledDisplay[1] = 0;\r\n\t\t}\r\n\r\n\t}", "static long getMinutesPart(Duration d) {\n long u = (d.getSeconds() / 60) % 60;\n\n return u;\n }", "private static String timeConversion(long totalSeconds) {\n\n final int MINUTES_IN_AN_HOUR = 60;\n final int SECONDS_IN_A_MINUTE = 60;\n\n long seconds = totalSeconds % SECONDS_IN_A_MINUTE;\n long totalMinutes = totalSeconds / SECONDS_IN_A_MINUTE;\n long minutes = totalMinutes % MINUTES_IN_AN_HOUR;\n long hours = totalMinutes / MINUTES_IN_AN_HOUR;\n\n StringBuilder time = new StringBuilder();\n time.append(totalSeconds < 0 ? \"-\" : \"\");\n time.append(hours < 10 ? \"0\" : \"\");\n time.append(Math.abs(hours) + \":\");\n time.append(minutes < 10 ? \"0\" : \"\");\n time.append(Math.abs(minutes) + \":\");\n time.append(seconds < 10 ? \"0\" : \"\");\n time.append(Math.abs(seconds));\n\n return time.toString();\n }", "public static String formatTime(long time) {\n long tmp = time;\n int hour = (int) (time / 3600);\n tmp -= hour * 3600;\n int min = (int) (tmp / 60);\n int sec = (int) (tmp - min * 60);\n\n String hourText = hour < 10 ? \"0\" + hour : \"\" + hour;\n String minText = min < 10 ? \"0\" + min : \"\" + min;\n String secText = sec < 10 ? \"0\" + sec : \"\" + sec;\n\n\n return hourText + \":\" + minText + \":\" + secText;\n }", "public String durationInMinutesAndSeconds( ){\n\t\t\n\t\tString time = \"\";\n\t\t\n\t\tint duration = totalTime();\n\n\t\tint minutes = 0;\n\n\t\tint seconds = 0;\n\n\t\tminutes = (int) (duration/60);\n\n\t\tseconds = (int) (duration- (minutes*60));\n\n\t\ttime = minutes + \":\" + seconds +\"\";\n\t\treturn time;\n\t\t\n\t}" ]
[ "0.7127264", "0.7083368", "0.6920192", "0.69176996", "0.6824133", "0.67617065", "0.6716678", "0.6688213", "0.6673724", "0.6654055", "0.6623503", "0.6569787", "0.656605", "0.6552848", "0.64127314", "0.63985115", "0.63717586", "0.6345859", "0.6312922", "0.63061154", "0.6290701", "0.6288355", "0.6269352", "0.6256032", "0.62487125", "0.6243705", "0.62333417", "0.6231175", "0.6226118", "0.6190806", "0.6187544", "0.618691", "0.614288", "0.614155", "0.61367464", "0.61031646", "0.6099937", "0.60990703", "0.60961586", "0.6069608", "0.60560715", "0.60502374", "0.6015871", "0.60143894", "0.6000094", "0.5998255", "0.5994028", "0.59863716", "0.59746164", "0.58970284", "0.5869275", "0.5865307", "0.58556503", "0.5854122", "0.58165777", "0.5813494", "0.5809783", "0.5804323", "0.5799941", "0.5799927", "0.57933104", "0.5787973", "0.5785197", "0.5774286", "0.57734525", "0.5757489", "0.573586", "0.57242185", "0.5722825", "0.5714466", "0.5698639", "0.5693559", "0.5687417", "0.568739", "0.56852406", "0.5682916", "0.568134", "0.5668087", "0.5663653", "0.56615883", "0.56534606", "0.564735", "0.56460327", "0.56300133", "0.56279343", "0.5627365", "0.5626029", "0.5614968", "0.5614943", "0.5612184", "0.5609423", "0.5604336", "0.5601262", "0.5594754", "0.5592775", "0.558339", "0.5575516", "0.55631214", "0.55613005", "0.55487084", "0.55406123" ]
0.0
-1
Instantiates a new list expenses DAOSQL.
public ListExpensesDAOSQL() { this.queryHandler = new QueryHandler(this.url,this.login,this.passwd); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public List<DBExpensesModel> getAllExpenseList() {\n List<DBExpensesModel> expenseArrayList = new ArrayList<DBExpensesModel>();\n\n String selectQuery = \"SELECT * FROM \" + TABLE_EXPENSE;\n Log.d(TAG, selectQuery);\n\n SQLiteDatabase db = this.getReadableDatabase();\n Cursor c = db.rawQuery(selectQuery, null);\n\n // looping through all rows and adding to list\n if (c.moveToFirst()) {\n do {\n DBExpensesModel expense = new DBExpensesModel();\n expense.id = c.getInt(c.getColumnIndex(KEY_ID));\n expense.type = c.getString(c.getColumnIndex(KEY_TYPE));\n expense.amount = c.getInt(c.getColumnIndex(KEY_AMOUNT));\n expense.place = c.getString(c.getColumnIndex(KEY_PLACE));\n expense.note = c.getString(c.getColumnIndex(KEY_NOTE));\n expense.cheque = c.getInt(c.getColumnIndex(KEY_CHEQUE));\n expense.date = c.getString(c.getColumnIndex(KEY_DATE));\n\n // adding to Expenses list\n expenseArrayList.add(expense);\n } while (c.moveToNext());\n }\n return expenseArrayList;\n }", "public Expense() {\n\t\tsuper();\n\t}", "private void createRequestExpense() {\n ExpensesRequest expensesRequestSuperCLass = new ExpensesRequest();\n ArrayList<ExpensesRequest.ExpenseList> expenseLists = new ArrayList<>();\n ExpensesRequest.ExpenseList expensesRequest = new ExpensesRequest().new ExpenseList();\n expensesRequest.setAmount(edittextExpesneAmount.getText().toString());\n expensesRequest.setClientId(Utility.getInstance().getclientRegId(mContext));\n String currentDate = edittextExpenseDate.getText().toString();\n String currentTime = new SimpleDateFormat(\"HH:mm\", Locale.getDefault()).format(new Date());\n Date date = null;\n try {\n date = new SimpleDateFormat(\"dd/MM/yyyy HH:mm\").parse(currentDate + \" \" + currentTime);\n } catch (ParseException e) {\n e.printStackTrace();\n }\n String expeId = \"\";\n expensesRequest.setExpendDate(date);\n expensesRequest.setExpenditureId(expeId);\n transactionIdToast = expeId;\n expensesRequest.setTransactionId(expeId);\n expensesRequest.setPurpose(edittextExpensePurpose.getText().toString());\n expensesRequest.setExpenseType(edittextExpenseName.getText().toString());\n expenseLists.add(expensesRequest);\n expensesRequestSuperCLass.setRegId(Utility.getInstance().getclientRegId(mContext));\n expensesRequestSuperCLass.setExpenseListArrayList(expenseLists);\n if (Utility.getInstance().isOnline(mContext)) {\n boolean valueStatus = validateExpense();\n if (valueStatus) {\n Utility.getInstance().showProgressDialogue(mContext);\n mPresenter.postExpense(expensesRequestSuperCLass, 1);\n }\n edittextExpenseName.setText(\"\");\n edittextExpesneAmount.setText(\"\");\n edittextExpensePurpose.setText(\"\");\n }\n }", "List<ObjectExpenseEntity> getAllObjectExpenses();", "private void populateExpenses() {\n\n List<ExpenseCategory> expenseCategories = expenseCategoryRepository.findAll();\n //todo this isn't null safe fix it\n Payee payee = payeeRepository.findByName(\"Tom\").get(0);\n\n for (int i = 0; i < 10; i++) {\n expenseRepository.save(new Expense(\n new Date(),\n expenseCategories.get(i),\n getRandomBigDecimal(),\n payee,\n \"this is a note about the expense\"\n ));\n\n }\n }", "public Expense(){\n\n }", "public static ExpensesFragment newInstance() {\n ExpensesFragment fragment = new ExpensesFragment();\n Bundle args = new Bundle();\n // args.putString(ARG_PARAM1, param1);\n // args.putString(ARG_PARAM2, param2);\n fragment.setArguments(args);\n return fragment;\n }", "public void initializeExpense() {\n try {\n\n Connection connection = connect();\n\n PreparedStatement createExpenseTable = connection.prepareStatement(\"CREATE TABLE IF NOT EXISTS expense (\"\n + \"id INTEGER PRIMARY KEY, \"\n + \"user_username varchar,\"\n + \"category_name varchar,\"\n + \"amount float,\"\n + \"time varchar,\"\n + \"FOREIGN KEY (user_username) REFERENCES user(username),\"\n + \"FOREIGN KEY(category_name) REFERENCES category(name)\"\n + \");\"\n );\n createExpenseTable.execute();\n createExpenseTable.close();\n connection.close();\n } catch (SQLException e) {\n System.out.println(e.getMessage());\n }\n\n }", "public void addExpense(Expense exp) {\n ContentValues values = new ContentValues();\n SQLiteDatabase db = getWritableDatabase();\n\n values.put(COLUMN_NAME, exp.get_name());\n values.put(COLUMN_DATE, exp.get_date());\n db.insert(TABLE_EXPENSES, null, values);\n db.close();\n }", "ObservableList<Expense> getExpenseList();", "@Dao\npublic interface ExpenseDao {\n\n @Query(\"SELECT * FROM expenses\")\n List<Expense> getExpenses();\n\n @Query(\"SELECT * FROM expenses WHERE id = :expenseId\")\n Expense getExpense(long expenseId);\n\n\n @Insert()\n long addExpense(Expense expense);\n\n @Update()\n void updateExpense(Expense expense);\n\n @Delete()\n void deleteExpense(Expense expense);\n\n @Insert()\n void addTwoExpenses(List<Expense> expenses);\n\n\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 void expensesRefresh() {\n expensesListData.clear();\n DBList.expenses(key1OfActiveChallenge, expensesListAdapter, expensesListData);\n }", "public List<DBIncomesModel> getAllIncomeList() {\n List<DBIncomesModel> incomeArrayList = new ArrayList<DBIncomesModel>();\n\n String selectQuery = \"SELECT * FROM \" + TABLE_INCOME;\n Log.d(TAG, selectQuery);\n\n SQLiteDatabase db = this.getReadableDatabase();\n Cursor c = db.rawQuery(selectQuery, null);\n\n // looping through all rows and adding to list\n if (c.moveToFirst()) {\n do {\n DBIncomesModel income = new DBIncomesModel();\n income.id = c.getInt(c.getColumnIndex(KEY_ID));\n income.type = c.getString(c.getColumnIndex(KEY_TYPE));\n income.amount = c.getInt(c.getColumnIndex(KEY_AMOUNT));\n income.place = c.getString(c.getColumnIndex(KEY_PLACE));\n income.note = c.getString(c.getColumnIndex(KEY_NOTE));\n income.cheque = c.getInt(c.getColumnIndex(KEY_CHEQUE));\n income.date = c.getString(c.getColumnIndex(KEY_DATE));\n\n // adding to Expenses list\n incomeArrayList.add(income);\n } while (c.moveToNext());\n }\n return incomeArrayList;\n }", "public void addNewExpense(Expense expense) {\n SQLiteDatabase db = this.getWritableDatabase();\n \n ContentValues values = new ContentValues();\n values.put(COLUMN_EXPENSE_AMOUNT, expense.getAmount());\n values.put(COLUMN_EXPENSE_CURRENCY, expense.getCurrency());\n values.put(COLUMN_EXPENSE_CATEGORY, expense.getCategory());\n values.put(COLUMN_EXPENSE_WALLET, expense.getWalletTitle());\n values.put(COLUMN_EXPENSE_WALLET_ID, expense.getWalletId());\n values.put(COLUMN_EXPENSE_NOTE, expense.getNote());\n values.put(COLUMN_EXPENSE_EXPENSE_DATE, expense.getExpenseDate());\n\n // Inserting Row\n db.insert(EXPENSE_TABLE, null, values);\n db.close();\n }", "List<Expenses> latestExpenses();", "@Override\r\n\tpublic List<Expense> findAll() {\n\t\treturn expenseRepository.findAll();\r\n\t}", "public ArrayList<Expense> getAllExpenseItems(int walletId) {\n String[] columns = {\n COLUMN_EXPENSE_ID,\n COLUMN_EXPENSE_AMOUNT,\n COLUMN_EXPENSE_CATEGORY,\n COLUMN_EXPENSE_EXPENSE_DATE,\n COLUMN_EXPENSE_CURRENCY,\n COLUMN_EXPENSE_NOTE,\n COLUMN_EXPENSE_WALLET,\n COLUMN_EXPENSE_WALLET_ID\n };\n // sorting orders\n String sortOrder =\n COLUMN_EXPENSE_ID + \" DESC\";\n ArrayList<Expense> expenseList = new ArrayList<Expense>();\n SQLiteDatabase db = this.getReadableDatabase();\n\n Cursor cursor = null;\n\n if (walletId == 0) {\n cursor = db.query(EXPENSE_TABLE, columns, null, null, null, null, sortOrder);\n }\n else {\n String where = \"\" + COLUMN_EXPENSE_WALLET_ID + \" = \"+ walletId +\"\";\n cursor = db.query(EXPENSE_TABLE, columns, where, null, null, null, sortOrder);\n }\n\n if (cursor != null){\n if (cursor.moveToFirst()) {\n do {\n Expense expense = new Expense();\n\n expense.setId(cursor.getInt(cursor.getColumnIndex(COLUMN_EXPENSE_ID)));\n expense.setAmount(cursor.getInt(cursor.getColumnIndex(COLUMN_EXPENSE_AMOUNT)));\n expense.setCategory((cursor.getString(cursor.getColumnIndex(COLUMN_EXPENSE_CATEGORY))));\n expense.setExpenseDate((cursor.getString(cursor.getColumnIndex(COLUMN_EXPENSE_EXPENSE_DATE))));\n expense.setCurrency(cursor.getInt(cursor.getColumnIndex(COLUMN_EXPENSE_CURRENCY)));\n expense.setNote(cursor.getString(cursor.getColumnIndex(COLUMN_EXPENSE_NOTE)));\n expense.setWalletTitle(cursor.getString(cursor.getColumnIndex(COLUMN_EXPENSE_WALLET)));\n expense.setWalletId(cursor.getInt(cursor.getColumnIndex(COLUMN_EXPENSE_WALLET_ID)));\n expenseList.add(expense);\n } while (cursor.moveToNext());\n }\n }\n cursor.close();\n db.close();\n return expenseList;\n }", "public Expense(String costCategory, String name, int price, Date date) {\n\t\t\tthis.costCategory = costCategory;\n\t\t\tthis.name = name;\n\t\t\tthis.price = price;\n\t\t\tthis.date = date;\n\t\t}", "@Override\n public void onCreate(SQLiteDatabase db) {\n String sqlCrearTabla1=\"create table expensesTable (_id integer primary key autoincrement,\";\n sqlCrearTabla1+=\"name text,description text,amount double,date text,category text)\";\n //Ejecutar la instrucción 1.\n db.execSQL(sqlCrearTabla1);\n }", "public List<DailyRecord> getDailyExpense(int year, Month month) throws SQLException {\n\t\treturn getDaily(year, month, \"Expense\");\n\t}", "@Test()\n public void testAddExpense() {\n\tDefaultTableModel model = new DefaultTableModel();\n\tExpense e = new Expense(\"bread\", 8, LocalDate.of(2015, 10, 22), ExpenseType.DAILY);\n\texpenseManager.setBudgetPerMonth(2500);\n\texpenseManager.addExpense(e, model);\n\tassertEquals(5, expenses.size(), 0);\n }", "private void openDatabase() {\n database = new DatabaseExpenses(this);\n database.open();\n }", "public Expense(String name, double amount, int month) {\n this.name = name;\n this.amount = amount;\n this.month = month;\n }", "@GetMapping(path=\"/expenses/all\")\n\tpublic @ResponseBody Iterable<Expenses> getAllExpenses(){\n\t\treturn expenseRepository.findAll();\n\t}", "public String getExpenseTable(String searchCriteria) {\n List<Expense> expenseList = new ArrayList<Expense>();\n List<Expense> tempExpenseList;\n HashSet<Integer> uniqueIdList = new HashSet<Integer>();\n ExpenseDAO expenseDAO = new ExpenseDAO();\n TagLogic tagLogic = new TagLogic();\n DateFormat dateFormat = new SimpleDateFormat(\"MM/dd/yyyy\");\n DataTableGenerator dataTableGenerator = new DataTableGenerator();\n String table;\n\n if (searchCriteria.equals(\"\")) {\n tempExpenseList = expenseDAO.getAll();\n\n for (Expense expense : tempExpenseList) {\n uniqueIdList.add(expense.getId());\n }\n\n for (Integer expenseId : uniqueIdList) {\n Expense expense = expenseDAO.getById(expenseId);\n expenseList.add(expense);\n }\n\n } else {\n expenseList = new ArrayList<Expense>();\n if (expenseDAO.getById(searchCriteria) != null) {\n expenseList.add(expenseDAO.getById(searchCriteria));\n }\n }\n\n table = dataTableGenerator.getStartTable();\n String dataArray[] = new String[4];\n dataArray[0] = \"Transaction ID\";\n dataArray[1] = \"Date\";\n dataArray[2] = \"Tags\";\n dataArray[3] = \"Amount\";\n table = table + dataTableGenerator.getTableHeader(dataArray);\n table = table + dataTableGenerator.getStartTableBody();\n\n for (Expense expense : expenseList) {\n dataArray[0] = String.valueOf(expense.getId());\n dataArray[1] = dateFormat.format(expense.getDate());\n dataArray[2] = tagLogic.getTagValue(expense.getTags());\n dataArray[3] = expense.getAmount().toString();\n table = table + dataTableGenerator.getTableBodyRow(dataArray, \"edit/\" + expense.getId(), \"delete/\" + expense.getId());\n }\n\n table = table + dataTableGenerator.getEndTableBody();\n table = table + dataTableGenerator.getEndTable();\n return table;\n }", "public interface ExpenseService {\n\n List<Expense> getExpenses();\n void addExpense(Expense newExpense);\n\tvoid remove(Expense expenseId);\n\n}", "public void createExpense(ExpenseBE expenseBE) {\n\n }", "void setExpenses(double amount);", "Exploitation createExploitation();", "public StockExistingExample() {\n oredCriteria = new ArrayList<Criteria>();\n }", "public List<MonthlyRecord> getMonthlyExpense(int year) throws SQLException {\n\t\treturn getMonthly(year, \"Expense\");\n\t}", "boolean saveExpense(Expenses exp);", "public void setExpense(Integer expense) {\n this.expense = expense;\n }", "public long addExpenseDetail(DBExpensesModel exp) {\n SQLiteDatabase db = this.getWritableDatabase();\n ContentValues values = new ContentValues();\n values.put(KEY_TYPE, exp.type);\n values.put(KEY_AMOUNT, exp.amount);\n values.put(KEY_PLACE, exp.place);\n values.put(KEY_NOTE, exp.note);\n values.put(KEY_CHEQUE, exp.cheque);\n values.put(KEY_DATE, exp.date);\n long insert = db.insert(TABLE_EXPENSE, null, values);\n return insert;\n }", "public static ExpenseCategoriesFragment newInstance() {\n ExpenseCategoriesFragment fragment = new ExpenseCategoriesFragment();\n Bundle args = new Bundle();\n\n return fragment;\n }", "@PostMapping(path=\"/expenses/add\")\n\tpublic @ResponseBody Expenses addNewExpense(@RequestBody Expenses n) {\n\t\tExpenses result = new Expenses();\n\t\tif(n.getAmount() == \" \" | n.getCategory() == \" \" | n.getExpensesName() == \" \" | n.getToken() == null) {\n\t\t\tresult.setError(true);\n\t\t\tresult.setError_msg(\"One or more fields is empty\");\n\t\t\treturn result;\n\t\t}\n\t\texpenseRepository.save(n);\n\t\tresult.setError(false);\n\t\treturn result;\n\t}", "@Test()\n public void testGetExpensesByTypeAndDay() {\n\tString type = \"DAILY\";\n\tLocalDate date = LocalDate.of(2015, 12, 2);\n\tList<Expense> expensesForDisplay = expenseManager.getExpensesByTypeAndDay(type, date);\n\tassertEquals(1, expensesForDisplay.size(), 0);\n }", "public static List getExpenses(int user, int limit, ArrayList<ArrayList<Filter>> filtersList, int page) {\n final Session session = HibernateUtil.getSessionFactory().openSession();\n List results = null;\n try {\n session.beginTransaction();\n Criteria criteria = session.createCriteria(Expenses.class);\n criteria.add(Restrictions.eq(\"id_main\", user));\n criteria=Filter.implmentFilters(criteria, filtersList);\n results = criteria.setFirstResult((page - 1) * limit)\n .setMaxResults(limit)\n .list();\n\n } catch (HibernateException e) {\n System.err.println(e);\n if (session.getTransaction() != null) {\n session.getTransaction().rollback();\n }\n } finally {\n session.close();\n }\n return results;\n }", "private void updateExpenseListView() {\n expenseListView.getItems().clear();\n int count = 1;\n for (Expense expense : duke.expenseList.getExternalList()) {\n expenseListView.getItems().add(count + \". \" + expense.toString());\n count++;\n }\n }", "public List<Query> queryExpansions() {\n return this.queryExpansions;\n }", "public void setExpId(int expId) {\n this.expId = expId;\n }", "@PostMapping(\"/expenses{id}\")\n ResponseEntity<Expense> createExpense(@Valid @RequestBody Expense expenses) throws URISyntaxException {\n Expense result = expenseRepository.save(expenses);\n return ResponseEntity.created(new URI(\"/api/expenses\" + result.getId())).body(result);\n }", "public Empleado list(int id) {\n Empleado emp = new Empleado();\r\n String sql = \"SELECT * FROM empleado WHERE Id=\" + id;\r\n \r\n try {\r\n con = cn.getConexion();\r\n ps = con.prepareStatement(sql);\r\n rs = ps.executeQuery();\r\n \r\n rs.next(); //un resultset empieza fuera, me posiciono en la primera\r\n emp.setId(rs.getInt(\"Id\"));\r\n emp.setNombre(rs.getString(\"Nombre\"));\r\n emp.setSalario(rs.getDouble(\"Salario\")); \r\n } catch(Exception e) {\r\n System.out.println(e.getMessage());\r\n }\r\n \r\n return emp;\r\n }", "List<Edible> getEdibles();", "public List<Expense> getExpensesPaidToMember(int memberid){\n\t\tList<Expense> expenses = new ArrayList<Expense>();\n\t\ttry {\n\t\t\tstatement = connection.prepareStatement(\"SELECT expense.id, senderid, amount, expensedate, description FROM expense INNER JOIN expense_receiver ON expense.id = expense_receiver.expenseid WHERE senderid ='\" + settings.getCurrentMember().getId()+ \"' AND receiverid ='\" + memberid +\"'\");\n\t\t\tResultSet set = statement.executeQuery();\n\n\t\t\tfor(@SuppressWarnings(\"unused\")int i = 0; set.next(); i++) {\n\t\t\t\texpenses.add(new Expense(set.getInt(1), set.getInt(2),set.getDouble(3), set.getString(4), set.getString(5)));\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\tstatement.close();\n\t\t\t}catch(SQLException e){\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\treturn expenses;\n\t}", "public Query(String expression) {\r\n\t\t_product = Product.class;\r\n\t\t_variable = \"p\";\r\n\t\t_expression = expression;\r\n\r\n\t}", "private PreparedQuery<Exhibition> makeExhibitionsPq() throws SQLException {\n Dao<ExhibitExhibition, Integer> dao = getHelper().getExhibitExhibitionDao();\n QueryBuilder<ExhibitExhibition, Integer> exhibitExhibitionQb = dao.queryBuilder();\n\n exhibitExhibitionQb.selectColumns(ExhibitExhibition.EXHIBITION_ID);\n SelectArg selectArg = new SelectArg();\n exhibitExhibitionQb.where().eq(ExhibitExhibition.EXHIBIT_ID, selectArg);\n\n Dao<Exhibition, Integer> exhibitionDao = getHelper().getExhibitionDao();\n QueryBuilder<Exhibition, Integer> exhibitionQb = exhibitionDao.queryBuilder();\n\n exhibitionQb.where().in(\"id\", exhibitExhibitionQb);\n return exhibitionQb.prepare();\n }", "public String addNew() throws Exception {\r\n\t\tgetNavigationPanel(2);\r\n\t\tExpensesCategoryModel model = new ExpensesCategoryModel();\r\n\t\tmodel.initiate(context, session);\r\n\t\tmodel.getData(expenses, request);\r\n\t\texpenses.setLoadFlag(true);\r\n\t\treset();\r\n\t\t//\texpenses.setFlag(true);\r\n\r\n\t\texpenses.setPanelFlag(\"2\");\r\n\t\texpenses.setRetrnFlag(\"success\");\r\n\r\n\t\tmodel.terminate();\r\n\t\treturn \"success\";\r\n\r\n\t}", "public Exhibitions(String coords,String name, String artisticForm, String price) {\r\n super(coords, name);\r\n this.artisticForm = artisticForm;\r\n this.price = price;\r\n }", "hr.domain.ResumeDBOuterClass.Experience getExperiences(int index);", "java.util.List<hr.domain.ResumeDBOuterClass.Education> \n getEducationsList();", "public RevenueList() {\n }", "public void setExplicandum(SqlNode explicandum) {\n this.explicandum = explicandum;\n }", "@Override\n\tpublic String[] getExpenseEntryLineFromSql(Long id) throws SQLException, NoSuchElementException {\n\t\tResultSet set = getResult(\"select * from expenses where id='\" + id + \"';\");\n\t\tString amount, date, comment, billto, type;\n\t\tif (set.next()) {\n\t\t\tamount = set.getString(\"amount\");\n\t\t\tdate = set.getString(\"date\");\n\t\t\tcomment = set.getString(\"comment\");\n\t\t\tbillto = set.getString(\"billto\");\n\t\t\ttype = set.getString(\"type\");\n\t\t\tset.close();\n\t\t\treturn new String[] { \"\" + id, amount, date, comment, billto, type };\n\t\t} else {\n\t\t\tthrow new NoSuchElementException();\n\t\t}\n\t}", "public Notification createExpense(HttpServletRequest request) {\n Notification notification = new Notification();\n ExpenseDAO expenseDAO = new ExpenseDAO();\n TagDAO tagDAO = new TagDAO();\n Expense expense = new Expense();\n SimpleDateFormat simpleDateFormat = new SimpleDateFormat(\"MM/dd/yyyy\");\n Date expenseDate = new Date();\n BigDecimal amount;\n\n try {\n expenseDate = simpleDateFormat.parse(request.getParameter(\"expenseDate\"));\n } catch (ParseException e) {\n log.error(\"[\" + className + \"] createExpense: Error in parsing expenseDate\");\n }\n\n HashSet<String> uniqueStringList = new HashSet<String>();\n HashSet<Tag> tagSet = new HashSet<Tag>();\n String tagStringList = request.getParameter(\"tagString\");\n tagStringList = tagStringList.replace(\" \", \"\");\n\n if (tagStringList != null) {\n String[] tagStringTokenizeList = tagStringList.split(\",\");\n\n for (String tagName : tagStringTokenizeList) {\n uniqueStringList.add(tagName);\n }\n\n for (String tagName : uniqueStringList) {\n Tag tag = tagDAO.getByDisplayName(tagName);\n\n if (tag == null) {\n log.error(\"tag is null;\");\n Tag createTag = new Tag();\n createTag.setName(tagName);\n createTag.setDisplayName(tagName);\n tagDAO.create(createTag);\n tag = tagDAO.getByDisplayName(tagName);\n }\n\n tagSet.add(tag);\n }\n }\n\n amount = new BigDecimal(request.getParameter(\"amount\"));\n\n expense.setDate(expenseDate);\n expense.setDescription(request.getParameter(\"description\"));\n expense.setAmount(amount);\n expense.setTags(tagSet);\n\n try {\n expenseDAO.create(expense);\n notification.setNotificationType(NotificationType.SUCCESS);\n notification.setMessage(\"Expense created successfully.\");\n log.info(\"[\" + className + \"] createExpense: created Expense\");\n } catch (Exception e) {\n notification.setNotificationType(NotificationType.DANGER);\n notification.setMessage(\"Something went wrong with creating expense. Please try again.\");\n log.error(\"[\" + className + \"] createExpense: failed creating expense\");\n }\n\n return notification;\n }", "public double addExpenseTransaction(ExpenseEntity expenseEntity);", "public AddExpensesForm() {\n initComponents();\n }", "@Test()\n public void testGetExpensesByType() {\n\tString type = \"YEARLY\";\n\tList<Expense> expensesForDisplay = expenseManager.getExpensesByType(type);\n\tassertEquals(1, expensesForDisplay.size(), 0);\n }", "public Index() {\n EntityManager emgr = new BeanBase().getEntityManager();\n this.listaUltimasEntradas = new BeanBaseJWiki().getUltimosCincoArticulosSmall();\n this.listaExistenciasFallidas = emgr.createQuery(\"SELECT e FROM Existencia e WHERE e.idestado.idestado=2\").getResultList();\n this.listaExistenciasMantenimiento = emgr.createQuery(\"SELECT e FROM Existencia e WHERE e.idestado.idestado=3\").getResultList();\n this.listaEquiposFallidos = emgr.createQuery(\"SELECT e FROM Equiposimple e WHERE e.idestado.idestado=2\").getResultList();\n this.listaEquiposMantenimiento = emgr.createQuery(\"SELECT e FROM Equiposimple e WHERE e.idestado.idestado=3\").getResultList();\n\n Calendar cal = Calendar.getInstance(); \n this.listaReservasHoy = new BeanBaseJCanon().getReservasMismoDia(cal.get(Calendar.DAY_OF_MONTH), cal.get(Calendar.MONTH) + 1, cal.get(Calendar.YEAR));\n\n }", "public Expense getExpense(String expenseId) {\n ExpenseDAO expenseDAO = new ExpenseDAO();\n Expense expense;\n try {\n expense = expenseDAO.getById(Integer.parseInt(expenseId));\n } catch (Exception e) {\n log.error(\"[\" + className + \"] getExpense: error in retrieving Expense by Id\");\n return null;\n }\n return expense;\n }", "@Test()\n public void testGetExpensesByTypeAndMonth() {\n\tString type = \"MONTHLY\";\n\tYearMonth yearMonth = YearMonth.of(2015, 6);\n\tList<Expense> expensesForDisplay = expenseManager.getExpensesByTypeAndMonth(type, yearMonth);\n\tassertEquals(1, expensesForDisplay.size(), 0);\n }", "public List<Expediente> getListaXEmpCtaExp(Object o) throws DAOException{\r\n\t\tList<Expediente> lista = null;\r\n\t\ttry{\r\n\t\t\tlista = (List) getSqlMapClientTemplate().queryForList(getNameSpace() + \".getListaXEmpCtaExp\", o);\r\n\t\t}catch(Exception e) {\r\n\t\t\tthrow new DAOException (e);\r\n\t\t}\r\n\t\treturn lista;\r\n\t}", "public double countExpenses() {\n\n double expenses = 0;\n\n for (int i = 0; i < budget.getExpense().size(); i++) {\n expenses += budget.getExpense().get(i).getAmount();\n }\n\n return expenses;\n }", "public List<Expense> getExpensesPaidByMember(int memberid){\n\t\tList<Expense> expenses = new ArrayList<Expense>();\n\t\ttry {\n\t\t\tstatement = connection.prepareStatement(\"SELECT expense.id, senderid, amount, expensedate, description FROM expense INNER JOIN expense_receiver ON expense.id = expense_receiver.expenseid WHERE senderid ='\" + memberid+ \"' AND receiverid ='\" + settings.getCurrentMember().getId() +\"'\");\n\t\t\tResultSet set = statement.executeQuery();\n\n\t\t\tfor(@SuppressWarnings(\"unused\")int i = 0; set.next(); i++) {\n\t\t\t\texpenses.add(new Expense(set.getInt(1), set.getInt(2),set.getDouble(3), set.getString(4), set.getString(5)));\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\tstatement.close();\n\t\t\t}catch(SQLException e){\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t\treturn expenses;\n\t}", "List<MonthlyExpenses> lastMonthExpenses();", "public static List<Offer> offerList() {\n OfferDAO offerDAO = getOfferDAO();\n List<Offer> offerList = offerDAO.offerList();\n return offerList;\n }", "public PurchaseExample() {\n oredCriteria = new ArrayList<Criteria>();\n }", "@RequestMapping(value = \"/insertMultiple\", method = RequestMethod.POST)\n\tpublic ResponseEntity<List<RestResponse>> insertMultiple(@RequestBody List<Expense> list) {\n List<RestResponse> listResults=new ArrayList<>();\n System.out.println(list.size());\n\t list.stream().forEach(expense ->\n {\n listResults.add(expenseService.insertOne(expense));\n System.out.println(\"*** Amount : \"+expense.getAmount());\n });\n\n\t\treturn new ResponseEntity<List<RestResponse>>(listResults, HttpStatus.OK);\n\t }", "@Test\r\n public void testloadExpenses_1() {\n fancyDatabase = new MyDatabase();\r\n expenseRepository = new ExpenseRepository(fancyDatabase);\r\n expenseRepository.loadExpenses();\r\n assertEquals(0,expenseRepository.getExpenses().size());\r\n }", "public ListSemental() {\n }", "public void createNewExpense(View view) {\n EditText newExpenseNameInput = (EditText) findViewById(R.id.newExpenseName);\n EditText newDateInput = (EditText) findViewById(R.id.addExpenseDateEditText);\n Spinner newWhoPaidSpinner = (Spinner) findViewById(R.id.addExpensePayerSpinner);\n\n String newExpenseName = newExpenseNameInput.getText().toString();\n Long newAmount = totalDebt;\n Date newDate = null;\n try {\n newDate = new SimpleDateFormat(\"dd/MM/yyyy\").parse(newDateInput.getText().toString());\n } catch (ParseException e) {\n e.printStackTrace();\n }\n String newWhoPaid = newWhoPaidSpinner.getSelectedItem().toString();\n List<String> newPayees = new ArrayList<String>();\n\n int payeeListItemHoldersSize = payeeListItemHolders.size();\n List<Long> newOwedAmounts = new ArrayList<Long>();\n\n for (int i = 0; i < payeeListItemHoldersSize; i++) {\n if (payeeListItemHolders.get(i).getCheckBox().isChecked()) {\n newPayees.add(payeeListItemHolders.get(i).getCheckBox().getText().toString());\n newOwedAmounts.add(payeeListItemHolders.get(i).getDebt());\n }\n }\n\n Expense newExpense = new Expense(newExpenseName, newAmount, newDate, newWhoPaid, newPayees, newOwedAmounts, group);\n\n try {\n newExpense.save();\n } catch (com.parse.ParseException e) {\n e.printStackTrace();\n }\n\n // finish activity\n Intent intent = setUpBackIntent();\n setResult(RESULT_OK, intent);\n finish();\n }", "public EmployeesAdapter(List<Employee> employeeList) {\n this.employeeList = employeeList;\n }", "public interface ExpensesRecordView extends BaseView {\n void showData(List entityList);\n}", "public InventoryList() {\n super(\"Inventory List\");\n }", "public ExpensesCatagories() {\n initComponents();\n //MySqlConnection1();\n fillTabel();\n }", "@Before\n public void setUp() throws Exception {\n\tExpense e1 = new Expense(\"cofee\", 5, LocalDate.of(2015, 5, 20), ExpenseType.DAILY);\n\tExpense e2 = new Expense(\"beer\", 40, LocalDate.of(2015, 2, 12), ExpenseType.WEEKLY);\n\tExpense e3 = new Expense(\"gas\", 300, LocalDate.of(2015, 4, 8), ExpenseType.MONTHLY);\n\tExpense e4 = new Expense(\"vacation\", 3000, LocalDate.of(2015, 8, 30), ExpenseType.YEARLY);\n\texpenses = new ArrayList<Expense>();\n\texpenses.add(e1);\n\texpenses.add(e2);\n\texpenses.add(e3);\n\texpenses.add(e4);\n\texpenseManager = new ExpenseManager(expenses);\n }", "public Query(Class c, String expression) {\r\n\t\t_product = c;\r\n\t\t_variable = \"c\";\r\n\t\t_expression = expression;\r\n\r\n\t}", "public interface ExpenseItemDAO extends GenericDAO {\r\n ExpenseItem find(long id) throws DAOException;\r\n\r\n List findByExpense(Expense expense, PageInfo pageInfo) throws DAOException;\r\n\r\n List findByCategory(ExpenseItemCategory expItemCat, PageInfo pageInfo) throws DAOException;\r\n\r\n List findByExpenseAndCategory(Expense expense, ExpenseItemCategory expItemCat,\r\n PageInfo pageInfo) throws DAOException;\r\n\r\n ExpenseItem store(ExpenseItem expItem) throws DAOException;\r\n\r\n void delete(long id) throws DAOException;\r\n\r\n}", "public EstadosSql() {\r\n }", "java.util.List<hr.domain.ResumeDBOuterClass.Experience> \n getExperiencesList();", "public ExemptedFeesVM() {\n list = new ArrayList<>();\n }", "public PurchaseList() {\n }", "public ArrayList<Desserts> getAllDesserts() { \r\n\t ArrayList<Desserts> AllDesserts = new ArrayList<Desserts>();\r\n\t try {\r\n\t Class.forName(\"com.mysql.jdbc.Driver\");\r\n\t Connection conn = DriverManager.getConnection(url+dbName,userName,password);\r\n\t statement=conn.createStatement();\r\n\t resultSet=statement.executeQuery(\"select * from g13restaurant.Desserts\");\r\n\t \r\n\t while ( resultSet.next() ) {\r\n\t \t Desserts nextDesserts = new Desserts(\r\n\t \t\t\t resultSet.getInt(\"dessert_ID\"), \r\n\t \t\t\t resultSet.getString(\"dessert_Name\"),\r\n\t resultSet.getString(\"dessert_Description\"), \r\n\t resultSet.getFloat(\"dessert_Cost\"),\r\n\t resultSet.getString(\"dessert_Type\").toString() ); \r\n\t AllDesserts.add(nextDesserts);\r\n\t }\r\n\t conn.close();\r\n\t } \r\n\t catch (Exception e) {\r\n\t e.printStackTrace();\r\n\t }\r\n\t return AllDesserts; \r\n\t }", "@Test()\n public void testGetExpensesByTypeAndYear() {\n\tString type = \"WEEKLY\";\n\tYear year = Year.of(2015);\n\tList<Expense> expensesForDisplay = expenseManager.getExpensesByTypeAndYear(type, year);\n\tassertEquals(1, expensesForDisplay.size(), 0);\n }", "private static Inventory[] createInventoryList() {\n Inventory[] inventory = new Inventory[3];\r\n \r\n Inventory potion = new Inventory();\r\n potion.setDescription(\"potion\");\r\n potion.setQuantityInStock(0);\r\n inventory[Item.potion.ordinal()] = potion;\r\n \r\n Inventory powerup = new Inventory();\r\n powerup.setDescription(\"powerup\");\r\n powerup.setQuantityInStock(0);\r\n inventory[Item.powerup.ordinal()] = powerup;\r\n \r\n Inventory journalclue = new Inventory();\r\n journalclue.setDescription(\"journalclue\");\r\n journalclue.setQuantityInStock(0);\r\n inventory[Item.journalclue.ordinal()] = journalclue;\r\n \r\n return inventory;\r\n }", "public List<Employees>getEMPMenaning() {\n\tString sql = \"SELECT Id_employees, Name_and_surname, Password, Work_role FROM employees \";\n\t\n\tList<Employees>list = new ArrayList<Employees>();\n\t\n\ttry {\n\t\tPreparedStatement preparedStatement = ConnectionToTheBase.getConnectionToTheBase().getConnection().prepareStatement(sql);\n\t\tResultSet resultSet = preparedStatement.executeQuery();\n\t\t\n\t\twhile(resultSet.next()) {\n\t\t\tEmployees getEMPMenaning = new Employees();\n\t\t\tgetEMPMenaning.setIdEmployees(resultSet.getInt(\"Id_employees\"));\n\t\t getEMPMenaning.setNameAndSurname(resultSet.getString(\"Name_and_surname\"));\n\t\t getEMPMenaning.setPassword(resultSet.getString(\"Password\"));\n\t\t getEMPMenaning.setWorkRole(resultSet.getInt(\"Work_role\"));\n\t\t \n\t\t\tlist.add(getEMPMenaning);\n\t\t}\n\t} catch (SQLException e) {\n\t\t// TODO Auto-generated catch block\n\t\te.printStackTrace();\n\t}\n\t\n\treturn list;\n\n\n\t\n}", "public List<Soldados> conectar(){\n EntityManagerFactory conexion = Persistence.createEntityManagerFactory(\"ABP_Servicio_MilitarPU\");\n //creamos una instancia de la clase controller\n SoldadosJpaController tablasoldado = new SoldadosJpaController(conexion);\n //creamos una lista de soldados\n List<Soldados> listasoldado = tablasoldado.findSoldadosEntities();\n \n return listasoldado;\n }", "public static ListInitExpression listInitE(NewExpression newExpression, Iterable<Expression> arguments) { throw Extensions.todo(); }", "public List<Food> getFood() {\n\tString sql =\"select * from food\";\n\tList<Food>list = new ArrayList<Food>();\n\t\n\ttry {\n\t\tPreparedStatement preparedStatement = ConnectionToTheBase.getConnectionToTheBase().getConnection().prepareStatement(sql);\n\t\tResultSet rs = preparedStatement.executeQuery();\n\t\twhile(rs.next()) {\n\t\t\tFood food = new Food();\n\t\t\tfood.setId(rs.getInt(\"Id_food\"));\n\t\t\tfood.setName(rs.getString(\"Name\"));\n\t\t\tfood.setPrice(rs.getDouble(\"Price\"));\n\t\t\tlist.add(food);\n\t\t}\n\t} catch (SQLException e) {\n\t\t// TODO Auto-generated catch block\n\t\te.printStackTrace();\n\t}\n\t\n\treturn list;\n}", "public EmpdetailExample() {\r\n oredCriteria = new ArrayList<Criteria>();\r\n }", "public IncomeDao() {\n super(Income.INCOME, moneytree.persist.db.generated.tables.pojos.Income.class);\n }", "hr.domain.ResumeDBOuterClass.Education getEducations(int index);", "public ExperiencevoucherofferingsRecord(UInteger id, UInteger guestcount, Double price, UInteger experienceid, Timestamp availablefrom, Timestamp availableto) {\n super(Experiencevoucherofferings.EXPERIENCEVOUCHEROFFERINGS);\n\n set(0, id);\n set(1, guestcount);\n set(2, price);\n set(3, experienceid);\n set(4, availablefrom);\n set(5, availableto);\n }", "public JPQLQuery(ExecutionContext ec)\r\n {\r\n this(ec, (JPQLQuery) null);\r\n }", "ObservableList<Expense> getFilteredExpenseList() throws NoUserSelectedException;", "public List<ExpenseItem> filterBySearch(String searchTerm)\n {\n SatisfyFilter filter = new SatisfyFilter(searchTerm);\n return (List<ExpenseItem>) filter.filter(entities.values());\n }", "public Getexamreceiptdeptlist() {\n this(DSL.name(\"getexamreceiptdeptlist\"), null);\n }", "@Test()\n public void testGetExpensesByTypeAndDayNull() {\n\tString type = \"DAILY\";\n\tLocalDate date = LocalDate.of(2015, 3, 25);\n\tList<Expense> expensesForDisplay = expenseManager.getExpensesByTypeAndDay(type, date);\n\tassertEquals(0, expensesForDisplay.size(), 0);\n }", "List<? extends ExpData> getExpDatas(ExpDataClass dataClass);" ]
[ "0.63628703", "0.59589595", "0.5938438", "0.5892213", "0.5876866", "0.58520967", "0.57638913", "0.5722207", "0.5653934", "0.56238365", "0.5564083", "0.5370996", "0.5342507", "0.52655995", "0.52551734", "0.5224359", "0.5198823", "0.5191511", "0.51797163", "0.5129849", "0.5112019", "0.5089519", "0.5080042", "0.5073505", "0.50500345", "0.5018423", "0.5005665", "0.49805942", "0.4965754", "0.49579066", "0.49495625", "0.49432507", "0.49157295", "0.49126628", "0.49057668", "0.490494", "0.49022466", "0.4897658", "0.48960662", "0.4871144", "0.4846145", "0.48376033", "0.4817579", "0.47735855", "0.47589436", "0.47302282", "0.472549", "0.47204903", "0.4699041", "0.46959987", "0.46923882", "0.46831357", "0.46755478", "0.46694964", "0.46669286", "0.46596733", "0.46587178", "0.4658572", "0.46560544", "0.46552658", "0.46348545", "0.46303445", "0.46170956", "0.46032462", "0.46010438", "0.45978835", "0.4590531", "0.4590019", "0.45891774", "0.45711762", "0.4565335", "0.45627686", "0.45623308", "0.45597616", "0.45592767", "0.45519456", "0.4551341", "0.4549312", "0.4540968", "0.45364124", "0.4535699", "0.4535649", "0.4535181", "0.4532082", "0.45272213", "0.4526557", "0.45249125", "0.4508727", "0.4500479", "0.44996628", "0.44994813", "0.4496012", "0.44956174", "0.4494562", "0.44814044", "0.44797465", "0.4475943", "0.44676727", "0.44643766", "0.44605154" ]
0.77041
0
Checks if is exist.
private boolean isExist(String name, Date date) { String sql = "SELECT * from `expenses` WHERE Name='"+name+"' AND Date='"+date+"';"; ResultSet rs = this.queryHandler.executeQuery(sql); try { boolean exist = false; while(rs.next()) { exist = true; } return exist; } catch (SQLException e) { e.printStackTrace(); } this.queryHandler.close(); return false; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract boolean doesExist();", "public boolean exist() {\n\t\treturn false;\n\t}", "@Override\r\n\tpublic boolean isExist() {\n\t\treturn false;\r\n\t}", "public boolean exists()\n\t{\n\n\t\treturn true;\n\t}", "public abstract boolean exists();", "boolean exists();", "boolean exists();", "public Boolean isExist() {\n\t\tif(pfDir.exists())\n\t\t\treturn true;\n\t\telse\n\t\t\treturn false;\n\t}", "@Override\r\n\tpublic boolean exists() {\n\t\treturn false;\r\n\t}", "@Override\n\tpublic boolean exists() {\n\t\treturn false;\n\t}", "boolean hasExists();", "public boolean isExists() {\n\t\treturn exists();\n\t}", "@Override\n\tpublic void exist() {\n\t\t\n\t}", "public boolean isIsExist() {\n return isExist;\n }", "@Override\n\tpublic boolean isExist(String name) {\n\t\treturn false;\n\t}", "boolean getExists();", "public abstract boolean exists() throws AccessException;", "@Override\n\tpublic boolean exists() {\n\t\treturn Files.exists(this.path);\n\t}", "public boolean exists() {\n try {\n return open() != null;\n } catch (IOException e) {\n return false;\n }\n }", "public boolean getExists();", "@Override\n public boolean isExist(Object o) {\n return true;\n }", "public boolean exists() throws LRException\n\t{\n\t\tDataHRecordData myData=(DataHRecordData)getData();\n\t\tgetBackground();\n\t\ttry { return myData.record.exists(background.getClient()); }\n\t\tcatch (LDBException e) { setStatus(e); }\n\t\treturn false;\n\t}", "abstract public boolean exists( String path )\r\n throws Exception;", "public boolean exists() {\n\t\t\n\t\tFile temp = new File(this.path);\n\t\treturn temp.exists();\n\t}", "public boolean exists(String name) throws IOException;", "@Override\r\n\tpublic boolean exists(String id) {\n\t\treturn false;\r\n\t}", "public abstract boolean exists() throws VlException;", "@Override\n\tpublic boolean exists(String arg0) {\n\t\treturn false;\n\t}", "boolean getIfNotExist();", "boolean getIfNotExist();", "abstract public boolean exists() throws VlException;", "public boolean exists(String path);", "public boolean exists() {\n return exists(Datastore.fetchDefaultService());\n }", "public boolean isExisting() throws Exception\r\n\t\t{\r\n\t\tRouteGroup myR = (RouteGroup) myRouteGroup.get();\r\n\t\tthis.UUID = myR.getUUID();\r\n\t\t\r\n\t\tVariables.getLogger().debug(\"Item \"+this.name+\" already exist in the CUCM\");\r\n\t\treturn true;\r\n\t\t}", "public boolean exists(String id) {\n\t\treturn false;\n\t}", "protected boolean resourceExists() {\n\t\tIWorkspace workspace = ResourcesPlugin.getWorkspace();\n\t\tif (workspace == null)\n\t\t\treturn false;\n\t\treturn RodinDB.getTarget(workspace.getRoot(), this.getPath()\n\t\t\t\t.makeRelative(), true) != null;\n\t}", "public boolean exists() {\n return Files.exists(path);\n }", "public boolean exists() {\n return _file.exists();\n }", "@java.lang.Override\n public boolean getExists() {\n return exists_;\n }", "@Override\n public boolean exists(Long id) {\n return false;\n }", "@Override\n public boolean exists(Long id) {\n return false;\n }", "boolean exists(Curso curso) throws BusinessException;", "public boolean exists(String id);", "private boolean checkFileExists(String fPath) {\n\t\tFile file = new File(fPath);\n\t\treturn file.exists();\n\t}", "boolean existsByName(String name);", "@Override\r\n\tpublic boolean itemExists(String absPath) throws RepositoryException {\n\t\treturn false;\r\n\t}", "public static boolean exist(String login) throws Exception {\n\t\t\n\t\tif (Record2.getNode(\"U[\"+login+\"]\")==null) {\n\t\t\treturn false;\n\t\t} else {\n\t\t\treturn true;\n\t\t}\n\t\t\n\t}", "@Override\n\tprotected boolean isExist(AbnormalDevice record) {\n\t\treturn false;\n\t}", "@java.lang.Override\n public boolean getExists() {\n return exists_;\n }", "public boolean fExists(){\n \n try(ObjectInputStream ois = new ObjectInputStream(new FileInputStream(file))){\n \n }\n catch (FileNotFoundException e){\n System.out.println(\"File not found\");\n return false;\n }\n catch (IOException e){\n System.out.println(\"Another exception\");\n return false;\n }\n\n return true;\n }", "protected boolean Exists()\n\t{\n\t\tif (identity<1) return false;\n\t\tNodeReference nodeReference = getNodeReference();\n\t\treturn (nodeReference.exists() || nodeReference.hasSubnodes());\n\t}", "public Boolean Exist(String name)\n\t{\n\t\tBoolean res = false;\n\n\t\tint f = this.FindByName(name);\n\n\t\tif (f == -1)\n\t\t{\n\t\t\tres = false;\n\t\t} else\n\t\t{\n\t\t\tres = true;\n\t\t}\n\n\t\treturn res;\n\t}", "@Override\n public boolean exists(File file) {\n\treturn false;\n }", "public boolean existsInstance(String name)\r\n\t{\r\n\t\treturn obtainOntResource(name) != null;\r\n\t}", "public static boolean exists(){\n \t\treturn everbie != null;\n \t}", "@Override\n\tpublic boolean existe(Long id) {\n\t\treturn false;\n\t}", "@Override\n\tpublic boolean existe(Long id) {\n\t\treturn false;\n\t}", "public boolean exist(String fileName) throws DataAccessException;", "public boolean exists() {\r\n\t\t// Try file existence: can we find the file in the file system?\r\n\t\ttry {\r\n\t\t\treturn getFile().exists();\r\n\t\t}\r\n\t\tcatch (IOException ex) {\r\n\t\t\t// Fall back to stream existence: can we open the stream?\r\n\t\t\ttry {\r\n\t\t\t\tInputStream is = getInputStream();\r\n\t\t\t\tis.close();\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\tcatch (Throwable isEx) {\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t}\r\n\t}", "@Test\n @Ignore\n public void testExists() throws Exception {\n System.out.println(\"exists\");\n Identifier identifier = null;\n IndexDaoImpl instance = null;\n boolean expResult = false;\n boolean result = instance.exists(identifier);\n assertEquals(expResult, result);\n // TODO review the generated test code and remove the default call to fail.\n fail(\"The test case is a prototype.\");\n }", "@Override\npublic boolean existsById(String id) {\n\treturn false;\n}", "public boolean isExist(int conId) throws AppException;", "private boolean exists(String pathName)\n {\n if(new File(pathName).exists())\n {\n return true;\n }\n else\n {\n return false;\n }\n }", "public boolean existsById(Integer id) {\n\t\treturn false;\n\t}", "boolean exists(String path) throws IOException;", "@Override\n\tpublic boolean existsById(UUID id) {\n\t\treturn false;\n\t}", "public boolean isExists() {\n return getIndexOperations().exists();\n }", "private boolean exists() {\n try {\n DatabaseMetaData md = conn.getMetaData();\n ResultSet rs = md.getTables(null, null, \"settings\", null);\n return rs.next();\n } catch (SQLException e) {\n System.err.println(e.getClass().getName() + \": \" + e.getMessage());\n System.exit(0);\n return false;\n }\n }", "public boolean ifExists(Model model)\n\t{\n\t\tSQLiteDatabase db = this.getWritableDatabase();\n\t\tCursor cursor = null;\n\t\tString checkQuery = \"SELECT \"+ KEY_NAME + \" FROM \" + TABLE_SHOP + \" WHERE \" + KEY_NAME + \"= '\"+model.getName() + \"'\";\n\t\tcursor= db.rawQuery(checkQuery,null);\n\t\tboolean exists = (cursor.getCount() > 0);\n\t\tcursor.close();\n\t\treturn exists;\n\t}", "@Override\n\tpublic boolean pathExists(String path) {\n\t\treturn false;\n\t}", "public boolean findUserIsExist(String name) {\n\t\treturn false;\r\n\t}", "public boolean isPresent() {\n return exists();\n }", "public boolean checkIfDatabaseExists() {\r\n return database.exists();\r\n }", "@Override\n\tpublic boolean existId(String id) {\n\t\treturn false;\n\t}", "@Override\r\n\tpublic boolean exists(Long arg0) {\n\t\treturn false;\r\n\t}", "@Override\n\tpublic boolean existsById(Integer id) {\n\t\treturn false;\n\t}", "@Override\r\n\tpublic boolean exists(Integer arg0) {\n\t\treturn false;\r\n\t}", "@Override\n\tpublic synchronized boolean exists(String key) {\n\t\treturn getFile(key).exists();\n\t}", "public boolean isExist(String fileName){\n\t\tFile f = new File(fileName);\n\t\treturn f.exists();\n\t}", "private boolean IsCfgExisted()\n {\n File f = new File(strCfgPath);\n if(f.exists())\n return true;\n return false;\n }", "@Override\r\n\tpublic boolean isAccountExist(Account account) {\n\t\treturn false;\r\n\t}", "@Override\n\tpublic boolean exists(Long arg0) {\n\t\treturn false;\n\t}", "@Override\n\tpublic boolean exists(Long arg0) {\n\t\treturn false;\n\t}", "@Override\n\tpublic boolean exists(Long arg0) {\n\t\treturn false;\n\t}", "public boolean isExist(String id) {\n return mysqlDao.isExist(id);\n }", "private boolean exists(String path, boolean watch) throws KeeperException, InterruptedException {\n Stat stat = zk.exists(path, watch);\n return stat != null;\n }", "@Override\n\tpublic boolean exists(Integer arg0) {\n\t\treturn false;\n\t}", "public static boolean tableIsExist(String name) throws Exception {\n init();\n TableName tableName = TableName.valueOf(name);\n boolean flag = admin.tableExists(tableName);\n close();\n return flag;\n }", "public Boolean doesExist(final UUID uniqueId);", "private boolean isFileExist() {\n File check_file = getFilesDir();\n File[] file_check_array = check_file.listFiles();\n for (File current : file_check_array) {\n boolean user_file = isValidName(current.getName());\n if (user_file) {\n return true;\n }\n }\n return false;\n }", "private static boolean doesUserExist () {\n String sqlRetrieveAisId = \"SELECT ais_id FROM users WHERE user_id=?\";\n \n boolean valid = false;\n try (Connection conn = Database.getConnection();\n PreparedStatement pstmt = conn.prepareStatement(sqlRetrieveAisId)) {\n \n pstmt.setInt(1, userId);\n \n ResultSet rs = pstmt.executeQuery();\n \n valid = rs.next() != false;\n } catch (SQLException se) {\n JOptionPane.showMessageDialog(MainLayout.getJPanel(), Messages.getError(1), Messages.getHeaders(0), JOptionPane.ERROR_MESSAGE);\n } catch (IOException ioe) {\n JOptionPane.showMessageDialog(MainLayout.getJPanel(), Messages.getError(0), Messages.getHeaders(0), JOptionPane.ERROR_MESSAGE);\n } catch (Exception e) {\n JOptionPane.showMessageDialog(MainLayout.getJPanel(), Messages.getError(0), Messages.getHeaders(0), JOptionPane.ERROR_MESSAGE);\n }\n \n return valid;\n }", "boolean exists(String userName);", "Boolean exists(Session session, IRI identifier);", "public boolean pathExists(String path) throws KeeperException, InterruptedException {\n return zkClient.exists(path, true);\n }", "private boolean existsSubResource()\r\n {\r\n return ((subResource_ != null) && subResource_.exists());\r\n }", "public boolean getExists() {\n try {\n return getExecutable(new Launcher.LocalLauncher(new StreamTaskListener(new NullStream()))) != null;\n } catch(IOException ex) {\n return false;\n } catch(InterruptedException e) {\n return false;\n }\n }", "@Override\n\tpublic boolean resourceExist(URI uri) throws StorageSecuirtyException {\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean itemExists() {\n\t\treturn false;\n\t}", "private boolean touchFileExists() {\n File f = new File(touchFile);\n return f.exists();\n }", "private boolean fileExists(Path p) {\n\t\treturn Files.exists(p);\n\t}", "public boolean exists(String arg0) {\n\t\treturn false;\n\t}" ]
[ "0.8233473", "0.8115012", "0.8088675", "0.78389513", "0.7808673", "0.76863796", "0.76863796", "0.76446164", "0.764029", "0.7596503", "0.75854754", "0.7505967", "0.7503808", "0.74896854", "0.7471488", "0.74190784", "0.7396904", "0.7388098", "0.73090345", "0.72983843", "0.72016424", "0.71266335", "0.71170044", "0.71120083", "0.7109741", "0.705998", "0.705734", "0.7044996", "0.7007787", "0.7007787", "0.6999136", "0.6992348", "0.69787174", "0.6925648", "0.69124216", "0.6912127", "0.6906827", "0.6899132", "0.6868793", "0.6840456", "0.6840456", "0.6831185", "0.68305844", "0.6829249", "0.68290764", "0.68133783", "0.68122154", "0.6811396", "0.681027", "0.680715", "0.6803578", "0.6787512", "0.6786672", "0.6774108", "0.6766639", "0.6751725", "0.6751725", "0.674543", "0.67396504", "0.6734001", "0.6731981", "0.67259645", "0.6707604", "0.6679621", "0.66786253", "0.66719544", "0.6671313", "0.66602063", "0.66582316", "0.66459477", "0.6643085", "0.6638854", "0.6636941", "0.6616488", "0.6610484", "0.6605811", "0.65956444", "0.6595476", "0.6587652", "0.65773815", "0.6572695", "0.65688366", "0.65688366", "0.65688366", "0.6563483", "0.655305", "0.65407634", "0.6536951", "0.6520221", "0.6509878", "0.6505488", "0.6491297", "0.6482926", "0.6476707", "0.64765334", "0.6471024", "0.6470891", "0.6460807", "0.64543116", "0.64480966", "0.64477056" ]
0.0
-1
Adds a status bar to an array which will be rendered later
public void addBar(String title, int bars, int color) { // More that 4 bars are not allowed at the moment // TODO: Allow more bars if(totalBars > 4) return; // TODO: Allow user to decide which image to use as a bar count barTitle[totalBars] = title; // Bars are stored in two variables in the following way // [ title 1, title 2 ] // [bar#, barColor, bar#, barColor] barData[totalBars * 2] = bars; barData[(totalBars * 2) + 1] = color; ++totalBars; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void createStatusBar(JPanel bar) {\n bar.setPreferredSize(new Dimension(getWidth(), 25));\n bar.setBackground(Color.LIGHT_GRAY);\n\n // add into container\n bar.add(paintModule.sizeLabel);\n bar.add(paintModule.coordinate);\n\n }", "private Component getStatusBar() {\n\t\tJPanel statusBar = new JPanel();\n\t\tstatusBar.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));\n\t\tstatusLabel = new JLabel(\"Status: \");\n\t\tstatusLabel.setFont(new Font(\"SansSerif\", Font.ITALIC, 11));\n\t\tstatusBar.setLayout(new FlowLayout(FlowLayout.LEFT));\n\t\tstatusBar.add(statusLabel);\n\t\tstatusBar.setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 4));\n\t\treturn statusBar;\n\t}", "private void initStatusBar() {\n ModelerSession.getStatusBarService().addStatusBarItem(\n getIdentifier(), selectedToolStatusBarItem, JideBoxLayout.FIX\n );\n }", "public StatusBar() {\n\t\tsuper();\n\t}", "@Override\n\tpublic StatusBar createStatusBar() {\n\t\tLightVisualThemeStatusBar lightVisualThemeStatusBar = new LightVisualThemeStatusBar();\n\t\treturn lightVisualThemeStatusBar;\n\t}", "protected void setupStatusBar() {\r\n\t\tStatusBar statusBar = new StatusBar() {\r\n\t\t\tprivate static final long serialVersionUID = -8334549384792867496L;\r\n\r\n\t\t\t@Override\r\n\t\t\tprotected String makeAngleDescription(String label, Angle angle) {\r\n\t\t\t\tString s;\r\n\t\t\t\tif (Angle.ANGLE_FORMAT_DMS.equals(getAngleFormat()))\r\n\t\t\t\t\ts = String.format(\"%s %s\", label, angle.toDMSString());\r\n\t\t\t\telse\r\n\t\t\t\t\ts = String.format(\"%s %,.6f\\u00B0\", label, angle.degrees);\r\n\t\t\t\treturn s;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\t/**\r\n\t\t\t * Overridden to capture the current altitude.\r\n\t\t\t */\r\n\t\t\t@Override\r\n\t\t\tprotected String makeEyeAltitudeDescription(double metersAltitude){\r\n\t\t\t\t//System.out.println(\"metersAltitude: \"+ metersAltitude);\r\n\t\t\t\tsetCurrentAltitude(metersAltitude);\r\n\t\t\t\treturn super.makeEyeAltitudeDescription(metersAltitude);\r\n\t\t\t}\r\n\t\t};\r\n\t\tadd(statusBar, BorderLayout.PAGE_END);\r\n\t\tstatusBar.setEventSource(getWWD());\r\n\t}", "public StatusBar() {\n\t\tthis(DEFAULT_STATUS_MESSAGE, true, 1, 1, true);\n\t}", "public static void updateStatusBar(){\n\t\tstatus.setText(\"Sensors: \"+Sensor.idToSensor.size()+(TurnController.getInstance().getCurrentTurn()!=null?\", Turn: \"+TurnController.getInstance().getCurrentTurn().turn:\"\"));\n\t}", "public SwingStatusBar() {\n super();\n \n setBorder(BorderFactory.createEmptyBorder(0, SMALL_BORDER, SMALL_BORDER,\n SMALL_BORDER));\n \n messageLabel = new JLabel(DEFAULT_MESSAGE);\n iconLabel = new JLabel(DEFAULT_ICON);\n \n messageLabel.setBorder(BorderFactory.createEtchedBorder());\n iconLabel.setBorder(BorderFactory.createEtchedBorder());\n \n messageLabel.addMouseListener(this);\n iconLabel.addMouseListener(this);\n ErrorManager.getErrorManager().addErrorListener(this);\n clearError();\n \n setLayout(new SpringLayout());\n \n add(messageLabel);\n add(iconLabel);\n \n setPreferredSize(new Dimension(Short.MAX_VALUE, 25));\n setMaximumSize(new Dimension(Short.MAX_VALUE, 25));\n \n layoutBar();\n }", "public StatusBar() {\n super();\n super.setPreferredSize(new Dimension(100, 16));\n setMessage(\"Ready\");\n }", "private void createStatusBar() {\r\n\t\tJPanel panel = new JPanel();\r\n\t\tpanel.setLayout(new GridLayout(1, 4));\r\n\t\t\r\n\t\tlengthLab = new JLabel(\"Length: 0\");\r\n\t\tlengthLab.setForeground(Color.GRAY);\r\n\t\tlengthLab.setHorizontalAlignment(SwingConstants.LEFT);\r\n\t\tpanel.add(lengthLab);\r\n\t\t\r\n\t\tlnLab = new JLabel(\"Ln: 0\");\r\n\t\tlnLab.setForeground(Color.GRAY);\r\n\t\tlnLab.setHorizontalAlignment(SwingConstants.LEFT);\r\n\t\tpanel.add(lnLab);\r\n\t\t\r\n\t\tcolLab = new JLabel(\"Col: 1\");\r\n\t\tcolLab.setForeground(Color.GRAY);\r\n\t\tcolLab.setHorizontalAlignment(SwingConstants.LEFT);\r\n\t\tpanel.add(colLab);\r\n\t\t\r\n\t selLab = new JLabel(\"Sel: 0\");\r\n\t\tselLab.setForeground(Color.GRAY);\r\n\t\tselLab.setHorizontalAlignment(SwingConstants.LEFT);\r\n\t\tpanel.add(selLab);\r\n\t\t\r\n\t\tJLabel clock = new JLabel(new Date().toString());\r\n\t\tclock.setHorizontalAlignment(SwingConstants.RIGHT);\r\n\t\tpanel.add(clock, BorderLayout.PAGE_END);\r\n\t\ttimer = new Timer(100, (e) -> { \r\n\t\t\tSimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss\");\r\n\t\t\tclock.setText(sdf.format(new Date()));\r\n\t\t});\r\n\t\ttimer.start();\r\n\t\t\r\n\t\tgetContentPane().add(panel, BorderLayout.PAGE_END);\r\n\t}", "public JLabel getStatusbarLabel()\r\n {\r\n return lbStatusbar;\r\n }", "private void changeStatusBar(String status)\r\n {\r\n jStatusBar.setText(status);\r\n }", "private void setStatusBar(String statusMsg)\r\n {\r\n\r\n debug(\"setStatusBar() - get a handle to the main application\");\r\n StockMarketApp mainApp = getMainApp();\r\n\r\n if (mainApp != null)\r\n {\r\n debug(\"setStatusBar() - Sending message to change applications\");\r\n mainApp.setStatus(statusMsg);\r\n }\r\n debug(\"setStatusBar() - Processing completed\");\r\n }", "public void updateStatus(final String newStatus)\n\t{\n\t\tif(statusBar!=null)\n\t\t{\n\t\t\tstatusBar.setText(\"Program Status: \" + newStatus);\n\t\t}\n\t\t//statusBar.repaint();\n\t}", "public StatusBar() {\r\n setLayout(new BorderLayout());\r\n setPreferredSize(new Dimension(100, 20));\r\n panel = new WebPanel();\r\n BoxLayout boxLayout = new BoxLayout(panel, BoxLayout.LINE_AXIS);\r\n panel.setLayout(boxLayout);\r\n panel.add(Box.createHorizontalGlue());\r\n add(panel, BorderLayout.CENTER);\r\n setVisible(false);\r\n }", "public void setStatusBar(String status) {\n this.statusBar.setText(status);\n }", "public void setupTransparentStatusBar(){\n\n if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){\n Window window = getWindow();\n window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);\n window.setFlags(\n WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS,\n WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);\n window.setFlags(\n WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION,\n WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);\n window.setNavigationBarColor(getResources().getColor(R.color.colorPrimaryDark));\n window.setStatusBarColor(getResources().getColor(R.color.colorPrimaryDark));\n }\n\n }", "private static void invasionStatusBar(Activity activity) {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {\n Window window = activity.getWindow();\n View decorView = window.getDecorView();\n decorView.setSystemUiVisibility(decorView.getSystemUiVisibility()\n | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN\n | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);\n window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);\n window.setStatusBarColor(Color.TRANSPARENT);\n }\n }", "public interface StatusBarService extends Service {\n\n /**\n * Appends new status bar item to the notation specific status bar.\n *\n * @param notationIdentifier is the identifier of notation into which status bar is the new item supposed to be\n * appended\n *\n * @param statusBarItem is the status bar item that is supposed to be appended\n *\n * @param itemLayout is the layout information, see JideBoxLayout.FIX, JideBoxLayout.FLEXIBLE, JideBoxLayout.VARY,\n * JideBoxLayout.FIX is the initial value in case of nullary info or invalid value\n *\n * @return any value from InsertStatusBarItemResult enumeration\n *\n * @see cz.cvut.promod.services.statusBarService.utils.InsertStatusBarItemResult for more detail info about return\n * values\n */\n public InsertStatusBarItemResult addStatusBarItem(final String notationIdentifier,\n final StatusBarItem statusBarItem,\n String itemLayout);\n\n}", "public JStatusbarFrame(String title) {\r\n super(title);\r\n Container cp = super.getContentPane();\r\n cp.setLayout(new BorderLayout());\r\n cp.add(pClient = new JPanel(), BorderLayout.CENTER);\r\n cp.add(lbStatusbar = new JLabel(), BorderLayout.SOUTH);\r\n }", "public TrayHandler() {\n this.statusImages[0] = Toolkit.getDefaultToolkit().getImage(\"src/apache2tray/images/active.png\");\n this.statusImages[1] = Toolkit.getDefaultToolkit().getImage(\"src/apache2tray/images/inactive.png\");\n \n this.statusText[0] = \"Apache is running\";\n this.statusText[1] = \"Apache is not running\";\n \n this.systemtray = SystemTray.getSystemTray();\n }", "private void updateBar() {\n\t\tString resources = String.format(\"Money: $%d\\nAgents: %d\\nMedia reach: %d\\nPopulation unrest: %d\"\n\t\t\t\t, player.getMoney(), player.getAgentNumber(), player.getMediaReach(), player.getUnrestSpread());\n\t\t((TextView) findViewById(R.id.text_resource_display_left)).setText(resources);\n\t\t\n\t\tresources = String.format(\"\\nAgent skill: %.0f%%\\nMedia influence: %.0f%%\\nPopulation care: %.0f%%\"\n\t\t\t\t, player.getAgentSkill(), player.getMediaPerception(), player.getUnrestStrength());\n\t\t((TextView) findViewById(R.id.text_resource_display_right)).setText(resources);\n\t}", "public InsertStatusBarItemResult addStatusBarItem(final String notationIdentifier,\n final StatusBarItem statusBarItem,\n String itemLayout);", "public void status(leapstream.scoreboard.core.model.Status status) {\n Stati stati = status.is();\n foreground(stati);\n background(stati);\n label.text(\"\" + stati);\n }", "private void internalSetStatus(String status) {\n jStatusLine.setText(\"Status: \" + status);\n }", "private void setupSystemUI() {\r\n toolbar.animate().translationY(Measure.getStatusBarHeight(getResources())).setInterpolator(new DecelerateInterpolator())\r\n .setDuration(0).start();\r\n getWindow().getDecorView().setSystemUiVisibility(\r\n View.SYSTEM_UI_FLAG_LAYOUT_STABLE\r\n | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION\r\n | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);\r\n }", "private void autoSetBarSize() {\n float statusBarHeight = Utils.getStatusBarHeight(ModifyPassActivity.this);\n mStatusView = findViewById(R.id.view_modify_status_bar);\n LinearLayout.LayoutParams Params1 = new LinearLayout.LayoutParams(\n ViewGroup.LayoutParams.MATCH_PARENT, (int) statusBarHeight);\n mStatusView.setLayoutParams(Params1);\n }", "private void initGUI() {\n statusLabel = new JLabel();\n add(statusLabel);\n updateStatus();\n }", "public void setStatus(byte[] status) {\r\n this.status = status;\r\n }", "private void setupProgressBar() {\n\t\tprogress_bar = new JProgressBar(0,words_to_spell.size());\n\t\tprogress_bar.setBounds(32, 170, 1284, 34);\n\t\tprogress_bar.setBorderPainted(false);\n\t\tprogress_bar.setBackground(Color.WHITE);\n\t\tprogress_bar.setStringPainted(true);\n\t\tprogress_bar.setString(\"\");\n\t\tadd(progress_bar);\n\t}", "private void displayStatus(String status) {\n\t\tif (!status.equals(\"\")) {\n\t\t\tdouble x = LEFT_MARGIN;\n\t\t\tdouble y = nameY + IMAGE_MARGIN + IMAGE_HEIGHT + STATUS_MARGIN;\n\t\t\tGLabel pstatus = new GLabel(status);\n\t\t\tpstatus.setFont(PROFILE_STATUS_FONT);\n\t\t\tif (getElementAt(x, y) != null) {\n\t\t\t\tremove(getElementAt(x, y));\n\t\t\t}\n\t\t\tadd(pstatus, x, y);\n\t\t}\n\t}", "private void changeStatusBarColor() {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {\n Window window = getWindow();\n window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);\n window.setStatusBarColor(Color.TRANSPARENT);\n }\n\n }", "private void updateGUIStatus() {\r\n\r\n }", "private void changeStatusBarColor() {\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {\n Window window = getWindow();\n window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);\n window.setStatusBarColor(Color.TRANSPARENT);\n }\n }", "private static View addFakeStatusBarView(Activity activity, int statusBarColor, int statusBarHeight) {\n Window window = activity.getWindow();\n ViewGroup mDecorView = (ViewGroup) window.getDecorView();\n\n View mStatusBarView = new View(activity);\n FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, statusBarHeight);\n layoutParams.gravity = Gravity.TOP;\n mStatusBarView.setLayoutParams(layoutParams);\n mStatusBarView.setBackgroundColor(statusBarColor);\n mStatusBarView.setTag(TAG_FAKE_STATUS_BAR_VIEW);\n\n mDecorView.addView(mStatusBarView);\n return mStatusBarView;\n }", "void setStatus(int status);", "void setStatus(java.lang.String status);", "private void ocultarBarras(){\n View decorView = getWindow().getDecorView();\n int uiOptions = View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY\n | View.SYSTEM_UI_FLAG_LAYOUT_STABLE\n | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION\n | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN\n | View.SYSTEM_UI_FLAG_FULLSCREEN;\n decorView.setSystemUiVisibility(uiOptions);\n }", "public void setStatusMessage(IStatus status);", "public void enableBar() {\n\t\t// enable listener for alerts button\n\t\t// alerts button\n\t\tthis.alertsButton = (Button) this.findViewById(R.id.alertsButton);\n\t\tupdateAlertCount();\n\t\tthis.alertsButton.setOnClickListener(new OnClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onClick(View view) {\n\t\t\t\t// featureNotEnabledMsg();\n\t\t\t\t// change layout to alerts layout\n\t\t\t\t// Intent myIntent = new Intent(v.getContext(),\n\t\t\t\t// AlertsActivity.class);\n\t\t\t\t// startActivityForResult(myIntent, 0);\n\t\t\t\tIntent myIntent = new Intent(view.getContext(),\n\t\t\t\t\t\tAlertsActivity.class);\n\t\t\t\t// startActivityForResult(myIntent, 0);\n\t\t\t\tstartActivity(myIntent);\n\t\t\t}\n\t\t});\n\t\t// FOR TEST\n\t\t// clicking bar will make a fake alert\n\t\tthis.barButton = (Button) this.findViewById(R.id.mainBar);\n\t\tupdateAlertCount();\n\t\tthis.barButton.setOnClickListener(new OnClickListener() {\n\t\t\t@Override\n\t\t\tpublic void onClick(View view) {\n\t\t\t\t// FOR TEST - create fake alert!!!\n\t\t\t\taddAlert(\"Fake Test Alert\");\n\t\t\t}\n\t\t});\n\t\t// disable button if alerts is disabled\n\t\tif (CapstoneControlActivity.testItemsDisabled) {\n\t\t\tbarButton.setEnabled(false);\n\t\t}\n\t\t// set up for thread that will search for alerts\n\t\tfinal Button alertsButton = (Button) this\n\t\t\t\t.findViewById(R.id.alertsButton);\n\t\tfinal Handler handler = new Handler();\n\t\tfinal Runnable updateRunner = new Runnable() {\n\t\t\tpublic void run() {\n\t\t\t\t// we are now in the event handling so to speak, update the gui\n\t\t\t\tif (alertsList.isEmpty()) {\n\t\t\t\t\t// set 0\n\t\t\t\t\talertsButton.setText(\"0\");\n\t\t\t\t} else {\n\t\t\t\t\t// set to the number of alerts\n\t\t\t\t\tString alertSize = Integer.toString(alertsList.size());\n\t\t\t\t\talertsButton.setText(alertSize);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\t}", "private void displayStatusPanel(String message, String title, int status) {\n JOptionPane.showMessageDialog(mainPanel, message, title, status);\n }", "void setStatus(String status);", "void setStatusMessage(String message);", "@Override\n public void setStatus(int arg0, String arg1) {\n\n }", "static void setStatusBarColor(Activity activity, int statusColor) {\n Window window = activity.getWindow();\n window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);\n\n ViewGroup mContentView = (ViewGroup) window.findViewById(Window.ID_ANDROID_CONTENT);\n View mContentChild = mContentView.getChildAt(0);\n int statusBarHeight = getStatusBarHeight(activity);\n\n removeFakeStatusBarViewIfExist(activity);\n addFakeStatusBarView(activity, statusColor, statusBarHeight);\n addMarginTopToContentChild(mContentChild, statusBarHeight);\n\n if (mContentChild != null) {\n ViewCompat.setFitsSystemWindows(mContentChild, false);\n }\n }", "@Test @Ignore\n public void checkStatusBarUpdates() {\n //Told to ignore by Alanna, status bars have changed 20/9/18 - JB\n verifyThat(\"#statusBar\", LabeledMatchers.hasText(\"ABC1234 Changed first name to Kate\"));\n }", "private void setupToolbars(){\n\t\ttopBar = new TopBar(0, 0, setup.getFrameWidth()+12, Constants.WINDOW_HEADER_HEIGHT, \n\t\t\t\tConstants.COLOR_HEADER_1, setup);\n\t\t\n\t\tbottomBar = new BottomBar(0, \n\t\t\t\tConstants.WINDOW_HEADER_HEIGHT+(Constants.WINDOW_MAP_MARGIN*2)+Constants.WINDOW_MAP_HEIGHT, \n\t\t\t\tsetup.getFrameWidth()+12, \n\t\t\t\tConstants.WINDOW_HEADER_HEIGHT, \n\t\t\t\tConstants.COLOR_HEADER_1, setup);\n\t\t\n\t\trightBar = new RightBar((Constants.WINDOW_MAP_MARGIN*2)+Constants.WINDOW_MAP_WIDTH, \n\t\t\t\tConstants.WINDOW_HEADER_HEIGHT, \n\t\t\t\tConstants.WINDOW_RIGHT_BAR_WIDTH, \n\t\t\t\tConstants.WINDOW_RIGHT_BAR_HEIGHT, \n\t\t\t\tConstants.COLOR_MAP_LAND, setup);\n\t}", "@Override\n public void setStatus(int arg0) {\n\n }", "private void progressMode() {\n\t\t// lazily build the layout\n\t\tif (progressLayout == null) {\n\t\t\tprogressLayout = new DefaultVerticalLayout(true, true);\n\n\t\t\tprogressBar = new ProgressBar();\n\t\t\tprogressBar.setHeight(\"20px\");\n\t\t\tprogressLayout.add(progressBar);\n\n\t\t\tstatusLabel = new Text(\"\");\n\t\t\tprogressLayout.add(statusLabel);\n\t\t}\n\t\tprogressBar.setValue(0.0f);\n\t\tstatusLabel.setText(\"\");\n\n\t\tremoveAll();\n\t\tadd(progressLayout);\n\t}", "private void initGUI() {\n\t\teditor = new JTextArea();\n\t\tthis.getContentPane().setLayout(new BorderLayout());\n\t\tthis.getContentPane().add(new JScrollPane(editor), BorderLayout.CENTER);\n\n\t\tscPane = new JScrollPane(editor);\n\t\tJPanel panel = new JPanel(new BorderLayout());\n\t\tpanel.add(scPane, BorderLayout.CENTER);\n\n\t\tadd(pane);\n\n\t\tJPanel statusBar = new JPanel();\n\t\tJLabel welcomedate;\n\t\twelcomedate = new JLabel();\n\n\t\tstatusBar.setBorder(new BevelBorder(BevelBorder.LOWERED));\n\t\tadd(statusBar, BorderLayout.SOUTH);\n\t\tstatusBar.setPreferredSize(new Dimension(getWidth(), 16));\n\t\tstatusBar.setLayout(new GridLayout(1, 4));\n\n\t\tstatusLabel = new JLabel();\n\t\tlineLabel = new JLabel();\n\t\tcolumnLabel = new JLabel();\n\t\tselectedLabel = new JLabel();\n\n\t\tstatusLabel.setHorizontalAlignment(SwingConstants.LEFT);\n\n\t\tstatusBar.add(statusLabel);\n\n\t\tstatusBar.add(lineLabel);\n\t\tstatusBar.add(columnLabel);\n\t\tstatusBar.add(selectedLabel);\n\n\t\tstatusBar.add(welcomedate, BorderLayout.EAST);\n\n\t\tjavax.swing.Timer time = new javax.swing.Timer(1000, new ActionListener() {\n\n\t\t\t@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tjava.util.Date now = new java.util.Date();\n\t\t\t\tString ss = SimpleDateFormat.getDateTimeInstance().format(now);\n\t\t\t\twelcomedate.setText(ss);\n\t\t\t}\n\t\t});\n\t\ttime.start();\n\n\t\tadd(statusBar, BorderLayout.SOUTH);\n\n\t\tsetVisible(true);\n\n\t\tcreateMenus();\n\t\tcreateToolbars();\n\n\t\tcreateLanguageMenu();\n\n\t}", "public void pushStatusIcon(IconReference ref);", "protected void addStatus(String status) {\n mOldStatus = mOldStatus + status;\n setStatus(mOldStatus);\n }", "static void setStatusBarColorForCollapsingToolbar(Activity activity, final AppBarLayout appBarLayout, final CollapsingToolbarLayout collapsingToolbarLayout,\n Toolbar toolbar, int statusColor) {\n Window window = activity.getWindow();\n window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);\n ViewGroup mContentView = (ViewGroup) window.findViewById(Window.ID_ANDROID_CONTENT);\n\n View mContentChild = mContentView.getChildAt(0);\n mContentChild.setFitsSystemWindows(false);\n ((View) appBarLayout.getParent()).setFitsSystemWindows(false);\n appBarLayout.setFitsSystemWindows(false);\n collapsingToolbarLayout.setFitsSystemWindows(false);\n collapsingToolbarLayout.getChildAt(0).setFitsSystemWindows(false);\n\n toolbar.setFitsSystemWindows(false);\n if (toolbar.getTag() == null) {\n CollapsingToolbarLayout.LayoutParams lp = (CollapsingToolbarLayout.LayoutParams) toolbar.getLayoutParams();\n int statusBarHeight = getStatusBarHeight(activity);\n lp.height += statusBarHeight;\n toolbar.setLayoutParams(lp);\n toolbar.setPadding(toolbar.getPaddingLeft(), toolbar.getPaddingTop() + statusBarHeight, toolbar.getPaddingRight(), toolbar.getPaddingBottom());\n toolbar.setTag(true);\n }\n\n int statusBarHeight = getStatusBarHeight(activity);\n removeFakeStatusBarViewIfExist(activity);\n removeMarginTopOfContentChild(mContentChild, statusBarHeight);\n final View statusView = addFakeStatusBarView(activity, statusColor, statusBarHeight);\n\n CoordinatorLayout.Behavior behavior = ((CoordinatorLayout.LayoutParams) appBarLayout.getLayoutParams()).getBehavior();\n if (behavior != null && behavior instanceof AppBarLayout.Behavior) {\n int verticalOffset = ((AppBarLayout.Behavior) behavior).getTopAndBottomOffset();\n if (Math.abs(verticalOffset) > appBarLayout.getHeight() - collapsingToolbarLayout.getScrimVisibleHeightTrigger()) {\n statusView.setAlpha(1f);\n } else {\n statusView.setAlpha(0f);\n }\n } else {\n statusView.setAlpha(0f);\n }\n\n appBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() {\n @Override\n public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {\n if (Math.abs(verticalOffset) > appBarLayout.getHeight() - collapsingToolbarLayout.getScrimVisibleHeightTrigger()) {\n if (statusView.getAlpha() == 0) {\n statusView.animate().cancel();\n statusView.animate().alpha(1f).setDuration(collapsingToolbarLayout.getScrimAnimationDuration()).start();\n }\n } else {\n if (statusView.getAlpha() == 1) {\n statusView.animate().cancel();\n statusView.animate().alpha(0f).setDuration(collapsingToolbarLayout.getScrimAnimationDuration()).start();\n }\n }\n }\n });\n }", "private void prepareStatus() {\n clock = new JLabel(new Date().toString());\n statusPanel = new JPanel();\n statusPanel.setBorder(new BevelBorder(BevelBorder.LOWERED));\n this.add(statusPanel, BorderLayout.SOUTH);\n statusPanel.setPreferredSize(new Dimension(this.getWidth(), 16));\n statusPanel.setLayout(new BoxLayout(statusPanel, BoxLayout.X_AXIS));\n statusLabel = new JLabel(\"status\");\n statusLabel.setHorizontalAlignment(SwingConstants.LEFT);\n statusPanel.add(statusLabel);\n statusPanel.add(new JLabel(\" \"));\n clock.setHorizontalAlignment(SwingConstants.RIGHT);\n statusPanel.add(clock);\n \n ActionListener updateClockAction = new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent e) {\n clock.setText(new Date().toString()); \n }\n };\n Timer t = new Timer(1000, updateClockAction);\n t.start();\n }", "static void translucentStatusBar(Activity activity) {\n Window window = activity.getWindow();\n window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);\n\n ViewGroup mContentView = (ViewGroup) activity.findViewById(Window.ID_ANDROID_CONTENT);\n View mContentChild = mContentView.getChildAt(0);\n\n removeFakeStatusBarViewIfExist(activity);\n removeMarginTopOfContentChild(mContentChild, getStatusBarHeight(activity));\n if (mContentChild != null) {\n ViewCompat.setFitsSystemWindows(mContentChild, false);\n }\n }", "@Override\n\tpublic void setStatusText (String text) {\n\t}", "private void setStatus(int resId) {\n actionBar.setSubtitle(resId);\n }", "private void setStatus(CharSequence subTitle) {\n getSupportActionBar().setSubtitle(subTitle);\n //textViewStatus.setText(subTitle);\n }", "public void setStatus(String status) { this.status = status; }", "public void changeStatusBar(int colorResource) {\n\n if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {\n Window window = getWindow();\n window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);\n window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);\n window.setStatusBarColor(ContextCompat.getColor(this, colorResource));\n }\n }", "private void setStatus(int resId) {\n\n getSupportActionBar().setSubtitle(resId);\n //textViewStatus.setText(resId);\n\n }", "public void setStatus(int status);", "public void setStatus(int status);", "@Override\n @SuppressWarnings(\"all\")\n public void setStatus(int arg0, String arg1) {\n\n }", "@Override\n protected void onProgressUpdate(String... values) {\n labelStatus.setText(values[0]);\n }", "private void showStatusBarNotification(String title, String sendMessage) {\n }", "private void showBars() {\n if (!mIsActive || mShowBars) {\n return;\n }\n mShowBars = true;\n mOrientationManager.unlockOrientation();\n showToolBar(true);\n showStatusBar();\n // mActionBar.show();\n //mActivity.getGLRoot().setLightsOutMode(false);\n refreshHidingMessage();\n refreshBottomControlsWhenReady();\n }", "void setStatus(STATUS status);", "public String getStatus() {\r\n return \"[\" + getStatusIcon() + \"]\";\r\n }", "private javax.swing.JLabel getTxtStatus() {\r\n\t\tif (txtStatus == null) {\r\n\t\t\ttxtStatus = new javax.swing.JLabel();\r\n\t\t\ttxtStatus.setName(\"txtStatus\");\r\n\t\t\ttxtStatus.setText(\"Initializing...\");\r\n\t\t\ttxtStatus.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);\r\n\t\t\ttxtStatus.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT);\r\n\t\t\ttxtStatus.setPreferredSize(new java.awt.Dimension(800,18));\r\n\t\t}\r\n\t\treturn txtStatus;\r\n\t}", "public void setStatusView(String statusView) {\r\n this.statusView = statusView;\r\n }", "@Override\n\tpublic void setStatus(int status);", "@Override\n public String getStatusIcon() {\n if (isDone) {\n return \"[X]\";\n } else {\n return \"[ ]\";\n }\n }", "private void updateStatus(final String status)\n {\n jLabelStatus.setText(status);\n jLabelStatus.paintImmediately(jLabelStatus.getVisibleRect());\n }", "private static void updateStatus(final int increment) {\n if (splash != null) {\n splash.advance();\n }\n }", "private String getProgressBar(){\n String output = \"\\u00A77[\";\n int total = 20;\n double unlocked = this.unlockedPercentage;\n output += \"\\u00A72\";\n //green bars for every 5% unlocked\n while(unlocked>=5){\n output += \"|\";\n unlocked-=5;\n total--;\n }\n //rest of them are red bars\n output += \"\\u00A7c\";\n while(total-->0){\n output += \"|\";\n }\n\n output += \"\\u00A77]\";\n return output;\n }", "@Override\n protected void process(List<String> chunks) {\n for (String message : chunks) {\n LOG.info(message);\n StatusDisplayer.getDefault().setStatusText(message);\n }\n\n }", "protected void fillCoolBar(ICoolBarManager coolBar) {\n\t\tIWorkbenchWindow window = getActionBarConfigurer().getWindowConfigurer().getWindow();\n\t\tIToolBarManager toolbar = new ToolBarManager(SWT.LEFT);\n\t\tcoolBar.add(new ToolBarContributionItem(toolbar, Messages.getString(\"IU.Strings.15\"))); //$NON-NLS-1$\n\t\ttoolbar.add(new GroupMarker(Messages.getString(\"IU.Strings.16\"))); //$NON-NLS-1$\n\n\n\t\t/*IWorkbenchAction open = ActionFactory..create(window);\n\t\topen.setImageDescriptor(Activator.getImageDescriptor(\"icons/charger.png\"));\n\t\ttoolbar.add(open);*/\n\n\t\tIWorkbenchAction save = ActionFactory.SAVE.create(window);\n\t\tsave.setImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.17\"))); //$NON-NLS-1$\n\t\tsave.setDisabledImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.18\"))); //$NON-NLS-1$\n\t\tsave.setHoverImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.19\"))); //$NON-NLS-1$\n\t\tsave.setText(Messages.getString(\"IU.Strings.20\")); //$NON-NLS-1$\n\t\tsave.setToolTipText(Messages.getString(\"IU.Strings.21\")); //$NON-NLS-1$\n\t\ttoolbar.add(save);\n\n\t\tIWorkbenchAction print = ActionFactory.PRINT.create(window);\n\t\tprint.setImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.22\"))); //$NON-NLS-1$\n\t\tprint.setDisabledImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.23\"))); //$NON-NLS-1$\n\t\tprint.setHoverImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.24\"))); //$NON-NLS-1$\n\t\tprint.setText(Messages.getString(\"IU.Strings.25\")); //$NON-NLS-1$\n\t\tprint.setToolTipText(Messages.getString(\"IU.Strings.26\")); //$NON-NLS-1$\n\t\ttoolbar.add(print);\n\n\n\t\ttoolbar.add(new GroupMarker(Messages.getString(\"IU.Strings.27\"))); //$NON-NLS-1$\n\t\ttoolbar.add(new Separator());\n\t\tIWorkbenchAction find = ActionFactory.FIND.create(window);\n\t\tfind.setImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.28\"))); //$NON-NLS-1$\n\t\t//find.setDisabledImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.29\"))); //$NON-NLS-1$\n\t\t//find.setHoverImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.30\"))); //$NON-NLS-1$\n\t\tfind.setText(Messages.getString(\"IU.Strings.31\")); //$NON-NLS-1$\n\t\tfind.setToolTipText(Messages.getString(\"IU.Strings.32\")); //$NON-NLS-1$\n\t\ttoolbar.add(find);\n\n\t\t/*toolbar.add(ActionFactory.COPY.create(window));\n\t\ttoolbar.add(ActionFactory.CUT.create(window));\n\t\ttoolbar.add(ActionFactory.PASTE.create(window));\n\t\ttoolbar.add(new Separator());*/\n\n\t\t//TODO Rrgler le bug d'icon non charger undo / redo entre l'editeur et la console\n\t\t/*IWorkbenchAction undo = ActionFactory.UNDO.create(window);\n\t\tundo.setImageDescriptor(Activator.getImageDescriptor(\"icons/undo.gif\"));\n\t\tundo.setDisabledImageDescriptor(Activator.getImageDescriptor(\"icons/undo.gif\"));\n\t\tundo.setHoverImageDescriptor(Activator.getImageDescriptor(\"icons/undo.gif\"));\n\t\ttoolbar.add(undo);\n\n\t\tIWorkbenchAction redo = ActionFactory.REDO.create(window);\n\t\tredo.setImageDescriptor(Activator.getImageDescriptor(\"icons/redo.gif\"));\n\t\tredo.setDisabledImageDescriptor(Activator.getImageDescriptor(\"icons/redo.gif\"));\n\t\tredo.setHoverImageDescriptor(Activator.getImageDescriptor(\"icons/redo.gif\"));\n\t\ttoolbar.add(redo);*/\n\n\t\t\n\t\t//toolbar.add(ActionFactory.REDO.create(window));*/\n\n\t\t//toolbox2.png\n\t\tToolsBoxAction toolBox = new ToolsBoxAction(window);\n\t\ttoolBox.setImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.33\"))); //$NON-NLS-1$\n\t\ttoolBox.setDisabledImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.34\"))); //$NON-NLS-1$\n\t\ttoolBox.setHoverImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.35\"))); //$NON-NLS-1$\n\t\ttoolbar.add(toolBox);\n\t\t\n\t\t\n\t\t//action_toolsBox.setMenuCreator(new IMenuCreator(){});\n\t\n\t\t//coolBar.add(new ToolBarContributionItem(toolbar2, \"main2\"));\n\t\t//toolbar2.add(ActionFactory.SHOW_VIEW_MENU.create(window));\n\n\t\t\n\t\tIToolBarManager toolbar2 = new ToolBarManager(SWT.RIGHT | SWT.FLAT | SWT.HORIZONTAL);\n\t\t\n\t\tcoolBar.add(new ToolBarContributionItem(toolbar2, Messages.getString(\"IU.Strings.36\")));\t //$NON-NLS-1$\n\t\ttoolbar2.add(new GroupMarker(Messages.getString(\"IU.Strings.37\"))); //$NON-NLS-1$\n\t\ttoolbar2.add(new GroupMarker(Messages.getString(\"IU.Strings.38\"))); //$NON-NLS-1$\n\t}", "public void setStatusBarColor() {\n super.setStatusBarColor();\n StatusBarUtil.StatusBarLightMode(this);\n }", "protected void initTimeBar() {\n\t\tcurrentTimeBar = new SimplePanel();\n\t\tcurrentTimeBar.addStyleName(\"current-time-bar\");\n\t\tcontainer.add(currentTimeBar);\n\t\tint y = dateToPixel(new Date());\n\t\tcurrentTimeBar.getElement().getStyle().setTop(y, Unit.PX);\n\t\t\n\t\tTimer t = new Timer() {\n\n\t\t\t@Override\n\t\t\tpublic void run() {\n\t\t\t\tint y = dateToPixel(new Date());\n\t\t\t\tcurrentTimeBar.getElement().getStyle().setTop(y, Unit.PX);\n\t\t\t}\n\t\t};\n\t\tt.scheduleRepeating(1 * 60 * 1000); // Repeat every 1 minutes\n\t}", "public void chargeStatusPanel(String[] statuts) {\n\n }", "public void setStatus(Status newStatus){\n status = newStatus;\n }", "public void setStatus(String status) {\n mBundle.putString(KEY_STATUS, status);\n }", "public void reevaluateStatusBarVisibility() {\n if (updateStatusBarVisibilityLocked(getDisplayPolicy().adjustSystemUiVisibilityLw(this.mLastStatusBarVisibility))) {\n this.mWmService.mWindowPlacerLocked.requestTraversal();\n }\n }", "public void setStatus(String status) {\n statusLabel.setText(status);\n }", "private void contributeToActionBars() {\n\t\tIActionBars bars = getViewSite().getActionBars();\n\t\tfillLocalPullDown(bars.getMenuManager());\n\t\tfillLocalToolBar(bars.getToolBarManager());\n\t}", "@Override\n public void setStatusText(String text) {\n status.setText(text);\n }", "private void createToolbars() {\r\n\t\tJToolBar toolBar = new JToolBar(\"Tool bar\");\r\n\t\ttoolBar.add(createBlankDocument);\r\n\t\ttoolBar.add(openDocumentAction);\r\n\t\ttoolBar.add(saveDocumentAction);\r\n\t\ttoolBar.add(saveDocumentAsAction);\r\n\t\ttoolBar.add(closeCurrentTabAction);\r\n\t\t\r\n\t\ttoolBar.addSeparator();\r\n\t\ttoolBar.add(copyAction);\r\n\t\ttoolBar.add(cutAction);\r\n\t\ttoolBar.add(pasteAction);\r\n\t\t\r\n\t\ttoolBar.addSeparator();\r\n\t\ttoolBar.add(getStatsAction);\r\n\t\t\r\n\t\ttoolBar.addSeparator();\r\n\t\ttoolBar.add(exitAction);\r\n\t\t\r\n\t\tgetContentPane().add(toolBar, BorderLayout.PAGE_START);\r\n\t}", "public void setStatus(String stat)\n {\n status = stat;\n }", "@Override\n\t\tpublic void setStatus(int status) {\n\t\t\t\n\t\t}", "public void setStatus(Short status) {\n this.status = status;\n }", "public void setStatus(java.lang.CharSequence value) {\n this.status = value;\n }", "private void setStatus(com.google.protobuf.ByteString value) {\n if (value == null) {\n throw new NullPointerException();\n }\n \n status_ = value;\n }", "public void appendStatusText(String msg) {\n status.append(msg);\n }", "void onStatusUpdate(int status);", "public void setStatus(String status) {\n SwingUtilities.invokeLater(() -> {\n this.internalSetStatus(status);\n });\n }", "public abstract void setStatus(String message);", "@Override\n public void run() {\n for(MessageManager temp : plugin.playerBossBars.values()){\n if(temp.bossBar.getPlayers().size() > 0){\n temp.advanceBar();\n\n BossBarMessage currentMessage = temp.getCurrentMessageObject();\n temp.bossBar.setTitle(currentMessage.barMessage);\n temp.bossBar.setColor(currentMessage.barColor);\n temp.bossBar.setStyle(currentMessage.barStyle);\n }\n }\n }", "public void setStatus(Status status) {\r\n\t this.status = status;\r\n\t }", "public Text displayBar(int score, int lives, int level, int highScore){\n if (highScore<score){\n statusBar.setText(\"Score: \"+ (score)+ \" Lives: \"+ (lives)+ \" Level: \"+ level + \" High Score: \"+ score);\n }\n else{\n statusBar.setText(\"Score: \"+ (score)+ \" Lives: \"+ (lives)+ \" Level: \"+ level+ \" High Score: \"+ highScore);}\n statusBar.setX(550);\n statusBar.setY(50);\n\n return statusBar;\n }" ]
[ "0.7049141", "0.6825802", "0.67866534", "0.66603875", "0.66602916", "0.6643857", "0.66400254", "0.6464015", "0.6461032", "0.6456419", "0.6441359", "0.6248069", "0.62349516", "0.6229974", "0.61747783", "0.6107508", "0.60131395", "0.5982549", "0.5972918", "0.5910906", "0.58615", "0.5848628", "0.57730454", "0.5772405", "0.57626665", "0.5683766", "0.56531465", "0.56513995", "0.56174874", "0.5611072", "0.5596729", "0.5586266", "0.55808103", "0.5523369", "0.5522689", "0.54956126", "0.54764426", "0.54646313", "0.5457389", "0.5454703", "0.543479", "0.5415202", "0.54109704", "0.54077977", "0.5395888", "0.53736186", "0.53724194", "0.5372371", "0.5360876", "0.53506666", "0.5332064", "0.531548", "0.53102565", "0.5308522", "0.53062457", "0.5295484", "0.52865344", "0.52861017", "0.5274646", "0.5274174", "0.52667624", "0.5263726", "0.5261997", "0.5261997", "0.52608037", "0.524558", "0.524459", "0.524256", "0.5234569", "0.52295965", "0.52256805", "0.5222117", "0.5219103", "0.52126956", "0.51835215", "0.5165255", "0.5161958", "0.5160955", "0.5159282", "0.5153705", "0.5150784", "0.5144356", "0.5137495", "0.51369137", "0.5134401", "0.51291704", "0.5126196", "0.5116555", "0.5114539", "0.5111858", "0.5088015", "0.5087473", "0.5081192", "0.5074316", "0.50637305", "0.50580573", "0.5053952", "0.50524104", "0.50502294", "0.5049778", "0.5043756" ]
0.0
-1
Create render format for the bars
private String renderBar(String title, int barQty, char symbol) { StringBuilder bar = new StringBuilder(); bar.append(title); bar.append(": "); for(int i = 0; i < barQty; i++) bar.append(symbol); return bar.toString(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private BarData generateBarData() {\n ArrayList<BarEntry> entries2 = new ArrayList<BarEntry>();\n\n /*\n for (int index = 0; index < itemcount; index++) {\n entries1.add(new BarEntry(0, 25));\n\n // stacked\n entries2.add(new BarEntry(0, new float[]{13, 13}));\n }*/\n entries2.add(new BarEntry(0, 3f));\n\n\n// BarDataSet set1 = new BarDataSet(entries1, \"Bar 1\");\n// set1.setColor(Color.rgb(60, 220, 78));\n// set1.setValueTextColor(Color.rgb(60, 220, 78));\n// set1.setValueTextSize(10f);\n// set1.setAxisDependency(YAxis.AxisDependency.LEFT);\n\n BarDataSet set2 = new BarDataSet(entries2, \"\");\n// set2.setStackLabels(new String[]{\"Stack 1\", \"Stack 2\"});\n// set2.setColors(new int[]{Color.rgb(61, 165, 255), Color.rgb(23, 197, 255)});\n set2.setColor(getResources().getColor(R.color.chart_red));\n set2.setValueTextColor(Color.rgb(61, 165, 255));\n\n set2.setValueTextSize(10f);\n set2.setHighlightEnabled(false);\n\n set2.setAxisDependency(YAxis.AxisDependency.LEFT);\n\n float barWidth = (hoursArray.size() + 1) * 2f; // x2 dataset\n // (0.45 + 0.02) * 2 + 0.06 = 1.00 -> interval per \"group\"\n\n BarData d = new BarData(set2);\n d.setBarWidth(barWidth);\n d.setValueTextSize(0f);\n\n // make this BarData object grouped\n// d.groupBars(0, groupSpace, barSpace); // start at x = 0\n\n return d;\n }", "private BarData generateDataBar() {\n String year = year_txt.getText().toString();\n String month1 =Utilities.getMonth(months,month_txt.getText().toString());\n ArrayList<BarEntry> entries = new ArrayList<>();\n ArrayList<TransactionBeans> transactionBeans = transactionDB.getTransactionRecordsMonth(month1,year);\n for (int i = 0; i < transactionBeans.size(); i++) {\n TransactionBeans beans = transactionBeans.get(i);\n entries.add(new BarEntry(i, (int) (Double.parseDouble(beans.getIncome()))));\n }\n\n BarDataSet d = new BarDataSet(entries, \"\");\n d.setColors(ColorTemplate.VORDIPLOM_COLORS);\n d.setHighLightAlpha(255);\n\n BarData cd = new BarData(d);\n cd.setBarWidth(0.9f);\n cd.setDrawValues(false);\n return cd;\n }", "private BarData generateDataBar() {\n\n ArrayList<BarEntry> entries = new ArrayList<>();\n\n for (int i = 0; i < 12; i++) {\n entries.add(new BarEntry(i, (int) (Math.random() * 70) + 30));\n }\n\n BarDataSet d = new BarDataSet(entries, \"New DataSet 1\");\n // 设置相邻的柱状图之间的距离\n d.setColors(ColorTemplate.VORDIPLOM_COLORS);\n // 设置高亮的透明度\n d.setHighLightAlpha(255);\n\n BarData cd = new BarData(d);\n cd.setBarWidth(0.9f);\n return cd;\n }", "private void addBarGraphRenderers() {\n Paint paint = new Paint();\n paint.setStrokeWidth(50f);\n paint.setAntiAlias(true);\n paint.setColor(Color.argb(200, 56, 138, 252));\n BarGraphRenderer barGraphRendererBottom = new BarGraphRenderer(16, paint, false);\n mVisualizerView.addRenderer(barGraphRendererBottom);\n\n Paint paint2 = new Paint();\n paint2.setStrokeWidth(12f);\n paint2.setAntiAlias(true);\n paint2.setColor(Color.argb(200, 181, 111, 233));\n BarGraphRenderer barGraphRendererTop = new BarGraphRenderer(4, paint2, true);\n mVisualizerView.addRenderer(barGraphRendererTop);\n }", "private void addBarGraphRenderers() {\n Paint paint = new Paint();\n paint.setStrokeWidth(12f);\n paint.setAntiAlias(true);\n paint.setColor(Color.argb(200, 56, 138, 252));\n BarGraphRenderer barGraphRendererBottom = new BarGraphRenderer(4, paint, false, false);\n mVisualizerView.addRenderer(barGraphRendererBottom);\n\n Paint paint2 = new Paint();\n paint2.setStrokeWidth(12f);\n paint2.setAntiAlias(true);\n paint2.setColor(Color.argb(200, 181, 111, 233));\n BarGraphRenderer barGraphRendererTop = new BarGraphRenderer(4, paint2, true, true);\n mVisualizerView.addRenderer(barGraphRendererTop);\n }", "public void generateBarChart(float[] act, float[] act1)\n {\n\n HorizontalBarChart barChart= (HorizontalBarChart) findViewById(R.id.chart);\n /*\n ArrayList<BarEntry> entries = new ArrayList<>();\n entries.add(new BarEntry(4f, 0));\n entries.add(new BarEntry(8f, 1));\n entries.add(new BarEntry(6f, 2));\n entries.add(new BarEntry(12f, 3));\n entries.add(new BarEntry(18f, 4));\n entries.add(new BarEntry(10f, 6));\n entries.add(new BarEntry(14f, 7));\n entries.add(new BarEntry(2f, 5));\n\n BarDataSet dataset1 = new BarDataSet(entries, \"# of Calls\");\n */\n\n ArrayList<String> labels = new ArrayList<String>();\n labels.add(\"Food\");\n labels.add(\"Cloth\");\n labels.add(\"Travelling\");\n labels.add(\"Stationary\");\n labels.add(\"Furniture\");\n labels.add(\"Medicine\");\n labels.add(\"Bill\");\n labels.add(\"Utensils\");\n\n\n /* for create Grouped Bar chart*/\n ArrayList<BarEntry> group1 = new ArrayList<>();\n group1.add(new BarEntry(act1[0], 0));\n group1.add(new BarEntry(act1[1], 1));\n group1.add(new BarEntry(act1[2], 2));\n group1.add(new BarEntry(act1[3], 3));\n group1.add(new BarEntry(act1[4], 4));\n group1.add(new BarEntry(act1[5], 5));\n group1.add(new BarEntry(act1[6], 6));\n group1.add(new BarEntry(act1[7], 7));\n\n ArrayList<BarEntry> group2 = new ArrayList<>();\n group2.add(new BarEntry(act[0], 0));\n group2.add(new BarEntry(act[1], 1));\n group2.add(new BarEntry(act[2], 2));\n group2.add(new BarEntry(act[3], 3));\n group2.add(new BarEntry(act[4], 4));\n group2.add(new BarEntry(act[5], 5));\n group2.add(new BarEntry(act[6], 6));\n group2.add(new BarEntry(act[7], 7));\n\n BarDataSet barDataSet1 = new BarDataSet(group1, \"Planned Amount\");\n //barDataSet1.setColor(Color.rgb(0, 155, 0));\n barDataSet1.setColor(getResources().getColor(R.color.darkgreen));\n\n BarDataSet barDataSet2 = new BarDataSet(group2, \"Actual Amount\");\n barDataSet2.setColor(getResources().getColor(R.color.purered));\n\n\n ArrayList<IBarDataSet> dataset = new ArrayList<>();\n dataset.add(barDataSet1);\n dataset.add(barDataSet2);\n /**/\n\n BarData data = new BarData(labels,dataset);\n// // dataset.setColors(ColorTemplate.COLORFUL_COLORS); //\n barChart.setData(data);\n barChart.animateY(5000);\n barChart.setDescription(\"Expense Graph\");\n barChart.setDescriptionPosition(2f, 2f);\n\n }", "private BarData getBarData(ArrayList<Column> columns, String Label){\n\n ArrayList<BarEntry> valueSet = new ArrayList<>();\n\n for(int i = 0; i < columns.size(); i++){\n valueSet.add(new BarEntry(i, columns.get(i).getColVal()));\n }\n\n BarDataSet barDataSet = new BarDataSet(valueSet, Label);\n barDataSet.setColors(ColorTemplate.COLORFUL_COLORS);\n barDataSet.setValueFormatter(new IValueFormatter() {\n @Override\n public String getFormattedValue(float value, Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {\n if (value == 0f)\n return \"\";\n return String.valueOf((int)value);\n }\n });\n\n\n return new BarData(barDataSet);\n }", "private void drawBars(Graphics g) {\n // declare local variables:\n int numberOfDigits=1;\n // end of local variables declaration\n\n\n // draw the bars\n for(int c = 0; c < bars ; c++) {\n // set the drawing colour\n g.setColor(Color.WHITE);\n\n // check the number of digits of c\n if( c > 8) {\n numberOfDigits = 2;\n } // end of if statement\n\n // check if bar number should be drawn\n if(c%3==0) {\n // set the colour\n g.setColor(new Color(190, 130, 0) );\n // draw bar number\n g.drawString(Integer.toString(c+1) ,\n getWidth()- (textAreaLenght+barLenght)- barLenght*c -( 3*numberOfDigits ),\n getHeight()-8);\n } // end of if statement\n\n // draw vertical mini line\n g.drawLine(getWidth()- (textAreaLenght+barLenght)- barLenght*c, getHeight()-24,\n getWidth()- (textAreaLenght+barLenght)- barLenght*c, getHeight()-20);\n\n\n } // end of for loop\n\n }", "public void generateBar(String path,List<Object[]> list) {\r\n\t\t\r\n\t\t//create DataSet using list\r\n\t\tDefaultCategoryDataset dataset=new DefaultCategoryDataset();\r\n\t\tfor(Object[] ob : list) {\r\n\t\t//order value, key label text\r\n\t\tdataset.setValue(new Double(ob[1].toString()), ob[0].toString(), \"UomType Details\");\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t\t//2.convert to JFreeChart using chartFactory\r\n\t\tJFreeChart chart=ChartFactory.createBarChart(\"UomType\", \"uomTypes\", \"count\", dataset);\r\n\t\t\r\n\t\t//3.save as Image using charts\r\n\t\ttry {\r\n\t\t\tChartUtils.saveChartAsJPEG(new File(path+\"/resources/images/UomTypetBar.jpg\"), chart, 300, 300);\r\n\t\t} catch (IOException e) {\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t}", "public static String exampleBarChart2() {\n final int MAX_MEDALS = 51;\n Data goldData= DataUtil.scaleWithinRange(0, MAX_MEDALS, Arrays.asList(MAX_MEDALS, 36, 23, 19, 16));\n Data silverData= DataUtil.scaleWithinRange(0, MAX_MEDALS, Arrays.asList(21, 38, 21, 13, 10));\n Data bronzeData= DataUtil.scaleWithinRange(0, MAX_MEDALS, Arrays.asList(28, 36, 28, 15, 15));\n BarChartPlot gold = Plots.newBarChartPlot(goldData, GOLD, \"Gold\");\n BarChartPlot silver = Plots.newBarChartPlot(silverData, SILVER, \"Silver\");\n BarChartPlot bronze = Plots.newBarChartPlot(bronzeData, Color.BROWN, \"Bronze\");\n BarChart chart = GCharts.newBarChart(gold, silver, bronze);\n\n // Defining axis info and styles\n AxisStyle axisStyle = AxisStyle.newAxisStyle(BLACK, 13, AxisTextAlignment.CENTER);\n AxisLabels country = AxisLabelsFactory.newAxisLabels(\"Country\", 50.0);\n country.setAxisStyle(axisStyle);\n AxisLabels countries = AxisLabelsFactory.newAxisLabels(\"Germany\", \"United Kingdom\", \"Russia\", \"USA\", \"China\");\n countries.setAxisStyle(axisStyle);\n AxisLabels medals = AxisLabelsFactory.newAxisLabels(\"Medals\", 50.0);\n medals.setAxisStyle(axisStyle);\n AxisLabels medalCount = AxisLabelsFactory.newNumericRangeAxisLabels(0, MAX_MEDALS);\n medalCount.setAxisStyle(axisStyle);\n\n\n // Adding axis info to chart.\n chart.addXAxisLabels(medalCount);\n chart.addXAxisLabels(medals);\n chart.addYAxisLabels(countries);\n chart.addYAxisLabels(country);\n chart.addTopAxisLabels(medalCount);\n chart.setHorizontal(true);\n chart.setSize(450, 650);\n chart.setSpaceBetweenGroupsOfBars(30);\n\n chart.setTitle(\"2008 Beijing Olympics Medal Count\", BLACK, 16);\n ///51 is the max number of medals.\n chart.setGrid((50.0/MAX_MEDALS)*20, 600, 3, 2);\n chart.setBackgroundFill(Fills.newSolidFill(LIGHTGREY));\n LinearGradientFill fill = Fills.newLinearGradientFill(0, Color.newColor(\"E37600\"), 100);\n fill.addColorAndOffset(Color.newColor(\"DC4800\"), 0);\n chart.setAreaFill(fill);\n String url = chart.toURLString();\n return url;\n }", "@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}", "public Parent createBarGraph(ObservableList<HappinessReport> data) {\n xAxis = new CategoryAxis();\n xAxis.setLabel(\"Country\");\n //Yaxis Creation\n yAxis = new NumberAxis();\n yAxis.setLabel(\"Score\");\n //Chart Creation\n barchart = new BarChart<>(xAxis, yAxis);\n barchart.setTitle(\"Horizontal Bar Chart Example\");\n //Country and Score Data load into chart\n for (int intx = 0; intx < data.size(); intx++) {\n XYChart.Series barChartSeries = new XYChart.Series<>();\n barChartSeries.getData().add(new XYChart.Data(String.valueOf(data.get(intx).getCountry()), data.get(intx).getScore()));\n barchart.getData().add(barChartSeries);\n }\n barchart.setTitle(\"Horizontal Bar Chart Example\");\n barchart.setLegendVisible(false);\n return barchart;\n }", "@Test\n public void test25() throws Throwable {\n CombinedRangeCategoryPlot combinedRangeCategoryPlot0 = new CombinedRangeCategoryPlot();\n AxisLocation axisLocation0 = AxisLocation.TOP_OR_RIGHT;\n AxisLocation axisLocation1 = axisLocation0.getOpposite();\n combinedRangeCategoryPlot0.setRangeAxisLocation(0, axisLocation0, true);\n SortOrder sortOrder0 = combinedRangeCategoryPlot0.getColumnRenderingOrder();\n CategoryItemRenderer[] categoryItemRendererArray0 = new CategoryItemRenderer[7];\n StatisticalBarRenderer statisticalBarRenderer0 = new StatisticalBarRenderer();\n categoryItemRendererArray0[0] = (CategoryItemRenderer) statisticalBarRenderer0;\n StackedAreaRenderer stackedAreaRenderer0 = new StackedAreaRenderer(true);\n categoryItemRendererArray0[1] = (CategoryItemRenderer) stackedAreaRenderer0;\n CombinedRangeXYPlot combinedRangeXYPlot0 = new CombinedRangeXYPlot();\n Paint paint0 = combinedRangeXYPlot0.getRangeTickBandPaint();\n WaterfallBarRenderer waterfallBarRenderer0 = null;\n try {\n waterfallBarRenderer0 = new WaterfallBarRenderer((Paint) null, (Paint) null, (Paint) null, (Paint) null);\n } catch(IllegalArgumentException e) {\n //\n // Null 'firstBarPaint' argument\n //\n assertThrownBy(\"org.jfree.chart.renderer.category.WaterfallBarRenderer\", e);\n }\n }", "private void setupBarChart() {\n mBarChart.setOnChartValueSelectedListener(this);\n mBarChart.getDescription().setEnabled(false);\n mBarChart.setDrawBorders(true);\n mBarChart.setBorderWidth(1.f);\n mBarChart.setBorderColor(Color.parseColor(\"#616161\"));\n mBarChart.setPinchZoom(true);\n mBarChart.setDrawBarShadow(false);\n mBarChart.setDrawGridBackground(false);\n mBarChart.setTouchEnabled(true);\n mBarChart.setDoubleTapToZoomEnabled(false);\n\n Legend l = mBarChart.getLegend();\n l.setVerticalAlignment(Legend.LegendVerticalAlignment.TOP);\n l.setHorizontalAlignment(Legend.LegendHorizontalAlignment.RIGHT);\n l.setOrientation(Legend.LegendOrientation.VERTICAL);\n l.setDrawInside(true);\n l.setYOffset(0f);\n l.setXOffset(10f);\n l.setYEntrySpace(0f);\n l.setTextSize(8f);\n\n// List<String> list = new ArrayList<String>();\n// for(Report report: mReportList){\n// list.add(report.monthYear);\n// }\n// final String[] stringMonthYear = list.toArray(new String[0]);\n\n XAxis xAxis = mBarChart.getXAxis();\n xAxis.setGranularity(1f);\n xAxis.setPosition(XAxis.XAxisPosition.TOP);\n xAxis.setCenterAxisLabels(true);\n xAxis.setValueFormatter(new IAxisValueFormatter() {\n @Override\n public String getFormattedValue(float value, AxisBase axis) {\n int n = (int) value;\n switch (n) {\n case 0:\n if(mReportList.size()<1){\n break;\n }\n return mReportList.get(0).monthYear;\n case 1:\n if(mReportList.size()<2){\n break;\n }\n return mReportList.get(1).monthYear;\n case 2:\n if(mReportList.size()<3){\n break;\n }\n return mReportList.get(2).monthYear;\n case 3:\n if(mReportList.size()<4){\n break;\n }\n return mReportList.get(3).monthYear;\n }\n if (n < 0) {\n return \"Tháng\";\n } else{\n return \"Tháng\";\n }\n }\n });\n\n YAxis leftAxis = mBarChart.getAxisLeft();\n leftAxis.setValueFormatter(new LargeValueFormatter());\n leftAxis.setDrawGridLines(false);\n leftAxis.setSpaceTop(35f);\n leftAxis.setAxisMinimum(0f); // this replaces setStartAtZero(true)\n\n mBarChart.getAxisRight().setEnabled(false);\n\n float groupSpace = 0.04f;\n float barSpace = 0.03f; // x2 dataset\n float barWidth = 0.45f; // x2 dataset\n // (0.45 + 0.03) * 2 + 0.04 = 1.00 -> interval per \"group\"\n\n int startMonth = 0;\n\n ArrayList<BarEntry> yValsThu = new ArrayList<BarEntry>();\n ArrayList<BarEntry> yValsChi = new ArrayList<BarEntry>();\n\n int i = 0;\n for (Report report : mReportList) {\n yValsThu.add(new BarEntry(i, (float) report.incomeTotal));\n yValsChi.add(new BarEntry(i, (float) report.expenseTotal));\n i++;\n }\n\n BarDataSet setThu, setChi;\n\n if (mBarChart.getData() != null && mBarChart.getData().getDataSetCount() > 0) {\n\n setThu = (BarDataSet) mBarChart.getData().getDataSetByIndex(0);\n setChi = (BarDataSet) mBarChart.getData().getDataSetByIndex(1);\n setThu.setValues(yValsThu);\n setChi.setValues(yValsChi);\n mBarChart.getData().notifyDataChanged();\n mBarChart.notifyDataSetChanged();\n\n } else {\n // create 4 DataSets\n setThu = new BarDataSet(yValsThu, \"Thu\");\n setThu.setColor(Color.parseColor(\"#64dd17\"));\n setChi = new BarDataSet(yValsChi, \"Chi\");\n setChi.setColor(Color.parseColor(\"#2196f3\"));\n\n BarData data = new BarData(setThu, setChi);\n data.setValueFormatter(new LargeValueFormatter());\n\n mBarChart.setData(data);\n }\n\n // specify the width each bar should have\n mBarChart.getBarData().setBarWidth(barWidth);\n\n // restrict the x-axis range\n mBarChart.getXAxis().setAxisMinimum(startMonth);\n\n // barData.getGroupWith(...) is a helper that calculates the width each group needs based on the provided parameters\n mBarChart.getXAxis().setAxisMaximum(startMonth + mBarChart.getBarData().getGroupWidth(groupSpace, barSpace) * mReportList.size());\n mBarChart.groupBars(startMonth, groupSpace, barSpace);\n for (IBarDataSet set : mBarChart.getData().getDataSets()) {\n ((BarDataSet) set).setBarBorderWidth(1.f);\n ((BarDataSet) set).setBarBorderColor(Color.parseColor(\"#616161\"));\n }\n mBarChart.invalidate();\n mBarChart.animateY(800);\n\n //[END Setup Bar Char]\n }", "private void createBarChart(FoodEmissions emissions, Context context) {\n ArrayList<BarEntry> barEntries = new ArrayList<>();\n ArrayList<String> labelNames = new ArrayList<>();\n labelNames.add(\"Meat\");\n labelNames.add(\"Dairy\");\n labelNames.add(\"Plant\");\n labelNames.add(\"Total\");\n barEntries.add(new BarEntry(0, Float.parseFloat(emissions.getMeat())));\n barEntries.add(new BarEntry(1, Float.parseFloat(emissions.getDairy())));\n barEntries.add(new BarEntry(2, Float.parseFloat(emissions.getPlant())));\n barEntries.add(new BarEntry(3, Float.parseFloat(emissions.getTotal())));\n LayoutInflater li = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);\n RelativeLayout relativeLayout = (RelativeLayout) li.inflate(R.layout.emission_chart_layout, null);\n BarChart chart = relativeLayout.findViewById(R.id.bar_chart);\n //Customization to the BarCharts look\n BarDataSet set = new BarDataSet(barEntries, \"CO2 Emissions (in Kg)\");\n set.setColors(ColorTemplate.COLORFUL_COLORS);\n set.setValueTextSize(20f);\n Description description = new Description();\n description.setText(\"\");\n chart.setDescription(description);\n BarData data = new BarData(set);\n chart.setData(data);\n Legend legend = chart.getLegend();\n legend.setTextSize(15f);\n XAxis xAxis = chart.getXAxis();\n xAxis.setValueFormatter(new IndexAxisValueFormatter(labelNames));\n xAxis.setPosition(XAxis.XAxisPosition.TOP);\n xAxis.setDrawGridLines(false);\n xAxis.setGranularity(1f);\n xAxis.setLabelCount(labelNames.size());\n AlertDialog builder = new AlertDialog.Builder(context)\n .setNegativeButton(\"Close\", null)\n .setView(relativeLayout)\n .setCancelable(false)\n .create();\n builder.show();\n }", "public JFreeChart render();", "public static String exampleBarChart() {\n BarChartPlot team1 = Plots.newBarChartPlot(Data.newData(25, 43, 12, 30), Color.BLUEVIOLET, \"Team A\");\n BarChartPlot team2 = Plots.newBarChartPlot(Data.newData(8, 35, 11, 5), Color.ORANGERED, \"Team B\");\n BarChartPlot team3 = Plots.newBarChartPlot(Data.newData(10, 20, 30, 30), Color.LIMEGREEN, \"Team C\");\n\n // Instantiating chart.\n BarChart chart = GCharts.newBarChart(team1, team2, team3);\n\n // Defining axis info and styles\n AxisStyle axisStyle = AxisStyle.newAxisStyle(Color.BLACK, 13, AxisTextAlignment.CENTER);\n AxisLabels score = AxisLabelsFactory.newAxisLabels(\"Score\", 50.0);\n score.setAxisStyle(axisStyle);\n AxisLabels year = AxisLabelsFactory.newAxisLabels(\"Year\", 50.0);\n year.setAxisStyle(axisStyle);\n\n // Adding axis info to chart.\n chart.addXAxisLabels(AxisLabelsFactory.newAxisLabels(\"2002\", \"2003\", \"2004\", \"2005\"));\n chart.addYAxisLabels(AxisLabelsFactory.newNumericRangeAxisLabels(0, 100));\n chart.addYAxisLabels(score);\n chart.addXAxisLabels(year);\n\n chart.setSize(600, 450);\n chart.setBarWidth(100);\n chart.setSpaceWithinGroupsOfBars(20);\n chart.setDataStacked(true);\n chart.setTitle(\"Team Scores\", Color.BLACK, 16);\n chart.setGrid(100, 10, 3, 2);\n chart.setBackgroundFill(Fills.newSolidFill(Color.ALICEBLUE));\n LinearGradientFill fill = Fills.newLinearGradientFill(0, Color.LAVENDER, 100);\n fill.addColorAndOffset(Color.WHITE, 0);\n chart.setAreaFill(fill);\n String url = chart.toURLString();\n return url;\n }", "private void renderSeries(SeriesData s) throws InvalidStateException {\r\n XYSeriesRenderer currentRenderer = new XYSeriesRenderer();\r\n mRenderer.addSeriesRenderer(currentRenderer);\r\n configureSeries(s, currentRenderer);\r\n\r\n XYSeries series = createSeries(Boolean.valueOf(s.getConfiguration(\"secondary-y\", \"false\")).equals(Boolean.TRUE) ? 1 : 0);\r\n series.setTitle(s.getConfiguration(\"name\", \"\"));\r\n if (Graph.TYPE_BUBBLE.equals(mData.getType())) {\r\n if (s.getConfiguration(\"radius-max\") != null) {\r\n ((RangeXYValueSeries) series).setMaxValue(parseYValue(s.getConfiguration(\"radius-max\"), \"radius-max\"));\r\n }\r\n }\r\n mDataset.addSeries(series);\r\n\r\n // Bubble charts will throw an index out of bounds exception if given points out of order\r\n Vector<XYPointData> sortedPoints = new Vector<XYPointData>(s.size());\r\n for (XYPointData d : s.getPoints()) {\r\n sortedPoints.add(d);\r\n }\r\n Comparator<XYPointData> comparator;\r\n if (Graph.TYPE_BAR.equals(mData.getType())) {\r\n String barSort = s.getConfiguration(\"bar-sort\", \"\");\r\n switch (barSort) {\r\n case \"ascending\":\r\n comparator = new AscendingValuePointComparator();\r\n break;\r\n case \"descending\":\r\n comparator = new DescendingValuePointComparator();\r\n break;\r\n default:\r\n comparator = new StringPointComparator();\r\n break;\r\n }\r\n } else {\r\n comparator = new NumericPointComparator();\r\n }\r\n Collections.sort(sortedPoints, comparator);\r\n\r\n int barIndex = 1;\r\n JSONObject barLabels = new JSONObject();\r\n for (XYPointData p : sortedPoints) {\r\n String description = \"point (\" + p.getX() + \", \" + p.getY() + \")\";\r\n if (Graph.TYPE_BUBBLE.equals(mData.getType())) {\r\n BubblePointData b = (BubblePointData) p;\r\n description += \" with radius \" + b.getRadius();\r\n ((RangeXYValueSeries) series).add(parseXValue(b.getX(), description), parseYValue(b.getY(), description), parseRadiusValue(b.getRadius(), description));\r\n } else if (Graph.TYPE_TIME.equals(mData.getType())) {\r\n ((TimeSeries) series).add(parseXValue(p.getX(), description), parseYValue(p.getY(), description));\r\n } else if (Graph.TYPE_BAR.equals(mData.getType())) {\r\n // In CommCare, bar graphs are specified with x as a set of text labels\r\n // and y as a set of values. In AChartEngine, bar graphs are a subclass\r\n // of XY graphs, with numeric x and y values. Deal with this by \r\n // assigning an arbitrary, evenly-spaced x value to each bar and then\r\n // populating x-labels with the user's x values. \r\n series.add(barIndex, parseYValue(p.getY(), description));\r\n try {\r\n // For horizontal graphs, force labels right so they appear on the graph itself\r\n String padding = getOrientation().equals(XYMultipleSeriesRenderer.Orientation.VERTICAL) ? \" \" : \"\";\r\n barLabels.put(Double.toString(barIndex), padding + p.getX());\r\n } catch (JSONException e) {\r\n throw new InvalidStateException(\"Could not handle bar label '\" + p.getX() + \"': \" + e.getMessage());\r\n }\r\n barIndex++;\r\n } else {\r\n series.add(parseXValue(p.getX(), description), parseYValue(p.getY(), description));\r\n }\r\n }\r\n if (Graph.TYPE_BAR.equals(mData.getType())) {\r\n mData.setConfiguration(\"x-min\", Double.toString(0.5));\r\n mData.setConfiguration(\"x-max\", Double.toString(sortedPoints.size() + 0.5));\r\n mData.setConfiguration(\"x-labels\", barLabels.toString());\r\n }\r\n }", "private void initBarChart() {\n\t\tBarChart<String, Number> chartLinguagens = new BarChart<String, Number>(new CategoryAxis(), new NumberAxis());\n\t\t// define o espaçamento entre as barras.\n\t\tchartLinguagens.setCategoryGap(30);\n\t\t// inserindo o title do grafico\n\t\tchartLinguagens.setTitle(\"Ranking de Linguagens de Programação Mar/2013\");\n\t\t// seta nome e valor de cada linguagem apresentada no grafico\n\t\tXYChart.Data<String, Number> dataJava = new XYChart.Data<String, Number>(\"Java\", 18.156);\n\t\tXYChart.Data<String, Number> dataC = new XYChart.Data<String, Number>(\"C\", 17.141);\n\t\tXYChart.Data<String, Number> dataObjectiveC = new XYChart.Data<String, Number>(\"Objective-C\", 10.230);\n\t\tXYChart.Data<String, Number> dataCPlus = new XYChart.Data<String, Number>(\"C++\", 9.115);\n\t\tXYChart.Data<String, Number> dataCSharp = new XYChart.Data<String, Number>(\"C#\", 6.597);\n\t\tXYChart.Series<String, Number> seriesData = new XYChart.Series<String, Number>();\n\t\t// rodapé ???\n\t\tseriesData.setName(\"Porcentagem (%)\");\n\n\t\tseriesData.getData().addAll(dataJava, dataC, dataObjectiveC, dataCPlus, dataCSharp);\n\n\t\tchartLinguagens.getData().add(seriesData);\n\t\t/* Indicar o BarChart em um painel principal... */\n\t\tpane.getChildren().add(chartLinguagens);\n\t}", "public SketchBarChart() {\n super(\"bar_sketch\");\n }", "BossBar createBossBar(String title, BossColor color, BossStyle style);", "public void showBarChart() {\r\n\r\n // Count classes\r\n int neutralCountPred = 0;\r\n int negativeCountPred = 0;\r\n int positiveCountPred = 0;\r\n\r\n int neutralCountAnsw = 0;\r\n int negativeCountAnsw = 0;\r\n int positiveCountAnsw = 0;\r\n\r\n for(Integer pred : predictions.values()) {\r\n switch (pred.intValue()) {\r\n case 0:\r\n negativeCountPred++;\r\n break;\r\n case 1:\r\n neutralCountPred++;\r\n break;\r\n case 2:\r\n positiveCountPred++;\r\n break;\r\n default:\r\n System.err.println(\"Illegal class index\");\r\n break;\r\n }\r\n }\r\n System.out.printf(\"PREDICTED \\nnegativeCountPred = %d, neutralCountPred = %d, positiveCountPred = %d\", negativeCountPred,\r\n neutralCountPred, positiveCountPred);\r\n\r\n for(Integer answer : rightAnswers.values()) {\r\n switch (answer.intValue()) {\r\n case 0:\r\n negativeCountAnsw++;\r\n break;\r\n case 1:\r\n neutralCountAnsw++;\r\n break;\r\n case 2:\r\n positiveCountAnsw++;\r\n break;\r\n default:\r\n System.err.println(\"Illegal class index\");\r\n break;\r\n }\r\n }\r\n System.out.printf(\"\\nRIGHT ANSWERS \\nnegativeCountAnsw = %d, neutralCountAnsw = %d, positiveCountAnsw = %d\", negativeCountAnsw,\r\n neutralCountAnsw, positiveCountAnsw);\r\n\r\n // Predicted classes\r\n XYChart.Series<String, Number> dataSeries1 = new XYChart.Series();\r\n dataSeries1.setName(\"Predicted\");\r\n dataSeries1.getData().add(new XYChart.Data(\"Neutral\", neutralCountPred));\r\n dataSeries1.getData().add(new XYChart.Data(\"Positive\", positiveCountPred));\r\n dataSeries1.getData().add(new XYChart.Data(\"Negative\", negativeCountPred));\r\n resultChart.getData().add(dataSeries1);\r\n\r\n // Predicted classes\r\n XYChart.Series<String, Number> dataSeries2 = new XYChart.Series();\r\n dataSeries2.setName(\"Right answers\");\r\n dataSeries2.getData().add(new XYChart.Data(\"Neutral\", neutralCountAnsw));\r\n dataSeries2.getData().add(new XYChart.Data(\"Positive\", positiveCountAnsw));\r\n dataSeries2.getData().add(new XYChart.Data(\"Negative\", negativeCountAnsw));\r\n resultChart.getData().add(dataSeries2);\r\n\r\n }", "@Override\n public String encode() throws IOException {\n FastStringWriter fsw = new FastStringWriter();\n\n try {\n fsw.write(\"{\");\n fsw.write(super.encode());\n\n ChartUtils.writeDataValue(fsw, \"beginAtZero\", this.beginAtZero, true);\n ChartUtils.writeDataValue(fsw, \"backdropColor\", this.backdropColor, true);\n ChartUtils.writeDataValue(fsw, \"backdropPaddingX\", this.backdropPaddingX, true);\n ChartUtils.writeDataValue(fsw, \"backdropPaddingY\", this.backdropPaddingY, true);\n ChartUtils.writeDataValue(fsw, \"min\", this.min, true);\n ChartUtils.writeDataValue(fsw, \"max\", this.max, true);\n ChartUtils.writeDataValue(fsw, \"maxTicksLimit\", this.maxTicksLimit, true);\n ChartUtils.writeDataValue(fsw, \"stepSize\", this.stepSize, true);\n ChartUtils.writeDataValue(fsw, \"suggestedMax\", this.suggestedMax, true);\n ChartUtils.writeDataValue(fsw, \"suggestedMin\", this.suggestedMin, true);\n ChartUtils.writeDataValue(fsw, \"showLabelBackdrop\", this.showLabelBackdrop, true);\n\n fsw.write(\"}\");\n }\n finally {\n fsw.close();\n }\n\n return fsw.toString();\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View view = inflater.inflate(R.layout.fragment_analysis,container,false);\n\n cases_bar = view.findViewById(R.id.cases_bar);\n //Appearance of Bar chart\n cases_bar.getDescription().setEnabled(false);\n cases_bar.setDrawValueAboveBar(false);\n cases_bar.animateY(5000);\n cases_bar.animateX(5000);\n\n XAxis xAxis = cases_bar.getXAxis();\n xAxis.setValueFormatter(new ValueFormatter() {\n @Override\n public String getFormattedValue(float value) {\n return YEARS[(int) value];\n }\n });\n\n YAxis axisLeft = cases_bar.getAxisLeft();\n axisLeft.setGranularity(100f);\n axisLeft.setAxisMinimum(0);\n\n YAxis axisRight = cases_bar.getAxisRight();\n axisLeft.setGranularity(100f);\n axisLeft.setAxisMinimum(0);\n\n\n ArrayList <BarEntry> cases = new ArrayList<>();\n cases.add(new BarEntry(0,2144));\n cases.add(new BarEntry(1,2230));\n cases.add(new BarEntry(2,1480));\n cases.add(new BarEntry(3,1131));\n cases.add(new BarEntry(4,1089));\n\n\n\n BarDataSet bardataset = new BarDataSet(cases, \"Cases\");\n\n ArrayList<IBarDataSet> labels = new ArrayList<>();\n labels.add(bardataset);\n\n BarData data = new BarData( labels);\n cases_bar.setData(data); // set the data and list of labels\n data.setValueTextSize(12f);\n bardataset.setColors(ColorTemplate.COLORFUL_COLORS);\n\n return view;\n }", "public void paintComponent(Graphics g)\n {\n Graphics2D g2 = (Graphics2D) g;\n \n //draws the lines\n g2.drawLine(0,200,800,200);\n g2.drawLine(0,400,800,400);\n \n //draws the bars on the bar graph\n int counter = 55;\n \n for(int i = 0; i < 30; i++)\n {\n bar[i] = new Rectangle();\n bar[i].x = counter;\n bar[i].y = 400 - a[i] * 3;\n bar[i].width = 15;\n bar[i].height = a[i] * 3;\n \n int color = 0;\n color = a[i];\n \n if(color > 0 && color <=4)\n g2.setColor(Color.RED);\n if(color > 4 && color <=9)\n g2.setColor(Color.ORANGE);\n if(color > 9 && color <=14)\n g2.setColor(Color.YELLOW);\n if(color > 14 && color <=19)\n g2.setColor(Color.GREEN);\n if(color > 19 && color <=24)\n g2.setColor(Color.CYAN);\n if(color > 24 && color <=29)\n g2.setColor(Color.BLUE);\n if(color > 29 && color <=34)\n g2.setColor(Color.PINK);\n if(color > 34 && color <=39)\n g2.setColor(Color.MAGENTA);\n if(color > 39 && color <=44)\n g2.setColor(Color.LIGHT_GRAY); \n if(color > 44 && color <=49)\n g2.setColor(Color.DARK_GRAY);\n if(color == 50)\n g2.setColor(Color.BLACK);\n \n g2.fill(bar[i]);\n g2.setColor(Color.BLACK);\n g2.draw(bar[i]);\n \n if(a[i] != 0)\n {\n Font font = new Font(\"Arial\", Font.BOLD, 12);\n g2.setFont(font);\n \n if(a[i] / 10 == 0)\n {\n g2.drawString(\"0\" + a[i] , counter+1, 390-a[i]*3);\n }\n else\n g2.drawString(\"\" + a[i] , counter+1, 390-a[i]*3);\n }\n \n counter = counter + 24;\n }\n \n Font font1 = new Font(\"Arial\", Font.PLAIN, 12);\n g2.setFont(font1);\n \n //draws the values\n for(int i = 0; i < 10; i++)\n {\n g2.drawString(i + \"\", i*75 + 60, 215);\n }\n \n \n \n \n //draws the buckets\n for(int i = 0; i < k; i++)\n {\n g2.drawString(\"Bucket\", 1, 215);\n g2.drawString(\"Values\", 1, 415);\n \n \n if(zero.size() != 0)\n {\n for(int j = 0; j < zero.size(); j++)\n {\n rect[j] = new Rectangle();\n rect[j].x = 50;\n rect[j].y = 185 - j*15;\n rect[j].width = 25;\n rect[j].height = 15;\n \n int color = 0;\n color = zero.get(j);\n \n if(color > 0 && color <=4)\n g2.setColor(Color.RED);\n if(color > 4 && color <=9)\n g2.setColor(Color.ORANGE);\n if(color > 9 && color <=14)\n g2.setColor(Color.YELLOW);\n if(color > 14 && color <=19)\n g2.setColor(Color.GREEN);\n if(color > 19 && color <=24)\n g2.setColor(Color.CYAN);\n if(color > 24 && color <=29)\n g2.setColor(Color.BLUE);\n if(color > 29 && color <=34)\n g2.setColor(Color.PINK);\n if(color > 34 && color <=39)\n g2.setColor(Color.MAGENTA);\n if(color > 39 && color <=44)\n g2.setColor(Color.LIGHT_GRAY); \n if(color > 44 && color <=49)\n g2.setColor(Color.DARK_GRAY);\n if(color == 50)\n g2.setColor(Color.BLACK);\n \n g2.fill(rect[j]);\n g2.setColor(Color.BLACK);\n g2.draw(rect[j]);\n }\n }\n if(one.size() != 0)\n {\n for(int j = 0; j < one.size(); j++)\n {\n rect[j] = new Rectangle();\n rect[j].x = 125;\n rect[j].y = 185 - j*15;\n rect[j].width = 25;\n rect[j].height = 15;\n g2.draw(rect[j]);\n \n \n int color = 0;\n color = one.get(j);\n \n if(color > 0 && color <=4)\n g2.setColor(Color.RED);\n if(color > 4 && color <=9)\n g2.setColor(Color.ORANGE);\n if(color > 9 && color <=14)\n g2.setColor(Color.YELLOW);\n if(color > 14 && color <=19)\n g2.setColor(Color.GREEN);\n if(color > 19 && color <=24)\n g2.setColor(Color.CYAN);\n if(color > 24 && color <=29)\n g2.setColor(Color.BLUE);\n if(color > 29 && color <=34)\n g2.setColor(Color.PINK);\n if(color > 34 && color <=39)\n g2.setColor(Color.MAGENTA);\n if(color > 39 && color <=44)\n g2.setColor(Color.LIGHT_GRAY); \n if(color > 44 && color <=49)\n g2.setColor(Color.DARK_GRAY);\n if(color == 50)\n g2.setColor(Color.BLACK);\n \n g2.fill(rect[j]);\n g2.setColor(Color.BLACK);\n g2.draw(rect[j]);\n }\n }\n if(two.size() != 0)\n {\n for(int j = 0; j < two.size(); j++)\n {\n rect[j] = new Rectangle();\n rect[j].x = 200;\n rect[j].y = 185 - j*15;\n rect[j].width = 25;\n rect[j].height = 15;\n g2.draw(rect[j]);\n \n \n int color = 0;\n color = two.get(j);\n \n if(color > 0 && color <=4)\n g2.setColor(Color.RED);\n if(color > 4 && color <=9)\n g2.setColor(Color.ORANGE);\n if(color > 9 && color <=14)\n g2.setColor(Color.YELLOW);\n if(color > 14 && color <=19)\n g2.setColor(Color.GREEN);\n if(color > 19 && color <=24)\n g2.setColor(Color.CYAN);\n if(color > 24 && color <=29)\n g2.setColor(Color.BLUE);\n if(color > 29 && color <=34)\n g2.setColor(Color.PINK);\n if(color > 34 && color <=39)\n g2.setColor(Color.MAGENTA);\n if(color > 39 && color <=44)\n g2.setColor(Color.LIGHT_GRAY); \n if(color > 44 && color <=49)\n g2.setColor(Color.DARK_GRAY);\n if(color == 50)\n g2.setColor(Color.BLACK);\n \n g2.fill(rect[j]);\n g2.setColor(Color.BLACK);\n g2.draw(rect[j]);\n }\n }\n if(three.size() != 0)\n {\n for(int j = 0; j < three.size(); j++)\n {\n rect[j] = new Rectangle();\n rect[j].x = 275;\n rect[j].y = 185 - j*15;\n rect[j].width = 25;\n rect[j].height = 15;\n g2.draw(rect[j]);\n \n \n int color = 0;\n color = three.get(j);\n \n if(color > 0 && color <=4)\n g2.setColor(Color.RED);\n if(color > 4 && color <=9)\n g2.setColor(Color.ORANGE);\n if(color > 9 && color <=14)\n g2.setColor(Color.YELLOW);\n if(color > 14 && color <=19)\n g2.setColor(Color.GREEN);\n if(color > 19 && color <=24)\n g2.setColor(Color.CYAN);\n if(color > 24 && color <=29)\n g2.setColor(Color.BLUE);\n if(color > 29 && color <=34)\n g2.setColor(Color.PINK);\n if(color > 34 && color <=39)\n g2.setColor(Color.MAGENTA);\n if(color > 39 && color <=44)\n g2.setColor(Color.LIGHT_GRAY); \n if(color > 44 && color <=49)\n g2.setColor(Color.DARK_GRAY);\n if(color == 50)\n g2.setColor(Color.BLACK);\n \n g2.fill(rect[j]);\n g2.setColor(Color.BLACK);\n g2.draw(rect[j]);\n }\n }\n \n if(four.size() != 0)\n {\n for(int j = 0; j < four.size(); j++)\n {\n rect[j] = new Rectangle();\n rect[j].x = 350;\n rect[j].y = 185 - j*15;\n rect[j].width = 25;\n rect[j].height = 15;\n g2.draw(rect[j]);\n \n \n int color = 0;\n color = four.get(j);\n \n if(color > 0 && color <=4)\n g2.setColor(Color.RED);\n if(color > 4 && color <=9)\n g2.setColor(Color.ORANGE);\n if(color > 9 && color <=14)\n g2.setColor(Color.YELLOW);\n if(color > 14 && color <=19)\n g2.setColor(Color.GREEN);\n if(color > 19 && color <=24)\n g2.setColor(Color.CYAN);\n if(color > 24 && color <=29)\n g2.setColor(Color.BLUE);\n if(color > 29 && color <=34)\n g2.setColor(Color.PINK);\n if(color > 34 && color <=39)\n g2.setColor(Color.MAGENTA);\n if(color > 39 && color <=44)\n g2.setColor(Color.LIGHT_GRAY); \n if(color > 44 && color <=49)\n g2.setColor(Color.DARK_GRAY);\n if(color == 50)\n g2.setColor(Color.BLACK);\n \n g2.fill(rect[j]);\n g2.setColor(Color.BLACK);\n g2.draw(rect[j]);\n }\n }\n if(five.size() != 0)\n {\n for(int j = 0; j < five.size(); j++)\n {\n rect[j] = new Rectangle();\n rect[j].x = 425;\n rect[j].y = 185 - j*15;\n rect[j].width = 25;\n rect[j].height = 15;\n g2.draw(rect[j]);\n \n \n int color = 0;\n color = five.get(j);\n \n if(color > 0 && color <=4)\n g2.setColor(Color.RED);\n if(color > 4 && color <=9)\n g2.setColor(Color.ORANGE);\n if(color > 9 && color <=14)\n g2.setColor(Color.YELLOW);\n if(color > 14 && color <=19)\n g2.setColor(Color.GREEN);\n if(color > 19 && color <=24)\n g2.setColor(Color.CYAN);\n if(color > 24 && color <=29)\n g2.setColor(Color.BLUE);\n if(color > 29 && color <=34)\n g2.setColor(Color.PINK);\n if(color > 34 && color <=39)\n g2.setColor(Color.MAGENTA);\n if(color > 39 && color <=44)\n g2.setColor(Color.LIGHT_GRAY); \n if(color > 44 && color <=49)\n g2.setColor(Color.DARK_GRAY);\n if(color == 50)\n g2.setColor(Color.BLACK);\n \n g2.fill(rect[j]);\n g2.setColor(Color.BLACK);\n g2.draw(rect[j]);\n }\n }\n if(six.size() != 0)\n {\n for(int j = 0; j < six.size(); j++)\n {\n rect[j] = new Rectangle();\n rect[j].x = 500;\n rect[j].y = 185 - j*15;\n rect[j].width = 25;\n rect[j].height = 15;\n g2.draw(rect[j]);\n \n \n int color = 0;\n color = six.get(j);\n \n if(color > 0 && color <=4)\n g2.setColor(Color.RED);\n if(color > 4 && color <=9)\n g2.setColor(Color.ORANGE);\n if(color > 9 && color <=14)\n g2.setColor(Color.YELLOW);\n if(color > 14 && color <=19)\n g2.setColor(Color.GREEN);\n if(color > 19 && color <=24)\n g2.setColor(Color.CYAN);\n if(color > 24 && color <=29)\n g2.setColor(Color.BLUE);\n if(color > 29 && color <=34)\n g2.setColor(Color.PINK);\n if(color > 34 && color <=39)\n g2.setColor(Color.MAGENTA);\n if(color > 39 && color <=44)\n g2.setColor(Color.LIGHT_GRAY); \n if(color > 44 && color <=49)\n g2.setColor(Color.DARK_GRAY);\n if(color == 50)\n g2.setColor(Color.BLACK);\n \n g2.fill(rect[j]);\n g2.setColor(Color.BLACK);\n g2.draw(rect[j]);\n }\n }\n if(seven.size() != 0)\n {\n for(int j = 0; j < seven.size(); j++)\n {\n rect[j] = new Rectangle();\n rect[j].x = 575;\n rect[j].y = 185 - j*15;\n rect[j].width = 25;\n rect[j].height = 15;\n g2.draw(rect[j]);\n \n \n int color = 0;\n color = seven.get(j);\n \n if(color > 0 && color <=4)\n g2.setColor(Color.RED);\n if(color > 4 && color <=9)\n g2.setColor(Color.ORANGE);\n if(color > 9 && color <=14)\n g2.setColor(Color.YELLOW);\n if(color > 14 && color <=19)\n g2.setColor(Color.GREEN);\n if(color > 19 && color <=24)\n g2.setColor(Color.CYAN);\n if(color > 24 && color <=29)\n g2.setColor(Color.BLUE);\n if(color > 29 && color <=34)\n g2.setColor(Color.PINK);\n if(color > 34 && color <=39)\n g2.setColor(Color.MAGENTA);\n if(color > 39 && color <=44)\n g2.setColor(Color.LIGHT_GRAY); \n if(color > 44 && color <=49)\n g2.setColor(Color.DARK_GRAY);\n if(color == 50)\n g2.setColor(Color.BLACK);\n \n g2.fill(rect[j]);\n g2.setColor(Color.BLACK);\n g2.draw(rect[j]);\n }\n }\n if(eight.size() != 0)\n {\n for(int j = 0; j < eight.size(); j++)\n {\n rect[j] = new Rectangle();\n rect[j].x = 650;\n rect[j].y = 185 - j*15;\n rect[j].width = 25;\n rect[j].height = 15;\n g2.draw(rect[j]);\n \n \n int color = 0;\n color = eight.get(j);\n \n if(color > 0 && color <=4)\n g2.setColor(Color.RED);\n if(color > 4 && color <=9)\n g2.setColor(Color.ORANGE);\n if(color > 9 && color <=14)\n g2.setColor(Color.YELLOW);\n if(color > 14 && color <=19)\n g2.setColor(Color.GREEN);\n if(color > 19 && color <=24)\n g2.setColor(Color.CYAN);\n if(color > 24 && color <=29)\n g2.setColor(Color.BLUE);\n if(color > 29 && color <=34)\n g2.setColor(Color.PINK);\n if(color > 34 && color <=39)\n g2.setColor(Color.MAGENTA);\n if(color > 39 && color <=44)\n g2.setColor(Color.LIGHT_GRAY); \n if(color > 44 && color <=49)\n g2.setColor(Color.DARK_GRAY);\n if(color == 50)\n g2.setColor(Color.BLACK);\n \n g2.fill(rect[j]);\n g2.setColor(Color.BLACK);\n g2.draw(rect[j]);\n }\n }\n if(nine.size() != 0)\n {\n for(int j = 0; j < nine.size(); j++)\n {\n rect[j] = new Rectangle();\n rect[j].x = 725;\n rect[j].y = 185 - j*15;\n rect[j].width = 25;\n rect[j].height = 15;\n g2.draw(rect[j]);\n \n \n int color = 0;\n color = nine.get(j);\n \n if(color > 0 && color <=4)\n g2.setColor(Color.RED);\n if(color > 4 && color <=9)\n g2.setColor(Color.ORANGE);\n if(color > 9 && color <=14)\n g2.setColor(Color.YELLOW);\n if(color > 14 && color <=19)\n g2.setColor(Color.GREEN);\n if(color > 19 && color <=24)\n g2.setColor(Color.CYAN);\n if(color > 24 && color <=29)\n g2.setColor(Color.BLUE);\n if(color > 29 && color <=34)\n g2.setColor(Color.PINK);\n if(color > 34 && color <=39)\n g2.setColor(Color.MAGENTA);\n if(color > 39 && color <=44)\n g2.setColor(Color.LIGHT_GRAY); \n if(color > 44 && color <=49)\n g2.setColor(Color.DARK_GRAY);\n if(color == 50)\n g2.setColor(Color.BLACK);\n \n g2.fill(rect[j]);\n g2.setColor(Color.BLACK);\n g2.draw(rect[j]);\n }\n }\n }\n \n //copies original array to an array list\n //copies final array to an array list\n ArrayList<Integer> startingArrayList = new ArrayList<Integer>();\n ArrayList<Integer> finalArrayList = new ArrayList<Integer>();\n for(int i = 0; i < 30; i++)\n {\n startingArrayList.add(b[i]);\n finalArrayList.add(a[i]);\n }\n \n //displays original and final array\n Font font3 = new Font(\"Arial\", Font.PLAIN, 13);\n g2.setFont(font3); \n g2.drawString(\"The number of comparisons are: 0\", 2, 475);\n g2.drawString(\"The number of swaps are: \" + s, 2, 500);\n g2.drawString(\"The original numbers are: \" + startingArrayList, 2, 525);\n g2.drawString(\"The sorted numbers are: \" + finalArrayList, 2, 550);\n }", "private void formatYAxis() {\n ((ValueAxis<Double>) performanceGraph.getYAxis()).setTickLabelFormatter(new StringConverter<Double>() {\n @Override\n public String toString(Double object) {\n if (currMode == Mode.GROSS_PROFITS) {\n if (object < 0) {\n return \"-$\" + Math.abs(object);\n } else {\n return \"$\" + object;\n }\n } else if (currMode == Mode.PERCENT_RETURN) {\n return object + \"%\";\n } else {\n return \"err\";\n }\n }\n\n @Override\n public Double fromString(String string) {\n return null;\n }\n });\n }", "public void outputBarChart() {\n System.out.println(\"Grade distribution\");\n\n // storage frequency of the grades in each interval 10 grades\n int[] frequency = new int[11];\n\n // for each grade, increment the frequency appropriates\n for (int grade : grades)\n ++frequency[grade / 10];\n\n // for each frequency of the grade, print bar on the chart\n for (int count =0; count < frequency.length; count++) {\n // generates output of the bar label (\"00-99: \", ..., \"90-99: \", \"100: \")\n if (count == 10)\n System.out.printf(\"%5d: \", 100);\n else\n System.out.printf(\"%02d-%02d: \", count * 10, count * 10 + 9);\n\n // prints the asterisk bar\n for (int stars =0; stars < frequency[count]; stars++)\n System.out.print(\"*\");\n\n System.out.println();\n }\n }", "private BarData generateDataBar(int cnt) {\n\n ArrayList<BarEntry> entries = new ArrayList<BarEntry>();\n\n for (int i = 0; i < 12; i++) {\n entries.add(new BarEntry(i, (int) (Math.random() * 70) + 30));\n }\n\n BarDataSet d = new BarDataSet(entries, \"New DataSet \" + cnt);\n d.setColors(ColorTemplate.VORDIPLOM_COLORS);\n d.setHighLightAlpha(255);\n\n BarData cd = new BarData(d);\n cd.setBarWidth(0.9f);\n return cd;\n }", "public void MakeBar() {\n\t\tBarButton = new JButton(\n\t\t\t\t new ImageIcon(getClass().getResource(GetBarChartImage())));\t\n\t\tBarButton.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent evt) {\n\t\t\t\tGetHost().instructionText.setVisible(false);\n\t\t\t\tGetHost().ExportEnabled();\n\t\t\t\t\n\t\t\t\tif(GetHost().GetTitle() == UNSET) {\n\t\t\t\t\tGetHost().LeftPanelContent(new BarChart(\n\t\t\t\t\tGetHost().GetGraphData(), \n\t\t\t\t\t\"Bar chart\", \n\t\t\t\t\tGetHost().GetColourScheme(),GetHost()));\n\t\t\t\t}else {\n\t\t\t\t\tGetHost().LeftPanelContent(new BarChart(\n\t\t\t\t\tGetHost().GetGraphData(), \n\t\t\t\t\tGetHost().GetTitle(), \n\t\t\t\t\tGetHost().GetColourScheme(),GetHost()));\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\tChartTypeInterface.add(BarButton);\t\n\t}", "public SegmentedBar() {\n segments.addListener((Observable it) -> listenToValues());\n listenToValues();\n\n getStyleClass().add(DEFAULT_STYLE);\n\n setSegmentViewFactory(segment -> new SegmentView(segment));\n setInfoNodeFactory(segment -> {\n Label label = new Label(\"Value: \" + segment.getValue());\n label.setPadding(new Insets(4));\n return label;\n });\n\n }", "void setupBars() {\n\n // ID, Horiz, Left\n bars.add(new LedBar(0, false, true));\n bars.add(new LedBar(1, true, true));\n bars.add(new LedBar(2, false, false));\n bars.add(new LedBar(3, false, true));\n bars.add(new LedBar(4, true, true));\n bars.add(new LedBar(5, true, false));\n bars.add(new LedBar(6, true, false));\n bars.add(new LedBar(7, true, false));\n bars.add(new LedBar(8, true, false));\n bars.add(new LedBar(9, true, true));\n bars.add(new LedBar(10, false, true));\n bars.add(new LedBar(11, false, false));\n bars.add(new LedBar(12, true, true));\n bars.add(new LedBar(13, false, false));\n bars.add(new LedBar(14, false, true));\n\n // hnext, hprev, vbro\n bars.get(0).setLinks(null, null, bars.get(4));\n bars.get(1).setLinks(bars.get(4), bars.get(8), bars.get(3));\n bars.get(2).setLinks(null, null, bars.get(5));\n bars.get(3).setLinks(null, null, bars.get(1));\n bars.get(4).setLinks(bars.get(9), bars.get(1), bars.get(0));\n bars.get(5).setLinks(bars.get(6), bars.get(12), bars.get(2));\n bars.get(6).setLinks(bars.get(7), bars.get(5), bars.get(11));\n bars.get(7).setLinks(bars.get(8), bars.get(6), bars.get(13));\n bars.get(8).setLinks(bars.get(1), bars.get(7), null); //Only one that hasn't got a vertical 'brother'\n bars.get(9).setLinks(bars.get(12), bars.get(4), bars.get(14));\n bars.get(10).setLinks(null, null, bars.get(12));\n bars.get(11).setLinks(null, null, bars.get(6));\n bars.get(12).setLinks(bars.get(5), bars.get(9), bars.get(10));\n bars.get(13).setLinks(null, null, bars.get(7));\n bars.get(14).setLinks(null, null, bars.get(9));\n\n verticals.add(0);\n verticals.add(2);\n verticals.add(3);\n verticals.add(10);\n verticals.add(11);\n verticals.add(13);\n verticals.add(14);\n }", "public JFreeChart createChart(IntervalXYDataset paramIntervalXYDataset) {\n\n\n JFreeChart jfreechart = ChartFactory.createXYBarChart(\n \"Spread Example\", //title\n \"Resource\", //xAxisLabel\n false, //dateAxis\n \"Timing\", //yAxisLabel\n paramIntervalXYDataset, //dataset\n PlotOrientation.VERTICAL, //orientation\n true, //legend\n true, //tooltips\n false); //urls\n\n\n\n XYPlot xyplot = (XYPlot) jfreechart.getPlot();\n\n xyplot.setBackgroundPaint(Color.white);\n xyplot.setRangeGridlinePaint(Color.darkGray);//vertical\n xyplot.setDomainGridlinePaint(Color.LIGHT_GRAY);//horizontal\n\n// xyplot.setDomainAxis(createTimeAxis());\n xyplot.setDomainAxis(createSymbolAxis());\n\n xyplot.setFixedLegendItems(createLegend());\n\n MyXYBarRenderer xyBarRenderer = new MyXYBarRenderer();\n xyBarRenderer.setUseYInterval(true);\n\n xyBarRenderer.setShadowVisible(false);\n\n xyBarRenderer.setDrawBarOutline(true);\n xyBarRenderer.setBaseOutlinePaint(Color.DARK_GRAY);\n\n xyBarRenderer.setBaseItemLabelFont(new Font(\"Arial\", Font.PLAIN, 10));\n\n xyBarRenderer.setMargin(0.2);\n xyplot.setRenderer(0, xyBarRenderer, true);\n\n//xyBarRenderer.\n\n\n MyXYBarPainter barPainter = new MyXYBarPainter((XYTaskDataset) paramIntervalXYDataset);\n barPainter.setPainterType(MyXYBarPainter.PainterType.GRADIENT);\n xyBarRenderer.setBarPainter(barPainter);\n\n\n\n //Item-Label:\n xyBarRenderer.setBaseItemLabelsVisible(true);\n xyBarRenderer.setBaseItemLabelGenerator(createItemLabelGenerator());\n xyBarRenderer.setBasePositiveItemLabelPosition(createItemLabelPosition());\n\n\n\n xyBarRenderer.setBaseToolTipGenerator(createTooltipGenerator());\n\n\n\n//PeriodAxis xaxis= new PeriodAxis(\"kk\");\n\n xyplot.setRangeAxis(createTimeAxis());\n// xyplot.setRangeAxis(createSymbolAxis());\n\n\n\n// DateAxis xaxis = new DateAxis();\n// xaxis.setVerticalTickLabels(true);\n// xyplot.setRangeAxis(xaxis);\n xyplot.setRangeAxisLocation(AxisLocation.TOP_OR_LEFT);\n\n// ChartUtilities.applyCurrentTheme(jfreechart);\n\n return jfreechart;\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n view = inflater.inflate(R.layout.fragment_five, container, false);\n initView(view);\n\n entries.add(new BarEntry(new float[]{16f,20f}, 0));\n entries.add(new BarEntry(new float[]{20f,25f}, 1));\n\n barDataSet = new BarDataSet(entries, \"\");\n barDataSet.setColors(new int[]{Color.GREEN,Color.YELLOW});\n barDataSet.setValueFormatter(new PercentFormatter());\n barDataSet.setStackLabels(new String[]{\"有违法\",\"无违法\"});\n barDataSet.setValueTextSize(20);\n barData = new BarData(s, barDataSet);\n mBar2chart.setData(barData);\n mBar2chart.setDescription(\"\");\n mBar2chart.getAxisRight().setEnabled(false);\n mBar2chart.getLegend().setPosition(Legend.LegendPosition.RIGHT_OF_CHART_CENTER);\n XAxis xAxis = mBar2chart.getXAxis();\n xAxis.setTextSize(15);\n xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);\n xAxis.setDrawGridLines(false);\n\n return view;\n }", "private void initBars()\n\t{\n\t\tfor (int i = 0; i < Constants.MAX_VALUE; i++)\n\t\t{\n\t\t\trows[i] = new Bar();\n\t\t\tcolumns[i] = new Bar();\n\t\t\tgrids[i] = new Bar();\n\t\t}\n\n\t\tfor (int rowIndex = 0; rowIndex < this.nodes.length; rowIndex++)\n\t\t{\n\t\t\tNode[] row = this.nodes[rowIndex];\n\t\t\tfor (int colIndex = 0; colIndex < row.length; colIndex++)\n\t\t\t{\n\t\t\t\tNode node = row[colIndex];\n\n\t\t\t\t// Make Rows\n\t\t\t\tthis.rows[rowIndex].nodes[colIndex] = node;\n\t\t\t\tnode.setRow(this.rows[rowIndex]);\n\n\t\t\t\t// Make Columns\n\t\t\t\tthis.columns[colIndex].nodes[rowIndex] = node;\n\t\t\t\tnode.setColumn(this.columns[colIndex]);\n\n\t\t\t\t// Make Grid\n\t\t\t\t// the index of Grid Array\n\t\t\t\tint gridIndex = colIndex / 3 + (rowIndex / 3) * 3;\n\n\t\t\t\t// the index of nodes array of one grid object\n\t\t\t\tint gridNodeIndex = colIndex % 3 + (rowIndex % 3) * 3;\n\t\t\t\tthis.grids[gridIndex].nodes[gridNodeIndex] = node;\n\t\t\t\tnode.setGrid(this.grids[gridIndex]);\n\t\t\t}\n\t\t}\n\t}", "protected abstract CounterFormatter createFormatter();", "@Override\n\tpublic GraphicalView makeChart(Context context) {\n\t\tXYMultipleSeriesRenderer renderer = getRenderer(context);\n\t\tchartView = ChartFactory.getBarChartView(context, getDataset(),renderer, Type.DEFAULT);\n\t\t// Return the view so it can be showed.\n\t\treturn chartView;\n\t}", "private void configure() throws InvalidStateException {\r\n // Default options\r\n mRenderer.setBackgroundColor(mContext.getResources().getColor(R.color.white));\r\n mRenderer.setMarginsColor(mContext.getResources().getColor(R.color.white));\r\n mRenderer.setLabelsColor(mContext.getResources().getColor(R.color.grey_darker));\r\n mRenderer.setXLabelsColor(mContext.getResources().getColor(R.color.grey_darker));\r\n mRenderer.setYLabelsColor(0, mContext.getResources().getColor(R.color.grey_darker));\r\n mRenderer.setYLabelsColor(1, mContext.getResources().getColor(R.color.grey_darker));\r\n mRenderer.setXLabelsAlign(Align.CENTER);\r\n mRenderer.setYLabelsAlign(Align.RIGHT);\r\n mRenderer.setYLabelsAlign(Align.LEFT, 1);\r\n mRenderer.setYAxisAlign(Align.RIGHT, 1);\r\n mRenderer.setAxesColor(mContext.getResources().getColor(R.color.grey_lighter));\r\n mRenderer.setLabelsTextSize(mTextSize);\r\n mRenderer.setAxisTitleTextSize(mTextSize);\r\n mRenderer.setApplyBackgroundColor(true);\r\n mRenderer.setShowGrid(true);\r\n\r\n int padding = 10;\r\n mRenderer.setXLabelsPadding(padding);\r\n mRenderer.setYLabelsPadding(padding);\r\n mRenderer.setYLabelsVerticalPadding(padding);\r\n\r\n if (Graph.TYPE_BAR.equals(mData.getType())) {\r\n mRenderer.setBarSpacing(0.5);\r\n }\r\n\r\n // User-configurable options\r\n mRenderer.setXTitle(mData.getConfiguration(\"x-title\", \"\"));\r\n mRenderer.setYTitle(mData.getConfiguration(\"y-title\", \"\"));\r\n mRenderer.setYTitle(mData.getConfiguration(\"secondary-y-title\", \"\"), 1);\r\n\r\n if (Graph.TYPE_BAR.equals(mData.getType())) {\r\n XYMultipleSeriesRenderer.Orientation orientation = getOrientation();\r\n mRenderer.setOrientation(orientation);\r\n if (orientation.equals(XYMultipleSeriesRenderer.Orientation.VERTICAL)) {\r\n mRenderer.setXLabelsAlign(Align.LEFT);\r\n mRenderer.setXLabelsPadding(0);\r\n }\r\n }\r\n\r\n if (mData.getConfiguration(\"x-min\") != null) {\r\n mRenderer.setXAxisMin(parseXValue(mData.getConfiguration(\"x-min\"), \"x-min\"));\r\n }\r\n if (mData.getConfiguration(\"y-min\") != null) {\r\n mRenderer.setYAxisMin(parseYValue(mData.getConfiguration(\"y-min\"), \"y-min\"));\r\n }\r\n if (mData.getConfiguration(\"secondary-y-min\") != null) {\r\n mRenderer.setYAxisMin(parseYValue(mData.getConfiguration(\"secondary-y-min\"), \"secondary-y-min\"), 1);\r\n }\r\n\r\n if (mData.getConfiguration(\"x-max\") != null) {\r\n mRenderer.setXAxisMax(parseXValue(mData.getConfiguration(\"x-max\"), \"x-max\"));\r\n }\r\n if (mData.getConfiguration(\"y-max\") != null) {\r\n mRenderer.setYAxisMax(parseYValue(mData.getConfiguration(\"y-max\"), \"y-max\"));\r\n }\r\n if (mData.getConfiguration(\"secondary-y-max\") != null) {\r\n mRenderer.setYAxisMax(parseYValue(mData.getConfiguration(\"secondary-y-max\"), \"secondary-y-max\"), 1);\r\n }\r\n\r\n boolean showGrid = Boolean.valueOf(mData.getConfiguration(\"show-grid\", \"true\")).equals(Boolean.TRUE);\r\n mRenderer.setShowGridX(showGrid);\r\n mRenderer.setShowGridY(showGrid);\r\n mRenderer.setShowCustomTextGridX(showGrid);\r\n mRenderer.setShowCustomTextGridY(showGrid);\r\n\r\n String showAxes = mData.getConfiguration(\"show-axes\", \"true\");\r\n if (Boolean.valueOf(showAxes).equals(Boolean.FALSE)) {\r\n mRenderer.setShowAxes(false);\r\n }\r\n\r\n // Legend\r\n boolean showLegend = Boolean.valueOf(mData.getConfiguration(\"show-legend\", \"false\"));\r\n mRenderer.setShowLegend(showLegend);\r\n mRenderer.setFitLegend(showLegend);\r\n mRenderer.setLegendTextSize(mTextSize);\r\n\r\n // Labels\r\n boolean hasX = configureLabels(\"x-labels\");\r\n boolean hasY = configureLabels(\"y-labels\");\r\n configureLabels(\"secondary-y-labels\");\r\n boolean showLabels = hasX || hasY;\r\n mRenderer.setShowLabels(showLabels);\r\n // Tick marks are sometimes ugly, so let's be minimalist and always leave the off\r\n mRenderer.setShowTickMarks(false);\r\n }", "Chart(ChartFormat cFormat, int digits) {\n // set the background\n setBackground(Color.BLACK);\n\n // set the members\n setFormat(cFormat);\n setBarLenght(DEFAULT_BAR_LENGH);\n setTextAreaLenght(DEFAULT_TEXT_AREA_LENGHT);\n setDigitsAfterDot(digits);\n\n }", "BossBar createBossBar(String title, float health, BossColor color, BossStyle style);", "public FormattedCellRenderer(Format format) {\r\n this.format = format;\r\n }", "private JFreeChart getBarChart()\n {\n loadData();\n \n // Create the vertical bar chart\n final JFreeChart chart = ChartFactory.createBarChart(getTitle(), \"\", \"\", getCategoryDataset(),\n PlotOrientation.HORIZONTAL, false, true, false);\n final CategoryPlot categoryplot = (CategoryPlot) chart.getPlot();\n categoryplot.setRangeAxisLocation(AxisLocation.BOTTOM_OR_LEFT);\n categoryplot.setRangePannable(true);\n categoryplot.setNoDataMessage(\"No data available\");\n \n final BarRenderer barrenderer = (BarRenderer) categoryplot.getRenderer();\n barrenderer.setItemLabelAnchorOffset(9D);\n barrenderer.setBaseItemLabelsVisible(true);\n barrenderer.setBaseItemLabelGenerator(new StandardCategoryItemLabelGenerator());\n // barrenderer.setBaseToolTipGenerator(new StandardCategoryToolTipGenerator(\"{1} = {2}\", new DecimalFormat(\"0\")));\n final CategoryAxis categoryaxis = categoryplot.getDomainAxis();\n categoryaxis.setCategoryMargin(0.25D);\n \n categoryaxis.setUpperMargin(0.02D);\n categoryaxis.setLowerMargin(0.02D);\n final NumberAxis numberaxis = (NumberAxis) categoryplot.getRangeAxis();\n numberaxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());\n numberaxis.setUpperMargin(0.10000000000000001D);\n ChartUtilities.applyCurrentTheme(chart);\n \n// if (useLegend())\n// {\n// // pieplot.setLegendLabelGenerator(new StandardPieSectionLabelGenerator(\"{0} ({1})\"));\n// chart.getLegend().setPosition(RectangleEdge.RIGHT);\n// // pieplot.setLegendLabelToolTipGenerator(new StandardPieSectionLabelGenerator(\"{0}: {2}%\"));\n// }\n \n return chart;\n }", "private BarChart.Options getOptions() {\n\t\tBarChart.Options options = BarChart.Options.create();\n\t\toptions.set3D(raised);\n\t\tif (label != null){options.setTitle(label);}\n\t\treturn options;\n\t}", "private void showBars() {\n graph.removeAllSeries();\n Log.d(\"ShowGraph \", \"started\");\n Log.d(\"Tuples length \", tuples.size() + \"\");\n ArrayList<Double> vkupno = new ArrayList<Double>();\n //vo vkupno, sekoj element, e vkupnata vrednost za nutrientot pod toj broj\n int brNutrienti = values.size();\n Log.d(\"Values length\", brNutrienti + \"\");\n for (int i = 0; i < brNutrienti; i++) {\n vkupno.add(i, 0.0);\n }\n Iterator<String> it = values.iterator();\n String currentNutrient = null;\n double dodadi = 0;\n for (int j = 0; j < brNutrienti; j++) {\n currentNutrient = it.next();\n for (int i = 0; i < tuples.size(); i++) {\n Tuple currentTuple = tuples.get(i);\n if (currentNutrient.equals(\"Protein\")) {\n dodadi = (currentTuple.getProtein()) * currentTuple.getQuantity() / 100;\n } else if (currentNutrient.equals(\"Total lipid (fat)\")) {\n dodadi = (currentTuple.getLipid()) * currentTuple.getQuantity() / 100;\n } else if (currentNutrient.equals(\"Carbohydrate\")) {\n dodadi = (currentTuple.getCarbohydrate()) * currentTuple.getQuantity() / 100;\n } else if (currentNutrient.equals(\"Glucose\")) {\n dodadi = (currentTuple.getGlucose()) * currentTuple.getQuantity() / 100;\n } else if (currentNutrient.equals(\"Calcium\")) {\n dodadi = (currentTuple.getCalcium()) * currentTuple.getQuantity() / 100;\n } else if (currentNutrient.equals(\"Iron\")) {\n dodadi = (currentTuple.getIron()) * currentTuple.getQuantity() / 100;\n } else if (currentNutrient.equals(\"Magnesium\")) {\n dodadi = (currentTuple.getMagnesium()) * currentTuple.getQuantity() / 100;\n } else if (currentNutrient.equals(\"Zinc\")) {\n dodadi = (currentTuple.getZinc()) * currentTuple.getQuantity() / 100;\n } else if (currentNutrient.equals(\"Vitamin C\")) {\n dodadi = (currentTuple.getVitaminC()) * currentTuple.getQuantity() / 100;\n } else if (currentNutrient.equals(\"Thiamin\")) {\n dodadi = (currentTuple.getThiamin()) * currentTuple.getQuantity() / 100;\n } else if (currentNutrient.equals(\"Riboflavin\")) {\n dodadi = (currentTuple.getRibofavin()) * currentTuple.getQuantity() / 100;\n } else if (currentNutrient.equals(\"Niacin\")) {\n dodadi = (currentTuple.getNiacin()) * currentTuple.getQuantity() / 100;\n } else if (currentNutrient.equals(\"Vitamin B6\")) {\n dodadi = (currentTuple.getVitaminB6()) * currentTuple.getQuantity() / 100;\n } else if (currentNutrient.equals(\"Vitamin B12\")) {\n dodadi = (currentTuple.getVitaminB12()) * currentTuple.getQuantity() / 100;\n } else if (currentNutrient.equals(\"VitaminA\")) {\n dodadi = (currentTuple.getVitaminA()) * currentTuple.getQuantity() / 100;\n } else if (currentNutrient.equals(\"Vitamin D\")) {\n dodadi = (currentTuple.getVitaminD()) * currentTuple.getQuantity() / 100;\n } else if (currentNutrient.equals(\"Vitamin E\")) {\n dodadi = (currentTuple.getVitaminE()) * currentTuple.getQuantity() / 100;\n }\n dodadi = dodadi + vkupno.get(j);\n vkupno.set(j, dodadi);\n dodadi = 0;\n }\n }\n Log.d(\"Posle polenje na vkupno\", \"sfsfsdf\");\n //posle ova vo vkupno se sodrzhat y vrednostite za grafikot\n DataPoint[] dpArray = new DataPoint[vkupno.size()];\n for (int i = 0; i < vkupno.size(); i++) {\n dpArray[i] = new DataPoint(i + 1, vkupno.get(i));\n intake.add(vkupno.get(i));\n Log.d(\"y(\" + i + \")=\", vkupno.get(i) + \"\");\n }\n BarGraphSeries<DataPoint> series = new BarGraphSeries<DataPoint>(dpArray);\n graph.addSeries(series);\n // styling\n series.setValueDependentColor(new ValueDependentColor<DataPoint>() {\n @Override\n public int get(DataPoint data) {\n return Color.rgb((int) data.getX() * 255 / 4, (int) Math.abs(data.getY() * 255 / 6), 100);\n }\n });\n series.setSpacing(1);\n series.setDataWidth(0.2);\n // draw values on top\n series.setDrawValuesOnTop(true);\n series.setValuesOnTopColor(Color.BLACK);\n /* StaticLabelsFormatter staticLabelsFormatter = new StaticLabelsFormatter(graph);\n staticLabelsFormatter.setHorizontalLabels(new String[] {\"CH\", \"F\", \"Pr\",\"Mi\"});\n graph.getGridLabelRenderer().setLabelFormatter(staticLabelsFormatter);\n */\n //graph.getLegendRenderer().setVisible(true);\n graph.getLegendRenderer().setAlign(LegendRenderer.LegendAlign.TOP);\n }", "private void setupBarChart(final GregorianCalendar period, boolean isMonth) {\n if (isMonth) {\n setupBarChartMonth(period);\n } else setupBarChartWeek(period);\n\n //disabling chart description\n Description description = new Description();\n description.setEnabled(false);\n barChart.setDescription(description);\n barChart.getBarData().setDrawValues(false);\n\n //creates a bit of empty space on the sides of the chart\n barChart.setFitBars(true);\n\n //disabling background grid\n barChart.getXAxis().setDrawGridLines(false);\n barChart.getAxisLeft().setDrawGridLines(false);\n// barChart.getAxisRight().setDrawGridLines(false);\n\n //working with legend. It is set of colors below a chart\n Legend legend = barChart.getLegend();\n legend.setEnabled(false);\n\n XAxis xaxis = barChart.getXAxis();\n if (isMonth) {\n xaxis.setLabelCount(15);\n } else {\n xaxis.setLabelCount(6);\n }\n xaxis.setPosition(XAxis.XAxisPosition.BOTTOM);\n\n YAxis yLAxis = barChart.getAxisLeft();\n yLAxis.setAxisMaximum(1.4f);\n yLAxis.setAxisMinimum(0.0f);\n yLAxis.setLabelCount(4);\n yLAxis.setDrawZeroLine(true);\n yLAxis.setGranularityEnabled(true);\n yLAxis.setGranularity(0.25f);\n\n YAxis yRAxis = barChart.getAxisRight();\n yRAxis.setAxisMaximum(1.4f);\n yRAxis.setAxisMinimum(0.0f);\n yRAxis.setLabelCount(4);\n yRAxis.setDrawZeroLine(true);\n yRAxis.setGranularityEnabled(true);\n yRAxis.setGranularity(0.25f);\n\n yLAxis.setValueFormatter(new IAxisValueFormatter() {\n @Override\n public String getFormattedValue(float value, AxisBase axis) {\n return Float.toString(value / 1.2f);\n }\n });\n yRAxis.setValueFormatter(new IAxisValueFormatter() {\n @Override\n public String getFormattedValue(float value, AxisBase axis) {\n return Float.toString(value / 1.2f);\n }\n });\n\n barChart.setScaleEnabled(false);\n barChart.setTouchEnabled(false);\n\n //updating chart\n barChart.invalidate();\n }", "private void setBarData(String report){\n\n int[] value = {0,0,0,0};\n String[] label = {\"Text Message\", \"Instagram\", \"Facebook Messenger\", \"Whatsapp\"} ;\n\n try {\n JSONObject jsonObject = new JSONObject(report);\n\n //Messages\n if(jsonObject.has(\"Text Message\"))\n {\n value[0] = jsonObject.getInt(\"Text Message\");\n }\n\n// if(jsonObject.has(\"com.samsung.android.messaging\"))\n// {\n// value[0] = jsonObject.getInt(\"com.samsung.android.messaging\");\n// }\n//\n// if(jsonObject.has(\"com.android.mms\"))\n// {\n// value[0] = jsonObject.getInt(\"com.android.mms\");\n// }\n\n //Instagram\n if(jsonObject.has(\"Instagram\"))\n {\n value[1] = jsonObject.getInt(\"Instagram\");\n }\n\n //Facebook messenger\n if(jsonObject.has(\"Facebook Messenger\"))\n {\n value[2] = jsonObject.getInt(\"Facebook Messenger\");\n }\n\n //Whatsapp\n if(jsonObject.has(\"Whatsapp\"))\n {\n value[3] = jsonObject.getInt(\"Whatsapp\");\n }\n\n } catch (JSONException e) {\n e.printStackTrace();\n }\n\n //Put the values in the JSON to a Hashmap for sorting values and showing the map appropriately.\n Map<String, Integer> unsortMap = new HashMap<String, Integer>();\n unsortMap.put(label[0], value[0]);\n unsortMap.put(label[1], value[1]);\n unsortMap.put(label[2], value[2]);\n unsortMap.put(label[3], value[3]);\n\n //Sort\n List<Entry<String, Integer>> list = new LinkedList<Entry<String, Integer>>(unsortMap.entrySet());\n\n // Sorting the list based on values\n Collections.sort(list, new Comparator<Entry<String, Integer>>()\n {\n public int compare(Entry<String, Integer> o1,\n Entry<String, Integer> o2)\n {\n\n return o2.getValue().compareTo(o1.getValue());\n }\n });\n\n // Maintaining insertion order with the help of LinkedList\n Map<String, Integer> sortedMap = new LinkedHashMap<String, Integer>();\n for (Entry<String, Integer> entry : list)\n {\n sortedMap.put(entry.getKey(), entry.getValue());\n }\n\n List<Integer> sortedValues = new ArrayList<Integer>(sortedMap.values());\n List<String> sortedKey = new ArrayList<String>(sortedMap.keySet());\n\n //BAR CHART IMPLEMENTATION\n ArrayList<BarEntry> barEntries = new ArrayList<>();\n\n //change it based on the values gotten from GET\n barEntries.add(new BarEntry(1, sortedValues.get(0)));\n barEntries.add(new BarEntry(2, sortedValues.get(1)));\n barEntries.add(new BarEntry(3, sortedValues.get(2)));\n barEntries.add(new BarEntry(4, sortedValues.get(3)));\n\n BarDataSet barDataSet = new BarDataSet(barEntries,\"Social Media Platforms\");\n barDataSet.setColors(ColorTemplate.PASTEL_COLORS);\n BarData theData = new BarData(barDataSet);\n theData.setValueFormatter(new IValueFormatter() {\n @Override\n public String getFormattedValue(float value, com.github.mikephil.charting.data.Entry entry, int dataSetIndex, ViewPortHandler viewPortHandler) {\n return String.valueOf((int)(value)) ;\n }\n });\n barChart.setData(theData);\n //barChart.invalidate();\n\n barChart.getAxisLeft().setAxisMinimum(0);\n barChart.getAxisRight().setAxisMinimum(0);\n barChart.setDrawBarShadow(false);\n barChart.setDrawValueAboveBar(true);\n //barChart.setMaxVisibleValueCount(10);\n barChart.setExtraOffsets(30,30,30,60);\n barChart.setPinchZoom(false);\n barChart.setDrawGridBackground(false);\n barChart.getAxisLeft().setValueFormatter(new IAxisValueFormatter() {\n @Override\n public String getFormattedValue(float value, AxisBase axis) {\n return String.valueOf((int) Math.floor(value));\n }\n });\n barChart.getAxisRight().setEnabled(false);\n\n XAxis xAxis = barChart.getXAxis();\n xAxis.setGranularity(1f);\n xAxis.setCenterAxisLabels(true);\n xAxis.setDrawGridLines(false);\n xAxis.setLabelRotationAngle(-45);\n xAxis.setPosition(XAxis.XAxisPosition.BOTTOM);\n xAxis.setAxisMinimum(0f);\n xAxis.setAxisMaximum(barEntries.size()+1);\n xAxis.setValueFormatter(new IndexAxisValueFormatter(sortedKey));\n barChart.getXAxis().setAxisMaximum(0 + barChart.getBarData().getGroupWidth(0.4f, 0.02f) * 5);\n\n YAxis leftAxis = barChart.getAxisLeft();\n leftAxis.removeAllLimitLines();\n leftAxis.setTypeface(Typeface.DEFAULT);\n leftAxis.setPosition(YAxis.YAxisLabelPosition.OUTSIDE_CHART);\n leftAxis.setTextColor(Color.BLACK);\n leftAxis.setDrawGridLines(false);\n leftAxis.setAxisMinimum(0f);\n leftAxis.setGranularityEnabled(true);\n leftAxis.setGranularity(1f);\n leftAxis.setAxisMaximum(leftAxis.getAxisMaximum()+1);\n\n barChart.invalidate();\n\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n binding = DataBindingUtil.inflate(inflater,R.layout.fragment_home_fault, container, false);\n\n progressDialog = new ProgressDialog(getContext());\n listMonitoring = new ArrayList<>();\n\n listFaultHistogram = new ArrayList<>();\n listColors = new ArrayList<>();\n /*BarDataSet barDataSet1 = new BarDataSet(barEntries1(), \"DataSet 1\");\n barDataSet1.setColor(Color.RED);\n BarDataSet barDataSet2 = new BarDataSet(barEntries2(), \"DataSet 2\");\n barDataSet2.setColor(Color.BLUE);\n BarDataSet barDataSet3 = new BarDataSet(barEntries3(), \"DataSet 3\");\n barDataSet3.setColor(Color.GREEN);\n BarDataSet barDataSet4 = new BarDataSet(barEntries4(), \"DataSet 4\");\n barDataSet4.setColor(Color.YELLOW);\n\n BarData data = new BarData(barDataSet1, barDataSet2, barDataSet3, barDataSet4);\n binding.barFault.setData(data);\n\n String[] days = new String[]{\"Sunday\", \"Monday\", \"Tuesday\", \"Wednesday\", \"Thursday\", \"Friday\", \"Saturday\"};\n XAxis xAxis = binding.barFault.getXAxis();\n\n xAxis.setValueFormatter(new IndexAxisValueFormatter(days));\n xAxis.setGranularityEnabled(true);\n xAxis.setCenterAxisLabels(true);\n xAxis.setGranularity(1f);\n xAxis.setTextSize(10f);\n xAxis.setTextColor(Color.RED);\n xAxis.setDrawAxisLine(true);\n xAxis.setDrawGridLines(false);\n\n binding.barFault.setDragEnabled(true);\n binding.barFault.setVisibleXRangeMaximum(3);\n\n float barSpace = 0.08f;\n float groupSpace = 0.44f;\n data.setBarWidth(0.10f);\n\n binding.barFault.getXAxis().setAxisMinimum(0);\n// binding.barFault.getXAxis().setAxisMinimum(0 +\n// binding.barFault.getBarData().getGroupWidth(groupSpace, barSpace)*7);\n binding.barFault.getAxisLeft().setAxisMinimum(0);\n\n binding.barFault.groupBars(0, groupSpace, barSpace);\n\n\n binding.barFault.invalidate();\n\n Legend l = binding.barFault.getLegend();\n l.setFormSize(10f);\n l.setForm(Legend.LegendForm.CIRCLE);\n l.setTextSize(12f);\n l.setTextColor(Color.BLACK);*/\n\n getFaultDaily();\n\n return binding.getRoot();\n }", "public static JFreeChart createBarChart (String xAxisTitle,\n String yAxisTitle,\n CategoryDataset ds)\n {\n JFreeChart chart = ChartFactory.createBarChart (null,\n xAxisTitle,\n yAxisTitle,\n ds,\n PlotOrientation.VERTICAL,\n true,\n true,\n true);\n\n chart.setBackgroundPaint(Color.white);\n\n // get a reference to the plot for further customisation...\n final CategoryPlot plot = chart.getCategoryPlot();\n plot.setBackgroundPaint (UIUtils.getComponentColor ());\n plot.setDomainGridlinePaint (UIUtils.getBorderColor ());\n plot.setRangeGridlinePaint (UIUtils.getBorderColor ());\n /*\n plot.setAxisOffset (new RectangleInsets (5D,\n 5D,\n 5D,\n 5D));\n*/\n plot.setDomainCrosshairVisible (true);\n plot.setRangeCrosshairVisible (true);\n plot.setDomainGridlinePaint (UIUtils.getColor (\"#cfcfcf\"));\n plot.setRangeGridlinePaint (UIUtils.getColor (\"#cfcfcf\"));\n\n // set the range axis to display integers only...\n final NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();\n rangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());\n rangeAxis.setNumberFormatOverride (Environment.getNumberFormatter ());\n\n // disable bar outlines...\n final BarRenderer renderer = (BarRenderer) plot.getRenderer();\n renderer.setDrawBarOutline(false);\n renderer.setItemMargin (0);\n /*\n // set up gradient paints for series...\n final GradientPaint gp0 = new GradientPaint(\n 0.0f, 0.0f, Color.blue,\n 0.0f, 0.0f, Color.lightGray\n );\n final GradientPaint gp1 = new GradientPaint(\n 0.0f, 0.0f, Color.green,\n 0.0f, 0.0f, Color.lightGray\n );\n final GradientPaint gp2 = new GradientPaint(\n 0.0f, 0.0f, Color.red,\n 0.0f, 0.0f, Color.lightGray\n );\n renderer.setSeriesPaint(0, gp0);\n renderer.setSeriesPaint(1, gp1);\n renderer.setSeriesPaint(2, gp2);\n*/\n final CategoryAxis domainAxis = plot.getDomainAxis();\n domainAxis.setCategoryLabelPositions(\n CategoryLabelPositions.createUpRotationLabelPositions(Math.PI / -0.6)\n );\n\n return chart;\n\n }", "private void updateBars() {\n \n // get the number of bars to draw\n bars = ( getWidth()-5 - textAreaLenght ) / barLenght;\n \n }", "@Override\n protected void paintComponent(Graphics g) {\n RoundRectangle2D bar = new RoundRectangle2D.Float(\n innerRadius, -barWidth / 2, outerRadius, barWidth, barWidth, barWidth);\n // x, y, width, height, arc width,arc height\n\n // angle in radians\n double angle = Math.PI * 2.0 / nBars; // between bars\n\n\n Graphics2D g2d = (Graphics2D) g;\n g2d.translate(getWidth() / 2, getHeight() / 2); // center the original point\n g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, // rendering hints\n RenderingHints.VALUE_ANTIALIAS_ON);\n\n\n // == Added for white bg\n // gets the current clipping area\n Rectangle clip = g.getClipBounds();\n\n // sets a 65% translucent composite\n AlphaComposite alpha = AlphaComposite.SrcOver.derive(0.65f);\n Composite composite = g2d.getComposite();\n g2d.setComposite(alpha);\n\n // fills the background\n g2d.setColor(getBackground());\n g2d.fillRect(clip.x, clip.y, clip.width, clip.height);\n\n\n // for each bar\n for (int i = 0; i < nBars; i++) {\n // compute bar i's color based on the frame index\n Color barColor = new Color((int) barGray, (int) barGray, (int) barGray);\n if (frame != -1) {\n for (int t = 0; t < trailLength; t++) {\n if (i == ((frame - t + nBars) % nBars)) {\n float tlf = trailLength;\n float pct = 1.0f - ((tlf - t) / tlf);\n int gray = (int) ((barGray - (pct * barGray)) + 0.5f);\n barColor = new Color(gray, gray, gray);\n }\n }\n }\n // draw the bar\n g2d.setColor(barColor);\n g2d.fill(bar);\n g2d.rotate(angle);\n }\n\n g2d.setComposite(composite);\n }", "@Test\n public void test82() throws Throwable {\n WaterfallBarRenderer waterfallBarRenderer0 = new WaterfallBarRenderer();\n SystemColor systemColor0 = SystemColor.textInactiveText;\n Line2D.Double line2D_Double0 = new Line2D.Double();\n CombinedRangeCategoryPlot combinedRangeCategoryPlot0 = new CombinedRangeCategoryPlot();\n combinedRangeCategoryPlot0.setAnchorValue(0.0, false);\n }", "private void nastavGraf() {\n barChart = (BarChart) findViewById(R.id.bargraph);\n\n ArrayList<BarEntry> barEntries = new ArrayList<>();\n ArrayList<String> theDates = new ArrayList<>();\n\n // ziskame zaznamy z tabuľky Steps a naplnime graf\n List<HashMap<String, String>> zoznam = mDatabaseHelper.getSteps();\n HashMap<String, String> mapa = new HashMap<>();\n for (int i = 0; i < zoznam.size(); i++) {\n if (i == 3) break;\n mapa = zoznam.get(i);\n theDates.add(mapa.get(\"datum\"));\n barEntries.add(new BarEntry(Float.parseFloat(mapa.get(\"kroky\")), i));\n }\n\n BarDataSet barDataSet = new BarDataSet(barEntries, \"Steps\");\n int redColorValue = Color.parseColor(\"#ff1744\");\n barDataSet.setColor(redColorValue);\n BarData theData = new BarData(theDates, barDataSet);\n\n barChart.setData(theData);\n barChart.getLegend().setEnabled(false);\n barChart.setDescription(null);\n }", "public String getCategoryAxisLabel(){\n\t\tNumberFormat formatter = NumberFormat.getInstance(locale);\n\t\tString out = \"Unit: \";\n\t\tif(this.histogramTally != null){\n\t\t\tboolean showTimeSpans \t= this.histogramTally.getShowTimeSpansInReport();\n\t\t\tif(showTimeSpans)\n\t\t\t\tout += \"TimeSpan [\"+this.format(null)+\"]\";\n\t\t\telse if(this.histogramTally.getUnit() != null) \t\n\t\t\t\tout += \"[\"+this.histogramTally.getUnit()+\"]\";\n\t\t\telse\t\t\t\t\t\t\t\t\t\n\t\t\t\tout += \"unknown\";\n\t\t\tif(showTimeSpans){\n\t\t\t\tdouble mean = new TimeSpan(this.histogramTally.getMean()).getTimeAsDouble(mayorTimeUnit);\n\t\t\t\tdouble stdDev = new TimeSpan(this.histogramTally.getStdDev()).getTimeAsDouble(mayorTimeUnit);\n\t\t\t\tdouble min = new TimeSpan(this.histogramTally.getMinimum()).getTimeAsDouble(mayorTimeUnit);\n\t\t\t\tdouble max = new TimeSpan(this.histogramTally.getMaximum()).getTimeAsDouble(mayorTimeUnit);\n\t\t\t\tout += \" ( Mean = \"+formatter.format(mean);\n\t\t\t\tout += \" Std.Dev = \"+formatter.format(stdDev);\n\t\t\t\tout += \" Min = \"+formatter.format(min);\n\t\t\t\tout += \" Max = \"+formatter.format(max);\n\t\t\t\tout += \" [\"+this.mayorTimeUnit.name()+\"] )\";\n\t\t\t}else{\n\t\t\t\tout += \" ( Mean = \"+formatter.format(this.histogramTally.getMean());\n\t\t\t\tout += \" Std.Dev = \"+formatter.format(this.histogramTally.getStdDev());\n\t\t\t\tout += \" Min = \"+formatter.format(this.histogramTally.getMinimum());\n\t\t\t\tout += \" Max = \"+formatter.format(this.histogramTally.getMaximum())+\" )\";\n\t\t\t}\n\t\t}else if(this.histogramAccumulate != null){\n\t\t\tboolean showTimeSpans \t= this.histogramAccumulate.getShowTimeSpansInReport();\n\t\t\tif(showTimeSpans)\n\t\t\t\tout += \"TimeSpan [\"+this.format(null)+\"]\";\n\t\t\telse if(this.histogramAccumulate.getUnit() != null) \t\n\t\t\t\tout += \"[\"+this.histogramAccumulate.getUnit()+\"]\";\n\t\t\telse\t\t\t\t\t\t\t\t\t\n\t\t\t\tout += \"unknown\";\n\t\t\tif(showTimeSpans){\n\t\t\t\tdouble mean = new TimeSpan(this.histogramAccumulate.getMean()).getTimeAsDouble(mayorTimeUnit);\n\t\t\t\tdouble stdDev = new TimeSpan(this.histogramAccumulate.getStdDev()).getTimeAsDouble(mayorTimeUnit);\n\t\t\t\tdouble min = new TimeSpan(this.histogramAccumulate.getMinimum()).getTimeAsDouble(mayorTimeUnit);\n\t\t\t\tdouble max = new TimeSpan(this.histogramAccumulate.getMaximum()).getTimeAsDouble(mayorTimeUnit);\n\t\t\t\tout += \" ( Mean = \"+formatter.format(mean);\n\t\t\t\tout += \" Std.Dev = \"+formatter.format(stdDev);\n\t\t\t\tout += \" Min = \"+formatter.format(min);\n\t\t\t\tout += \" Max = \"+formatter.format(max);\n\t\t\t\tout += \" [\"+this.mayorTimeUnit.name()+\"] )\";\n\t\t\t}else{\n\t\t\t\tout += \" ( Mean = \"+formatter.format(this.histogramAccumulate.getMean());\n\t\t\t\tout += \" Std.Dev = \"+formatter.format(this.histogramAccumulate.getStdDev());\n\t\t\t\tout += \" Min = \"+formatter.format(this.histogramAccumulate.getMinimum());\n\t\t\t\tout += \" Max = \"+formatter.format(this.histogramAccumulate.getMaximum())+\" )\";\n\t\t\t}\n\t\t}\n\t\treturn out;\n\t}", "@Override\n public Component getTableCellRendererComponent(JTable table, Object value,\n boolean isSelected, boolean hasFocus, int row, int column) {\n\n final Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);\n\n // Check the column name, if it is \"version\"\n if (table.getColumnName(column).compareToIgnoreCase(columnName) == 0) {\n // You know version column includes string\n Double val = NumberUtils.toDouble(value.toString().replace(\",\", \".\")) / 100.0;\n \n if (val > 1.0) val = 1.0;\n \n double H = val * 0.4; // Hue (note 0.4 = Green, see huge chart below)\n double S = 1; // Saturation\n double B = 1; // Brightness\n\n\n Color color = Color.getHSBColor((float)H, (float)S, (float)B);\n \n c.setForeground(color);\n c.setBackground(Color.BLACK);\n c.setFont(new Font(\"Dialog\", Font.BOLD, 12));\n setText(value.toString() + \"%\");\n setHorizontalAlignment(SwingConstants.CENTER);\n\n } else {\n // Here you should also stay at default\n //stay at default\n c.setForeground(Color.BLACK);\n c.setBackground(Color.WHITE);\n c.setFont(new Font(\"Dialog\", Font.PLAIN, 12));\n if (NumberUtils.isNumber(value.toString()))\n setHorizontalAlignment(SwingConstants.CENTER);\n else\n setHorizontalAlignment(SwingConstants.LEFT);\n }\n return c;\n }", "public BarChart() {\n\n\t\t//set the initial size of the store for curve data\n\t\tfor (int i = 0; i < 5; i++) {\n\t\t\tcvV.add(new CurveData());\n\t\t}\n\n\t\tbarChartPanel.add(GP, BorderLayout.CENTER);\n\n\t\tBorder etchedBorder = BorderFactory.createEtchedBorder();\n\t\tborder = BorderFactory.createTitledBorder(etchedBorder, \"Title\");\n\t\tborder.setTitleColor(Color.blue);\n\t\tbarChartPanel.setBorder(border);\n\n\t\tMarkerFormat = new MarkerFormat(barColumns);\n\n\t\tGP.setSmartGL(false);\n\t\tGP.setNumberFormatX(MarkerFormat);\n\n\t\tGP.addHorLimitsListener(\n\t\t\t\t\t\t\t\tnew ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\n\t\t\t\tint nClmns = barColumns.size();\n\t\t\t\tint nMaxLines = 0;\n\t\t\t\tjava.util.Iterator<BarColumn> itr = barColumns.iterator();\n\t\t\t\twhile (itr.hasNext()) {\n\t\t\t\t\tBarColumn bc = itr.next();\n\t\t\t\t\tif (nMaxLines < bc.size()) {\n\t\t\t\t\t\tnMaxLines = bc.size();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif (nClmns > 0 && nMaxLines > 0) {\n\t\t\t\t\t//int iMin = GP.getScreenX(GP.getCurrentMinX());\n\t\t\t\t\t//int iMax = GP.getScreenX(GP.getCurrentMaxX());\n\t\t\t\t\tint iMin = GP.getScreenX(GP.getInnerMinX());\n\t\t\t\t\tint iMax = GP.getScreenX(GP.getInnerMaxX());\n\n\t\t\t\t\twidth = (int) ((iMax - iMin) / (1.9 * nMaxLines * nClmns));\n\t\t\t\t\tif (width < 1) {\n\t\t\t\t\t\twidth = 1;\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (int i = 1, n = Math.min(nClmns * nMaxLines + 1, cvV.size()); i < n; i++) {\n\t\t\t\t\t\tCurveData cd = cvV.get(i);\n\t\t\t\t\t\tcd.setLineWidth(width);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tRunnable runRefresh =\n\t\t\t\tnew Runnable() {\n\t\t\t\t\tpublic void run() {\n\t\t\t\t\t\tGP.refreshGraphJPanel();\n\t\t\t\t\t}\n\t\t\t\t};\n\t\t\t\tThread mThread = new Thread(runRefresh);\n\t\t\t\tmThread.start();\n\t\t\t}\n\t\t});\n\n\t\t//operations with clicked point object\n\t\tJLabel infoLabel = new JLabel(\" Clicked Point Info: \", JLabel.CENTER);\n\n\t\tFunctionGraphsJPanel.ClickedPoint cpObj = GP.getClickedPointObject();\n\t\tcpObj.xValueLabel = new JLabel(\"X-Marker=\", JLabel.RIGHT);\n\t\tcpObj.xValueFormat = MarkerFormat;\n\t\tcpObj.xValueText = new JTextField(10);\n\t\tcpObj.xValueText.setHorizontalAlignment(JTextField.CENTER);\n\t\tcpObj.xValueText.setForeground(Color.blue);\n\n\t\tcpObj.yValueLabel = new JLabel(\" Value=\", JLabel.RIGHT);\n\t\tcpObj.yValueFormat = fortranFrmt;\n\t\tcpObj.yValueText = new JTextField(12);\n\t\tcpObj.yValueText.setHorizontalAlignment(JTextField.CENTER);\n\t\tcpObj.yValueText.setForeground(Color.blue);\n\n\t\tJPanel infoPanel = new JPanel(new FlowLayout(FlowLayout.LEFT, 4, 0));\n\t\tinfoPanel.add(infoLabel);\n\t\tinfoPanel.add(cpObj.xValueLabel);\n\t\tinfoPanel.add(cpObj.xValueText);\n\t\tinfoPanel.add(cpObj.yValueLabel);\n\t\tinfoPanel.add(cpObj.yValueText);\n\n\t\tbarChartPanel.add(infoPanel, BorderLayout.SOUTH);\n\t}", "@Override\n\tprotected void draw() {\n\t\tif (values == null || values.isEmpty()) {\n\t\t\tif (field != null) {field.removeFromParent();}\n\t\t\tfield = null;\n\t\t}\n\t\telse if (field == null) {VisualizationUtils.loadVisualizationApi(onLoadCallback, BarChart.PACKAGE);}\n\t\telse {field.draw(getDataTable(), getOptions());}\n\t}", "public void generateChart(){\n String[][] contents = retrieveFields();\n\n// String msg = \"test - \";\n// printCells(contents);\n\n String[] houseDisplay = new String[12];\n houseDisplay = new String[]{\"6\",\"4\",\"2\",\"1\",\"4\",\"6\",\"3\",\"5\",\"7/8\",\"\",\"5\",\"3\"};\n display(houseDisplay);\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}", "JFreeChart generateBox();", "@Override\n public String encode() throws IOException {\n FastStringWriter fsw = new FastStringWriter();\n\n try {\n fsw.write(\"{\");\n\n ChartUtils.writeDataValue(fsw, \"type\", \"polarArea\", false);\n ChartUtils.writeDataValue(fsw, \"data\", this.data, true);\n ChartUtils.writeDataValue(fsw, \"backgroundColor\", this.backgroundColor, true);\n ChartUtils.writeDataValue(fsw, \"borderColor\", this.borderColor, true);\n ChartUtils.writeDataValue(fsw, \"borderWidth\", this.borderWidth, true);\n ChartUtils.writeDataValue(fsw, \"hoverBackgroundColor\", this.hoverBackgroundColor, true);\n ChartUtils.writeDataValue(fsw, \"hoverBorderColor\", this.hoverBorderColor, true);\n ChartUtils.writeDataValue(fsw, \"hoverBorderWidth\", this.hoverBorderWidth, true);\n\n fsw.write(\"}\");\n }\n finally {\n fsw.close();\n }\n\n return fsw.toString();\n }", "private XYMultipleSeriesRenderer.Orientation getOrientation() {\n String orientation = mData.getConfiguration(\"bar-orientation\", \"\");\r\n if (orientation.equalsIgnoreCase(\"vertical\")) {\r\n return XYMultipleSeriesRenderer.Orientation.HORIZONTAL;\r\n } else {\r\n return XYMultipleSeriesRenderer.Orientation.VERTICAL;\r\n }\r\n }", "String getHtml() {\n Map<String, Object> context = new HashMap<>();\n context.put(\"tileRows\", mTileRows);\n context.put(\"rows\", mRows);\n context.put(\"columns\", Lists.newArrayList(mColumnsByStartMillis.values()));\n context.put(\"numColumnsPerDay\", getSegmentStartTimes().length);\n context.put(\"nowColumnStart\", mNowColumn.start);\n context.put(\"nowDate\", mNow.toLocalDate());\n context.put(\"orders\", mOrders);\n context.put(\"dataCellsByConceptId\", getJsonDataDump());\n return renderTemplate(\"assets/chart.html\", context);\n }", "public void getRegionalDistrictData(final String mRegion,final String mWeek){\n mSTKCStockOutBarRegional = new STKCStockOutBarRegional() {\n @Override\n protected void onPostExecute(String results) {\n //dialog.dismiss();\n if (!results.equalsIgnoreCase(\"error\")) {\n try {\n JSONObject obj = new JSONObject(results);\n if(obj.getString(\"status\").equalsIgnoreCase(\"ok\")) {\n\n Log.e(\"District GraphData\", \"\"+results);\n\n JSONArray res = obj.getJSONArray(\"results\");\n\n String[] drugs = new String[res.length()];\n\n for(int i= 0; i< res.length();i++){\n JSONArray array = res.getJSONArray(i);\n barEntries.add(new BarEntry(i+1, (float) array.getDouble(2)));\n barEntries1.add(new BarEntry(i+1, (float) array.getDouble(1)));\n drugs[i] = array.getString(3);\n }\n // [\"UcOzqLVFJVo\",0,0,\"Kyotera District\"]\n\n BarDataSet barDataSet = new BarDataSet(barEntries,\"Stockouts\");\n barDataSet.setColor(Color.parseColor(\"#7CB5EC\"));\n Collections.sort(barEntries, new EntryXComparator());\n BarDataSet barDataSet1 = new BarDataSet(barEntries1,\"Clients at risk(*100) -Paediatrics\");\n barDataSet1.setColors(Color.parseColor(\"#000000\"));\n Collections.sort(barEntries1, new EntryXComparator());\n\n\n BarData data = new BarData(barDataSet,barDataSet1);\n barChart.setData(data);\n\n barProg.setVisibility(View.GONE);\n\n XAxis xAxisB = barChart.getXAxis();\n xAxisB.setValueFormatter(new IndexAxisValueFormatter(drugs));\n barChart.getAxisLeft().setAxisMinimum(0);\n xAxisB.setPosition(XAxis.XAxisPosition.BOTTOM);\n xAxisB.setGranularity(1);\n xAxisB.setLabelRotationAngle(45);\n xAxisB.setCenterAxisLabels(true);\n xAxisB.setGranularityEnabled(true);\n\n barChart.setFitBars(true);\n\n float barSpace = 0.01f;\n float groupSpace = 0.1f;\n int groupCount = 12;\n\n //IMPORTANT *****\n data.setBarWidth(0.15f);\n barChart.getXAxis().setAxisMinimum(0);\n barChart.getXAxis().setAxisMaximum(0 + barChart.getBarData().getGroupWidth(groupSpace, barSpace) * groupCount);\n barChart.groupBars(0, groupSpace, barSpace); // perform the \"explicit\" grouping\n //***** IMPORTANT\n\n Log.e(\"here GraphData 2\", \"\"+res.length());\n\n\n\n }else{\n Toast.makeText(getActivity(), \"message failed!\", Toast.LENGTH_SHORT).show();\n if(dialog.isShowing()){\n dialog.dismiss();\n }\n }\n } catch (JSONException localJSONException) {\n Log.e(\"gettingjson\", localJSONException.toString());\n localJSONException.printStackTrace();\n if(dialog.isShowing()){\n dialog.dismiss();\n }\n }\n }\n }\n @Override\n protected void onPreExecute()\n {\n //dialog = ProgressDialog.show(getActivity(), \"\", \"Loading Data...\", true);\n //dialog.setCancelable(true);\n }\n\n };\n mSTKCStockOutBarRegional.execute(mRegion, mWeek);\n\n }", "public JLabel getRendering(String column, Object value);", "private XYMultipleSeriesRenderer getdemorenderer() {\n\t\t\t\trender = new XYMultipleSeriesRenderer();\n\t\t\t\trender.setChartTitle(\"温度时间曲线\");\n\t\t\t\trender.setChartTitleTextSize(30);//设置整个图表标题文字的大小\n\t\t\t\trender.setAxisTitleTextSize(18);//设置轴标题文字的大小\n\t\t\t\trender.setAxesColor(Color.BLACK);\n\t\t\t\trender.setXTitle(\"时间\");\n\t\t\t\trender.setYTitle(\"温度\");\n\t\t\t\t\n\t\t\t\trender.setLabelsTextSize(25);//设置轴刻度文字的大小\n\t\t\t\trender.setLabelsColor(Color.BLACK);\n\t\t\t\trender.setXLabelsColor(Color.BLACK);\n\t\t\t\trender.setYLabelsColor(0, Color.BLACK);\n\t\t\t\trender.setLegendTextSize(25);//设置图例文字大小 \n\t\t\t\trender.setShowLegend(false);//显示不显示在这里设置,非常完美,对应第184行\n\t\t\t\t\n\t\t\t\t// 设置图表中曲线本身的样式,包括颜色、点的大小以及线的粗细等\n\t\t\t\tXYSeriesRenderer r = new XYSeriesRenderer();//设置颜色和点类型\n\t\t\t\tr.setColor(Color.RED);\n\t\t\t\tr.setPointStyle(PointStyle.CIRCLE);//设置点的样式\n\t\t\t\tr.setFillPoints(true);\n\t\t\t\tr.setLineWidth(3);// 这是线宽\n\t\t\t\tr.setChartValuesSpacing(3);\n\t\t\t\tr.setChartValuesTextSize(30);//设置数值的字体大小 \n\t\t\t\t\n\t\t\t\tDecimalFormat df1 = new DecimalFormat(\".00\");\n\t\t r.setChartValuesFormat(df1);//设置折线点的值的格式,显示小数点后2位\n\t\t\t\t\n\t\t\t\tr.setDisplayChartValues(true);//显示折线上点的数值****\n\t\t\t\t\n\t\t\t\trender.addSeriesRenderer(r);\n\t\t\t\trender.setYLabelsAlign(Align.RIGHT);//刻度值相对于刻度的位置\n\t\t\t\trender.setShowGrid(true);//显示网格\n\t\t\t\trender.setYAxisMax(40);//设置y轴的范围\n\t\t\t\trender.setYAxisMin(25);\n\t\t\t\trender.setYLabels(5);//分七等份\n\t\t\t\trender.getSeriesRendererAt(0);\n//\t\t\t\t((XYSeriesRenderer) render.getSeriesRendererAt(0))).setDisplayChartValues(true); //显示折线上点的数值\n\t\t\t\trender.setInScroll(true);\n\t\t\t\trender.setLabelsTextSize(25);\n\t\t\t\trender.setLabelsColor(Color.BLACK);\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\trender.setPanEnabled(false,true);//false表示禁止报表的拖动,X轴、Y轴平移限制\n\t\t\t\trender.setPointSize(5f);//设置点的大小(图上显示的点的大小和图例中点的大小都会被设置)\n\t\t\t\trender.setMargins(new int[]{60,40,40,40}); //设置图形四周的留白(上左下右)\n\t\t\t\trender.setMarginsColor(Color.WHITE);\n\t\t\t\trender.setXLabels(0);// 取消X坐标的数字zjk,只有自己定义横坐标是才设为此值\n\t\t\t\t\n\t\t\t\treturn render;\n\t\t\t}", "@Override\n public DisplayColumn createRenderer(ColumnInfo colInfo)\n {\n assert colInfo.getJdbcType() == JdbcType.DOUBLE;\n return new DisplayColumnDecorator(_factory.createRenderer(colInfo))\n {\n {\n _textAlign = \"right\";\n }\n\n @Override\n public void renderGridCellContents(RenderContext ctx, Writer out) throws IOException\n {\n Object o = getValue(ctx);\n\n if (null == o)\n {\n super.renderGridCellContents(ctx, out);\n }\n else\n {\n String formatted = ModuleContext.formatVersion((double)o);\n out.write(formatted);\n }\n }\n };\n }", "@Override\n public View onCreateView(LayoutInflater inflater, ViewGroup container,\n Bundle savedInstanceState) {\n View v = inflater.inflate(R.layout.fragment_statistics, container, false);\n ((SideNavigationActivity) getActivity()).setActionBarTitle(\"Statistieken\");\n ((SideNavigationActivity) getActivity()).setSelectedMenuItem(R.id.statistics);\n\n BarChart chart = (BarChart) v.findViewById(R.id.chart);\n final String[] quarters = new String[]{LocalDate.now().minusDays(4).toString(), LocalDate.now().minusDays(3).toString(), LocalDate.now().minusDays(2).toString(), LocalDate.now().minusDays(1).toString(), LocalDate.now().toString()};\n\n IAxisValueFormatter formatter = new IAxisValueFormatter() {\n\n @Override\n public String getFormattedValue(float value, AxisBase axis) {\n return quarters[(int) value];\n }\n };\n\n List<BarEntry> entries = new ArrayList<BarEntry>();\n\n StatsDao statsDao = AppDatabase.getInstance(getContext()).statsDao();\n entries.add(new BarEntry(4, statsDao.countStats(LocalDate.now().toString())));\n entries.add(new BarEntry(3, statsDao.countStats(LocalDate.now().minusDays(1).toString())));\n entries.add(new BarEntry(2, statsDao.countStats(LocalDate.now().minusDays(2).toString())));\n entries.add(new BarEntry(1, statsDao.countStats(LocalDate.now().minusDays(3).toString())));\n entries.add(new BarEntry(0, statsDao.countStats(LocalDate.now().minusDays(4).toString())));\n\n BarDataSet dataSet = new BarDataSet(entries, \"Aantal recepten bekeken per dag\");\n\n List<IBarDataSet> dataSets = new ArrayList<IBarDataSet>();\n dataSets.add(dataSet);\n\n BarData data = new BarData(dataSets);\n\n chart.setData(data);\n\n XAxis xAxis = chart.getXAxis();\n xAxis.setGranularity(1f);\n xAxis.setValueFormatter(formatter);\n\n chart.getDescription().setEnabled(false);\n chart.invalidate();\n\n ((TextView) v.findViewById(R.id.StatsCountAllValue)).setText(String.valueOf(statsDao.countAllStats()));\n return v;\n\n }", "public interface BarGraphsApi {\n\n void loadVisualizationApi(Runnable callback);\n\n Widget createBarGraph(\n String title, String[] labels, Float[] values, Float maxValue);\n}", "private void setBarValues() {\n\t\t// Get highest value\n\t\tint iMax = 0;\n\t\tdouble dMax = 0;\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tif (dMax < a[i]) {\n\t\t\t\tiMax = i;\n\t\t\t\tdMax = a[i];\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\t// Highlight leading alternative\n\t\t\tif (i == iMax)\n\t\t\t\talternativeBarComponents[i].doUpdate(a[i], SWT.NORMAL);\n\t\t\telse\n\t\t\t\talternativeBarComponents[i].doUpdate(a[i], SWT.PAUSED);\n\t\t}\n\t}", "private static JFreeChart createChart(CategoryDataset dataset) {\n\t\t//the title of the chart depending of the attributes chosen by the user\n\t\tif (queryNumber==0) {domainLabel=\"Per day\";}\n\t\telse if (queryNumber==1) {domainLabel=\"Per hour\";}\n\t\telse if (queryNumber==2) {domainLabel=\"Per minute\";}\n\t\t\n\t\t// setting the title \n\t\tString rangeLabel=\"Average (ms)\";\n\t\t// create the chart...\n\t\tJFreeChart chart = ChartFactory.createBarChart(\n\t\t\t\t\"Static\", // chart title\n\t\t\t\tdomainLabel, // domain axis label\n\t\t\t\trangeLabel, // range axis label\n\t\t\t\tdataset, // data\n\t\t\t\tPlotOrientation.VERTICAL, // orientation\n\t\t\t\tfalse, // include legend\n\t\t\t\ttrue, // tooltips\n\t\t\t\tfalse // URLs\n\t\t\t\t);\n\t\t\n\t\t//setting the title preferences and format\n\t\tchart.getTitle().setFont(fontStatic);\n\t\tchart.getTitle().setPaint(Color.red);\n\t\tchart.setBackgroundPaint(Color.white);\n\t\tCategoryPlot plot = chart.getCategoryPlot();\n\t\tplot.setBackgroundPaint(Color.lightGray);\n\t\tplot.setDomainGridlinePaint(Color.white);\n\t\tplot.setDomainGridlinesVisible(true);\n\t\tplot.setRangeGridlinePaint(Color.white);\n\t\tfinal NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis();\n\t\tchart.getCategoryPlot().getRangeAxis().setLabelPaint(Color.RED);\n\t\tchart.getCategoryPlot().getDomainAxis().setLabelPaint(Color.RED);\n\t\trangeAxis.setStandardTickUnits(NumberAxis.createIntegerTickUnits());\n\t\tBarRenderer renderer = (BarRenderer) plot.getRenderer();\n\t\trenderer.setDrawBarOutline(false);\n\t\tfor (int i =0;i<25;i++) renderer.setSeriesPaint(i, Color.BLUE);\n\t\treturn chart;\n\t}", "@Override\n public int getRenderType()\n {\n return 22;\n }", "@Override\r\n public boolean isBar ()\r\n {\r\n return ShapeSet.Barlines.contains(getShape());\r\n }", "private String getProgressBar(){\n String output = \"\\u00A77[\";\n int total = 20;\n double unlocked = this.unlockedPercentage;\n output += \"\\u00A72\";\n //green bars for every 5% unlocked\n while(unlocked>=5){\n output += \"|\";\n unlocked-=5;\n total--;\n }\n //rest of them are red bars\n output += \"\\u00A7c\";\n while(total-->0){\n output += \"|\";\n }\n\n output += \"\\u00A77]\";\n return output;\n }", "public void MakeBar3D() {\n\t\tBarButton3D = new JButton(\n\t\t\t\t new ImageIcon(getClass().getResource(\n\t\t\t\t\tGet3DBarChartImage())));\n\t\tBarButton3D.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent evt) {\t\n\t\t\t\tGetHost().instructionText.setVisible(false);\n\t\t\t\tGetHost().ExportEnabled();\n\t\t\t\t\n\t\t\t\tif(GetHost().GetTitle() == UNSET) {\n\t\t\t\t\tGetHost().LeftPanelContent(new BarChart3D(\n\t\t\t\t\tGetHost().GetGraphData(), \n\t\t\t\t\t\"3D Bar Chart\", \n\t\t\t\t\tGetHost().GetColourScheme(),GetHost()));\n\t\t\t\t}else {\n\t\t\t\t\tGetHost().LeftPanelContent(new BarChart3D(\n\t\t\t\t\tGetHost().GetGraphData(), \n\t\t\t\t\tGetHost().GetTitle(), \n\t\t\t\t\tGetHost().GetColourScheme(),GetHost()));\n\t\t\t\t}\n\t\t\t}\n\t\t});\t\t\n\t\t\n\t\tChartTypeInterface.add(BarButton3D);\n\t}", "@Test\n public void test48() throws Throwable {\n Line2D.Double line2D_Double0 = new Line2D.Double(0.0, 0.0, (-3419.6012506212037), (-3419.6012506212037));\n line2D_Double0.y2 = 1830.949;\n CategoryAxis3D categoryAxis3D0 = new CategoryAxis3D(\"A2mVhdCINzNxW\\\"g@uU\");\n CombinedDomainCategoryPlot combinedDomainCategoryPlot0 = new CombinedDomainCategoryPlot((CategoryAxis) categoryAxis3D0);\n CategoryItemRenderer[] categoryItemRendererArray0 = new CategoryItemRenderer[8];\n ScatterRenderer scatterRenderer0 = new ScatterRenderer();\n categoryItemRendererArray0[0] = (CategoryItemRenderer) scatterRenderer0;\n AreaRenderer areaRenderer0 = new AreaRenderer();\n categoryItemRendererArray0[1] = (CategoryItemRenderer) areaRenderer0;\n AreaRenderer areaRenderer1 = new AreaRenderer();\n categoryItemRendererArray0[2] = (CategoryItemRenderer) areaRenderer1;\n StackedBarRenderer stackedBarRenderer0 = new StackedBarRenderer(true);\n categoryItemRendererArray0[3] = (CategoryItemRenderer) stackedBarRenderer0;\n CategoryStepRenderer categoryStepRenderer0 = new CategoryStepRenderer(false);\n categoryItemRendererArray0[4] = (CategoryItemRenderer) categoryStepRenderer0;\n WaterfallBarRenderer waterfallBarRenderer0 = new WaterfallBarRenderer();\n categoryItemRendererArray0[5] = (CategoryItemRenderer) waterfallBarRenderer0;\n StackedBarRenderer3D stackedBarRenderer3D0 = new StackedBarRenderer3D(false);\n categoryItemRendererArray0[6] = (CategoryItemRenderer) stackedBarRenderer3D0;\n IntervalBarRenderer intervalBarRenderer0 = new IntervalBarRenderer();\n categoryItemRendererArray0[7] = (CategoryItemRenderer) intervalBarRenderer0;\n combinedDomainCategoryPlot0.setRenderers(categoryItemRendererArray0);\n StackedBarRenderer3D stackedBarRenderer3D1 = new StackedBarRenderer3D();\n TickUnits tickUnits0 = new TickUnits();\n combinedDomainCategoryPlot0.setRenderer(93, (CategoryItemRenderer) stackedBarRenderer3D1);\n }", "java.lang.String getRenderer();", "private StringBuffer formattedStringBuffer( final double value ) {\n\t\t\tStringBuffer strb = new StringBuffer(\" \");\n\t\t\tif (barColumns != null && barColumns.size() > 0) {\n\t\t\t\tint ind = (int) Math.round(value - 1.0);\n\t\t\t\t//System.out.println(\"debug ind=\" + ind);\n\t\t\t\tif (ind >= 0 && ind < barColumns.size()) {\n\t\t\t\t\tstrb.append( barColumns.get( ind ).marker() );\n\t\t\t\t} else {\n\t\t\t\t\tstrb.append(emptyStr);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tstrb.append(emptyStr);\n\t\t\t}\n\n\t\t\t//System.out.println(\"debug strb=\" + strb);\n\n\t\t\tstrb.append(\" \");\n\n\t\t\treturn strb;\n\t\t}", "private void paintSymbolsAxisLabel(Graphics2D g2d,\n List<BarSymbol> barSymbolComponents, ViewPart viewPart) {\n\n for (SymbolComponent barComponent : barSymbolComponents) {\n barComponent.setHost(getHost());\n if (barComponent instanceof BarSymbol) {\n if (barComponent instanceof BarSymbolGroup) {\n BarSymbolGroup barGroup = (BarSymbolGroup) barComponent;\n List<BarSymbol> groupBarSymbolComponents = barGroup\n .getSymbolComponents();\n\n paintSymbolsAxisLabel(g2d, groupBarSymbolComponents,\n viewPart);\n\n if (barGroup.getAxisLabel() != null) {\n barGroup.getAxisLabel().paintSymbol(g2d, barGroup,\n viewPart);\n }\n }\n else {// simple symbol or stackedSymbol\n paintBarAxisLabel(g2d, (BarSymbol) barComponent, viewPart);\n }\n }\n\n }\n }", "private void paintBarAxisLabel(Graphics2D g2d, BarSymbol barSymbol,\n ViewPart viewPart) {\n if (barSymbol.getAxisLabel() != null) {\n barSymbol.getAxisLabel().paintSymbol(g2d, barSymbol, viewPart);\n }\n }", "public static void main(String[] args) {\r\n\r\n // create a chart\r\n double[][] data = new double[][] {\r\n {56.0, -12.0, 34.0, 76.0, 56.0, 100.0, 67.0, 45.0},\r\n {37.0, 45.0, 67.0, 25.0, 34.0, 34.0, 100.0, 53.0},\r\n {43.0, 54.0, 34.0, 34.0, 87.0, 64.0, 73.0, 12.0}};\r\n CategoryDataset dataset = DatasetUtilities.createCategoryDataset(\r\n \"Series \", \"Type \", data);\r\n\r\n JFreeChart chart = null;\r\n boolean drilldown = true;\r\n\r\n if (drilldown) {\r\n CategoryAxis categoryAxis = new CategoryAxis(\"Category\");\r\n ValueAxis valueAxis = new NumberAxis(\"Value\");\r\n BarRenderer renderer = new BarRenderer();\r\n renderer.setBaseToolTipGenerator(\r\n new StandardCategoryToolTipGenerator());\r\n renderer.setBaseItemURLGenerator(new StandardCategoryURLGenerator(\r\n \"bar_chart_detail.jsp\"));\r\n \r\n // add URLs to the series names in the legend...\r\n renderer.setLegendItemURLGenerator(new CategorySeriesLabelGenerator() \r\n {\r\n public String generateLabel(CategoryDataset dataset, int series) {\r\n return \"series.html?series=\" + (series + 1);\r\n }\r\n \r\n });\r\n \r\n // add tool tips to the series names in the legend...\r\n renderer.setLegendItemToolTipGenerator(new CategorySeriesLabelGenerator() \r\n {\r\n public String generateLabel(CategoryDataset dataset, int series) {\r\n return \"Tool tip for series \" + (series + 1);\r\n }\r\n \r\n });\r\n CategoryPlot plot = new CategoryPlot(dataset, categoryAxis, \r\n valueAxis, renderer);\r\n plot.setOrientation(PlotOrientation.VERTICAL);\r\n chart = new JFreeChart(\"Bar Chart\", JFreeChart.DEFAULT_TITLE_FONT,\r\n plot, true);\r\n }\r\n else {\r\n chart = ChartFactory.createBarChart(\r\n \"Vertical Bar Chart\", // chart title\r\n \"Category\", // domain axis label\r\n \"Value\", // range axis label\r\n dataset, // data\r\n PlotOrientation.VERTICAL,\r\n true, // include legend\r\n true,\r\n false\r\n );\r\n }\r\n chart.setBackgroundPaint(java.awt.Color.white);\r\n \r\n // save it to an image\r\n try {\r\n ChartRenderingInfo info = new ChartRenderingInfo(\r\n new StandardEntityCollection());\r\n File file1 = new File(\"barchart100.png\");\r\n ChartUtilities.saveChartAsPNG(file1, chart, 600, 400, info);\r\n\r\n // write an HTML page incorporating the image with an image map\r\n File file2 = new File(\"barchart100.html\");\r\n OutputStream out = new BufferedOutputStream(\r\n new FileOutputStream(file2));\r\n PrintWriter writer = new PrintWriter(out);\r\n writer.println(\"<!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Strict//EN\\\"\");\r\n writer.println(\"\\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\\\">\");\r\n writer.println(\"<html xmlns=\\\"http://www.w3.org/1999/xhtml\\\" lang=\\\"en\\\" xml:lang=\\\"en\\\">\");\r\n writer.println(\"<head><title>JFreeChart Image Map Demo</title></head>\");\r\n writer.println(\"<body><p>\");\r\n ImageMapUtilities.writeImageMap(writer, \"chart\", info);\r\n writer.println(\"<img src=\\\"barchart100.png\\\" \"\r\n + \"width=\\\"600\\\" height=\\\"400\\\" usemap=\\\"#chart\\\" alt=\\\"barchart100.png\\\"/>\");\r\n writer.println(\"</p></body>\");\r\n writer.println(\"</html>\");\r\n writer.close();\r\n\r\n }\r\n catch (IOException e) {\r\n System.out.println(e.toString());\r\n }\r\n\r\n }", "private static void barGraphPrinter(double total, double remaining) {\n int ratioBase = 58;\n int ratio = (int) Math.ceil((remaining / total) * ratioBase);\n System.out.println(REPRESENTATION_MSG);\n System.out.print(\"\\t\" + LEFT_BRACKET);\n for (int i = 0; i < ratio; i++) {\n System.out.print(X);\n }\n for (int i = ratio; i < 58; i++) {\n System.out.print(SPACE);\n }\n System.out.println(RIGHT_BRACKET);\n }", "public void BarChartForViolationFines() {\n\t\t\n\t\t// Dataset Generation\t\t\n\n\t\tDefaultCategoryDataset dataset = new DefaultCategoryDataset();\t\t\t\n\t\tfor (int i = 0; i < 10; i++) {\n\t\t\tString key = sortedKeysByVioDesc.get(i);\n\t\t\tdataset.addValue(ticketByVioFine.get(key), \"Violation Fine\", key);\n\t\t}\t\t\t\n\t\tCategoryDataset plotDataset = dataset;\n\n\t\t// JFreeChart Call for BarChart and passing formats\n\t\tJFreeChart barChart2 = ChartFactory.createBarChart(\n\t\t\t\t\"Parking Tickets by Violation Fee\", \n\t\t\t\t\"Ticket Description\", \n\t\t\t\t\"Ticket Fee ($)\", \n\t\t\t\tplotDataset, \n\t\t\t\tPlotOrientation.VERTICAL, \n\t\t\t\tfalse, //legend\n\t\t\t\ttrue, //tool tip\n\t\t\t\tfalse // use to generate URL\n\t\t\t\t);\t\n\n\t\t// Turing label by 45 degree to show full label\n\t\tCategoryPlot cplot2 = barChart2.getCategoryPlot();\n\t\tCategoryAxis xAxis = (CategoryAxis)cplot2.getDomainAxis();\n\t\txAxis.setCategoryLabelPositions(CategoryLabelPositions.UP_45);\n\t\t\n\t\t//Chart panel generation\n ChartPanel chartPanel2 = new ChartPanel(barChart2);\n chartPanel2.setBorder(BorderFactory.createEmptyBorder(15, 15, 15, 15));\n chartPanel2.setBackground(Color.white);\n add(chartPanel2);\n pack();\n setLocationRelativeTo(null);\n setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\n setVisible(true);\n try {\n \tfinal ChartRenderingInfo chartInfo2 = new ChartRenderingInfo(new StandardEntityCollection());\n \tfinal File file4 = new File(\"BarChartForViolationFee.png\");\n ChartUtilities.saveChartAsPNG(file4, barChart2, 800, 800, chartInfo2);\n }\n catch (Exception e) {\n }\n\t}", "@Override\n\tprotected String formatted(Walue _) {\n\t\treturn \"\";\n\t}", "public void createStatusBar(JPanel bar) {\n bar.setPreferredSize(new Dimension(getWidth(), 25));\n bar.setBackground(Color.LIGHT_GRAY);\n\n // add into container\n bar.add(paintModule.sizeLabel);\n bar.add(paintModule.coordinate);\n\n }", "private void drawTextArea(Graphics g) {\n // declare local variables:\n int buffer;\n int horizontalBars;\n int greatestMinimum;\n int greatestMaximum;\n int dataMinimums[];\n int dataMaximums[];\n int heightDifference;\n double verticalDifference;\n DisplayData displayData[];\n BigDecimal horizontalLevels[];\n // end of local variables declaration\n\n\n // set the drawing colour\n g.setColor(Color.WHITE);\n\n // determine what data is displayed\n displayData = format.getDisplayData();\n\n // check for null pointer\n if(displayData == null || data == null) {\n // exit\n return;\n } // end of if statement\n \n // initialize the minimums and maximums\n dataMinimums = new int[displayData.length];\n dataMaximums = new int[displayData.length];\n\n // get the minimums and maximums\n for(int c = 0; c < displayData.length; c++) {\n //\n switch(displayData[c]) {\n case CLOSE_PRICES:\n dataMinimums[c] = data.getMinimum(data.getClosePrices(bars) );\n dataMaximums[c] = data.getMaximum(data.getClosePrices(bars) );\n break;\n\n case HIGH_PRICES:\n dataMinimums[c] = data.getMinimum(data.getHighPrices(bars) );\n dataMaximums[c] = data.getMaximum(data.getHighPrices(bars) );\n break;\n\n case LOW_PRICES:\n dataMinimums[c] = data.getMinimum(data.getLowPrices(bars) );\n dataMaximums[c] = data.getMinimum(data.getLowPrices(bars) );\n break;\n\n case VOLUMES:\n dataMinimums[c] = data.getMinimum(data.getVolumes(bars) );\n dataMaximums[c] = data.getMinimum(data.getVolumes(bars) );\n break;\n } // end of switch statement\n\n } // end of for loop\n\n // find the greatest minimums and greatest maximum\n greatestMinimum = data.getMinimum(dataMinimums);\n greatestMaximum = data.getMaximum(dataMaximums);\n\n // find the heightDifference\n heightDifference = greatestMaximum - greatestMinimum;\n\n // check for logical error\n if(heightDifference == 0 || heightDifference < 0 ) {\n // exit from method\n return;\n } // end of if statement\n\n // find the horizontal bars\n horizontalBars = (getHeight() - 50 ) / 35 ;\n\n // find the verticalDifference\n verticalDifference = heightDifference / horizontalBars ;\n\n // initialize the horizontal levels array\n horizontalLevels = new BigDecimal[horizontalBars+1];\n\n // resolve the horizontal levels array\n for(int c = 0; c < horizontalLevels.length ; c++) {\n buffer = (int ) greatestMinimum + c* ( (int ) Math.round(verticalDifference) );\n horizontalLevels[c] = new BigDecimal(Integer.toString( buffer ) );\n horizontalLevels[c] = horizontalLevels[c].movePointLeft(digitsAfterDot);\n } // end of for loop\n\n // add the maximum\n horizontalLevels[horizontalLevels.length-1] = new BigDecimal(Integer.toString(greatestMaximum) );\n horizontalLevels[horizontalLevels.length-1] = horizontalLevels[horizontalLevels.length-1].movePointLeft(digitsAfterDot);\n\n // draw the horizontal bars\n for(int c = 0; c < horizontalLevels.length; c++) {\n g.drawLine(getWidth()-textAreaLenght,\n getHeight() - 30 - c* ( 35 + ( Math.round ( (( getHeight() - 50 ) % 35) / horizontalBars ) ) ),\n getWidth()-textAreaLenght+5,\n getHeight() - 30 - c* ( 35 + ( Math.round ( (( getHeight() - 50 ) % 35) / horizontalBars ) ) ) );\n } // end of for loop\n\n // draw the horizontalLevel prices\n for(int c = 0 ; c < horizontalLevels.length; c++) {\n // draw the current horizontal level \n g.drawString(horizontalLevels[c].toString() , getWidth()-textAreaLenght+10,\n getHeight() + 5 - 30 - c* ( 35 + ( Math.round ( (( getHeight() - 50 ) % 35) / horizontalBars ) ) ) );\n } // end of if statement\n\n }", "@Override\n public int getRenderType()\n {\n return 31;\n }", "public void drawHistograms(Graphics2D g, int x0, int y0, int w, int h)\n{\n double ymax = alldefs.histogram.yaxisMax;\n double ymin = alldefs.histogram.yaxisMin;\n\n for (int i = 0; i < histograms.length; i+=alldefs.histogram.barStack)\n {\n double v0 = 0;\n double v2 = 0;\n for (int j = 0; j < alldefs.histogram.barStack; j++)\n { \n double v = histograms[i + j]; \n if (v > 0)\n v0 += v;\n else\n v2 += v;\n }\n\n if (v0 > ymax) ymax = v0;\n if (v2 < ymin) ymin = v2;\n }\n\n if (alldefs.histogram.yaxisIncrement > 0)\n {\n double y = 0;\n if (ymax >= 0)\n {\n while (ymax > y)\n { y += alldefs.histogram.yaxisIncrement; }\n }\n else\n {\n while (ymax < y - alldefs.histogram.yaxisIncrement)\n { y -= alldefs.histogram.yaxisIncrement; }\n }\n ymax = y;\n\n y = 0;\n if (ymin >= 0)\n {\n while (ymin > y)\n { y += alldefs.histogram.yaxisIncrement; }\n }\n else\n {\n while (ymin < y)\n { y -= alldefs.histogram.yaxisIncrement; }\n }\n ymin = y;\n }\n\n FontMetrics fm = getFontMetrics(getFont());\n int ascent = fm.getAscent(); \n\n int yTop = 1 //space\n + ascent //font\n + 1; //space\n\n int yBottom = 4 //tic and overlapping line\n + ascent //font\n + 1 //space\n + ascent //font\n + 1; //space\n\n int xLeft = 1 //space\n + ascent //font\n + 1 //space\n + 0 //stringwidth placeholder\n + 4; //tic and overlapping line\n\n int xRight = 4; //spacing only\n\n int sw1 = \n fm.stringWidth(format.doublewithdecimals(ymin, alldefs.histogram.yaxisDecimals));\n int sw2 = \n fm.stringWidth(format.doublewithdecimals(ymax, alldefs.histogram.yaxisDecimals));\n\n xLeft += sw1 > sw2 ? sw1 : sw2;\n\n double ypix = 0;\n if (ymax > ymin)\n {\n g.setColor(Color.black);\n\n if (yTop + yBottom < h)\n {\n ypix = Math.abs(ymax - ymin) / (double)(h - yTop - yBottom);\n\n g.drawLine(xLeft, h - yBottom, xLeft, yTop);\n g.drawLine(xLeft + 1, h - yBottom, xLeft + 1, yTop);\n }\n else\n { ypix = Math.abs(ymax - ymin) / (double)1; }\n\n if (alldefs.histogram.yaxisIncrement > 0 && ypix > 0)\n {\n int j0 = yTop;\n int jn = h - yBottom - 1;\n\n int factor = 0;\n {\n int total;\n int size = jn - j0 + 1 - ascent;\n do\n {\n total = 0;\n factor++;\n\n double y = ymax - factor * alldefs.histogram.yaxisIncrement;\n while (y > ymin)\n {\n total += ascent;\n y -= factor * alldefs.histogram.yaxisIncrement;\n }\n } while (total > size);\n }\n\n double y = ymax;\n while (j0 <= jn)\n {\n String s = format.doublewithdecimals(y, alldefs.histogram.yaxisDecimals);\n int sw = fm.stringWidth(s);\n\n g.drawString(s, xLeft - sw - 4, j0 + ascent / 2 + 1);\n g.drawLine(xLeft, j0, xLeft - 4, j0);\n \n y -= factor * alldefs.histogram.yaxisIncrement;\n j0 = yTop + (int)((ymax - y) / ypix);\n }\n }\n else\n {\n String s = \n format.doublewithdecimals(ymax, alldefs.histogram.yaxisDecimals);\n int sw = fm.stringWidth(s);\n\n g.drawString(s, xLeft - sw - 4, yTop + ascent / 2 - 1);\n g.drawLine(xLeft, yTop, xLeft - 4, yTop);\n }\n\n if (alldefs.histogram.barTotal > 0)\n {\n int spacing = alldefs.histogram.barSpacing;\n int width = alldefs.histogram.barWidth;\n\n if (width <= 0)\n {\n width = (w - xLeft - xRight - alldefs.histogram.barTotal * spacing * 2) / alldefs.histogram.barTotal;\n }\n\n if (width <= 0)\n width = 1;\n\n int total = spacing * 2 + width;\n\n int xa = xLeft + 2;\n int xb = xa + alldefs.histogram.barTotal * total;\n int yb = h - yBottom;\n g.drawLine(xa - 2, yb, xb, yb);\n g.drawLine(xa - 2, yb - 1, xb, yb - 1);\n\n int yc = yTop + (int)(ymax / ypix);\n g.drawLine(xa - 2, yc, xb, yc);\n\n int idx = 0;\n for (int i = 0; i < alldefs.histogram.barTotal; i++)\n {\n int yT = yc;\n int yB = yc;\n for (int j = 0; j < alldefs.histogram.barStack; j++)\n {\n double v = histograms[idx++];\n int j2 = Math.abs((int)(v / ypix));\n if (j2 > 1)\n {\n g.setColor(alldefs.histogram.barColors[j]);\n\n if (v > 0)\n {\n yT -= j2;\n\n g.fillRect(xa + spacing, yT, width, j2);\n \n g.setColor(Color.black);\n g.drawRect(xa + spacing, yT, width, j2);\n }\n else\n {\n g.fillRect(xa + spacing, yB, width, j2);\n \n g.setColor(Color.black);\n g.drawRect(xa + spacing, yB, width, j2);\n\n yB += j2;\n }\n }\n } \n\n if (alldefs.histogram.barLabels != null \n && alldefs.histogram.barLabels.length \n == alldefs.histogram.barTotal)\n {\n String s = alldefs.histogram.barLabels[i];\n if (s != null)\n {\n g.drawLine(xa + total / 2, yb, xa + total / 2, yb + 4);\n \n int sw0 = fm.stringWidth(s) / 2;\n g.drawString(s, xa + total / 2 - sw0, yb + 4 + 1 + ascent);\n }\n }\n xa += total;\n }\n }\n }\n\n g.setColor(Color.black);\n\n //draw Titles\n if (alldefs.histogram.title != null)\n g.drawString(alldefs.histogram.title, xLeft, yTop - 1);\n\n if (alldefs.histogram.barTitle != null)\n g.drawString(alldefs.histogram.barTitle,\n w / 2,\n h - 1);\n\n if (alldefs.histogram.yaxisTitle != null)\n {\n g.rotate(Math.PI / -2.0, 1 + ascent, h / 2);\n g.drawString(alldefs.histogram.yaxisTitle, \n 1 + ascent, \n h / 2);\n g.rotate(Math.PI / 2.0, 1 + ascent, h / 2);\n }\n}", "private void drawHighPrices(Graphics g , int contentHeight) {\n // declare local variables:\n int buffer;\n int actualBars;\n int dataMinimum;\n int heightDifference;\n int highPrices[];\n int dataArray[];\n double scale;\n // end of local variables declaration\n\n\n // check fro logical error\n if(data == null) {\n // exit from method\n return;\n } // end of if statement\n\n // check for logical error\n if(data.getHighPrices() == null || data.getHighPrices().length < 2) {\n // exit from method\n return;\n } // end of if statement\n\n\n // find the data minimum\n dataMinimum = ChartData.getMinimum(data.getHighPrices(bars));\n\n // resolve the data array\n highPrices = data.getHighPrices(bars);\n dataArray = new int[highPrices.length];\n System.arraycopy(highPrices, 0, dataArray, 0, highPrices.length);\n\n // resolve the actual bars\n actualBars = dataArray.length;\n\n // find the heightDifference\n heightDifference = ChartData.getMaximum(data.getHighPrices(bars)) - dataMinimum;\n\n // check if the heightDifference is too big and reduce it\n buffer = heightDifference / 50;\n if( buffer > 0) {\n heightDifference = heightDifference / buffer;\n } // end of if statement\n\n //\n for(int c = 0; c < actualBars; c++) {\n //\n dataArray[c] = dataArray[c] - dataMinimum;\n } // end of for loop;\n\n //\n if(buffer > 0) {\n //\n for(int c=0; c < actualBars; c++) {\n //\n dataArray[c] = dataArray[c] / buffer;\n } // end of for loop\n\n } // end of if statement\n\n\n // resolve the scale\n scale = contentHeight / heightDifference;\n\n // select color\n g.setColor(format.getHighPricesColor());\n\n // main drawing loop\n for(int c = 0; c < actualBars -1 ; c++) {\n //\n g.drawLine(getWidth()-textAreaLenght-c*barLenght,\n getHeight()- 30 - (int) Math.round(dataArray[c]*scale),\n getWidth()-textAreaLenght- ( (c+1)*barLenght ),\n getHeight()- 30 - (int) Math.round(dataArray[c+1]*scale));\n } // end of for loop\n\n }", "protected ListCellRenderer createRenderer()\n {\n return new BEComboBoxRenderer.UIResource(this);\n }", "public SplitBarView(Context context, AttributeSet attrs) {\n super(context, attrs);\n\n TypedArray a = context.getTheme().obtainStyledAttributes(\n attrs,\n R.styleable.SplitBarView,\n 0, 0\n );\n\n int barColor;\n int textColor;\n float textSize;\n\n try {\n barColor = a.getColor(R.styleable.SplitBarView_bar_color, 0xff000000);\n textColor = a.getColor(R.styleable.SplitBarView_text_color, 0xff000000);\n textSize = a.getDimension(R.styleable.SplitBarView_text_size, 9.0f);\n } finally {\n a.recycle();\n }\n\n mText = \"\";\n mShowText = false;\n mTextAlpha = 0;\n\n //Paint for the bar\n mBarPaint = new Paint();\n mBarPaint.setColor(barColor);\n\n //Paint for the text\n mTextPaint = new Paint();\n mTextPaint.setColor(textColor);\n mTextPaint.setTextSize(textSize);\n mTextPaint.setTextAlign(Paint.Align.CENTER);\n mTextPaint.setStyle(Paint.Style.FILL);\n mTextPaint.setAlpha(mTextAlpha);\n\n mUpArrow = BitmapFactory.decodeResource(this.getResources(), R.drawable.white_arrow);\n mDownArrow = BitmapFactory.decodeResource(this.getResources(), R.drawable.white_arrow_down);\n }", "private void initChart() {\r\n /*mCurrentSeries = new XYSeries(\"Sample Data\");\r\n mDataset.addSeries(mCurrentSeries);\r\n mCurrentRenderer = new XYSeriesRenderer();\r\n mRenderer.addSeriesRenderer(mCurrentRenderer);*/\r\n \t\r\n \tList<Integer> MyListValue = new ArrayList<Integer>();\r\n\t\t/*for (int i = 0; i < SpeakingTimeList.size(); i++){\r\n\t\t\tMyListValue.add(SpeakingTimeList.get(i));\r\n\t\t}*/\r\n\t\tfor (int i = 0; i < participantAndSpeakingTimeList.size(); i++){\r\n\t\t\tMyListValue.add(participantAndSpeakingTimeList.get(i).getValue());\r\n\t\t}\r\n\t\t\r\n\t\t/*MyList.add(25);\r\n\t\tMyList.add(10);\r\n\t\tMyList.add(15);\r\n\t\tMyList.add(20);*/\r\n\t\t\t\t\r\n\t\tint[] y = new int[MyListValue.size()];\r\n\t\tfor (int i = 0; i < MyListValue.size(); i++) \r\n\t\t\ty[i] = MyListValue.get(i);\r\n\t\t\r\n\t\t//int y[] = {25,10,15,20};\r\n\t \r\n CategorySeries series = new CategorySeries(\"Speaking time in secondes\");\r\n for(int i=0; i < y.length; i++){\r\n series.add(\"Bar\"+(i+1),y[i]);\r\n }\r\n \r\n dataSet = new XYMultipleSeriesDataset(); // collection of series under one object.,there could any\r\n dataSet.addSeries(series.toXYSeries()); // number of series\r\n \r\n //customization of the chart\r\n \r\n XYSeriesRenderer renderer = new XYSeriesRenderer(); // one renderer for one series\r\n renderer.setColor(Color.parseColor(\"#0099FF\"));\r\n renderer.setDisplayChartValues(true);\r\n renderer.setChartValuesSpacing((float) 5.5d);\r\n renderer.setLineWidth((float) 10.5d);\r\n \r\n \r\n mRenderer = new XYMultipleSeriesRenderer(); // collection multiple values for one renderer or series\r\n mRenderer.addSeriesRenderer(renderer);\r\n mRenderer.setChartTitle(\"Speaking time per participant\");\r\n// mRenderer.setXTitle(\"xValues\");\r\n mRenderer.setYTitle(\"Time in secondes\");\r\n mRenderer.setZoomButtonsVisible(true); mRenderer.setShowLegend(true);\r\n mRenderer.setShowGridX(true); // this will show the grid in graph\r\n mRenderer.setShowGridY(true); \r\n// mRenderer.setAntialiasing(true);\r\n mRenderer.setBarSpacing(.5); // adding spacing between the line or stacks\r\n mRenderer.setApplyBackgroundColor(true);\r\n mRenderer.setBackgroundColor(Color.BLACK);\r\n mRenderer.setXAxisMin(0);\r\n mRenderer.setYAxisMin(0);\r\n //mRenderer.setXAxisMax(5);\r\n /*mRenderer.setXAxisMax(ParticipantsList.size()+1);*/\r\n mRenderer.setXAxisMax(participantAndSpeakingTimeList.size()+1);\r\n //mRenderer.setYAxisMax(100);\r\n mRenderer.setYAxisMax(Math.round(getMaxValue()/10)*10+10);\r\n// \r\n \r\n mRenderer.setXLabels(0);\r\n \r\n mRenderer.setXLabelsAngle(90);\r\n mRenderer.setXLabelsAlign(Align.LEFT);\r\n \r\n /*for (int i = 0; i < ParticipantsList.size(); i++){\r\n\t\t\tmRenderer.addXTextLabel(i+1, ParticipantsList.get(i));\r\n\t\t}*/\r\n for (int i = 0; i < participantAndSpeakingTimeList.size(); i++){\r\n\t\t\tmRenderer.addXTextLabel(i+1, participantAndSpeakingTimeList.get(i).getName());\r\n\t\t}\r\n \r\n /*mRenderer.addXTextLabel(1,\"Income\");\r\n mRenderer.addXTextLabel(2,\"Saving\");\r\n mRenderer.addXTextLabel(3,\"Expenditure\");\r\n mRenderer.addXTextLabel(4,\"NetIncome\");*/\r\n \r\n mRenderer.setPanEnabled(true, true); // will fix the chart position\r\n //Intent intent = ChartFactory.getBarChartIntent(context, dataSet, mRenderer,Type.DEFAULT);\r\n \r\n //return intent;\r\n\r\n\t\r\n\t}", "@Override\n\tpublic void draw(PGraphics g) {\n\t\t\n\t\tfor (BoosterHistory boosterHistory : boosterHistories) {\n\t\t\tboosterHistory.draw(g);\n\t\t}\n\t\t\n\t\tfor(String boosterName : labels.keySet()) {\n\t\t\tString labelText = labels.get(boosterName);\n\t\t\tthis.drawFlag(g, boosterName, labelText);\n\t\t}\n\t\t\n\t\tthis.drawSeparator(g);\n\t}", "public String getHealthBar() {\n String healthBar = \"|\";\n for (int i=0; i<40; i++) {\n if (i < 40*hp/maxHp) {\n healthBar += \"\\u2588\";\n } else {\n healthBar += \" \";\n }\n }\n return healthBar + \"|\";\n }", "private void updateBar() {\n\t\tString resources = String.format(\"Money: $%d\\nAgents: %d\\nMedia reach: %d\\nPopulation unrest: %d\"\n\t\t\t\t, player.getMoney(), player.getAgentNumber(), player.getMediaReach(), player.getUnrestSpread());\n\t\t((TextView) findViewById(R.id.text_resource_display_left)).setText(resources);\n\t\t\n\t\tresources = String.format(\"\\nAgent skill: %.0f%%\\nMedia influence: %.0f%%\\nPopulation care: %.0f%%\"\n\t\t\t\t, player.getAgentSkill(), player.getMediaPerception(), player.getUnrestStrength());\n\t\t((TextView) findViewById(R.id.text_resource_display_right)).setText(resources);\n\t}", "private void setData() {\n BarDataSet set = new BarDataSet(getEntries(), \"Monthly Report\");\n set.setColors(new int[]{R.color.md_blue_700, R.color.md_deep_purple_300}, this);\n mData = new BarData(set);\n mChart.setData(mData);\n mData.setValueFormatter(new LargeValueFormatter());\n }", "public static void barChart(String title, int[] arr) \n {\n CategoryChartBuilder builder = new CategoryChartBuilder();\n builder.width(800);\n builder.height(600);\n builder.title(\"Int array values\");\n builder.xAxisTitle(\"Index\");\n builder.yAxisTitle(\"Number\");\n\n // Add data and title to the chart\n CategoryChart chart = builder.build();\n chart.addSeries(title, null, arr);\n\n // display the chart:\n new SwingWrapper(chart).displayChart();\n }", "public XSSFBorderFormatting createBorderFormatting(){\n CTDxf dxf = getDxf(true);\n CTBorder border;\n if(!dxf.isSetBorder()) {\n border = dxf.addNewBorder();\n } else {\n border = dxf.getBorder();\n }\n\n return new XSSFBorderFormatting(border, _sh.getWorkbook().getStylesSource().getIndexedColors());\n }", "public void draw(int[] moduleMarks) {\n\t\t\r\n\t\tboolean[] coreModule = new boolean[] { true, false, true, true, true, true }; // creating a boolean array to work out if a module is core or not\r\n\t\t\r\n\t\tBar x = new Bar(); // creating an object called 'x' which will be the x axis on my graph\r\n\t\tx.makeVisible(); // making the object visible\r\n\t\tx.changeSize(200, 5); // making the object into the shape of a thin line\r\n\t\tx.changeColour(Colour.BLACK); // making the line black\r\n\t\tx.moveVertical(200); //aligning the line so it is in the correct place\r\n\t\t\r\n\t\tBar y = new Bar(); // creating an object called 'y' which will be the y axis on my graph\r\n\t\ty.makeVisible(); // making the object visible\r\n\t\ty.changeSize(5, 200); // making the object into the shape of a thin line\r\n\t\ty.changeColour(Colour.BLACK); // making the line black\r\n\t\t\r\n\t\tint xPosition = 5; // Stating x position for the bars\r\n\t\tint xDistance = 23; // the distance the bars are moved to the right\r\n\t\r\n\t\tfor (int i = 0; i < moduleMarks.length; i++){ // creating a for loop for creating the bars\r\n\t\t\t\r\n\t\t\tBar j = new Bar(); // making an object j which will by the bars for each module\r\n\t\t\tj.makeVisible(); // making the bars visible\r\n\t\t\tj.moveHorizontal(xPosition); // sets the horizontal position of the bars to 'xPosition'\r\n\t\t\txPosition += xDistance; // each time a new bar is created it adds the xDistance to the previous position.\r\n\t\t\tj.changeSize(20, moduleMarks[i]); //changing the size of the bars depending on the results\r\n\t\t\tj.moveVertical(200 - moduleMarks[i]); // changes the height of the bars depending on the marks\r\n\t\t\t\r\n\t\t\tif (moduleMarks[i] > 70){ //changes the colour of the bars depending on the result which the student got\r\n\t\t\t\tj.changeColour(Colour.MAGENTA);\r\n\t\t\t}\r\n\t\t\telse if(moduleMarks[i] >= 40){\r\n\t\t\t\tj.changeColour(Colour.GREEN);\r\n\t\t\t}\r\n\t\t\telse if(moduleMarks[i] < 40 && moduleMarks[i] > 35 && coreModule[i] == true){\r\n\t\t\t\tj.changeColour(Colour.YELLOW);\r\n\t\t\t}\r\n\t\t\telse{\r\n\t\t\t\tj.changeColour(Colour.RED);\r\n\t\t\t}\r\n\t\t}\r\n\t\t\r\n\t\t\r\n\t}", "@Override\n public TableCellRenderer getCellRenderer(int row, int column) {\n DefaultTableCellRenderer renderer;\n switch (columnTypes[column]) {\n case TEXT_COL:\n renderer = new DefaultTableCellRenderer();\n renderer.setHorizontalAlignment(LEFT);\n break;\n\n case CURR0_COL:\n case CURR2_COL:\n Vector<CurrencyType> rowCurrencies = getDataModel().getRowCurrencies();\n CurrencyType curr;\n if (0 <= row && row < rowCurrencies.size()) {\n curr = rowCurrencies.get(row); // Security\n } else {\n curr = book.getCurrencies().getBaseType(); // Footer reports base currency\n }\n renderer = new CurrencyRenderer(mdGUI, curr, columnTypes[column].equals(CURR0_COL));\n renderer.setHorizontalAlignment(RIGHT);\n break;\n\n case PERCENT_COL:\n renderer = new PercentRenderer(mdGUI);\n renderer.setHorizontalAlignment(RIGHT);\n break;\n\n default:\n renderer = new DefaultTableCellRenderer();\n }\n return renderer;\n }", "private void createchart() {\n int successcount = 0;\n int failedcount = 0;\n \n DefaultPieDataset barchartdata = new DefaultPieDataset();\n \n if(system == null && enterprise == null){\n for(Enterprise ent: network.getEnterpriseDirectory().getEnterpriseList()){\n for(WorkRequest request: ent.getWorkQueue().getWorkQueue()){\n if(request.getStatus() == WorkRequest.Status.ENTERPRISE2ADMINAPPROVED || request.getStatus() == WorkRequest.Status.ORGANIZATION3ADMINAPPROVED)\n successcount++;\n else if(request.getStatus() == WorkRequest.Status.TESTFAILED)\n failedcount++;\n }\n }\n }\n else if(network == null && enterprise == null){\n for(Network net: system.getNetworkList()){\n for(Enterprise ent: net.getEnterpriseDirectory().getEnterpriseList()){\n for(WorkRequest request: ent.getWorkQueue().getWorkQueue()){\n if(request.getStatus() == WorkRequest.Status.ENTERPRISE2ADMINAPPROVED || request.getStatus() == WorkRequest.Status.ORGANIZATION3ADMINAPPROVED)\n successcount++;\n else if(request.getStatus() == WorkRequest.Status.TESTFAILED)\n failedcount++;\n }\n }\n }\n }\n else{\n for(WorkRequest request: enterprise.getWorkQueue().getWorkQueue()){\n if(request.getStatus() == WorkRequest.Status.ENTERPRISE2ADMINAPPROVED || request.getStatus() == WorkRequest.Status.ORGANIZATION3ADMINAPPROVED)\n successcount++;\n else if(request.getStatus() == WorkRequest.Status.TESTFAILED)\n failedcount++;\n }\n }\n \n barchartdata.setValue( \"Successful Trials\",new Double(successcount));\n barchartdata.setValue(\"Failed trials\",new Double(failedcount));\n\n JFreeChart pieChart = ChartFactory.createPieChart(\"Successful versus failed trials\",barchartdata, false, true, false);\n final PiePlot plot=(PiePlot) pieChart.getPlot();\n ChartPanel barPanel = new ChartPanel(pieChart);\n\n dashboardpanel.removeAll();\n dashboardpanel.setLayout(new java.awt.BorderLayout());\n dashboardpanel.add(barPanel, BorderLayout.CENTER);\n dashboardpanel.validate();\n \n }", "public void plot() {\n // TODO: Implement this method\n System.out.printf(\"%10s : [\",this.label);\n for (int i=1;i<=this.value;i++) {\n System.out.print(\"#\");\n }\n System.out.printf(\"] (%d)\\n\",this.value);\n }" ]
[ "0.6583482", "0.6471658", "0.63389355", "0.63263774", "0.6322981", "0.60692644", "0.59031564", "0.5811182", "0.5759212", "0.5752496", "0.57519346", "0.5707148", "0.56827825", "0.5676971", "0.55912995", "0.5583856", "0.5560941", "0.55568314", "0.55541396", "0.5551368", "0.5522574", "0.5520291", "0.5518246", "0.5498321", "0.5489907", "0.5486902", "0.5480132", "0.5473473", "0.5460328", "0.54439294", "0.5443495", "0.54336625", "0.54313415", "0.5417734", "0.540963", "0.5404571", "0.5403564", "0.538757", "0.53699625", "0.53636867", "0.5358689", "0.53448063", "0.53442764", "0.53312236", "0.5330185", "0.5313013", "0.52421707", "0.52222174", "0.52217585", "0.52171755", "0.5210343", "0.5208561", "0.51990026", "0.51916313", "0.51889807", "0.5184049", "0.51735187", "0.5172482", "0.5151462", "0.5146739", "0.5143999", "0.5142306", "0.51375043", "0.5135641", "0.51336575", "0.51328", "0.5127162", "0.5120767", "0.5117891", "0.50967926", "0.5093566", "0.5092145", "0.5090752", "0.5066587", "0.5059879", "0.5038656", "0.5030091", "0.50218856", "0.5018266", "0.50176215", "0.5014337", "0.50108093", "0.49978647", "0.49918967", "0.49914744", "0.49887207", "0.49860504", "0.49845934", "0.49769187", "0.4968933", "0.4947324", "0.4944668", "0.49319857", "0.4921865", "0.49203822", "0.4919826", "0.48934597", "0.48903847", "0.48860112", "0.4882906" ]
0.5862632
7
TODO Bar changing code goes here
@Override public void update(GameContainer gc) { }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "private void setBar(){\n lastBarHitId = beats.get(lastBeatHitId).getContainedIn();\n }", "public void visitBumpBar( DevCat devCat ) {}", "public void setBars(List<Bar> bars) { this.bars = bars; }", "private void updateBar() {\n\t\tString resources = String.format(\"Money: $%d\\nAgents: %d\\nMedia reach: %d\\nPopulation unrest: %d\"\n\t\t\t\t, player.getMoney(), player.getAgentNumber(), player.getMediaReach(), player.getUnrestSpread());\n\t\t((TextView) findViewById(R.id.text_resource_display_left)).setText(resources);\n\t\t\n\t\tresources = String.format(\"\\nAgent skill: %.0f%%\\nMedia influence: %.0f%%\\nPopulation care: %.0f%%\"\n\t\t\t\t, player.getAgentSkill(), player.getMediaPerception(), player.getUnrestStrength());\n\t\t((TextView) findViewById(R.id.text_resource_display_right)).setText(resources);\n\t}", "public void onBar(Bar event) {\n barCount++;\n }", "private void updateBarABC(int num) {\r\n if (num < 0) {\r\n window.removeAllShapes();\r\n }\r\n else {\r\n State currentState = covidCalculator.getLL().get(num);\r\n ArrayList<Race> currentRacesSorted = covidCalculator.sortByABC(\r\n currentState);\r\n\r\n for (int i = 0; i < currentRacesSorted.size(); i++) {\r\n double currentCFR = currentRacesSorted.get(i).getCFR();\r\n if (currentCFR > 0) {\r\n Shape cfrBar = new Shape(0, 0, 25, (int)(10 * currentCFR),\r\n Color.RED);\r\n cfrBar.moveTo(barXPos + (spacingSize * spacingCounter) + 5,\r\n barYPos - cfrBar.getHeight());\r\n window.addShape(cfrBar);\r\n }\r\n else {\r\n TextShape name = new TextShape(0, 0, \"NA\");\r\n name.moveTo(barXPos + (spacingSize * spacingCounter) + 5,\r\n barYPos - 20);\r\n }\r\n spacingCounter++;\r\n }\r\n }\r\n lastStateMemory = num;\r\n spacingCounter = 1;\r\n }", "private void add_bar(Bar bar) {\n PVector vector = new PVector(); // vector along the bar\n PVector norm = new PVector(); // normalized vector\n PVector step = new PVector(); // step vector per pixel\n PVector start = new PVector(); // starting coordinates\n PVector coords = new PVector(); // current coordinates\n\n float density = pixel_density;\n float buffer = pixel_buffer;\n String layout = pixel_layout;\n float rate = 1f / density;\n if (buffer == 0.f) {\n buffer = rate;\n } // pixels never start right at a node\n\n //============ Vector Magic\n PVector.sub(get_node(bar.node2).xyz, get_node(bar.node1).xyz, vector);\n vector.normalize(norm);\n\n float len_bar = vector.mag();\n float len_zone = len_bar - (2f * buffer);\n int count = (int) Math.floor(len_zone * density);\n float len_true = count / density;\n float len_waste = len_true - len_zone;\n\n // offset coordinates for first pixel\n switch (layout) {\n case \"fill\":\n PVector.mult(norm, buffer, start);\n PVector.mult(norm, rate, step);\n break;\n case \"center\":\n PVector.mult(norm, buffer + (len_waste / 2f), start);\n PVector.mult(norm, rate, step);\n break;\n }\n // move to true coordinates\n PVector.add(start, get_node(bar.node1).xyz, coords);\n\n //---------- map channels \n // See if we need to add a new channel\n // TODO: Actually build the channels\n if (pixels_in_channel + count > max_pixels_per_channel) {\n channels++;\n strips = 0;\n pixels_in_channel = 0;\n }\n pixels_in_channel += count;\n pixels_in_model += count;\n\n //------------ Allocate Pixels!\n List<LXPoint> points = new ArrayList<>();\n for (int i = 0; i <= count; i++) {\n LXPoint point = new LXPoint(coords.x, coords.y, coords.z);\n points.add(point);\n coords.add(step);\n }\n\n /*\n bar.channel = channels - 1;\n bar.strip = strips;\n bar.channel_pixel = pixels_in_channel;\n bar.model_pixel = pixals_in_model;\n bar.points = points;\n\n rev = bar.reverse();\n */\n //------------ Add Points and Bars to Model\n this.bars.get(bar.node1).put(bar.node2, bar);\n // this.bars.get(node2.name).put(node1.name, rev);\n\n }", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "@Override\r\n\tpublic void bicar() {\n\t\t\r\n\t}", "public int getBarSize() { return _barSize; }", "private void setBarValues() {\n\t\t// Get highest value\n\t\tint iMax = 0;\n\t\tdouble dMax = 0;\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tif (dMax < a[i]) {\n\t\t\t\tiMax = i;\n\t\t\t\tdMax = a[i];\n\t\t\t}\n\t\t}\n\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\t// Highlight leading alternative\n\t\t\tif (i == iMax)\n\t\t\t\talternativeBarComponents[i].doUpdate(a[i], SWT.NORMAL);\n\t\t\telse\n\t\t\t\talternativeBarComponents[i].doUpdate(a[i], SWT.PAUSED);\n\t\t}\n\t}", "private void updateBars() {\n \n // get the number of bars to draw\n bars = ( getWidth()-5 - textAreaLenght ) / barLenght;\n \n }", "public boolean getBar() {\n\t\treturn this.bar;\n\t}", "protected abstract void mo3471b(ProgressBar progressBar);", "public void setBar(JProgressBar bar){\n prog = bar;\n }", "public List<Bar> getBars() { return bars; }", "@Override\r\n\tpublic void onXMinBar(Bar bar) throws Exception {\n\t\t\r\n\t}", "private void updateBarCFR(int num) {\r\n if (num < 0) {\r\n window.removeAllShapes();\r\n }\r\n else {\r\n State currentState = covidCalculator.getLL().get(num);\r\n ArrayList<Race> currentRacesSorted = covidCalculator.sortByCFR(\r\n currentState);\r\n\r\n for (int i = 0; i < currentRacesSorted.size(); i++) {\r\n double currentCFR = currentRacesSorted.get(i).getCFR();\r\n if (currentCFR > 1) {\r\n Shape cfrBar = new Shape(0, 0, 25, (int)(10 * currentCFR),\r\n Color.RED);\r\n cfrBar.moveTo(barXPos + (spacingSize * spacingCounter) + 5,\r\n barYPos - cfrBar.getHeight());\r\n window.addShape(cfrBar);\r\n }\r\n else {\r\n TextShape name = new TextShape(0, 0, \"NA\");\r\n name.moveTo(barXPos + (spacingSize * spacingCounter) + 5,\r\n barYPos - 20);\r\n }\r\n spacingCounter++;\r\n }\r\n }\r\n lastStateMemory = num;\r\n spacingCounter = 1;\r\n }", "protected abstract void mo3469a(ProgressBar progressBar);", "public abstract String getBarTitle();", "public void MakeBar() {\n\t\tBarButton = new JButton(\n\t\t\t\t new ImageIcon(getClass().getResource(GetBarChartImage())));\t\n\t\tBarButton.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent evt) {\n\t\t\t\tGetHost().instructionText.setVisible(false);\n\t\t\t\tGetHost().ExportEnabled();\n\t\t\t\t\n\t\t\t\tif(GetHost().GetTitle() == UNSET) {\n\t\t\t\t\tGetHost().LeftPanelContent(new BarChart(\n\t\t\t\t\tGetHost().GetGraphData(), \n\t\t\t\t\t\"Bar chart\", \n\t\t\t\t\tGetHost().GetColourScheme(),GetHost()));\n\t\t\t\t}else {\n\t\t\t\t\tGetHost().LeftPanelContent(new BarChart(\n\t\t\t\t\tGetHost().GetGraphData(), \n\t\t\t\t\tGetHost().GetTitle(), \n\t\t\t\t\tGetHost().GetColourScheme(),GetHost()));\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\t\n\t\tChartTypeInterface.add(BarButton);\t\n\t}", "@FXML\n public void addBar() {\n \tnew eMenuHandler().hideMenu();\n \tDisplayBuildingInstructions.showBuildingInstr();\n \tAddEntityOnMouseClick.setBuildMode(Boolean.TRUE);\n \tAddEntityOnMouseClick.entityList(new BuildingBar(0, 0));\n }", "public void addElts(Bars bar){\r\n BarsList.add(bar);\r\n }", "public void setLevelObjectBar(LevelStatsBar bar) {\n\t\tmyLevelObjectBar = bar;\n\t}", "public interface BarParamsAnimator {\n void start();\n void stop();\n void animate();\n}", "public abstract BossBar show();", "void setupBars() {\n\n // ID, Horiz, Left\n bars.add(new LedBar(0, false, true));\n bars.add(new LedBar(1, true, true));\n bars.add(new LedBar(2, false, false));\n bars.add(new LedBar(3, false, true));\n bars.add(new LedBar(4, true, true));\n bars.add(new LedBar(5, true, false));\n bars.add(new LedBar(6, true, false));\n bars.add(new LedBar(7, true, false));\n bars.add(new LedBar(8, true, false));\n bars.add(new LedBar(9, true, true));\n bars.add(new LedBar(10, false, true));\n bars.add(new LedBar(11, false, false));\n bars.add(new LedBar(12, true, true));\n bars.add(new LedBar(13, false, false));\n bars.add(new LedBar(14, false, true));\n\n // hnext, hprev, vbro\n bars.get(0).setLinks(null, null, bars.get(4));\n bars.get(1).setLinks(bars.get(4), bars.get(8), bars.get(3));\n bars.get(2).setLinks(null, null, bars.get(5));\n bars.get(3).setLinks(null, null, bars.get(1));\n bars.get(4).setLinks(bars.get(9), bars.get(1), bars.get(0));\n bars.get(5).setLinks(bars.get(6), bars.get(12), bars.get(2));\n bars.get(6).setLinks(bars.get(7), bars.get(5), bars.get(11));\n bars.get(7).setLinks(bars.get(8), bars.get(6), bars.get(13));\n bars.get(8).setLinks(bars.get(1), bars.get(7), null); //Only one that hasn't got a vertical 'brother'\n bars.get(9).setLinks(bars.get(12), bars.get(4), bars.get(14));\n bars.get(10).setLinks(null, null, bars.get(12));\n bars.get(11).setLinks(null, null, bars.get(6));\n bars.get(12).setLinks(bars.get(5), bars.get(9), bars.get(10));\n bars.get(13).setLinks(null, null, bars.get(7));\n bars.get(14).setLinks(null, null, bars.get(9));\n\n verticals.add(0);\n verticals.add(2);\n verticals.add(3);\n verticals.add(10);\n verticals.add(11);\n verticals.add(13);\n verticals.add(14);\n }", "private BarData generateDataBar() {\n String year = year_txt.getText().toString();\n String month1 =Utilities.getMonth(months,month_txt.getText().toString());\n ArrayList<BarEntry> entries = new ArrayList<>();\n ArrayList<TransactionBeans> transactionBeans = transactionDB.getTransactionRecordsMonth(month1,year);\n for (int i = 0; i < transactionBeans.size(); i++) {\n TransactionBeans beans = transactionBeans.get(i);\n entries.add(new BarEntry(i, (int) (Double.parseDouble(beans.getIncome()))));\n }\n\n BarDataSet d = new BarDataSet(entries, \"\");\n d.setColors(ColorTemplate.VORDIPLOM_COLORS);\n d.setHighLightAlpha(255);\n\n BarData cd = new BarData(d);\n cd.setBarWidth(0.9f);\n cd.setDrawValues(false);\n return cd;\n }", "public Bar createBar(Bar bar) {\n ContentValues values\n = new ContentValues();\n values.put(HelperCubata.COLUMN_NOMBAR,\n bar.getnomBar());\n values.put(HelperCubata.COLUMN_IDLOCALITZACIO,\n bar.getIdLocalitzacio());\n\n long insertId= database.insert(HelperCubata.TABLE_BAR,null,values);\n bar.setId(insertId);\n return bar;\n }", "public T caseBarChart(BarChart object)\n {\n return null;\n }", "public FourBarOpenAndClose(FourBar fourBar) {\r\n // Add your commands in the super() call, e.g.\r\n super(new FourBarHalfOpen(fourBar), new FourBarHalfClose(fourBar), new delayAuto(0.6),new FourBarHalfOpen(fourBar), new FourBarHalfClose(fourBar), new delayAuto(0.25));\r\n \r\n }", "public void initImmersionBar() {\n super.initImmersionBar();\n this.mImmersionBar.a(false).b();\n }", "public static void memBar(){\n \n }", "public interface BarGraphsApi {\n\n void loadVisualizationApi(Runnable callback);\n\n Widget createBarGraph(\n String title, String[] labels, Float[] values, Float maxValue);\n}", "public BarService getBarService() {\n\t\treturn barService;\n\t}", "public SketchBarChart() {\n super(\"bar_sketch\");\n }", "private void drawHBar(int x, int r, int g, int b) {\n int rows= currentIm.getRows();\n int cols= currentIm.getCols();\n \n /* inv: pixels currentIm[x..x+3][0..c-1] are color c */\n for (int c= 0; c < cols; c= c+1) {\n int alpha= DM.getAlpha(currentIm.getPixel(x,c));\n currentIm.setPixel(x, c, (alpha << 24) | (r << 16) | (g << 8) | b);\n currentIm.setPixel(x+1, c, (alpha << 24) | (r << 16) | (g << 8) | b);\n currentIm.setPixel(x+2, c, (alpha << 24) | (r << 16) | (g << 8) | b);\n }\n }", "BossBar createBossBar(String title, BossColor color, BossStyle style);", "private void ChangeBar(int x)\r\n\t{\r\n\t\tString s1=TextField1.getText();\r\n\t\tString s2=TextField2.getText();\r\n\t\tString s3=TextField3.getText();\r\n\t\t \r\n\t\tint red=Integer.parseInt(s1);\r\n\t\tint green=Integer.parseInt(s2);\r\n\t\tint blue=Integer.parseInt(s3);\r\n\t\tint max=getmax(red,green,blue);\r\n\t\t \r\n\t\tif (max > x)\r\n\t\t{\r\n\t\t\tint d = abs(max-x-0);\r\n\t\t\tred -= d;\r\n\t\t\tgreen -= d;\r\n\t\t\tblue -= d;\r\n\t\t}\r\n\t\telse\r\n\t\t{\r\n\t\t\tint d = abs(max+x+100);\r\n\t\t\tred += d;\r\n\t\t\tgreen += d;\r\n\t\t\tblue += d;\r\n\t\t}\r\n\t\tTextField1.setText(String.valueOf(red));\r\n\t\tTextField2.setText(String.valueOf(green));\r\n\t\tTextField3.setText(String.valueOf(blue));\r\n\t\trepaint();\r\n\t\t}", "public void act() {\r\n\t\t// For every bar, update self based on updates from controller.\r\n\t\tfor (int i = 0; i < barCount; i++) {\r\n\t\t\t// If regeneration is on, regenerate.\r\n\t\t\tif (regen[i]) {\r\n\t\t\t\t// Adjust the target value according to regeneration.\r\n\t\t\t\tupdate(i, regenRate[i]);\r\n\t\t\t}\r\n\r\n\t\t\t// Now managing the approach of the display value to the target\r\n\t\t\t// value.\r\n\t\t\t// If the distance from the current display value to the target is\r\n\t\t\t// less than the change rate, then the change would pass the target\r\n\t\t\t// and the bar would fluctuate above and below the target, so\r\n\t\t\t// instead set the display equal to target.\r\n\t\t\tif (Math.abs(currentTarget[i] - currentValue[i]) < changeRate[i]) {\r\n\t\t\t\tcurrentValue[i] = currentTarget[i];\r\n\t\t\t\t// Otherwise, approach the target by the set change rate.\r\n\t\t\t} else {\r\n\t\t\t\tif (currentValue[i] > currentTarget[i]) {\r\n\t\t\t\t\tcurrentValue[i] -= changeRate[i];\r\n\t\t\t\t} else if (currentValue[i] < currentTarget[i]) {\r\n\t\t\t\t\tcurrentValue[i] += changeRate[i];\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// Ensure the display value is valid and in range of boundaries.\r\n\t\t\tcurrentValue[i] = correctToRange(currentValue[i], 0.0, maxValue[i]);\r\n\t\t}\r\n\t\t// Update the display with the display value.\r\n\t\tupdate();\r\n\t}", "public interface BarberCloning\n{\n /**\n * Set barber id.\n *\n * @param id barber id\n */\n\n public void setBarberId (int id);\n\n /**\n * Get barber id.\n *\n * @return barber id\n */\n\n public int getBarberId ();\n\n /**\n * Set barber state.\n *\n * @param state new barber state\n */\n\n public void setBarberState (int state);\n\n /**\n * Get barber state.\n *\n * @return barber state\n */\n\n public int getBarberState ();\n}", "public void testCloning() {\n StandardXYBarPainter p1 = new StandardXYBarPainter();\n }", "private void showBossBars(TabPlayer p, List<String> bars) {\n\t\tif (bars == null) return;\n\t\tfor (String defaultBar : bars) {\n\t\t\tBossBarLine bar = getLines().get(defaultBar);\n\t\t\tif (bar.isConditionMet(p) && !p.getActiveBossBars().contains(bar)) {\n\t\t\t\tbar.create(p);\n\t\t\t\tp.getActiveBossBars().add(bar);\n\t\t\t}\n\t\t}\n\t}", "private void update() {\r\n\t\t// Creating display image, a bounded rectangle in which the set of bars\r\n\t\t// will fit.\r\n\t\t// The height and width should both be total diameter, which is double\r\n\t\t// the bar and central radii sum.\r\n\t\tdouble displaySize = 2.0 * (sumArray(barRadii) + centralRadius);\r\n\t\t// Rounding dimensions up to ensure the actual set will fit.\r\n\t\tGreenfootImage widget = new GreenfootImage(\r\n\t\t\t\t(int) Math.ceil(displaySize), (int) Math.ceil(displaySize));\r\n\t\t// Setting up canvas for the foundation of the display image, to be\r\n\t\t// drawn on.\r\n\t\tGraphics2D img = widget.getAwtImage().createGraphics();\r\n\t\t// This variable stores the radius at which to begin drawing each bar.\r\n\t\t// Its starting value, for the first bar, is the\r\n\t\t// size of the central circle, which is reserved for avatars, etc. The\r\n\t\t// for loop will use it to keep track of position,\r\n\t\t// to draw outwards.\r\n\t\tdouble drawBarFromRadius = centralRadius;\r\n\t\t// Central coordinates of entire set.\r\n\t\tdouble cenXAndY = displaySize / 2.0;\r\n\t\t// Draw central avatar onto display at center. The parameters still\r\n\t\t// use the upper left corner, so values are corrected as such.\r\n\t\timg.drawImage(avatar.getAwtImage(), (int) (cenXAndY - centralRadius),\r\n\t\t\t\t(int) (cenXAndY - centralRadius), null);\r\n\t\t// This class numerically identifies bars from 0 upwards, from inside to\r\n\t\t// out.\r\n\t\t// Now building bars from inside to out and drawing them onto display\r\n\t\t// image foundation.\r\n\t\tfor (int i = 0; i < barCount; i++) {\r\n\t\t\t// These variables will be frequently used in a moment; inner and\r\n\t\t\t// outer radii of the current bar.\r\n\t\t\tdouble innerRadius = drawBarFromRadius;\r\n\t\t\tdouble outerRadius = drawBarFromRadius + barRadii[i];\r\n\t\t\t// Creating circles for the bar boundaries, to form the rings. These\r\n\t\t\t// are the empty bar backgrounds, not the actual bars.\r\n\t\t\t// Centered on display center.\r\n\t\t\tShape innerBound = getCircle(cenXAndY, cenXAndY, innerRadius);\r\n\t\t\tShape outerBound = getCircle(cenXAndY, cenXAndY, outerRadius);\r\n\t\t\t// Using area subtraction to create an empty ring shape with a\r\n\t\t\t// transparent center.\r\n\t\t\t// This ring is the background.\r\n\t\t\t// After establishing the areas,\r\n\t\t\tArea innerA = new Area(innerBound);\r\n\t\t\tArea ring = new Area(outerBound);\r\n\t\t\t// Subtract the inner, smaller area from the larger to create the\r\n\t\t\t// ring.\r\n\t\t\tring.subtract(innerA);\r\n\t\t\t// Now creating the actual bar, the green partial ring indicator\r\n\t\t\t// that will change in arc length to show statistics.\r\n\t\t\t// First create a new copy of the ring area.\r\n\t\t\tArea bar = new Area(ring);\r\n\t\t\t// Temporary variable used to calculate the proportion of the\r\n\t\t\t// circumference, in degrees, representing the proportion of the\r\n\t\t\t// current status relative to maximum possible status. Percentage\r\n\t\t\t// times the total degree measure of the circle, 360 degrees.\r\n\t\t\tdouble arcAngle = (currentValue[i] / maxValue[i]) * 360.0;\r\n\t\t\t// Now retrieve the area of the pie shape for this arc, for the\r\n\t\t\t// outer boundary circle.\r\n\t\t\tArea pieShapeIndicator = new Area(getPie(cenXAndY, cenXAndY,\r\n\t\t\t\t\touterRadius, 0.0, arcAngle));\r\n\t\t\t// Then turn the bar area, currently still a ring of outer subtract\r\n\t\t\t// inner, into an arc ring by intersecting it with the pie shape.\r\n\t\t\t// The pie shape's center is removed, as only the intersecting\r\n\t\t\t// partial outer ring overlap of both areas is kept.\r\n\t\t\t// Bar is now an arc ring, fitting into the background ring\r\n\t\t\t// appropriately according to status.\r\n\t\t\tbar.intersect(pieShapeIndicator);\r\n\t\t\t// Draw the bar background onto the display.\r\n\t\t\timg.setColor(barBGColors[i]);\r\n\t\t\timg.fill(ring);\r\n\t\t\t// If the visual should be simple.\r\n\t\t\tif (!gradientEffect[i]) {\r\n\t\t\t\t// Draw the simple indicator onto the display.\r\n\t\t\t\timg.setColor(barColors[i]);\r\n\t\t\t\timg.fill(bar);\r\n\t\t\t} else {\r\n\t\t\t\t// Draw a gradient bar. From inner bound to outer bound of arc,\r\n\t\t\t\t// focused at center;\r\n\t\t\t\tRadialGradientPaint grad = new RadialGradientPaint(\r\n\t\t\t\t// Coordinates of center.\r\n\t\t\t\t\t\t(float) cenXAndY, (float) cenXAndY,\r\n\t\t\t\t\t\t// Bounding radius, outer.\r\n\t\t\t\t\t\t(float) outerRadius,\r\n\t\t\t\t\t\t// Key-frame radius positions as a proportion of\r\n\t\t\t\t\t\t// bounding radius. First color is at inner radius,\r\n\t\t\t\t\t\t// second at outer.\r\n\t\t\t\t\t\tnew float[] { (float) (innerRadius / outerRadius), 1.0f },\r\n\t\t\t\t\t\t// Colors to be interpolated between for gradient.\r\n\t\t\t\t\t\t// Uses the set color and a darker version of it.\r\n\t\t\t\t\t\tnew Color[] { barColors[i].darker(), barColors[i] });\r\n\t\t\t\t// Draw arc ring.\r\n\t\t\t\timg.setPaint(grad);\r\n\t\t\t\timg.fill(bar);\r\n\t\t\t}\r\n\t\t\t// Clause for alert feature; if alert is on and should show for\r\n\t\t\t// current status then;\r\n\t\t\tif (lowStatusAlert[i]\r\n\t\t\t\t\t&& currentTarget[i] < alertPercent[i] * maxValue[i]) {\r\n\t\t\t\t// Draw the flicker if it should be there this frame.\r\n\t\t\t\t// Otherwise do nothing.\r\n\t\t\t\tif (alertFlickering[i]) {\r\n\t\t\t\t\timg.setColor(alertColors[i]);\r\n\t\t\t\t\timg.fill(bar);\r\n\t\t\t\t}\r\n\t\t\t\t// Switch the flag for next frame.\r\n\t\t\t\talertFlickering[i] = !alertFlickering[i];\r\n\t\t\t}\r\n\t\t\t// This bar is now updated. Moving onto the next one. The radius at\r\n\t\t\t// which to begin drawing the next is noted down here.\r\n\t\t\tdrawBarFromRadius += barRadii[i];\r\n\t\t}\r\n\t\t// Display.\r\n\t\tsetImage(widget);\r\n\t}", "@Override\r\n public boolean isBar ()\r\n {\r\n return ShapeSet.Barlines.contains(getShape());\r\n }", "@Test\n public void test82() throws Throwable {\n WaterfallBarRenderer waterfallBarRenderer0 = new WaterfallBarRenderer();\n SystemColor systemColor0 = SystemColor.textInactiveText;\n Line2D.Double line2D_Double0 = new Line2D.Double();\n CombinedRangeCategoryPlot combinedRangeCategoryPlot0 = new CombinedRangeCategoryPlot();\n combinedRangeCategoryPlot0.setAnchorValue(0.0, false);\n }", "private void showBars() {\n if (!mIsActive || mShowBars) {\n return;\n }\n mShowBars = true;\n mOrientationManager.unlockOrientation();\n showToolBar(true);\n showStatusBar();\n // mActionBar.show();\n //mActivity.getGLRoot().setLightsOutMode(false);\n refreshHidingMessage();\n refreshBottomControlsWhenReady();\n }", "private String renderBar(String title, int barQty, char symbol) {\n\t\tStringBuilder bar = new StringBuilder();\n\t\tbar.append(title);\n\t\tbar.append(\": \");\n\t\tfor(int i = 0; i < barQty; i++)\n\t\t\tbar.append(symbol);\n\t\treturn bar.toString();\n\t\t\n\t}", "void seeGreen() {\n\t\tbar.setForeground(Color.GREEN);\n\t}", "public void drawHealthBar() {}", "@Override\n public void done() {\n \tbar.finished();\n \tbar.setCursor(null);\n }", "public BossBar(TAB tab) {\n\t\tthis.tab = tab;\n\t\tdisabledWorlds = tab.getConfiguration().getConfig().getStringList(\"disable-features-in-\"+tab.getPlatform().getSeparatorType()+\"s.bossbar\", Arrays.asList(\"disabled\" + tab.getPlatform().getSeparatorType()));\n\t\ttoggleCommand = tab.getConfiguration().getBossbarConfig().getString(\"bossbar-toggle-command\", \"/bossbar\");\n\t\tdefaultBars = tab.getConfiguration().getBossbarConfig().getStringList(\"default-bars\", new ArrayList<>());\n\t\tpermToToggle = tab.getConfiguration().getBossbarConfig().getBoolean(\"permission-required-to-toggle\", false);\n\t\thiddenByDefault = tab.getConfiguration().getBossbarConfig().getBoolean(\"hidden-by-default\", false);\n\t\tperWorld = tab.getConfiguration().getBossbarConfig().getConfigurationSection(\"per-world\");\n\t\tfor (Object bar : tab.getConfiguration().getBossbarConfig().getConfigurationSection(\"bars\").keySet()){\n\t\t\tgetLines().put(bar.toString(), BossBarLine.fromConfig(bar.toString()));\n\t\t}\n\t\tfor (String bar : new ArrayList<>(defaultBars)) {\n\t\t\tif (getLines().get(bar) == null) {\n\t\t\t\ttab.getErrorManager().startupWarn(\"BossBar \\\"&e\" + bar + \"&c\\\" is defined as default bar, but does not exist! &bIgnoring.\");\n\t\t\t\tdefaultBars.remove(bar);\n\t\t\t}\n\t\t}\n\t\tfor (Entry<String, List<String>> entry : perWorld.entrySet()) {\n\t\t\tList<String> bars = entry.getValue();\n\t\t\tfor (String bar : new ArrayList<>(bars)) {\n\t\t\t\tif (getLines().get(bar) == null) {\n\t\t\t\t\ttab.getErrorManager().startupWarn(\"BossBar \\\"&e\" + bar + \"&c\\\" is defined as per-world bar in world &e\" + entry.getKey() + \"&c, but does not exist! &bIgnoring.\");\n\t\t\t\t\tbars.remove(bar);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\trememberToggleChoice = tab.getConfiguration().getBossbarConfig().getBoolean(\"remember-toggle-choice\", false);\n\t\tif (isRememberToggleChoice()) {\n\t\t\tbossbarOffPlayers = tab.getConfiguration().getPlayerData(\"bossbar-off\");\n\t\t}\n\t\tTAB.getInstance().getPlaceholderManager().getAllUsedPlaceholderIdentifiers().add(\"%countdown%\");\n\t\tTAB.getInstance().getPlaceholderManager().registerPlaceholder(new ServerPlaceholder(\"%countdown%\", 100) {\n\n\t\t\t@Override\n\t\t\tpublic String get() {\n\t\t\t\treturn String.valueOf((getAnnounceEndTime() - System.currentTimeMillis()) / 1000);\n\t\t\t}\n\t\t});\n\t\ttab.debug(String.format(\"Loaded Bossbar feature with parameters disabledWorlds=%s, toggleCommand=%s, defaultBars=%s, permToToggle=%s, hiddenByDefault=%s, perWorld=%s, remember_toggle_choice=%s\",\n\t\t\t\tdisabledWorlds, toggleCommand, defaultBars, isPermToToggle(), hiddenByDefault, perWorld, isRememberToggleChoice()));\n\t}", "public AiBar(int x, int y, GameManager gm, Color color){\n\t\tsuper(x, y, gm, color);\n\t\try0 = (double) height / 100 * ((100 - rangePercent)/2);\n\t\try1 = (double) height / 100 * rangePercent + ry0;\n\t\tballx = 0;\n\t\tbally = gm.h;\n\t}", "private BarData generateDataBar() {\n\n ArrayList<BarEntry> entries = new ArrayList<>();\n\n for (int i = 0; i < 12; i++) {\n entries.add(new BarEntry(i, (int) (Math.random() * 70) + 30));\n }\n\n BarDataSet d = new BarDataSet(entries, \"New DataSet 1\");\n // 设置相邻的柱状图之间的距离\n d.setColors(ColorTemplate.VORDIPLOM_COLORS);\n // 设置高亮的透明度\n d.setHighLightAlpha(255);\n\n BarData cd = new BarData(d);\n cd.setBarWidth(0.9f);\n return cd;\n }", "BossBar createBossBar(String title, float health, BossColor color, BossStyle style);", "public void editBar(int id, double amountUsed){\n for (int i=0; i<bars.size(); i++){\n if (bars.get(i).getId()==id){\n if (bars.get(i).getLength()>=amountUsed){\n bars.get(i).setLength(bars.get(i).getLength()-amountUsed);\n break;\n }\n }\n }\n }", "public void setBarCode(String barCode) {\n this.barCode = barCode;\n }", "public void setBarPersistence(BarPersistence barPersistence) {\n this.barPersistence = barPersistence;\n }", "private void paintBarAxisLabel(Graphics2D g2d, BarSymbol barSymbol,\n ViewPart viewPart) {\n if (barSymbol.getAxisLabel() != null) {\n barSymbol.getAxisLabel().paintSymbol(g2d, barSymbol, viewPart);\n }\n }", "private void alterCPHPBars() {\n int cpInputSnapshot = mCPInput;\n int hpInputSnapshot = mHPInput;\n\n\n mCPMax = Pokemon.calculateMaxCPAtLevel(mPokemonNumber, mPokemonLevel);\n Log.d(TAG, \"alterCPHPBars: calculate\");\n mCPMin = Pokemon.calculateMinCPAtLevel(mPokemonNumber, mPokemonLevel);\n\n mCPBar.setMax(mCPMax - mCPMin);\n if (cpInputSnapshot >= mCPMin && cpInputSnapshot <= mCPMax) {\n mCPBar.setProgress(cpInputSnapshot - mCPMin);\n\n } else if (cpInputSnapshot > mCPMax) {\n //hack to make sure the listener registers a change if the progress stays the same but the mCPMax has actually changed\n mCPBar.setProgress(0);\n mCPBar.setProgress(mCPBar.getMax());\n } else if (cpInputSnapshot < mCPMin) {\n mCPBar.setProgress(mCPBar.getMax());\n mCPBar.setProgress(0);\n }\n mCPText.setText(\"CP : \" + mCPInput);\n\n mHPMax = Pokemon.calculateMaxHPAtLevel(mPokemonNumber, mPokemonLevel);\n mHPMin = Pokemon.calculateMinHPAtLevel(mPokemonNumber, mPokemonLevel);\n\n mHPBar.setMax(mHPMax - mHPMin);\n if (hpInputSnapshot >= mHPMin && hpInputSnapshot <= mHPMax) {\n mHPBar.setProgress(hpInputSnapshot - mHPMin);\n\n } else if (hpInputSnapshot > mHPMax) {\n mHPBar.setProgress(0);\n mHPBar.setProgress(mHPBar.getMax());\n } else if (hpInputSnapshot < mHPMin) {\n mHPBar.setProgress(mHPBar.getMax());\n mHPBar.setProgress(0);\n }\n mHPText.setText(\"HP : \" + mHPInput);\n\n }", "@Override\n public void run() {\n for(MessageManager temp : plugin.playerBossBars.values()){\n if(temp.bossBar.getPlayers().size() > 0){\n temp.advanceBar();\n\n BossBarMessage currentMessage = temp.getCurrentMessageObject();\n temp.bossBar.setTitle(currentMessage.barMessage);\n temp.bossBar.setColor(currentMessage.barColor);\n temp.bossBar.setStyle(currentMessage.barStyle);\n }\n }\n }", "@Override\n public void perish() {\n \n }", "@Override\n public int getNumGuiBars() {\n return 1;\n }", "@Test\n\tpublic void testUpdateStatusbarValue() {\n\t}", "private void drawBars(Graphics g) {\n // declare local variables:\n int numberOfDigits=1;\n // end of local variables declaration\n\n\n // draw the bars\n for(int c = 0; c < bars ; c++) {\n // set the drawing colour\n g.setColor(Color.WHITE);\n\n // check the number of digits of c\n if( c > 8) {\n numberOfDigits = 2;\n } // end of if statement\n\n // check if bar number should be drawn\n if(c%3==0) {\n // set the colour\n g.setColor(new Color(190, 130, 0) );\n // draw bar number\n g.drawString(Integer.toString(c+1) ,\n getWidth()- (textAreaLenght+barLenght)- barLenght*c -( 3*numberOfDigits ),\n getHeight()-8);\n } // end of if statement\n\n // draw vertical mini line\n g.drawLine(getWidth()- (textAreaLenght+barLenght)- barLenght*c, getHeight()-24,\n getWidth()- (textAreaLenght+barLenght)- barLenght*c, getHeight()-20);\n\n\n } // end of for loop\n\n }", "@Override\n\tprotected void interr() {\n\t}", "public void bark() {\n\t\tsuper.bark(bark1);\n\t}", "private void barEnterExitTracker(BarSymbol bar, int x, int y) {\n\n if (bar.getBarShape() == null) {\n return;\n }\n\n if (bar.getBarShape().contains(x, y) && !bar.isLockEnter()) {\n bar.lockEnter();\n fireBarEntered(bar);\n }\n else if (!bar.getBarShape().contains(x, y) && bar.isLockEnter()) {\n bar.unlockEnter();\n fireBarExited(bar);\n }\n }", "@Override\n\tpublic void grabar() {\n\t\t\n\t}", "public void addBar(String title, int bars, int color) {\n\t\t// More that 4 bars are not allowed at the moment\n\t\t// TODO: Allow more bars\n\t\tif(totalBars > 4) return; \n\t\t\n\t\t// TODO: Allow user to decide which image to use as a bar count\n\t\tbarTitle[totalBars] = title;\n\t\t\n\t\t// Bars are stored in two variables in the following way\n\t\t// [ title 1, title 2 ]\n\t\t// [bar#, barColor, bar#, barColor]\n\t\t\t\n\t\tbarData[totalBars * 2] = bars;\n\t\tbarData[(totalBars * 2) + 1] = color;\n\t\t\n\t\t++totalBars;\n\t}", "public void setProgressBar(JProgressBar bar) {\n matchProgressBar = bar;\n }", "private void drawVBar(int c, int r, int g, int b) {\n int rows= currentIm.getRows();\n int cols= currentIm.getCols();\n \n /* inv: pixels currentIm[c..c+4][0..x-1] are color c */\n for (int x= 0; x < rows; x= x+1) {\n \n int alpha= DM.getAlpha(currentIm.getPixel(x,c));\n currentIm.setPixel(x, c, (alpha << 24) | (r << 16) | (g << 8) | b);\n currentIm.setPixel(x, c+1, (alpha << 24) | (r << 16) | (g << 8) | b);\n currentIm.setPixel(x, c+2, (alpha << 24) | (r << 16) | (g << 8) | b);\n currentIm.setPixel(x, c+3, (alpha << 24) | (r << 16) | (g << 8) | b);\n }\n }", "void seeRed() {\n\t\tbar.setForeground(Color.RED);\n\t}", "@Override\n public int bar(int a, int b) {\n return a * b + 1;\n }", "public void update(){\n infoBar = new GreenfootImage (960, 50);\n infoBar.setFont(textFont);\n infoBar.setColor(textColor);\n String output = (\"Trees: \" + numTrees + \" Bushes: \" + numBushes + \" Prey: \" + numPrey + \" Predators: \" + numPredators);\n\n //centres the output on the bar.\n int centre = (960/2) - ((output.length() * 14)/2);\n\n infoBar.drawString(output, centre, 22); //draw the bar.\n this.setImage(infoBar);\n }", "public void SetBarChartImage(String bar) {\n\t\tboolean test = true;\n\t\t\n\t\tif((bar.isEmpty()) && (test)) {\n\t\t\tSystem.err.println(\"*** Warning ChartTypeChooser::\" +\n\t\t\t\"SetBarChartImage():: image is set to an empty string.\");\n\t\t}\n\t\tif ((bar.length() > MAX_SIZE) && (test)) {\n\t\t \tSystem.err.println(\"*** Warning ChartTypeChooser::\" +\n\t\t \t\"SetBarChartImage():: image is a very long name.\");\n\t\t}\n\t\telse if (test) {\n\t\t \tSystem.out.println(\"ChartTypeChooser:: \" +\n\t\t \t\"SetBarChartImage():: chosen image is set to: \" \n\t\t \t+ bar);\n\t\t}\n\t\tm_BarChartImage = bar;\n\t}", "public void testSerialization() {\n StandardXYBarPainter p1 = new StandardXYBarPainter();\n StandardXYBarPainter p2 = (StandardXYBarPainter) TestUtilities.serialised(p1);\n }", "private void setBarLenght(int len) {\n // check for logical error\n if(len <= 0) {\n // error ..\n eHandler.newError(ErrorType.INVALID_ARGUMENT, \"setBarLenght\", \"Zero or negative bar lenght\");\n\n // set to default\n barLenght =DEFAULT_BAR_LENGH;\n\n // exit from method\n return;\n } // end of if statement\n\n // set the barLenght\n barLenght = len;\n\n }", "public void createStatusBar(JPanel bar) {\n bar.setPreferredSize(new Dimension(getWidth(), 25));\n bar.setBackground(Color.LIGHT_GRAY);\n\n // add into container\n bar.add(paintModule.sizeLabel);\n bar.add(paintModule.coordinate);\n\n }", "protected void fillCoolBar(ICoolBarManager coolBar) {\n\t\tIWorkbenchWindow window = getActionBarConfigurer().getWindowConfigurer().getWindow();\n\t\tIToolBarManager toolbar = new ToolBarManager(SWT.LEFT);\n\t\tcoolBar.add(new ToolBarContributionItem(toolbar, Messages.getString(\"IU.Strings.15\"))); //$NON-NLS-1$\n\t\ttoolbar.add(new GroupMarker(Messages.getString(\"IU.Strings.16\"))); //$NON-NLS-1$\n\n\n\t\t/*IWorkbenchAction open = ActionFactory..create(window);\n\t\topen.setImageDescriptor(Activator.getImageDescriptor(\"icons/charger.png\"));\n\t\ttoolbar.add(open);*/\n\n\t\tIWorkbenchAction save = ActionFactory.SAVE.create(window);\n\t\tsave.setImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.17\"))); //$NON-NLS-1$\n\t\tsave.setDisabledImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.18\"))); //$NON-NLS-1$\n\t\tsave.setHoverImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.19\"))); //$NON-NLS-1$\n\t\tsave.setText(Messages.getString(\"IU.Strings.20\")); //$NON-NLS-1$\n\t\tsave.setToolTipText(Messages.getString(\"IU.Strings.21\")); //$NON-NLS-1$\n\t\ttoolbar.add(save);\n\n\t\tIWorkbenchAction print = ActionFactory.PRINT.create(window);\n\t\tprint.setImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.22\"))); //$NON-NLS-1$\n\t\tprint.setDisabledImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.23\"))); //$NON-NLS-1$\n\t\tprint.setHoverImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.24\"))); //$NON-NLS-1$\n\t\tprint.setText(Messages.getString(\"IU.Strings.25\")); //$NON-NLS-1$\n\t\tprint.setToolTipText(Messages.getString(\"IU.Strings.26\")); //$NON-NLS-1$\n\t\ttoolbar.add(print);\n\n\n\t\ttoolbar.add(new GroupMarker(Messages.getString(\"IU.Strings.27\"))); //$NON-NLS-1$\n\t\ttoolbar.add(new Separator());\n\t\tIWorkbenchAction find = ActionFactory.FIND.create(window);\n\t\tfind.setImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.28\"))); //$NON-NLS-1$\n\t\t//find.setDisabledImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.29\"))); //$NON-NLS-1$\n\t\t//find.setHoverImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.30\"))); //$NON-NLS-1$\n\t\tfind.setText(Messages.getString(\"IU.Strings.31\")); //$NON-NLS-1$\n\t\tfind.setToolTipText(Messages.getString(\"IU.Strings.32\")); //$NON-NLS-1$\n\t\ttoolbar.add(find);\n\n\t\t/*toolbar.add(ActionFactory.COPY.create(window));\n\t\ttoolbar.add(ActionFactory.CUT.create(window));\n\t\ttoolbar.add(ActionFactory.PASTE.create(window));\n\t\ttoolbar.add(new Separator());*/\n\n\t\t//TODO Rrgler le bug d'icon non charger undo / redo entre l'editeur et la console\n\t\t/*IWorkbenchAction undo = ActionFactory.UNDO.create(window);\n\t\tundo.setImageDescriptor(Activator.getImageDescriptor(\"icons/undo.gif\"));\n\t\tundo.setDisabledImageDescriptor(Activator.getImageDescriptor(\"icons/undo.gif\"));\n\t\tundo.setHoverImageDescriptor(Activator.getImageDescriptor(\"icons/undo.gif\"));\n\t\ttoolbar.add(undo);\n\n\t\tIWorkbenchAction redo = ActionFactory.REDO.create(window);\n\t\tredo.setImageDescriptor(Activator.getImageDescriptor(\"icons/redo.gif\"));\n\t\tredo.setDisabledImageDescriptor(Activator.getImageDescriptor(\"icons/redo.gif\"));\n\t\tredo.setHoverImageDescriptor(Activator.getImageDescriptor(\"icons/redo.gif\"));\n\t\ttoolbar.add(redo);*/\n\n\t\t\n\t\t//toolbar.add(ActionFactory.REDO.create(window));*/\n\n\t\t//toolbox2.png\n\t\tToolsBoxAction toolBox = new ToolsBoxAction(window);\n\t\ttoolBox.setImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.33\"))); //$NON-NLS-1$\n\t\ttoolBox.setDisabledImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.34\"))); //$NON-NLS-1$\n\t\ttoolBox.setHoverImageDescriptor(Activator.getImageDescriptor(Messages.getString(\"IU.Strings.35\"))); //$NON-NLS-1$\n\t\ttoolbar.add(toolBox);\n\t\t\n\t\t\n\t\t//action_toolsBox.setMenuCreator(new IMenuCreator(){});\n\t\n\t\t//coolBar.add(new ToolBarContributionItem(toolbar2, \"main2\"));\n\t\t//toolbar2.add(ActionFactory.SHOW_VIEW_MENU.create(window));\n\n\t\t\n\t\tIToolBarManager toolbar2 = new ToolBarManager(SWT.RIGHT | SWT.FLAT | SWT.HORIZONTAL);\n\t\t\n\t\tcoolBar.add(new ToolBarContributionItem(toolbar2, Messages.getString(\"IU.Strings.36\")));\t //$NON-NLS-1$\n\t\ttoolbar2.add(new GroupMarker(Messages.getString(\"IU.Strings.37\"))); //$NON-NLS-1$\n\t\ttoolbar2.add(new GroupMarker(Messages.getString(\"IU.Strings.38\"))); //$NON-NLS-1$\n\t}", "public abstract BossBar setStyle(BossStyle style);", "public void baocun() {\n\t\t\n\t}", "public void addCopyElts(Bars bar){\r\n Bars tempBar = new Bars();\r\n for(Iterator<Meters> i = bar.MetersList.iterator(); i.hasNext();){\r\n tempBar.addCopyElts(i.next());\r\n }\r\n addElts(tempBar);\r\n }", "@Override\n\tprotected void update() {\n\t\t\n\t}", "public void addComponentToCoolBar(Component component) {\n\t\t_coolBar.addComponent(component);\n\t}", "@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}", "private void autoSetBarSize() {\n float statusBarHeight = Utils.getStatusBarHeight(ModifyPassActivity.this);\n mStatusView = findViewById(R.id.view_modify_status_bar);\n LinearLayout.LayoutParams Params1 = new LinearLayout.LayoutParams(\n ViewGroup.LayoutParams.MATCH_PARENT, (int) statusBarHeight);\n mStatusView.setLayoutParams(Params1);\n }", "BottombarViewFlipper getBottomBar();", "public BarChartModel getBarModel() {\r\n\t\treturn barModel;\r\n\t}", "@Override\n\tpublic void bbb() {\n\t\t\n\t}", "private void initBars()\n\t{\n\t\tfor (int i = 0; i < Constants.MAX_VALUE; i++)\n\t\t{\n\t\t\trows[i] = new Bar();\n\t\t\tcolumns[i] = new Bar();\n\t\t\tgrids[i] = new Bar();\n\t\t}\n\n\t\tfor (int rowIndex = 0; rowIndex < this.nodes.length; rowIndex++)\n\t\t{\n\t\t\tNode[] row = this.nodes[rowIndex];\n\t\t\tfor (int colIndex = 0; colIndex < row.length; colIndex++)\n\t\t\t{\n\t\t\t\tNode node = row[colIndex];\n\n\t\t\t\t// Make Rows\n\t\t\t\tthis.rows[rowIndex].nodes[colIndex] = node;\n\t\t\t\tnode.setRow(this.rows[rowIndex]);\n\n\t\t\t\t// Make Columns\n\t\t\t\tthis.columns[colIndex].nodes[rowIndex] = node;\n\t\t\t\tnode.setColumn(this.columns[colIndex]);\n\n\t\t\t\t// Make Grid\n\t\t\t\t// the index of Grid Array\n\t\t\t\tint gridIndex = colIndex / 3 + (rowIndex / 3) * 3;\n\n\t\t\t\t// the index of nodes array of one grid object\n\t\t\t\tint gridNodeIndex = colIndex % 3 + (rowIndex % 3) * 3;\n\t\t\t\tthis.grids[gridIndex].nodes[gridNodeIndex] = node;\n\t\t\t\tnode.setGrid(this.grids[gridIndex]);\n\t\t\t}\n\t\t}\n\t}", "private void addBarGraphRenderers() {\n Paint paint = new Paint();\n paint.setStrokeWidth(12f);\n paint.setAntiAlias(true);\n paint.setColor(Color.argb(200, 56, 138, 252));\n BarGraphRenderer barGraphRendererBottom = new BarGraphRenderer(4, paint, false, false);\n mVisualizerView.addRenderer(barGraphRendererBottom);\n\n Paint paint2 = new Paint();\n paint2.setStrokeWidth(12f);\n paint2.setAntiAlias(true);\n paint2.setColor(Color.argb(200, 181, 111, 233));\n BarGraphRenderer barGraphRendererTop = new BarGraphRenderer(4, paint2, true, true);\n mVisualizerView.addRenderer(barGraphRendererTop);\n }", "private void addBarGraphRenderers() {\n Paint paint = new Paint();\n paint.setStrokeWidth(50f);\n paint.setAntiAlias(true);\n paint.setColor(Color.argb(200, 56, 138, 252));\n BarGraphRenderer barGraphRendererBottom = new BarGraphRenderer(16, paint, false);\n mVisualizerView.addRenderer(barGraphRendererBottom);\n\n Paint paint2 = new Paint();\n paint2.setStrokeWidth(12f);\n paint2.setAntiAlias(true);\n paint2.setColor(Color.argb(200, 181, 111, 233));\n BarGraphRenderer barGraphRendererTop = new BarGraphRenderer(4, paint2, true);\n mVisualizerView.addRenderer(barGraphRendererTop);\n }", "void modifyToolbar(Toolbar toolbar){\r\n toolbar.setTitle(name);\r\n toolbar.inflateMenu(R.menu.menu_toolbar_package);\r\n\r\n //needed to send context to util classes\r\n final Context context = this;\r\n\r\n toolbar.setOnMenuItemClickListener(\r\n new Toolbar.OnMenuItemClickListener() {\r\n @Override\r\n public boolean onMenuItemClick(MenuItem item) {\r\n switch (item.getItemId())\r\n {\r\n case R.id.action_exit_fragment:\r\n onBackPressed();\r\n break;\r\n case R.id.action_phone:\r\n DialogUtil.makePhoneDialog(context,R.string.dialog_phone_title, R.string.dialog_phone_customer_positive, selectedTask.getReceiver().getPhone());\r\n break;\r\n case R.id.action_sms:\r\n DialogUtil.makeSMSDialog(context, selectedTask);\r\n break;\r\n default:break;\r\n }\r\n return true;\r\n }\r\n });\r\n\r\n }", "public void extendCollector() { \n m_fourBarLeft.set(FOURBAR_SPEED);\n m_fourBarRight.set(FOURBAR_SPEED);\n\n }", "public void MakeBar3D() {\n\t\tBarButton3D = new JButton(\n\t\t\t\t new ImageIcon(getClass().getResource(\n\t\t\t\t\tGet3DBarChartImage())));\n\t\tBarButton3D.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent evt) {\t\n\t\t\t\tGetHost().instructionText.setVisible(false);\n\t\t\t\tGetHost().ExportEnabled();\n\t\t\t\t\n\t\t\t\tif(GetHost().GetTitle() == UNSET) {\n\t\t\t\t\tGetHost().LeftPanelContent(new BarChart3D(\n\t\t\t\t\tGetHost().GetGraphData(), \n\t\t\t\t\t\"3D Bar Chart\", \n\t\t\t\t\tGetHost().GetColourScheme(),GetHost()));\n\t\t\t\t}else {\n\t\t\t\t\tGetHost().LeftPanelContent(new BarChart3D(\n\t\t\t\t\tGetHost().GetGraphData(), \n\t\t\t\t\tGetHost().GetTitle(), \n\t\t\t\t\tGetHost().GetColourScheme(),GetHost()));\n\t\t\t\t}\n\t\t\t}\n\t\t});\t\t\n\t\t\n\t\tChartTypeInterface.add(BarButton3D);\n\t}", "UIBar(int instance, String context) {\n\tsuper(instance, context);\n\n\t// Setup object property and method table.\n\t//\n\taddObjectTable(fieldTable, null);\n }", "public void testEquals() {\n StandardXYBarPainter p1 = new StandardXYBarPainter();\n StandardXYBarPainter p2 = new StandardXYBarPainter();\n }", "protected abstract int getTitleBarStringId();", "@Override\n\tpublic void alterar() {\n\t\t\n\t}" ]
[ "0.6873399", "0.6447074", "0.63208884", "0.6153133", "0.614336", "0.6139106", "0.6077405", "0.6033865", "0.6033865", "0.6006549", "0.5980527", "0.5956701", "0.59069246", "0.5862451", "0.5839797", "0.57415", "0.57150227", "0.5712228", "0.5709557", "0.57044435", "0.5703975", "0.5674546", "0.56644326", "0.56613547", "0.56550175", "0.56427634", "0.5595753", "0.55752236", "0.55488646", "0.553068", "0.55207455", "0.5494429", "0.5491439", "0.5490958", "0.5487962", "0.5470046", "0.54655033", "0.54647374", "0.5464041", "0.5453417", "0.5447742", "0.54329056", "0.5429524", "0.5423694", "0.54051065", "0.53975147", "0.53934234", "0.5390166", "0.5367775", "0.53658986", "0.536295", "0.5356746", "0.5354785", "0.535468", "0.53219736", "0.53098893", "0.5303831", "0.5299417", "0.52865624", "0.52746457", "0.5273651", "0.5272186", "0.5271314", "0.5270166", "0.5268465", "0.52631277", "0.5261421", "0.52605736", "0.5251119", "0.52484566", "0.5238976", "0.52363247", "0.52323705", "0.52319145", "0.5221016", "0.5212483", "0.5209334", "0.52091014", "0.52057904", "0.5204787", "0.51951754", "0.5192652", "0.51915556", "0.51781476", "0.5178006", "0.51753104", "0.5169452", "0.51551425", "0.51542026", "0.5152086", "0.5148629", "0.5148524", "0.5129363", "0.5119565", "0.5119001", "0.5103259", "0.5101931", "0.50993454", "0.5084693", "0.5082453", "0.50803703" ]
0.0
-1
TODO Autogenerated method stub
public static void main(String[] args) { int a; int b; int c; a=10; b=20; c=a+b; System.out.println("Sum of a and b is "+ c); System.out.println(1212); System.out.println("hello"); System.out.println("same line"); System.out.println(a>b); if(a>b) { System.out.println("a is greater than b"); } else if(a==b) { System.out.println("a and b are same"); }else { System.out.println("a is not greater than b"); } }
{ "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
/ The method asks the question and returns a answer.
@Override public String ask(String question) { return answers[position++]; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "String ask();", "java.lang.String getCorrectAnswer();", "protected abstract String answer();", "String userInput(String question);", "public abstract String chooseAnswer();", "boolean hasCorrectAnswer();", "String getAnswerResponse();", "public String askSomething(String question, String titel);", "public static void main(){\n \n \n String question = \"There are 10 types of people in this world, those who understand binary and those who don't.\";\n String answer = \"true\";\n \n Question tfQuest = new Question (question, answer);\n tfQuest.getAnswer();\n \n }", "public String getUserInput(String question) {\r\n System.out.print(question);\r\n return scanner.next();\r\n }", "private int getAnswer() throws IOException {\n String w = next();\n while (w.equals(\"\")) {\n w = next();\n }\n // System.out.println(w + \" is the answer key\");\n c = r.read();\n if (w.equals(\"b\")) {\n return 1;\n } else {\n return 0;\n }\n }", "int getWrongAnswers();", "private void checkAsk(FyQuestion q, FyAnswer a) {\n\t\treturn;\r\n\t}", "public int getPlayerAnswer()\r\n\t{\r\n\t\tScanner in = new Scanner(System.in);\r\n\t\tSystem.out.print(\"Enter your answer (0-3): \");\r\n\t\treturn in.nextInt();\r\n\t}", "static void askQuestion() {\n\t\t// Setting up a Scanner to get user input\n\t\tScanner userInput = new Scanner(System.in);\n\n\t\t// Declaring variables\n\t\tdouble num1, num2, answer, userAnswer;\n\n\t\t// GENERATING QUESTION\n\n\t\t// Getting two new random numbers, rounded to one decimal place (with numbers generation from 0 to 50)\n\t\tnum1 = Math.round((Math.random() * 50)*10.0)/10.0;\n\t\tnum2 = Math.round((Math.random() * 50)*10.0)/10.0;\n\n\t\t// Generating a random number between 1 and 4 to randomize the math operation. A switch case is used to calculate the answer based on the math operation that gets generated.\n\t\tswitch ((int) Math.round(Math.random() * 3 + 1)) {\n\t\t\tcase 1: // Similar structure for each case (and the default case), structured as follows\n\t\t\t\tSystem.out.print(num1 + \" + \" + num2 + \" = \"); // Printing the question (based on the generated operation)\n\t\t\t\tanswer = num1 + num2; // Calculating the answer (based on the generated operation)\n\t\t\t\tbreak; // Exit the switch statement\n\t\t\tcase 2:\n\t\t\t\tSystem.out.print(num1 + \" - \" + num2 + \" = \");\n\t\t\t\tanswer = num1 - num2;\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\tSystem.out.print(num1 + \" / \" + num2 + \" = \");\n\t\t\t\tanswer = num1 / num2;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tSystem.out.print(num1 + \" * \" + num2 + \" = \");\n\t\t\t\tanswer = num1 * num2;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tanswer = Math.round(answer * 10.0) / 10.0; // Rounding the answer to one decimal place\n\t\tuserAnswer = userInput.nextDouble(); // Getting the user's answer\n\n\t\tif (answer == userAnswer) System.out.println(\"That's right. Good Job!\\n\"); // If the answers match, the user is correct and the staetment is printed accordingly.\n\t\telse System.out.println(\"Incorrect. The correct answer was \" + answer + \".\\n\"); // Otherwise, show that the user's answer is incorrect and output an according statement.\n\t}", "public void getInput() {\r\n System.out.print(\"Is the car silent when you turn the key? \");\r\n setAnswer1(in.nextLine());\r\n if(getAnswer1().equals(YES)) {\r\n System.out.print(\"Are the battery terminals corroded? \");\r\n setAnswer2(in.nextLine());\r\n if(getAnswer2().equals(YES)){\r\n printString(\"Clean the terminals and try again\");\r\n }\r\n else {\r\n printString(\"The battery may be damaged.\\nReplace the cables and try again\");\r\n }\r\n\r\n }\r\n else {\r\n System.out.print(\"Does the car make a slicking noise? \");\r\n setAnswer3(in.nextLine());\r\n if(getAnswer3().equals(YES)) {\r\n printString(\"Replace the battery\");\r\n }\r\n else {\r\n System.out.print(\"Does the car crank up but fail to start? \");\r\n setAnswer4(in.nextLine());\r\n if(getAnswer4().equals(YES)) {\r\n printString(\"Check spark plug connections.\");\r\n }\r\n else{\r\n System.out.print(\"Does the engine start and then die? \");\r\n setAnswer5(in.nextLine());\r\n if(getAnswer5().equals(YES)){\r\n System.out.print(\"Does your care have fuel injection? \");\r\n setAnswer6(in.nextLine());\r\n if(getAnswer6().equals(YES)){\r\n printString(\"Get it in for service\");\r\n }\r\n else{\r\n printString(\"Check to insure the chock is opening and closing\");\r\n }\r\n }\r\n else {\r\n printString(\"This should be impossible\");\r\n }\r\n }\r\n }\r\n\r\n }\r\n\r\n\r\n\r\n }", "private String promptForAnswer(AnswerChecker answerChecker) {\n String answer;\n while (true) {\n regularPresenter.newAnswerPrompter();\n answer = scanner.nextLine();\n if (answerChecker.isValidAnswerForm(answer)) break;\n else regularPresenter.illegalAnswerReporter();\n }\n return answer;\n }", "double scoreAnswer(Question question, Answer answer);", "public abstract String promptSelectionFromAnswers(final String question, final List<String> answers) throws JVMIOException;", "public String getAnswer() {\n return answer;\n }", "pb4server.GiveRansomAskReq getGiveRansomAskReq();", "public int getAnswer()\n {\n return answer;\n }", "public abstract AnswerStatus checkAnswer(String answer) throws SyntaxException;", "static boolean yesNoQuestion(String prompt){\r\n while(true){\r\n System.out.println(prompt);\r\n String input = Console.in.readWord();\r\n if (input.equals(\"yes\")) return true;\r\n else if (input.equals(\"no\")) return false;\r\n }\r\n }", "String askForData();", "public static String getString (String ask)\r\n {\r\n Scanner keyboard = new Scanner(System.in);\r\n System.out.print(ask + \" -> \");\r\n String input = keyboard.nextLine();\r\n return input;\r\n }", "protected abstract void askResponse();", "public boolean replyResult(int answer){\n \t_numberOfChoice = answer;\r\n return false;\r\n }", "public void checkAnswer() {\n }", "public void question() {\n\t\tlead.answer(this);\n\t}", "public int getAnswer() {\n return answer;\n }", "public void setAnswer(String answer) {\r\n this.answer = answer;\r\n }", "public int askWhatAssistants(int assi);", "public String getAnswer(String input)\n\t{\n\t\tString answer = \"\";\n\t\t\n\t\tanswer = JOptionPane.showInputDialog(null, input);\n\t\t\n\t\treturn answer;\n\t}", "String prompt(String message) throws IOException;", "public String getAnswer(){\n return this.answer;\n }", "private static int getIntFromUser(String prompt)\n\t {\n\t System.out.print(prompt); // Prompt user to enter input value\n\t return input.nextInt(); // Read and return user's response\n\t }", "public boolean callIntoQuestion();", "protected Answer(){\r\n\t\t\r\n\t}", "public String getAnswer(){\n\t\tString result = new String(answer);\n\t\tanswer = \"\"; //reset answer after every read\n\t\treturn result;\n\t}", "public int getAnswer() {\n\t\treturn answer;\n\t}", "public void quiz() {\n\t\t\t\t\tcorrectans = 0;\n\t\t\t\t\tint k = 0;\n\t\t\t\t\tint j = 0;\n\t\t\t\t\tint M = 0;\n\t\t\t\t\tj = readDifficulty();\n\t\t\t\t\tM = readProblemType();\n\t\t\t\t\t//ask the student to solve 10 different problems, as determined by the problem type\n\t\t\t for(int i = 0; i < 10; i++ ) {\n\t\t\t \t//contain two numbers sampled from a uniform random distribution with bounds determined by the problem difficulty\n\t\t\t \tint x = rand.nextInt(j); \n\t\t\t\t int y = rand.nextInt(j);\n\t\t\t\t int O = askquestion(j, M,x,y);\n\t\t\t\t if(M == 4) {\n\t\t\t\t \t float floatans = readdivision();\n\t\t\t\t \tk = divisionsol(floatans, x, y);\n\t\t\t\t }\n\t\t\t\t else {\n\t\t\t int userin = readResponse();\n\t\t\t k = isnanswercorrect(O , userin);\n\t\t\t }\n\t\t\t if(k == 1) {\n\t\t\t \t correctans++;\n\t\t\t }\n\t\t\t }\n\t\t\t int L = 0;\n\t\t\t L = displayCompletionMessage(correctans);\n\t\t\t if ( L == 1) {\n\t\t\t \tquiz();\n\t\t\t }\n\t\t\t else {\n\t\t\t \treturn;\n\t\t\t }\n\t\t\t \n\t\t\t\t}", "String promptString();", "public abstract void promptForInput(final String msg);", "public int initialAsk(){\n System.out.println(\"Hi, what would you like to do? \");\n System.out.println(\"Please type in the number: \");\n System.out.println(\"1. Add a client to the database \");\n System.out.println(\"2. Add an order to the database \");\n System.out.println(\"3. Display all clients from the database \");\n System.out.println(\"4. Display all orders from the database \");\n System.out.println(\"5. Update the client data \");\n System.out.println(\"6. Update the order data \");\n System.out.println(\"7. Delete the client from a database \");\n System.out.println(\"8. Delete the order from a database \");\n System.out.println(\"9. Find the client\");\n System.out.println(\"10. Find the order\");\n System.out.println(\"11. Finish work/ Close app\");\n return inN.nextInt();\n}", "@Override\r\n public String ask() {\r\n String word = \"\";\r\n Time.getInstance().time += 1;\r\n word = \"Do you like the Story?\";\r\n System.out.println(word);\r\n return word;\r\n }", "private void askConfirm(String question) {\n\t\tScanner scanner = new Scanner(System.in);\n\t\tString confirm = \"y\";\n\t\twhile (!confirm.equals(\"y\") && !confirm.equals(\"n\")) {\n\t\t\tSystem.out.println(question);\n\t\t\tconfirm = scanner.nextLine();\n\t\t\tif (confirm.equals(\"y\")) {\n\t\t\t\tSystem.out.println(\"Thank you.\");\n\t\t\t} else if (confirm.equals(\"n\")) {\n\t\t\t\tSystem.out.println(\"You can edit the config settings in src/main/config\");\n\t\t\t\tSystem.exit(1);\n\t\t\t} else {\n\t\t\t\tSystem.out.println(\"Really funny. Try again.\");\n\t\t\t}\n\n\t\t}\n\t\tscanner.close();\n\t}", "@Override\r\n\tpublic void checkAnswer() {\n\t\t\r\n\t}", "public static boolean askYesNo(String message) {\n\n\t\t// Present the choice (and log it where chosen.)\n\t\tpresent(message + \" [Y/N] :: \");\n\n\t\tString choice = \"\";\n\n\t\t// Get a result from the user.\n\t\ttry {\n\t\t\tboolean chosen = false;\n\t\t\twhile ( !(chosen)) {\n\n\t\t\t\tchoice = System.console().readLine();\n\n\t\t\t\tchoice = choice.toUpperCase().trim();\n\n\t\t\t\tif ((choice.compareTo(\"Y\") == 0) || (choice.compareTo(\"N\") == 0) ){\n\t\t\t\t\tchosen = true;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t} catch\t(Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t\t// Log the user's choice. \n\t\taddLine(\"(The user chose: \\\"\" + choice + \"\\\".)\");\n\n\t\tif (choice.compareTo(\"Y\") == 0 ) {\n\t\t\treturn true;\n\t\t} else {\n\t\t\treturn false;\n\t\t}\n\n\t}", "public static String answer(Scanner console) {\r\n System.out.print(\"Do you want to play again? \"); \r\n String answer = console.next();\r\n System.out.println();\r\n return answer; \r\n }", "public String getUserDecision(){\n return input.nextLine();\n }", "public String printOutQuestion()\n\t{\n\t\tRandom rand = new Random();\n\t\tString[] answers = new String[4];\n\t\tString returnString;\n\t\tanswers[0] = answer;\n\t\tanswers[1] = falseAnswers[0];\n\t\tanswers[2] = falseAnswers[1];\n\t\tanswers[3] = falseAnswers[2];\n\t\tString firstAns = \"\", secondAns = \"\", thirdAns = \"\", fourthAns = \"\";\n\t\t\n\t\twhile(firstAns == secondAns || firstAns == thirdAns || firstAns == fourthAns || secondAns == thirdAns || secondAns == fourthAns || thirdAns == fourthAns)\n\t\t{\n\t\t\tfirstAns = answers[rand.nextInt(4)];\n\t\t//\tSystem.out.println(firstAns); Used for debugging\n\t\t\tsecondAns = answers[rand.nextInt(4)];\n\t\t//\tSystem.out.println(secondAns); Used for debugging\n\t\t\tthirdAns = answers[rand.nextInt(4)];\n\t\t//\tSystem.out.println(thirdAns); Used for debugging\n\t\t\tfourthAns = answers[rand.nextInt(4)];\n\t\t//\tSystem.out.println(fourthAns); Used for debugging\n\t\t}\n\t\t\n\t\tanswerA = firstAns;\n\t\tanswerB = secondAns;\n\t\tanswerC = thirdAns;\n\t\tanswerD = fourthAns;\n\t\t//System.out.println(questionString + \"Answer A: \" + firstAns + \"Answer B: \" + secondAns + \"Answer C: \" + thirdAns + \"Answer D: \" + fourthAns); Used for debugging\n\t\treturnString = questionString + \"?\"; \n\t\tSystem.out.println(\"Actual Answer is: \" + answer);\n\t\treturn returnString;\n\t}", "private SpeechletResponse generateAskResponse(String stringOutput,\n String repromptText) {\n\n /* Set output speech */\n OutputSpeech outputSpeech, repromptOutputSpeech;\n outputSpeech = new PlainTextOutputSpeech();\n ((PlainTextOutputSpeech) outputSpeech).setText(stringOutput);\n\n /* Set re-prompt speech */\n repromptOutputSpeech = new PlainTextOutputSpeech();\n ((PlainTextOutputSpeech) repromptOutputSpeech).setText(repromptText);\n Reprompt reprompt = new Reprompt();\n reprompt.setOutputSpeech(repromptOutputSpeech);\n\n return SpeechletResponse.newAskResponse(outputSpeech, reprompt);\n }", "@Override\n\tpublic void solve(String result) {\n\t\tSystem.out.println(\"你告诉我的答案是--->\"+result); \n\t}", "public static void main(String[] args) \r\n {\r\n // TODO: Read the input from the user and call produceAnswer with an equation\r\n \tScanner in = new Scanner(System.in);\r\n \tString problem = in.nextLine();\r\n \tin.close();\r\n \tSystem.out.printf(\"Result: %s\" , produceAnswer(problem));\r\n }", "public boolean askQuestion(Question curentQuestion, int level) {\n this.level = level;\n System.out.println(\"Die \"+(1+level)*100+\" Euro Frage!\");\n System.out.println(curentQuestion.getQuestion());\n //Sets the position of the right answer so it will be random\n int positionCorrectAnswer = (int) (Math.random() * ((curentQuestion.getWrongAnswers().size()) + 1));\n curentQuestion.getWrongAnswers().add(positionCorrectAnswer, curentQuestion.getCorrectAnswer());\n for (int j = 0; j < curentQuestion.getWrongAnswers().size(); j++) {\n System.out.println(\"\\t\" + (1 + j) + \". \" + curentQuestion.getWrongAnswers().get(j));\n }\n int amountOfAnswers = curentQuestion.getWrongAnswers().size();\n if (joker) {\n System.out.println(\"\\t5. 50:50 Joker\");\n amountOfAnswers = 5;\n\n }\n return getUserInput(amountOfAnswers, positionCorrectAnswer, curentQuestion);\n\n }", "private void askUser(){\n\t\tprintln(\"Enter the values to compute Pythagorean Theorem: \");\n\t\tprint(\"a: \");\n\t\tint a = readInt();\n\t\tprint(\"b: \");\n\t\tint b = readInt();\n\t\tcomputePythagorean(a, b);\n\t}", "private static boolean getUserYesOrNo(SimpleReader in, SimpleWriter out) {\r\n String answer = in.nextLine();\r\n boolean answerIsYes = true;\r\n while (!answer.equalsIgnoreCase(\"y\") && !answer.equalsIgnoreCase(\"n\")) {\r\n out.print(\"Error: please enter 'y' or 'n' as a response: \");\r\n answer = in.nextLine();\r\n }\r\n if (answer.equalsIgnoreCase(\"n\")) {\r\n answerIsYes = false;\r\n }\r\n return answerIsYes;\r\n }", "public static boolean bool(String question) {\r\n\t\tSystem.out.println(question);\r\n\t\tboolean v = false, re = true;\r\n\t\twhile (!v) {\r\n\t\t\tString sr = scan.nextLine();\r\n\t\t\tString s = sr.toLowerCase();\r\n\t\t\tswitch (s) {\r\n\t\t\tcase \"y\":\r\n\t\t\t\tv = true;\r\n\t\t\t\tre = true;\r\n\t\t\t\tbreak;\r\n\t\t\tcase \"n\":\r\n\t\t\t\tv = true;\r\n\t\t\t\tre = false;\r\n\t\t\t\tbreak;\r\n\t\t\tdefault:\r\n\t\t\t\tSystem.out.println(\"Not enter avalidable enter.(y/n)\");\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn re;\r\n\t}", "@FXML\n\tprivate void answerQuestion() {\n\t\tint correctAnsID = 0;\n\t\ttry {\n\t\t\tswitch (((RadioButton) answerGroup.getSelectedToggle()).getId()) {\n\t\t\tcase \"ans1Check\":\n\t\t\t\tcorrectAnsID = 1;\n\t\t\t\tbreak;\n\t\t\tcase \"ans2Check\":\n\t\t\t\tcorrectAnsID = 2;\n\t\t\t\tbreak;\n\t\t\tcase \"ans3Check\":\n\t\t\t\tcorrectAnsID = 3;\n\t\t\t\tbreak;\n\t\t\tcase \"ans4Check\":\n\t\t\t\tcorrectAnsID = 4;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} catch (Exception e) {\n\t\t\terrorLabel.setVisible(true);\n\t\t}\n\n\t\t// nothing is selected\n\t\tif (correctAnsID == 0) { \n\t\t\terrorLabel.setVisible(true);\n\t\t\t// correct answer\n\t\t} else if (question.getCorrect_ans() == correctAnsID) {\n\t\t\tcontrol.setScore(control.getScore() + question.getScore());\n\t\t\thandleAlertAndWindow(AlertType.INFORMATION, \"Congrats! :D\",\n\t\t\t\t\t\"You received \" + question.getScore() + \" points\");\n\t\t\t// wrong answer\n\t\t} else {\n\t\t\tcontrol.setScore(control.getScore() + question.getPenalty());\n\n\t\t\thandleAlertAndWindow(AlertType.ERROR, \"Uh oh! :(\",\n\t\t\t\t\t\"You lost \" + question.getPenalty() + \" points\");\n\t\t}\n\n\t\t// reset the eaten question\n\t\tViewLogic.playGameController.getControl().setQuestionEaten(null);\n\t}", "public void verifyAnswer() {\n\t\tint i=0;\n\t\tSystem.out.println(\"in verify answer function\");\n\t\tSystem.out.println(\"Number of Answers: \"+ansCount);\n\t\tSystem.out.println(\"User ans: \"+userEquation);\n\t\tif (ansCount==0)\n\t\t\tlb2.setText(\"There is no solution for this set\");\n\t\telse{\n\t\t\tint c=0;\n\t\t\t\n\t\t\twhile(c<ansCount) {\n\t\t\t\tif (solutions[i].equals(userEquation)) {\n\t\t\t\t\tSystem.out.println(\"Ans was Correct\");\n\t\t\t\t\tfinal long duration = System.nanoTime() - startTime;\n\t\t\t\t\tseconds = TimeUnit.NANOSECONDS.toSeconds(duration);\n\t\t\t\t\tlb2.setText(\"Congradulations! You took \"+seconds+\" seconds to find an answer.\");\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ti++;\n\t\t\t\tc++;\n\t\t\t\tSystem.out.println(\"C: \"+c);\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t\tSystem.out.println(\"Ans was not Correct\");\n\t}\n\t}", "public void showQuestion()\n\t{\n\t\tSystem.out.println(ans);\n\t\tfor(int k = 0; k<numAns; k++)\n\t\t{\n\t\t\tSystem.out.println(k+\". \"+answers[k]);\n\t\t}\n\t}", "@Override\n\tpublic String answer() {\n\t\treturn null;\n\t}", "com.google.protobuf.ByteString\n getCorrectAnswerBytes();", "Question getQuestion();", "public String getAnAnswer() {\n\t\t\n\t\tString answer = \"\";\n\t\t\n\t\t\n\t\tRandom randomGenerator = new Random(); //Construct a new random number generator\n\t\tint randomNumber = randomGenerator.nextInt(mAnswers.length);\n\t\t\n\t\tanswer = mAnswers[randomNumber];\n\t\t\n\t\treturn answer;\n\t}", "static String answer(String command)\n {\n return stateDependentAnswer.apply(command);\n }", "public static void main(String[] args) {\n\t\tRandom rand = new Random();\n\t\tScanner scan = new Scanner(System.in);\n\t\tint randNum;\n\t\tString userGuess;\n\t\tString outcome;\n\t\tString goAgain;\n\t\tboolean goAgainValid=false;\n\t\tboolean quit=false;\n\t\t\n\t\ttry {\n\t\t\t// declaring the questions and answers\n\t\t\tString[] jokeQuestions = { \"Largest planet ? \", \"Worse song ever ? \", \"Capital of Peru?\", \"Roman god of War ?\" };\n\t\t\tString[] jokeAnswers = { \"Jupiter\", \"Baby\", \"Lima\", \"Mars\" };\n\t\n\t\t\tSystem.out.println(\"General knowledge quiz...\");\n\t\t\n\t\t\tdo {\n\t\t\t\t// generate random number (between 0-3)\n\t\t\t\trandNum = rand.nextInt(4);\n\t\t\t\t\n\t\t\t\t// user given random question\n\t\t\t\tSystem.out.println(\"\\nQ: \"+jokeQuestions[randNum]);\n\t\t\t\t// user responds\n\t\t\t\tSystem.out.printf(\"A: \");\n\t\t\t\tuserGuess = scan.next();\n\t\t\t\t// user answer checked against correct answer\n\t\t\t\tif (userGuess.equalsIgnoreCase(jokeAnswers[randNum])) {\n\t\t\t\t\t// correct\n\t\t\t\t\toutcome = \"Well done, your answer was correct!\";\n\t\t\t\t} else {\n\t\t\t\t\t// wrong\n\t\t\t\t\toutcome = \"Sorry, your answer was incorrect\";\n\t\t\t\t}\n\t\t\t\t// user is notified of outcome\n\t\t\t\tSystem.out.println(\"\\n\"+outcome);\n\t\t\t\t// user is prompted to continue or quit (loop until they give a valid response\n\t\t\t\tdo {\n\t\t\t\t\tSystem.out.println(\"Would you like another question? (Y or N)\");\n\t\t\t\t\tgoAgain = scan.next();\n\t\t\t\t\tif (goAgain.equalsIgnoreCase(\"y\")) {\n\t\t\t\t\t\t// repeat\n\t\t\t\t\t\tgoAgainValid=true;\n\t\t\t\t\t} else if (goAgain.equalsIgnoreCase(\"n\")) {\n\t\t\t\t\t\t// quit\n\t\t\t\t\t\tgoAgainValid=true;\n\t\t\t\t\t\tquit=true;\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// choose again\n\t\t\t\t\t\tSystem.out.println(\"That was an invlaid response, please respond with Y or N\");\n\t\t\t\t\t}\n\t\t\t\t} while (!goAgainValid);\n\t\t\t} while (!quit);\n\t\t} catch (Exception exception) {\n\t\t\tSystem.out.println(\"The quiz master has had a problem...\");\n\t\t} finally {\n\t\t\tSystem.out.println(\"Thanks for playing!\");\n\t\t\tscan.close();\n\t\t}\n\t}", "int promptNumber();", "public static int askUser(Scanner in)\n {\n System.out.println(\"What do you want, respectable human being?\");\n System.out.println(\"1. Add Reminder\");\n System.out.println(\"2. View Reminder\");\n System.out.println(\"3. Edit Reminder\");\n System.out.println(\"4. Delete Reminder\");\n System.out.println(\"5. Exit\");\n System.out.print(\"User Input : \");\n return in.nextInt();\n }", "public boolean yesTo(String prompt) {\r\n System.out.print(prompt + \" (y/n)? \");\r\n String response = console.nextLine().trim().toLowerCase();\r\n while (!response.equals(\"y\") && !response.equals(\"n\")) {\r\n System.out.println(\"Please answer y or n.\");\r\n System.out.print(prompt + \" (y/n)? \");\r\n response = console.nextLine().trim().toLowerCase();\r\n }\r\n return response.equals(\"y\");\r\n }", "public boolean yesTo(String prompt) {\r\n System.out.print(prompt + \" (y/n)? \");\r\n String response = console.nextLine().trim().toLowerCase();\r\n while (!response.equals(\"y\") && !response.equals(\"n\")) {\r\n System.out.println(\"Please answer y or n.\");\r\n System.out.print(prompt + \" (y/n)? \");\r\n response = console.nextLine().trim().toLowerCase();\r\n }\r\n return response.equals(\"y\");\r\n }", "String getUserInput(String prompt) {\r\n System.out.print(prompt);\r\n try {\r\n return rdr.readLine();\r\n }\r\n catch (IOException ex) {\r\n return null;\r\n }\r\n }", "public Question getQuestion() {\n\t\treturn questionToAsk;\n\t}", "public static boolean yesNo(String prompt) throws Exception {\n if (scanner == null) {\n throw new Exception(\"Input Utility's scanner is not set\");\n }\n boolean response;\n\n // enter the string\n if (prompt != null) {\n System.out.print(prompt);\n }\n response = scanner.nextLine().toLowerCase().contains(\"y\");\n return response;\n }", "private String getResponse()\n {\n System.out.println();\n System.out.println(\"Enter id number to look up, 'd' to display list, 'q' to quit\");\n System.out.print(\"Your choice: \");\n return scanner.nextLine();\n }", "String answerStatement(boolean answer) {\n String answerStatement = getResources().getString(R.string.wrong);\n if (answer) {\n answerStatement = getResources().getString(R.string.correct);\n }\n return answerStatement;\n }", "private void answerResultAlert(String feedback){\n AlertDialog.Builder showResult = new AlertDialog.Builder(this);\n\n showResult.setTitle(feedback);\n showResult.setMessage(currentQuestion.getExplanation());\n showResult.setCancelable(false); //if this is not set, the user may click outside the alert, cancelling it. no cheating this way\n showResult.setNeutralButton(\"ok\", new DialogInterface.OnClickListener() {\n public void onClick(DialogInterface dialog, int which) {\n //only when the ok is clicked will continue to run the program\n setUpQuestions();\n }\n });\n showResult.create();\n showResult.show();\n }", "public int askquestion(int J, int M, int X, int Y){\n\t\t//type of 5 shall result questions that are a randomly mixture of addition, multiplication, subtraction, and division problems\n\t\tif(M == 5) {\n\t\t\tM = 1 + rand.nextInt(4);\n\t\t}\n\t\t\t\t\n\t\t\t\t\tswitch (M) {\n\t\t\t\t\t//type of 1 shall limit the program to generating only addition problems\n\t\t case 1: System.out.println(\"Solve this addition problem:\\n\");\n\t\t\t\t\t\t\tSystem.out.println(\"How much is \" + X + \" plus \" + Y + \" equal\");\n\t\t\t\t\t\t\t M = X+Y;\n\t\t break;\n\t\t // type 2 shall limit the program to generating only multiplication problems.\n\t\t case 2: System.out.println(\"Solve this multiplication problem:\\n\");\n\t\t\t\t\t\t\tSystem.out.println(\"How much is \" + X + \" times \" + Y + \" equal\");\n\t\t\t\t\t\t\tM = X*Y;\n\t\t break;\n\t\t //type of 3 shall limit the program to generating only subtraction problems\n\t\t case 3: System.out.println(\"Solve this subtraction problem:\\n\");\n\t\t\t\t\t\t\tSystem.out.println(\"How much is \" + X + \" minus \" + Y + \" equal\");\n\t\t\t\t\t\t\tM = X-Y;\n\t\t break;\n\t\t // type of 4 shall limit the program to generating only division problems\n\t\t case 4: System.out.println(\"Solve this division problem:\\n\");\n\t\t\t\t\t\t\tSystem.out.println(\"How much is \" + X + \" divided by \" + Y + \" equal\");\n\t\t\t\t\t\t\tM = 0;\n\t\t break;}\n\t\t return M;\n\t\t\t\t}", "public double getAnswer() {\n return answer;\n }", "public int getUserIntInput(String question) {\r\n System.out.print(question);\r\n while (!scanner.hasNextInt()) {\r\n scanner.next();\r\n }\r\n int result = scanner.nextInt();\r\n return result;\r\n }", "private static String getCountryInput(){\n System.out.println(countryPrompt);\n String s = sc.nextLine();\n while(!query.countryExists(s) && !s.equals(\"x\")){\n System.out.println(\"That country is not available. Please ensure correct spelling and capitalization\");\n System.out.println(countryPrompt);\n System.out.println(\"Enter 'x' to cancel this query\");\n s = sc.nextLine();\n }\n if(s.equals(\"x\")){\n return null;\n } else {\n return s;\n }\n\n }", "public static void main(String[] args) {\n\t// 1. Ask for an initial password, and store it in a variable\n String answer1 = JOptionPane.showInputDialog(null, \"What is the secret message?\"); \n\t// 2. Ask for a message and store it in a variable\n String answer2 = JOptionPane.showInputDialog(null, \"What is your password?\");\n\t// 3. Ask your friend for the password and store it in a variable\n String answer3 = JOptionPane.showInputDialog(\"Do you know the password?\");\n\t// 4. If the password matches,\n if (answer1.equals(answer3))\n {\n\tJOptionPane.showMessageDialog(null, \"\" + answer2);\t\n\t}\n else\n {\n \tJOptionPane.showMessageDialog(null, \"Your wrong.\");\n }\n\t\t// show the secret message\n\t// *5. OPTIONAL: let your friend keep guessing even if they are wrong\n\n}", "protected boolean promptBoolean(String prompt) {\r\n\tSystem.out.print(prompt + \" ('y' or 'n'): \");\r\n\tchar userResponse = reader.nextLine().charAt(0);\r\n\r\n\twhile (userResponse != 'y' && userResponse != 'n') {\r\n\t System.out.print(\"Please enter a valid choice.\\n\" + prompt + \" ('y' or 'n'): \");\r\n\t userResponse = reader.nextLine().charAt(0);\r\n\t}\r\n\r\n\tif (userResponse == 'y') {\r\n\t return true;\r\n\t} else {\r\n\t return false;\r\n\t}\r\n }", "public int askSecondary();", "private void promptForSomething() {\n userInputValue = prompt(\"Please enter something: \", true);\n System.out.println(\"Thank you. You can see your input by choosing the Display Something menu\");\n }", "private String getInput(String prompt) throws IOException {\n System.out.print(prompt);\n BufferedReader in = new BufferedReader(\n new InputStreamReader(System.in));\n return in.readLine();\n }", "private static String getUserInput(String prompt){ \r\n Scanner in = new Scanner(System.in);\r\n System.out.print(prompt);\r\n return in.nextLine();\r\n }", "public MAidQuestion(String s) {\n\t\tScanner sc = new Scanner(s);\n\t\tSystem.err.println(\"s: \"+s);\n //test if there is an integer\n\t\ttry {\n\t\t\tsc.nextInt();\n\t\t\tsc.next();\n\t\t} catch (Exception e) {\n\t\t\tsc.next();\n\t\t}\n\t\t\n //tests if there is one and only one question mark\n\t\ts = \"\";\n\t\twhile (sc.hasNextLine()){\n\t\t\ts = s+sc.nextLine().trim()+\" \";\n\t\t}\n\t\ts = s.trim();\n\t\tint lq = s.lastIndexOf('?');\n\t\tint fq = s.indexOf('?');\n\t\tif (fq != lq){\n\t\t\tSystem.out.println(\"bad question:\\n\"+s);\n\t\t\treturn;\n\t\t}\n \n\t\tquestion = s.substring(0,lq+1);\n\t\t//validate the answer\n s = s.substring(lq+1).trim();\n\t\tSystem.out.println(\"ans s: \"+s);\n\t\tint f_ = s.indexOf('_');\n\t\ts = s.substring(0,f_);\n\t\tsc = new Scanner(s);\n\t\tString numS = Util.dollarProcess(sc.next()); //process currency quantity\n\t\ttry {\n\t\t\tanswerNum = Double.parseDouble(numS); //gets answer as a number if possible\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t\tgoodQ = false; //if we can't represent the answer as a number, badness results\n\t\t\treturn;\n\t\t}\n\t\t\n\t\ttry {\n\t\t\tanswerObj = sc.nextLine();\n\t\t} catch (Exception e) {\n\t\t\t\n\t\t}\n\t\t\n\t\tif (sc.hasNext()){\n\t\t\tSystem.out.println(\"bad end \"+question+\" \"+answerNum);\n\t\t\tgoodQ = false;\n\t\t}\n\t\tgoodQ = true;\n\t}", "public static boolean yesOrno(){\n boolean result;\n Scanner input = new Scanner(System.in);\n do {\n String choice = input.next();\n if (choice.equals(\"y\")) {\n result = true;\n break;\n } else if (choice.equals(\"n\")) {\n result = false;\n break;\n } else {\n System.out.println(\"Wrong Input please enter y or n !\");\n }\n } while (true);\n\n return result;\n\n }", "public boolean promptYesNo(String str)\r\n\t\t{\r\n\t\t\treturn true;\r\n\t\t}", "public void askWatson(@NonNull String question){\n if (watson == null){\n logMessage(TAG, \"Watson service is null\");\n return;\n }\n// if (!isTtsInitiated){\n// String msg = \"Be patient! TTS is not initialized yet\";\n// logMessage(TAG, msg);\n// showToast(mContext, msg);\n// return;\n// }\n watson.ask(question);\n }", "public IAnswer select() throws NoPossibleAnswersException;", "public void createEssay() {\n Question q = new Essay(this.in,this.o);\n this.o.setDisplay(\"Enter the prompt for your Essay question:\\n\");\n this.o.getDisplay();\n\n q.setPrompt(this.in.getUserInput());\n\n int numAns = 0;\n while (numAns == 0) {\n this.o.setDisplay(\"How many answers does this question have?\\n\");\n this.o.getDisplay();\n\n try {\n numAns = Integer.parseInt(this.in.getUserInput());\n if (numAns > numChoices || numAns < 1) {\n numAns = 0;\n } else {\n q.setMaxResponses(numAns);\n }\n } catch (NumberFormatException e) {\n numAns = 0;\n }\n }\n\n if (isTest) {\n RCA ca = new RCA(this.in,this.o);\n Test t = (Test)this.survey;\n String ans;\n\n this.o.setDisplay(\"Enter correct answer(s)\\n\");\n this.o.getDisplay();\n\n for (int j=0; j < q.getMaxResponses(); j++){\n\n ans = this.in.getUserInput();\n\n ca.addResponse(ans);\n }\n t.addAnswer(ca);\n }\n\n this.survey.addQuestion(q);\n }", "private JPanel answer() {\n\t\t// initiate the answer panel\n\t\tJPanel answerPanel = new JPanel();\n\t\t// create the yes and no buttons\n\t\tJButton yes = new JButton(\"Yes\");\n\t\tJButton no = new JButton(\"No\");\n\n\t\t// set color, font, opaque, and border\n\t\tyes.setForeground(new Color(205, 92, 209));\n\t\tyes.setBackground(new Color(206, 213, 224));\n\t\tyes.setFont(new Font(\"Serif\", Font.BOLD, 18));\n\t\tyes.setOpaque(true);\n\t\tyes.setBorderPainted(false);\n\n\t\t// set color, font, opaque, and border\n\t\tno.setForeground(new Color(98, 158, 36));\n\t\tno.setBackground(new Color(206, 213, 224));\n\t\tno.setFont(new Font(\"Serif\", Font.BOLD, 18));\n\t\tno.setOpaque(true);\n\t\tno.setBorderPainted(false);\n\n\t\t// add action listener\n\t\tyes.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\t// pass in the boolean that remembers which button is pressed\n\t\t\t\t// if boolean yes is true, then the yes button is pressed\n\t\t\t\tboolean yes = true;\n\t\t\t\t// update the question text\n\t\t\t\tupdateQuestion(yes);\n\t\t\t}\n\t\t});\n\n\t\t// add action listener\n\t\tno.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\t// pass in the boolean that remembers which button is pressed\n\t\t\t\t// if boolean yes is false, then the no button is pressed\n\t\t\t\tboolean yes = false;\n\t\t\t\t// update the question text\n\t\t\t\tupdateQuestion(yes);\n\t\t\t}\n\t\t});\n\t\t// add the yes and no buttons to the answer panel\n\t\tanswerPanel.add(yes);\n\t\tanswerPanel.add(no);\n\t\t// return the answer panel\n\t\treturn answerPanel;\n\t}", "private void askUser()\n { \n System.out.println(\"What is your command?\");\n\n String command = scanner.nextLine();\n commandPrompt(command);\n }", "private boolean getUserInput(int amountOfAnswers, int positionCorrectAnswer, Question curentQuestion) {\n int userAnswer = Tastatur.intInput();\n //Checks if the user input is valid\n while (userAnswer < 1 || userAnswer > amountOfAnswers) {\n System.out.println(\"Invalide Antwort\");\n userAnswer = Tastatur.intInput();\n }\n //checks if the users input is correct\n if (userAnswer == positionCorrectAnswer + 1) {\n System.out.println(\"Korrekt!\\n\");\n return true;\n // If the user uses the joker\n } else if (joker && userAnswer == 5) {\n //gets one wrong answer\n String wrongAnswer = curentQuestion.joker(positionCorrectAnswer);\n List<String> wrongAnswers = new ArrayList<>();\n wrongAnswers.add(wrongAnswer);\n //Creates a new Question Object\n Question question = new Question(curentQuestion.getQuestion(), 0, curentQuestion.getCorrectAnswer(), wrongAnswers);\n joker = false;\n //Ask the question again with only two answer possibilities\n return askQuestion(question, level);\n\n } else {\n System.out.println(\"Falsch\\n\");\n return false;\n }\n }", "private static int getIntReply(String prompt) {\n System.out.print(prompt + \": \");\n String input = sc.nextLine();\n if (input.charAt(0) < 48 || input.charAt(0) > 57) {\n System.out.println(\"Invalid input\");\n return -1;\n } else return Integer.parseInt(input);\n }", "public abstract void generateQuestion();", "public void setInputAnswer(String inputAnswer) {\n this.inputAnswer = inputAnswer;\n }" ]
[ "0.7843002", "0.7611323", "0.74769735", "0.7280621", "0.69535214", "0.67510515", "0.66985786", "0.6686789", "0.6652097", "0.6631929", "0.6629203", "0.66194504", "0.66137725", "0.6591108", "0.6568494", "0.656445", "0.65365607", "0.6509434", "0.6507397", "0.64678824", "0.6446899", "0.6446773", "0.6446256", "0.64103097", "0.63728315", "0.6362951", "0.63497376", "0.63399124", "0.63239396", "0.6316744", "0.6313181", "0.6297739", "0.6284659", "0.627556", "0.62672824", "0.6253567", "0.62037915", "0.61970866", "0.6193636", "0.6145361", "0.6145344", "0.61315197", "0.6121293", "0.6117654", "0.6115791", "0.61129636", "0.61027306", "0.60834426", "0.6061085", "0.60474753", "0.6034682", "0.6015079", "0.600691", "0.6000412", "0.59999", "0.5984181", "0.5981952", "0.5981543", "0.5966216", "0.5963948", "0.59592813", "0.59590566", "0.5942408", "0.5927184", "0.5922689", "0.5920902", "0.5907673", "0.590729", "0.5902283", "0.5897423", "0.58860135", "0.58860135", "0.5884243", "0.5882841", "0.58688295", "0.5864363", "0.5850168", "0.58439624", "0.5842388", "0.5839553", "0.5833623", "0.58297354", "0.582845", "0.5823913", "0.5821013", "0.58208597", "0.5820545", "0.5815581", "0.5812955", "0.580306", "0.5798513", "0.5795033", "0.579286", "0.5789567", "0.57841444", "0.5782844", "0.5764171", "0.57627034", "0.57588977", "0.57540333" ]
0.7200313
4
/++++ CARGA EL USERNAME DEL USUARIO EN EL DRAWER ++++
@Override public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); try { Thread.sleep(300); } catch (InterruptedException e) { e.printStackTrace(); } FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user != null) { String username = user.getDisplayName(); if (username == null || username.isEmpty()) { navUsername.setText(R.string.no_user); } else { navUsername.setText(username); } } else { navUsername.setText(R.string.no_user); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "java.lang.String getUserName();", "java.lang.String getUserName();", "java.lang.String getUserName();", "@Override\n public java.lang.String getUserName() {\n return _partido.getUserName();\n }", "public String usuarioconectado() {\n\t\tString nome;\n\t\tObject principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();\n\n\t\tif (principal instanceof UserDetails) {\n\t\t\tnome = ((UserDetails) principal).getUsername();\n\t\t} else {\n\t\t\tnome = principal.toString();\n\t\t}\n\t\t// System.out.println(nome);\n\t\treturn nome;\n\t}", "String getUserName();", "String getUserName();", "java.lang.String getUsername();", "java.lang.String getUsername();", "java.lang.String getUsername();", "java.lang.String getUsername();", "java.lang.String getUsername();", "java.lang.String getUsername();", "java.lang.String getUsername();", "java.lang.String getUsername();", "java.lang.String getUsername();", "String getUserUsername();", "public String getUserName();", "private String getLoggedInUserName() {\n try {\n /*\n * Get the user information.\n */\n String userName = ServerUtilities.getServerUserInfo().getName();\n\n if(userName.isEmpty()) {\n return new String(\"Anonymous User\");\n }\n return userName;\n } catch (Exception ignore) {\n }\n\n return new String(\"Anonymous User\");\n }", "protected static String getUsername() {\n if (username == null || username.isEmpty()) {\n Console console = System.console();\n if (console != null) {\n username = console.readLine(\"Username:\");\n } else {\n throw new UnsupportedOperationException(\n \"Username must be specified\");\n }\n }\n return username;\n }", "@AutoEscape\n\tpublic String getUser_name();", "@Override\n\tpublic String getUserName() {\n\t\treturn super.getUserName();\n\t}", "@Override\n\tpublic String getUserName() {\n\t\treturn super.getUserName();\n\t}", "java.lang.String getUser();", "@Override\n public String getUserName() {\n return name;\n }", "String getUsername();", "String getUsername();", "String getUsername();", "String getUsername();", "String getUsername();", "String getUsername();", "@AutoEscape\n\t@Override\n\tpublic String getUserName();", "@AutoEscape\n\t@Override\n\tpublic String getUserName();", "@Override\r\n\tpublic String getUserName() {\n\t\treturn null;\r\n\t}", "private String getUserName() {\n EditText nameEditText = (EditText) findViewById(R.id.name_edit_text);\n return nameEditText.getText().toString().trim();\n }", "public String getUsername() throws SQLException {\n\t\tloadFromDB();\n\t\treturn rev_user_text;\n\t}", "public static String getUserDisplayName() {\r\n return getUsername();\r\n }", "public String getUserName() {\n\t \t return userName; \n\t}", "@Override\n\tpublic String getUserName() {\n\t\treturn null;\n\t}", "public String getUserName() {\n return userName;\n }", "private void getUserNamePwd() {\n\n try {\n // get Application Connection ID\n LogonCoreContext lgCtx = LogonCore.getInstance().getLogonContext();\n userName = lgCtx.getBackendUser();\n pwd = lgCtx.getBackendPassword();\n appConnID = LogonCore.getInstance().getLogonContext()\n .getConnId();\n } catch (LogonCoreException e) {\n LogManager.writeLogError(Constants.device_reg_failed_txt, e);\n }\n }", "static String getUserName() {\n return System.getProperty(\"user.name\");\n }", "public String getUserName() {\n return txtUserName().getText();\n }", "public String getUserName() {\n return userName;\n }", "String getUser();", "String getUser();", "public String getUserName() {\r\n return userName;\r\n }", "public String getUserName() {\r\n return userName;\r\n }", "public String getUserName() {\r\n return userName;\r\n }", "public String getUserName() {\r\n return userName;\r\n }", "private String getLoggedUser() {\n\t\torg.springframework.security.core.userdetails.User user2 = \n\t\t\t\t(org.springframework.security.core.userdetails.User) \n\t\t\t\tSecurityContextHolder.getContext().getAuthentication().getPrincipal();\n\t\tString name = user2.getUsername();\n\t\treturn name;\n\t}", "public String getUserName()\n {\n return userName;\n }", "@Override\n\tpublic String getUserName() {\n\t\treturn model.getUserName();\n\t}", "@Override\n\tpublic String getUserName() {\n\t\treturn model.getUserName();\n\t}", "public void setUser_name(String user_name);", "@Override\r\n\t\t\tpublic String getUsername() {\n\t\t\t\treturn \"User1\";\r\n\t\t\t}", "public static String onGetLocalUserName(Context context){\n return PreferencesUtils.getString(context, Config.KEY_OF_USER_NAME, \"\");\n }", "@Override\n\tpublic String getUsername(Context ctx){\n\t\treturn ctx.session().get(\"username\");\n\t}", "public void setDisplayUserName(){\n TextView lblName = (TextView) findViewById(R.id.nav_header_textView);\n\n String content;\n\n if(userName != null){ //If the user is connected\n content = getString(R.string.welcomeName,this.userName);\n }\n else{ //If the user isn't connected\n content = getString(R.string.notConnectedWelcome);\n }\n\n lblName.setText(content);\n }", "@Override\n\tpublic String getUsername() {\n\t\treturn user.getUserName();\n\t}", "public String getUserName() {\n return sessionData.getUserName();\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n if (passCred != null)\n return passCred.getUserName();\n else\n return null;\n }", "private Component getUserName() {\n\t\tif (userName == null) {\r\n\t\t\tuserName = new JTextField();\r\n\t\t\tuserName.setText(\"user1\");\r\n\t\t}\r\n\t\treturn userName;\r\n\t}", "public String getUserName(){\n\t\treturn this.userName;\n\t}", "@Override\n public String getUserName() throws ResourceException {\n return session.getUserID();\n }", "protected final String getUserName() {\n return this.userName;\n }", "private void getUserName() {\n if (mAuth.getCurrentUser() != null) {\n nameOfCurrentUser = mAuth.getCurrentUser().getDisplayName();\n Log.d(TAG, \"getUserName: getDisplayName is not null\");\n if (nameOfCurrentUser != null && nameOfCurrentUser.contains(\" \")) {\n String[] nameArray = nameOfCurrentUser.split(\" \");\n personalWelcomeMessage.setText(\"Hello, \" + nameArray[0]);\n Log.d(TAG, \"Name is: \" + personalWelcomeMessage.getText().toString());\n }\n else if (nameOfCurrentUser != null && !nameOfCurrentUser.contains(\" \")) {\n personalWelcomeMessage.setText(\"Hello, \" + nameOfCurrentUser);\n Log.d(TAG, \"Name is: \" + personalWelcomeMessage.getText().toString());\n }\n else if (nameOfCurrentUser==null){\n personalWelcomeMessage.setText(\"Hello\");\n }\n }\n }", "public String getName(){\n return username;\n\t}", "@Override\n\tpublic java.lang.String getUserName() {\n\t\treturn _paper.getUserName();\n\t}", "public String getUserName() {\n return this.userName;\n }", "public String getUserName() {\n return this.userName;\n }", "public String getUserName() {\n return this.userName;\n }", "public abstract String getUserName();", "protected String getDefaultUserName()\n {\n return \"admin\";\n }", "public String getUser_name() {\n return user_name;\n }", "String getUserName() {\r\n\t\t\treturn username;\r\n\t\t}", "public String getUserName() {\n\t\treturn this.username;\r\n\t}", "public String getUserName()\n\t{\n\t\treturn this.userName;\n\t}", "@Override\n\tpublic String getUsername() {\n\t\treturn \"ajay\";\n\t}", "public String getUserName() {\n\t\treturn phoneText.getText().toString();\n\t}" ]
[ "0.749591", "0.749591", "0.749591", "0.745007", "0.7376616", "0.731764", "0.731764", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7138344", "0.7057902", "0.70392084", "0.703902", "0.70279896", "0.69812196", "0.69812196", "0.69681793", "0.6964303", "0.69255644", "0.69255644", "0.69255644", "0.69255644", "0.69255644", "0.69255644", "0.6868905", "0.6868905", "0.68684965", "0.68386805", "0.6828037", "0.6825769", "0.6818546", "0.68152374", "0.680182", "0.67965", "0.6793363", "0.678522", "0.6771466", "0.6770702", "0.6770702", "0.67669946", "0.67669946", "0.67669946", "0.67669946", "0.67596036", "0.67572016", "0.67508656", "0.67508656", "0.67499274", "0.67341423", "0.67329675", "0.6720608", "0.6711408", "0.6700949", "0.66988426", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6688005", "0.6686526", "0.66833246", "0.66805655", "0.6675979", "0.6665271", "0.66630673", "0.666289", "0.6634355", "0.6634355", "0.6634355", "0.66306955", "0.6629146", "0.6621113", "0.66147935", "0.66028965", "0.6598105", "0.6590964", "0.6590856" ]
0.0
-1
/++++ CARGA EL USERNAME DEL USUARIO EN EL DRAWER ++++
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.fragment_main, container, false); toolbar = v.findViewById(R.id.toolbar); recyclerView = v.findViewById(R.id.recyclerViewMain); drawerLayout = v.findViewById(R.id.drawerLayout); bottomNavigationView = v.findViewById(R.id.bottomNavigation); searchView = v.findViewById(R.id.searchView); contents = v.findViewById(R.id.mainFragmentContents); imageContents = v.findViewById(R.id.imageContent); NavigationView navigationView = v.findViewById(R.id.navigationView); View headerView = navigationView.getHeaderView(0); navUsername = headerView.findViewById(R.id.nameUserDrawer); /*+++++++ LOG OUT +++++++*/ ImageButton logOutButton = v.findViewById(R.id.logOutButton); logOutButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser(); if (user != null){ FirebaseAuth.getInstance().signOut(); navController.navigate(R.id.action_mainFragment_to_homeScreenFragment); }else{ Toast.makeText(getContext(), "NO HAY NADIE LOGEADO", Toast.LENGTH_SHORT).show(); } } }); /*+++++++ LOG OUT +++++++*/ ((AppCompatActivity) requireActivity()).setSupportActionBar(toolbar); setUpRecycler(recyclerView); toolbar.setNavigationOnClickListener(v1 -> drawerLayout.open()); bottomNavigationView.setOnNavigationItemSelectedListener(this::bottomMenu); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String query) { filtrarRecycler(query); return false; } @Override public boolean onQueryTextChange(String newText) { filtrarRecycler(newText); return false; } }); return v; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "java.lang.String getUserName();", "java.lang.String getUserName();", "java.lang.String getUserName();", "@Override\n public java.lang.String getUserName() {\n return _partido.getUserName();\n }", "public String usuarioconectado() {\n\t\tString nome;\n\t\tObject principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();\n\n\t\tif (principal instanceof UserDetails) {\n\t\t\tnome = ((UserDetails) principal).getUsername();\n\t\t} else {\n\t\t\tnome = principal.toString();\n\t\t}\n\t\t// System.out.println(nome);\n\t\treturn nome;\n\t}", "String getUserName();", "String getUserName();", "java.lang.String getUsername();", "java.lang.String getUsername();", "java.lang.String getUsername();", "java.lang.String getUsername();", "java.lang.String getUsername();", "java.lang.String getUsername();", "java.lang.String getUsername();", "java.lang.String getUsername();", "java.lang.String getUsername();", "String getUserUsername();", "public String getUserName();", "private String getLoggedInUserName() {\n try {\n /*\n * Get the user information.\n */\n String userName = ServerUtilities.getServerUserInfo().getName();\n\n if(userName.isEmpty()) {\n return new String(\"Anonymous User\");\n }\n return userName;\n } catch (Exception ignore) {\n }\n\n return new String(\"Anonymous User\");\n }", "protected static String getUsername() {\n if (username == null || username.isEmpty()) {\n Console console = System.console();\n if (console != null) {\n username = console.readLine(\"Username:\");\n } else {\n throw new UnsupportedOperationException(\n \"Username must be specified\");\n }\n }\n return username;\n }", "@AutoEscape\n\tpublic String getUser_name();", "@Override\n\tpublic String getUserName() {\n\t\treturn super.getUserName();\n\t}", "@Override\n\tpublic String getUserName() {\n\t\treturn super.getUserName();\n\t}", "java.lang.String getUser();", "@Override\n public String getUserName() {\n return name;\n }", "String getUsername();", "String getUsername();", "String getUsername();", "String getUsername();", "String getUsername();", "String getUsername();", "@AutoEscape\n\t@Override\n\tpublic String getUserName();", "@AutoEscape\n\t@Override\n\tpublic String getUserName();", "@Override\r\n\tpublic String getUserName() {\n\t\treturn null;\r\n\t}", "private String getUserName() {\n EditText nameEditText = (EditText) findViewById(R.id.name_edit_text);\n return nameEditText.getText().toString().trim();\n }", "public String getUsername() throws SQLException {\n\t\tloadFromDB();\n\t\treturn rev_user_text;\n\t}", "public static String getUserDisplayName() {\r\n return getUsername();\r\n }", "public String getUserName() {\n\t \t return userName; \n\t}", "@Override\n\tpublic String getUserName() {\n\t\treturn null;\n\t}", "public String getUserName() {\n return userName;\n }", "private void getUserNamePwd() {\n\n try {\n // get Application Connection ID\n LogonCoreContext lgCtx = LogonCore.getInstance().getLogonContext();\n userName = lgCtx.getBackendUser();\n pwd = lgCtx.getBackendPassword();\n appConnID = LogonCore.getInstance().getLogonContext()\n .getConnId();\n } catch (LogonCoreException e) {\n LogManager.writeLogError(Constants.device_reg_failed_txt, e);\n }\n }", "static String getUserName() {\n return System.getProperty(\"user.name\");\n }", "public String getUserName() {\n return txtUserName().getText();\n }", "public String getUserName() {\n return userName;\n }", "String getUser();", "String getUser();", "public String getUserName() {\r\n return userName;\r\n }", "public String getUserName() {\r\n return userName;\r\n }", "public String getUserName() {\r\n return userName;\r\n }", "public String getUserName() {\r\n return userName;\r\n }", "private String getLoggedUser() {\n\t\torg.springframework.security.core.userdetails.User user2 = \n\t\t\t\t(org.springframework.security.core.userdetails.User) \n\t\t\t\tSecurityContextHolder.getContext().getAuthentication().getPrincipal();\n\t\tString name = user2.getUsername();\n\t\treturn name;\n\t}", "public String getUserName()\n {\n return userName;\n }", "@Override\n\tpublic String getUserName() {\n\t\treturn model.getUserName();\n\t}", "@Override\n\tpublic String getUserName() {\n\t\treturn model.getUserName();\n\t}", "public void setUser_name(String user_name);", "@Override\r\n\t\t\tpublic String getUsername() {\n\t\t\t\treturn \"User1\";\r\n\t\t\t}", "public static String onGetLocalUserName(Context context){\n return PreferencesUtils.getString(context, Config.KEY_OF_USER_NAME, \"\");\n }", "@Override\n\tpublic String getUsername(Context ctx){\n\t\treturn ctx.session().get(\"username\");\n\t}", "public void setDisplayUserName(){\n TextView lblName = (TextView) findViewById(R.id.nav_header_textView);\n\n String content;\n\n if(userName != null){ //If the user is connected\n content = getString(R.string.welcomeName,this.userName);\n }\n else{ //If the user isn't connected\n content = getString(R.string.notConnectedWelcome);\n }\n\n lblName.setText(content);\n }", "@Override\n\tpublic String getUsername() {\n\t\treturn user.getUserName();\n\t}", "public String getUserName() {\n return sessionData.getUserName();\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n return userName;\n }", "public String getUserName() {\n if (passCred != null)\n return passCred.getUserName();\n else\n return null;\n }", "private Component getUserName() {\n\t\tif (userName == null) {\r\n\t\t\tuserName = new JTextField();\r\n\t\t\tuserName.setText(\"user1\");\r\n\t\t}\r\n\t\treturn userName;\r\n\t}", "public String getUserName(){\n\t\treturn this.userName;\n\t}", "@Override\n public String getUserName() throws ResourceException {\n return session.getUserID();\n }", "protected final String getUserName() {\n return this.userName;\n }", "private void getUserName() {\n if (mAuth.getCurrentUser() != null) {\n nameOfCurrentUser = mAuth.getCurrentUser().getDisplayName();\n Log.d(TAG, \"getUserName: getDisplayName is not null\");\n if (nameOfCurrentUser != null && nameOfCurrentUser.contains(\" \")) {\n String[] nameArray = nameOfCurrentUser.split(\" \");\n personalWelcomeMessage.setText(\"Hello, \" + nameArray[0]);\n Log.d(TAG, \"Name is: \" + personalWelcomeMessage.getText().toString());\n }\n else if (nameOfCurrentUser != null && !nameOfCurrentUser.contains(\" \")) {\n personalWelcomeMessage.setText(\"Hello, \" + nameOfCurrentUser);\n Log.d(TAG, \"Name is: \" + personalWelcomeMessage.getText().toString());\n }\n else if (nameOfCurrentUser==null){\n personalWelcomeMessage.setText(\"Hello\");\n }\n }\n }", "public String getName(){\n return username;\n\t}", "@Override\n\tpublic java.lang.String getUserName() {\n\t\treturn _paper.getUserName();\n\t}", "public String getUserName() {\n return this.userName;\n }", "public String getUserName() {\n return this.userName;\n }", "public String getUserName() {\n return this.userName;\n }", "public abstract String getUserName();", "protected String getDefaultUserName()\n {\n return \"admin\";\n }", "public String getUser_name() {\n return user_name;\n }", "String getUserName() {\r\n\t\t\treturn username;\r\n\t\t}", "public String getUserName() {\n\t\treturn this.username;\r\n\t}", "public String getUserName()\n\t{\n\t\treturn this.userName;\n\t}", "@Override\n\tpublic String getUsername() {\n\t\treturn \"ajay\";\n\t}", "public String getUserName() {\n\t\treturn phoneText.getText().toString();\n\t}" ]
[ "0.749591", "0.749591", "0.749591", "0.745007", "0.7376616", "0.731764", "0.731764", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7236427", "0.7138344", "0.7057902", "0.70392084", "0.703902", "0.70279896", "0.69812196", "0.69812196", "0.69681793", "0.6964303", "0.69255644", "0.69255644", "0.69255644", "0.69255644", "0.69255644", "0.69255644", "0.6868905", "0.6868905", "0.68684965", "0.68386805", "0.6828037", "0.6825769", "0.6818546", "0.68152374", "0.680182", "0.67965", "0.6793363", "0.678522", "0.6771466", "0.6770702", "0.6770702", "0.67669946", "0.67669946", "0.67669946", "0.67669946", "0.67596036", "0.67572016", "0.67508656", "0.67508656", "0.67499274", "0.67341423", "0.67329675", "0.6720608", "0.6711408", "0.6700949", "0.66988426", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6698822", "0.6688005", "0.6686526", "0.66833246", "0.66805655", "0.6675979", "0.6665271", "0.66630673", "0.666289", "0.6634355", "0.6634355", "0.6634355", "0.66306955", "0.6629146", "0.6621113", "0.66147935", "0.66028965", "0.6598105", "0.6590964", "0.6590856" ]
0.0
-1
/ DBUtils.uploadPost(new Post("MWYgVorRGpajcRNoj", new User("onlyforjazzmemes"), "8h", "version 8.0", " 20, 113, 0)); / ConexionBBDD.uploadPost(new Post("MWYgVorRGpajcRNok", new User("DeveloperNightshade"), "10h", "Hmm, fuck it", " 24, 3800, 456));
private void setUpRecycler(RecyclerView recyclerView) { recyclerView.setLayoutManager(new LinearLayoutManager(requireContext())); FirebaseRecyclerOptions<Post> options = new FirebaseRecyclerOptions.Builder<Post>() .setQuery(DBUtils.getReferencePost(), Post.class).build(); adapter = new PostAdapter(options, requireContext()); recyclerView.setAdapter(adapter); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@POST(\"posts\")\n public Call<Post> UploadPost (@Body Post post);", "@FormUrlEncoded\n @POST(\"posts\")\n Call<Post> createPost(@Field(\"userId\") int userId, @Field(\"title\") String title, @Field(\"body\") String text);", "int insert(WpPostsWithBLOBs record);", "Post save(Post post) throws Exception;", "public void uploadObject() {\n\n\t}", "@FormUrlEncoded\n @POST(\"posts/\")\n Call<Post> createPostUrlFormatted(\n @Field(\"userId\") Integer id,\n @Field(\"title\") String title,\n @Field(\"body\") String body\n );", "void savePost(Post post);", "public void upload(String username, String password, String photo) {\n HttpClient httpclient = new DefaultHttpClient();\n HttpPost httppost = new HttpPost(\n \"https://epitech-tiekeo.c9.io/photos/add-photo-mobile\");\n\n try {\n // Add your data\n List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();\n nameValuePairs.add(new BasicNameValuePair(\"username\",\n username));\n nameValuePairs.add(new BasicNameValuePair(\"password\",\n password));\n nameValuePairs.add(new BasicNameValuePair(\"photo\",\n photo));\n httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));\n\n // Execute HTTP Post Request\n HttpResponse response = httpclient.execute(httppost);\n\n } catch (ClientProtocolException e) {\n // TODO Auto-generated catch block\n } catch (IOException e) {\n // TODO Auto-generated catch block\n }\n }", "@Test\n public void uploadTest() throws ApiException {\n String path = null;\n Integer devid = null;\n File file = null;\n api.upload(path, devid, file);\n\n // TODO: test validations\n }", "void sendPost(String title, String body);", "public static void main(String[] args) {\n Account account_1 = new Account(\"firstUser\", \"firstPassword\", \"First User\", \"[email protected]\", new ActivityController());\r\n Account account_2 = new Account(\"secondUser\", \"secondPassword\", \"Second User\", \"[email protected]\", new ActivityController());\r\n\r\n \r\n Post textPost = account_1.activityController.createPost(\"TextImage\", \"REGULARPOST\");\r\n /*Post videoImagePost = account_2.activityController.createPost(\"VideoImage\", \"TAGGEDPOST\");\r\n Post textImnageVideoPost = account_1.activityController.createPost(\"TextImageVideo\", \"TAGGEDPOST\");*/\r\n System.out.println(\"Likes: \" + textPost.getLikeCount() + \" Dislikes: \"+ textPost.getDislikeCount());\r\n account_1.activityController.reactToPost(textPost, \"Like\");\r\n account_2.activityController.reactToPost(textPost, \"DisLike\");\r\n\r\n\t}", "private void saveAndUpload(String name, String email, Uri photoUri){\n\n // TODO implement save to local DB\n // TODO implement safe upload to Server\n }", "@FormUrlEncoded\n @POST(\"upload.php\")\n Call<ImageClass> uploadImage(@Field(\"title\") String title, @Field(\"image\") String image);", "@Test\n public void createPost() throws IOException {\n PostData postData = new PostData()\n .withId(101)\n .withUserId(1)\n .withTitle(\"New Post\")\n .withBody(\"This is the body of the post.\");\n\n // Create an HTTP Post Request\n HttpPost post = new HttpPost(POSTS);\n\n // Set the \"Content-type\" header of the\n // HTTP Post Request to \"Application/json; charset=UTF-8\"\n post.setHeader(\n CONTENT_TYPE,\n \"Application/json; charset=UTF-8\"\n );\n\n // Create a String Entity out of the JSON data and add it\n // to the HTTP Post Request.\n //\n // This will serialize the JSON data into a String\n post.setEntity(\n new StringEntity(\n this.gson.toJson(postData)\n )\n );\n\n // Execute the HTTP Post with the client\n HttpResponse response = this.httpClient.execute(post);\n\n // Get a PostData class instance from the response\n PostData responsePostData = getPostData(response);\n\n // Make assertions about the response\n assertThat(response.getStatusLine().getStatusCode())\n .isEqualTo(201);\n\n // Make assertions about the data returned\n assertThat(responsePostData.getId()).isEqualTo(101);\n assertThat(responsePostData.getUserId()).isEqualTo(1);\n assertThat(responsePostData.getTitle())\n .isEqualTo(postData.getTitle());\n assertThat(responsePostData.getBody())\n .isEqualTo(postData.getBody());\n }", "MovilizerRequest prepareUploadRequest(Long systemId, String password, MovilizerRequest request);", "void uploadSuccessful(long bytes);", "public String post();", "@POST(\"posts\")\n public Call<Post> UploadPost (@Body HashMap<Object, Object> map);", "public void upload(){\n put(\"Title\",title);\n put(\"Location\",location);\n put(\"DateMonth\", dateMonth);\n put(\"DateDay\", dateDay);\n put(\"DateYear\",dateYear);\n put(\"StartHour\",startHour);\n put(\"StartMinute\", startMinute);\n put(\"EndHour\", endHour);\n put(\"EndMinute\", endMinute);\n put(\"NumGoing\",numGoing);\n put(\"Description\",description);\n put(\"Category\",category);\n put(\"Author\", author);\n put(\"Contact\", contact);\n put(\"Attending\", attending);\n saveInBackground();\n }", "public Post(String user, String postContent, String webAddress) {\n this.orderPosted = nextOrderPosted;\n nextOrderPosted++;\n this.user = user;\n this.postContent = postContent;\n this.webAddress = webAddress;\n// this.myAuthor=myAuthor;\n\n }", "public static void createUser(User user) {\n URL url = null;\n HttpURLConnection connection = null;\n final String methodPath = \"/entities.credential/\";\n try {\n Gson gson = new Gson();\n String stringUserJson = gson.toJson(user);\n url = new URL(BASE_URI + methodPath);\n // open connection\n connection = (HttpURLConnection) url.openConnection();\n // set time out\n connection.setReadTimeout(10000);\n connection.setConnectTimeout(15000);\n // set connection method to POST\n connection.setRequestMethod(\"POST\");\n // set the output to true\n connection.setDoOutput(true);\n // set length of the data you want to send\n connection.setFixedLengthStreamingMode(stringUserJson.getBytes().length);\n // add HTTP headers\n connection.setRequestProperty(\"Content-Type\", \"application/json\");\n\n // send the POST out\n PrintWriter out = new PrintWriter(connection.getOutputStream());\n out.print(stringUserJson);\n out.close();\n Log.i(\"error\", new Integer(connection.getResponseCode()).toString());\n\n } catch (Exception e) {\n e.printStackTrace();\n } finally {\n connection.disconnect();\n }\n }", "@POST(\"posts\")\n Call<Post> createPost(@Body Post post);", "void bytesToUpload(long bytes);", "public void post(){\n\t\tHttpClient client = new HttpClient();\n\n\t\tPostMethod post = new PostMethod(\"http://211.138.245.85:8000/sso/POST\");\n//\t\tPostMethod post = new PostMethod(\"/eshopclient/product/show.do?id=111655\");\n//\t\tpost.addRequestHeader(\"Cookie\", cookieHead);\n\n\n\t\ttry {\n\t\t\tSystem.out.println(\"��������====\");\n\t\t\tint status = client.executeMethod(post);\n\t\t\tSystem.out.println(status);\n\t\t} catch (HttpException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\t// TODO Auto-generated catch block\n\t\t\te.printStackTrace();\n\t\t}\n\n//\t\ttaskCount++;\n//\t\tcountDown--;\n\t}", "int uploadNdwi6(File file, String project, DataDate date, DataDate updated) throws IOException, SQLException;", "@Test\n void sendPostRequest() {\n try {\n LoginPacket packet = new LoginPacket(\"testUser\", \"testPassword\");\n String response = HttpUtils.sendPost(\"\", WriteJSON.writePacket(packet));\n } catch (IOException e) {\n e.printStackTrace();\n fail();\n }\n }", "public void PreparedPostRequest(String username, String password);", "@POST\n Call<Post> createPost(@Body Post post);", "private void uploadToServer(String filePath, String title) {\n APIClient apiClient = new APIClient();\n Retrofit retrofit = apiClient.getApiClient();\n ApiInterface apiInterface = retrofit.create(ApiInterface.class);\n File file = new File(filePath);\n\n MultipartBody.Part filePart =\n MultipartBody.Part.createFormData(\"file\", title+\".jpg\", //file.getName(),\n RequestBody.create(MediaType.parse(\"image/*\"), file));\n\n\n Call call = apiInterface.uploadImage(filePart);\n call.enqueue(new Callback() {\n @Override\n public void onResponse(Call call, Response response) {\n Toast.makeText(AddPost.this, \"Worked\",Toast.LENGTH_SHORT).show();\n }\n @Override\n public void onFailure(Call call, Throwable t) {\n t.printStackTrace();\n Toast.makeText(AddPost.this, \"Didn't work\",Toast.LENGTH_SHORT).show();\n }\n });\n }", "@Override\n protected void upload(X x) {\n }", "@POST\n @Consumes(MediaType.APPLICATION_JSON)\n// trying to make the big deal post insertable but didn't worked out because of the parsing in java\n public String addVote(String body) {\n return \"test\";\n }", "public synchronized void upload(){\n\t}", "private void createPost() {\n PostModel model = new PostModel(23, \"New Title\", \"New Text\");\n Call<PostModel> call = jsonPlaceHolderAPI.createPost(model);\n call.enqueue(new Callback<PostModel>() {\n @Override\n @EverythingIsNonNull\n public void onResponse(Call<PostModel> call, Response<PostModel> response) {\n if (!response.isSuccessful()) {\n textResult.setText(response.code());\n return;\n }\n PostModel postResponse = response.body();\n String content = \"\";\n assert postResponse != null;\n content += \"Code: \" + response.code() + \"\\n\";\n content += \"ID: \" + postResponse.getId() + \"\\n\";\n content += \"User ID: \" + postResponse.getUserId() + \"\\n\";\n content += \"Title: \" + postResponse.getUserId() + \"\\n\";\n content += \"Body: \" + postResponse.getText();\n textResult.append(content);\n }\n\n @Override\n @EverythingIsNonNull\n public void onFailure(Call<PostModel> call, Throwable t) {\n textResult.setText(t.getMessage());\n }\n });\n }", "int uploadNdwi5(File file, String project, DataDate date, DataDate updated) throws IOException, SQLException;", "public Long createFileUpload(FileUpload fileUpload, InputStream fileInputStream) throws AppException;", "private void uploadImage(byte[] imageData) {\n\n }", "public void postData() {\n\n\t}", "public String uploadFile(String filename, InputStream is)\n {\n String url=null;\n try {\n \n FileMetadata metadata = client.files().uploadBuilder(\"/\"+filename).uploadAndFinish(is);\n SharedLinkMetadata sharedLinkMetadata = client.sharing().createSharedLinkWithSettings(\"/\"+filename);\n url=sharedLinkMetadata.getUrl();\n url=url.substring(0, url.length()-1)+\"1\";\n \n }\n// catch (FileNotFoundException fne)\n// {\n// System.out.println(\"96 : FileNotFoundException Caused By \"+fne.getLocalizedMessage());\n// }\n catch (IOException ioe)\n {\n System.out.println(\"100 : IOException Caused By \"+ioe.getLocalizedMessage());\n }\n// catch (DbxException dbxe)\n// {\n// \n// System.out.println(\"105 : DbxException Caused By \"+dbxe.getLocalizedMessage());\n// }\n catch(DbxException e)\n {\n System.out.println(\"--++--------+++++\");\n session = sfobj.openSession();\n tx = session.beginTransaction();\n\n System.out.println(\"line no= \"+e.getStackTrace()[2].getLineNumber());\n System.out.println(\"mathod name= \"+e.getStackTrace()[2].getMethodName());\n System.out.println(\"type= \"+e.toString());\n String nameofCurrMethod = new Throwable() \n .getStackTrace()[2] \n .getMethodName(); \n System.out.println(\"----method\"+nameofCurrMethod);\n // System.out.println(ea.getStackTrace().toString());\n System.out.println(\"class name= \"+e.getStackTrace()[2].getFileName());\n Errors ee=new Errors();\n ee.setGymid(gymid);\n ee.setError_name(\"line no= \"+e.getStackTrace()[2].getLineNumber()+\"type= \"+e.toString());\n ee.setMethod_name(e.getStackTrace()[2].getMethodName());\n session.save(ee);\n tx.commit();\n session.close();\n }\n return url;\n }", "private void uploadFromDataStorage() {\n }", "@Override\n public JSONObject postToWalletServer(String urlSegment, String body) {\n HttpHeaders header = constructHttpHeaders();\n // Construct the http URL.\n String baseUrl = ConfigUtil.instants().getValue(\"walletServerBaseUrl\");\n String walletServerUrl = baseUrl + urlSegment;\n\n // Send the http request and get response.\n HttpEntity<JSONObject> entity = new HttpEntity<>(JSONObject.parseObject(body), header);\n ResponseEntity<JSONObject> exchange =\n REST_TEMPLATE.exchange(walletServerUrl, HttpMethod.POST, entity, JSONObject.class);\n\n // Return the posted model or instance or NFC card personalized data.\n return exchange.getBody();\n }", "@Override\n\tvoid post() {\n\t\t\n\t}", "public Post addNewPost(@RequestBody NewPostBean post, String userTokenId);", "int uploadEta(File file, String project, DataDate date, DataDate updated) throws IOException, SQLException;", "void savePerilClass(HttpServletRequest request, String userId) throws SQLException, JSONException, Exception;", "@PostMapping(\"/p-v-app-users\")\n @Timed\n public ResponseEntity<PVAppUserDTO> createPVAppUser(@RequestBody PVAppUserDTO pVAppUserDTO) throws URISyntaxException {\n //log.debug(\"REST request to save PVAppUser : {}\", pVAppUserDTO);\n Cloudinary cloudinary = new Cloudinary(ObjectUtils.asMap(\n \"cloud_name\", \"codesidedevs\",\n \"api_key\", \"748436656856871\",\n \"api_secret\", \"mvN_DfjWnvWgA7ZCaQyUdn4-p4Y\"));\n if (pVAppUserDTO.getId() != null) {\n return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME, \"idexists\", \"A new pVAppUser cannot already have an ID\")).body(null);\n }\n if (pVAppUserDTO.getPhoto()==null){\n pVAppUserDTO.setPhoto(new PhotoDTO());\n pVAppUserDTO.getPhoto().setUrl(\"http://res.cloudinary.com/codesidedevs/image/upload/v1501719450/default-user-photo.png\");\n }else{\n try{\n System.out.println(\"Saving image\");\n String imageString = pVAppUserDTO.getPhoto().getUrl().split(\",\")[1];\n Map uploadResult = cloudinary.uploader().upload(pVAppUserDTO.getPhoto().getUrl(), ObjectUtils.emptyMap());\n System.out.println(\"URL de imagen: \" +uploadResult.get(\"url\"));\n pVAppUserDTO.getPhoto().setUrl(uploadResult.get(\"url\").toString());\n }catch(IOException ex){}\n }\n pVAppUserDTO.setRegistrationDate(LocalDate.now());\n pVAppUserDTO.setStatus(1);\n PVAppUser pVAppUser = pVAppUserMapper.toEntity(pVAppUserDTO);\n pVAppUser = pVAppUserRepository.save(pVAppUser);\n PVAppUserDTO result = pVAppUserMapper.toDto(pVAppUser);\n return ResponseEntity.created(new URI(\"/api/p-v-app-users/\" + result.getId()))\n .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))\n .body(result);\n }", "int createUser(User data) throws Exception;", "private void erweimaHttpPost() {\n\t\tHttpUtils httpUtils = new HttpUtils();\n\t\tUtils utils = new Utils();\n\t\tString[] verstring = utils.getVersionInfo(getActivity());\n\t\tRequestParams params = new RequestParams();\n\t\tparams.addHeader(\"ccq\", utils.getSystemVersion()+\",\"+ verstring[0]+\",\"+verstring[2]);\n\t\tparams.addBodyParameter(\"token\",\n\t\t\t\tnew DButil().gettoken(getActivity()));\n\t\tparams.addBodyParameter(\"member_id\",\n\t\t\t\tnew DButil().getMember_id(getActivity()));\n\t\thttpUtils.send(HttpMethod.POST, JiekouUtils.TUIGUANGERWEIMA, params,\n\t\t\t\tnew RequestCallBack<String>() {\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onFailure(HttpException arg0, String arg1) {\n\t\t\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\t\tLog.e(\"ee\", \"失败:\" + arg1);\n\t\t\t\t\t\thandler.sendEmptyMessage(HANDLER_NET_FAILURE);\n\t\t\t\t\t\t// handler.sendEmptyMessage(HANDLER_NET_FAILURE);\n\t\t\t\t\t}\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onSuccess(ResponseInfo<String> arg0) {\n\t\t\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\t\terweimaJsonInfo(arg0.result);\n\t\t\t\t\t}\n\t\t\t\t});\n\t}", "public void usersPost (User body, final Response.Listener<User> responseListener, final Response.ErrorListener errorListener) {\n Object postBody = body;\n\n\n // create path and map variables\n String path = \"/users\".replaceAll(\"\\\\{format\\\\}\",\"json\");\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 \"application/json\"\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[] { };\n\n try {\n apiInvoker.invokeAPI(basePath, path, \"POST\", queryParams, postBody, headerParams, formParams, contentType, authNames,\n new Response.Listener<String>() {\n @Override\n public void onResponse(String localVarResponse) {\n try {\n responseListener.onResponse((User) ApiInvoker.deserialize(localVarResponse, \"\", User.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 }", "@Test(enabled=false)\n\tpublic void objectPost() {\t\n\t\tPosts posts = new Posts(\"3\", \"Seahawks\", \"Wilson\");\n\t\t\n\t\tResponse res = given().\n\t\twhen().\n\t\tcontentType(ContentType.JSON).\n\t\tbody(posts).\n\t\tpost(\"http://localhost:3000/posts/\");\n\t\n\t\tSystem.out.println(\"Response as object: \"+res.asString());\n\t}", "@Test(enabled=false)\n\tpublic void basicPost() {\t\n\t\tResponse res = \n\t\tgiven().\n\t\tbody(\" { \\\"id\\\": \\\"2\\\",\"\n\t\t\t\t+ \"\\\"title\\\": \\\"Cleveland\\\", \"\n\t\t\t\t+ \"\\\"author\\\": \\\"Kyrie\\\" }\").\n\t\twhen().\n\t\tcontentType(ContentType.JSON).\n\t\tpost(\"http://localhost:3000/posts/\");\n\t\n\t\tSystem.out.println(res.asString());\n\t}", "private boolean upload(MimeMessage m, boolean bPostMsg, String changedSubj)\r\n\t{\r\n\t\ttry\r\n\t\t{\r\n\t Object msgContent = m.getContent();\r\n\t if (!(msgContent instanceof MimeMultipart))\r\n\t {\r\n\t \treject(m, \"Post/Upload command failed. Unsupported message type - you must use MimeMultipart.\");\r\n\t \treturn false;\r\n\t }\r\n\r\n\t // get the target object ID\r\n\t //subj = subj.replace(\"fw:\", \"\").replace(\"re:\", \"\").trim();\r\n\t String commandS = \"\";\r\n\r\n\t\t\t// upload/post 12345 user's optional subject\r\n\t String subj = null;\r\n\t if (changedSubj == null) {\r\n\t \tsubj = m.getSubject();\r\n\t }\r\n\t else {\r\n\t \tsubj = changedSubj;\t\t// for [EGIFN-1.1], changedSubj is now \"post EGIFN-1.1 xxx\"\r\n\t }\r\n\t String [] sa = subj.split(\" \");\r\n\t if (sa.length < 2)\r\n\t {\r\n\t \treject(m, \"Post/Upload command failed. You must specify the target task ID or project tag for the files to be uploaded to.\");\r\n\t \treturn false;\r\n\t }\r\n\r\n\t String pjAbbrev = null;\r\n\t String taskIdS = sa[1].trim();\r\n\r\n\t commandS = sa[0] + \" \" + sa[1];\t\t\t// e.g. upload 12345 or post ABC-2.1\r\n\r\n\t int taskId = 0;\t\t\t\t\t\t\t// taskId\r\n\t String taskMatchName = null;\r\n\t try {taskId = Integer.parseInt(taskIdS);}\r\n\t catch (Exception e)\r\n\t {\r\n\t\t\t\t// now support doing: post/upload UCAHP-2.1\r\n\t \t// UCAHP-2.1 or UCAHP\r\n\t \t// also support UCAHP-competition (match the first occurrence of the word \"competition\" for task name\r\n\t \tint idx = taskIdS.indexOf(\"-\");\r\n\t \tif (idx == -1) {\r\n\t \t\t// case of UCAHP only\r\n\t\t\t\t\tpjAbbrev = taskIdS;\t\t// UCAHP\r\n\t\t\t\t\ttaskIdS = \"\";\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// case of UCAHP-2.1 or UCAHP-competition\r\n\t\t\t\t\tpjAbbrev = taskIdS.substring(0, idx).trim();\t// UCAHP\r\n\t\t\t\t\ttaskIdS = taskIdS.substring(idx+1).trim();\t\t// assume 2.1\r\n\t\t\t\t\ttry {Float.parseFloat(taskIdS);}\r\n\t\t\t\t\tcatch (Exception ee) {\r\n\t\t\t\t\t\t// it is not 2.1, assume it is UCAHP-competition\r\n\t\t\t\t\t\ttaskMatchName = taskIdS;\r\n\t\t\t\t\t\ttaskIdS = \"\";\t\t// turn it into the case like UCAHP only and be handle below\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t }\r\n\r\n\t String optSubj = null;\r\n\t if (sa.length > 2) {\r\n\t \toptSubj = subj.substring(subj.indexOf(sa[2]));\t// remove post... or [EGIFN-1.1] etc.\r\n\t }\r\n\r\n\t // get ready to check for link file collision later\r\n\t \tboolean bReject = false;\r\n\t \tPstAbstractObject [] linkDocArr = new PstAbstractObject[0];\r\n\t\t\tint [] ids = attMgr.findId(jwu, \"Link='\" + taskIdS + \"'\");\r\n\t\t\tlinkDocArr = attMgr.get(jwu, ids);\r\n\r\n\t // authorization check\r\n\t // only project team member can upload to the project task\r\n\t int idx1;\r\n\t PstAbstractObject taskObj, pjObj=null;\r\n\t user uObj;\r\n\t String fromEmail = getPlainFrom(m);\r\n\t System.out.println(\"Processing RoboMail request from [\" + fromEmail + \"]\");\r\n\t try {uObj = (user)uMgr.get(jwu, fromEmail);}\r\n\t catch (Exception e)\r\n\t {\r\n\t\t\t\t// try to see if fromEmail is found in Email attribute\r\n\t\t\t\tint [] tempIds = uMgr.findId(jwu, \"Email='\" + fromEmail + \"'\");\r\n\t\t\t\tif (tempIds.length <= 0) return false;\r\n\t\t\t\tuObj = (user)uMgr.get(jwu, tempIds[0]);\r\n\t\t\t}\r\n\t int uid = uObj.getObjectId();\r\n\t String myName = uObj.getFullName();\r\n\r\n\t // check to see if I need to get taskId from project abbreviation\r\n\t if (taskId == 0) {\r\n\t \t// try decode post UCAHP-2.1. Using UCAHP-2.1 to find taskId\r\n\t \tpjObj = pjMgr.getProjectByAbbreviation(uObj, pjAbbrev);\r\n\t \tif (pjObj == null) {\r\n\t \t\treject(m, \"Post/Upload command failed. (\" + subj + \") is not a valid command. E.g. upload 12345\");\r\n\t \t\treturn false;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t// now get task from header number. e.g. 2.1\r\n\t\t\t\tif (taskIdS != \"\") {\r\n\t\t\t\t\ttry {Float.parseFloat(taskIdS);}\r\n\t\t\t\t\tcatch (Exception e) {\r\n\t\t\t\t\t\t// now support doing: post/upload UCAHP-2.1\r\n\t\t\t\t\t\treject(m, \"Post/Upload command failed. (\" + subj + \") is not a valid command. E.g. upload UCAHP-2.1\");\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t// the case of UCAHP-2.1\r\n\t\t\t\t\t// taskIdS is 2.1 or something like that\r\n\t\t\t\t\ttaskIdS = ((project)pjObj).getTaskByHeader(uObj, taskIdS);\r\n\t\t\t\t\ttaskId = Integer.parseInt(taskIdS);\r\n\t\t\t\t}\r\n\t\t\t\telse {\r\n\t\t\t\t\t// either the case of UCAHP without the task header number (same as UCAHP-other)\r\n\t\t\t\t\t// or the case of UCAHP-competition\r\n\t\t\t\t\ttask tk;\r\n\t\t\t\t\tString tkName;\r\n\t\t\t\t\tint [] tids = ((project)pjObj).getCurrentTasks(uObj);\r\n\t\t\t\t\tfor (int i=0; i<tids.length; i++) {\r\n\t\t\t\t\t\ttk = (task)tMgr.get(uObj, tids[i]);\r\n\t\t\t\t\t\ttkName = ((String)tk.getPlanTask(uObj).getAttribute(\"Name\")[0]).trim().toLowerCase();\r\n\t\t\t\t\t\tif ( (taskMatchName!=null && tkName.contains(taskMatchName)) ||\r\n\t\t\t\t\t\t\t tkName.equals(\"other\") ||\r\n\t\t\t\t\t\t\t tkName.equals(\"others\")) {\r\n\t\t\t\t\t\t\t// found task\r\n\t\t\t\t\t\t\ttaskId = tids[i];\r\n\t\t\t\t\t\t\ttaskIdS = String.valueOf(taskId);\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\tif (taskId == 0) {\r\n\t\t\t\t\t\treject(m, \"Post/Upload command failed. (\" + subj + \") cannot find the task to complete the command.\");\r\n\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tl.info(\"Robomail translated [\" + commandS + \"] to task [\" + taskIdS + \"]\");\r\n\t\t\t}\r\n\r\n\t taskObj = tMgr.get(jwu, taskId);\r\n\t String projIdS = (String)taskObj.getAttribute(\"ProjectID\")[0];\r\n\t if (pjObj == null)\r\n\t \tpjObj = pjMgr.get(jwu, Integer.parseInt(projIdS));\r\n\t if (pjObj.getAttribute(\"Type\")[0].equals(\"Private\") && !Util2.foundAttribute(pjObj, \"TeamMembers\", uid))\r\n\t {\r\n\t \treject(m, \"Post/Upload command failed. You don't have authority to post to this task (\" + taskId + \")\");\r\n\t \treturn false;\r\n\t }\r\n\r\n\t //\r\n\t // now ready to upload the file attachments\r\n\t //\r\n\t String s;\r\n InputStream io;\r\n\t\t\tbyte [] contentBuf = new byte[8192];\r\n\t\t\tFileOutputStream fos;\r\n\t\t\tFile newF=null, dirObj;\r\n\t\t\tFileTransfer ft = new FileTransfer(uObj);\r\n\t\t\tPstAbstractObject attObj;\r\n\t\t\tString sessErrMsg = \"\";\r\n\t\t\tString fileLinkS = \"\";\r\n\t\t\tString optMsg = null;\r\n\t\t\tboolean bUploadedFile = false;\r\n\t\t\tString mailContentType = null;\t// to support multi-byte charset\r\n\t\t\tString charsetName = null;\r\n\t\t\tint ct = 0;\r\n\t\t\tint mpCount = 0;\r\n\r\n\t\t\tMimeMultipart mp = (MimeMultipart) msgContent;\r\n\t\t\ttry {mpCount = mp.getCount();}\r\n\t\t\tcatch (MessagingException e) {\r\n\t\t\t\tl.error(\"Error in upload(): failed to get multipart in mail. mp.getCount() Exception.\");\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\t\r\n if (mp!=null && mpCount>0)\r\n {\r\n \t// ensure the upload directory is there\r\n \tString dirStr = UPLOAD_PATH + \"/\" + taskIdS;\r\n \tdirObj = new File(dirStr);\r\n \tif (!dirObj.exists())\r\n \t\tdirObj.mkdirs();\t\t\t// create the C:/Repository/CR/12345 directory\r\n\r\n for (int j=0; j<mpCount; j++)\r\n {\r\n MimeBodyPart bp = (MimeBodyPart) mp.getBodyPart(j);\r\n\r\n // get the attachment content\r\n String fname = bp.getFileName();\r\n\r\n if (!bPostMsg && fname==null)\r\n \tcontinue;\r\n\r\n\t\t\t\t\tif (fname==null)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t// this is the content of the message\r\n\t\t\t\t\t\tif (bp.getContent() instanceof MimeMultipart)\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tMimeMultipart tempMp = (MimeMultipart) bp.getContent();\r\n\t\t\t\t\t\t\tbp = (MimeBodyPart)tempMp.getBodyPart(0);\t\t\t\t// this is just the content\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\toptMsg = bp.getContent().toString();\r\n\t\t\t\t\t\ts = bp.getContentType();\r\n\t\t\t\t\t\tif (s != null) s = s.toLowerCase();\r\n\t\t\t\t\t\tSystem.out.println(\"Robomail handling email content type: \" + s);\r\n\t\t\t\t\t\tif (s==null || !s.contains(\"html\")) {\r\n\t\t\t\t\t\t\t// mainly have to deal with RTF email\r\n\t\t\t\t\t\t\toptMsg = optMsg.replaceAll(\"<\\\\S[^>]*>\", \"\");\r\n\t\t\t\t\t\t\toptMsg = optMsg.replaceAll(\"\\n\", \"<br>\");\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tif (s!=null && s.contains(\"charset\")) {\r\n\t\t\t\t\t\t\tmailContentType = bp.getContentType();\t// support multibype charset\r\n\t\t\t\t\t\t\tSystem.out.println(\"encoding=\" + bp.getEncoding());\r\n\t\t\t\t\t\t\tint idx = s.indexOf(\"charset=\");\r\n\t\t\t\t\t\t\tcharsetName = mailContentType.substring(idx+8);\r\n\t\t\t\t\t\t\tSystem.out.println(\"charset=\"+charsetName);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tcontinue;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t // reject if upload file collide with link files in this task\r\n\t\t\t\t\t// error checking: if the filename match any linked file, reject the upload\r\n\t\t\t\t\tbReject = false;\r\n\t\t\t\t\tfor (int i=0; i<linkDocArr.length; i++)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tif (Util3.getOnlyFileName(linkDocArr[i]).equalsIgnoreCase(fname))\r\n\t\t\t\t\t\t{\r\n\t\t\t\t\t\t\tbReject = true;\r\n\t\t\t\t\t\t\tif (sessErrMsg.length() <= 0)\r\n\t\t\t\t\t\t\t\tsessErrMsg = \"The following file(s) are not uploaded:<br>\";\r\n\t\t\t\t\t\t\tsessErrMsg += \"- \" + fname + \": filename collides with a linked file.<br>\";\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\tif (bReject) continue;\r\n\r\n io = bp.getInputStream();\r\n newF = new File(fname);\r\n newF.createNewFile();\r\n fos = new FileOutputStream(newF);\r\n\r\n\t\t\t\t\tint count = 0;\r\n\t\t\t\t\tint len = 0; // Check total length read\r\n\t\t\t\t\twhile((count = io.read(contentBuf)) != -1)\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tfos.write(contentBuf, 0, count);\r\n\t\t\t\t\t\tfos.flush();\r\n\t\t\t\t\t\tlen += count;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tfos.close();\r\n\t\t\t\t\tio.close();\r\n\t\t\t\t\tbUploadedFile = true;\r\n\r\n\t\t\t\t\t// save the file and update task object\r\n\t\t\t\t\tattObj = ft.saveFile(taskId, projIdS, newF, null, attachment.TYPE_TASK, null, null, true);\t// versioning on\r\n\t\t\t\t\ttaskObj.appendAttribute(\"AttachmentID\", String.valueOf(attObj.getObjectId()));\r\n\t\t\t\t\ttMgr.commit(taskObj);\r\n\t\t\t\t\tct++;\r\n\r\n\t\t\t\t\t// build fileLinkS for display in the blog and email notification\r\n\t\t\t\t\tif (fileLinkS.length() > 0) fileLinkS += \"<br>\";\r\n\t\t\t\t\ts = (String)attObj.getAttribute(\"Location\")[0];\r\n\t\t\t\t\tif ((idx1 = s.lastIndexOf('/')) != -1)\r\n\t\t\t\t\t\ts = s.substring(idx1+1);\r\n\t\t\t\t\tfileLinkS += \"<li><a class='plaintext' href='\" + HOST + \"/servlet/ShowFile?attId=\" + attObj.getObjectId() + \"'><u>\"\r\n\t\t\t\t\t\t\t\t+ s + \"</u></a>\";\r\n\r\n l.info(\"RoboMail uploaded attachment: \" + (String)attObj.getAttribute(\"Location\")[0] + \" (\" + len + \" B)\");\r\n }\t// end for each attachment file\r\n if (bReject)\r\n \treject(m, \"Post/Upload command completed with warning.<br>\" + sessErrMsg);\r\n\r\n // most of the following notification/blog code is from post_updtask.jsp\r\n if (ct>0 || optMsg!=null)\r\n {\r\n \tString projName = ((project)pjObj).getDisplayName();\r\n \tids = ptMgr.findId(jwu, \"TaskID='\" + taskIdS + \"'\");\r\n \tArrays.sort(ids);\r\n \tint pTaskId = ids[ids.length-1];\r\n \t\tString taskName = (String)ptMgr.get(jwu, pTaskId).getAttribute(\"Name\")[0];\r\n \t\tif (optSubj == null)\r\n \t\t{\r\n\t \t\tif (ct > 0)\r\n\t \t\t{\r\n\t\t \t\t\tsubj = ct + \" file\";\r\n\t\t \t\t\tif (ct > 1) subj += \"s are \";\r\n\t\t \t\t\telse subj += \" is \";\r\n\t \t\t}\r\n\t \t\telse\r\n\t \t\t\tsubj = \"A blog is \";\r\n\t\t \t\tsubj += \"posted on (\" + projName + \")\";\r\n \t\t}\r\n \t\telse {\r\n \t\t\tsubj = optSubj.trim();\t// this should only be the email subject w/o post...\r\n \t\t}\r\n \t\tsubj = \"[\" + app + \" Blog] \" + subj;\r\n \t\tString nowS = df0.format(new Date());\r\n\r\n \t\tStringBuffer msgBuf = new StringBuffer(4096);\r\n \t\tif (optMsg != null)\r\n \t\t{\r\n \t\t\t\t//optMsg = \"Message from \" + myName + \":<br><div STYLE='font-size: 14px; font-family: Courier New'><br>\"\r\n \t\t\t\toptMsg = \"Message from \" + myName + \":<br><div><br>\"\r\n\t\t\t\t\t\t+ optMsg + \"</div><br />\";\r\n \t\t\tmsgBuf = msgBuf.append(optMsg);\r\n \t\t\tif (ct > 0) msgBuf.append(\"<hr>\");\r\n \t\t}\r\n \t\tif (ct > 0)\r\n \t\t{\r\n\t \t\tmsgBuf.append(myName + \" has posted \" + ct + \" new file\");\r\n\t \t\tif (ct > 1) msgBuf.append(\"s\");\r\n\t \t\tmsgBuf.append(\" on \" + nowS + \"<blockquote><table>\");\r\n\t \t\tmsgBuf.append(\"<tr><td class='plaintext' width='80'>PROJECT:</td><td class='plaintext'><a href='\" + HOST + \"/project/cr.jsp?projId=\");\r\n\t \t\tmsgBuf.append(projIdS + \"'><u>\" + projName + \"</u></a></td></tr>\");\r\n\t \t\tmsgBuf.append(\"<tr><td class='plaintext' width='80'>TASK:</td><td class='plaintext'><a href='\" + HOST + \"/project/task_update.jsp?projId=\");\r\n\t \t\tmsgBuf.append( projIdS + \"&taskId=\" + taskIdS + \"'><u>\" + taskName + \"</u></a></td></tr>\");\r\n\t \t\tmsgBuf.append(\"</table></blockquote>You may click on the following filename to open the file:<blockquote><ul>\");\r\n\t \t\tmsgBuf.append(fileLinkS);\r\n\t \t\tmsgBuf.append(\"</ul></blockquote>\");\r\n \t\t}\r\n\r\n \t\t// we must blog, but check to see if we need to send notification email\r\n \t\tObject [] userIdArr = null;\r\n \t\tString optStr = (String)pjObj.getAttribute(\"Option\")[0];\r\n \t\tif (optStr!=null && optStr.indexOf(project.OP_NOTIFY_BLOG)!=-1)\r\n \t\t{\r\n \t\t\t// need to send team notification email\r\n \t\t\tuserIdArr = pjObj.getAttribute(\"TeamMembers\");\t\t// userIdArr was null\r\n \t\t\tUtil.sendMailAsyn(uObj, fromEmail, userIdArr, null, null, subj, msgBuf.toString(),\r\n \t\t\t\t\tMAILFILE, null, null, false, mailContentType);\r\n \t\t}\r\n\r\n \t\t// @ECC071408 post blog whether sending email or not\r\n \t\tString blogIdS = Util2.postBlog(uObj, result.TYPE_TASK_BLOG, taskIdS, projIdS, subj,\r\n \t\t\t\tmsgBuf.toString(), charsetName);\r\n \t\t\r\n \t\t/////////////\r\n \t\t// send notification event\r\n \t\t// the below code is basically from post_addblog.jsp\r\n\t\t\t\t\tString lnkStr = \"<blockquote class='bq_com'>uploaded email ... <a class='listlink' \"\r\n\t\t\t\t\t\t+ \"href='../blog/blog_task.jsp?blogId=\" + blogIdS\r\n\t\t\t\t\t\t+ \"&projId=\" + projIdS + \"&taskId=\" + taskIdS\r\n\t\t\t\t\t\t+ \"'>read more & reply</a></blockquote>\";\t\t// this link is used by both original blog or comment on task\r\n\r\n\t\t\t\t\ts = (String)pjObj.getAttribute(\"TownID\")[0];\r\n\t\t\t\t\tevent evt = PrmEvent.create(uObj, PrmEvent.EVT_BLG_PROJ, null, s, null);\r\n\t\t\t\t\tString temp = \"<a href='\" + Prm.getPrmHost() + \"/project/proj_plan.jsp?projId=\"\r\n\t\t\t\t\t\t+ projIdS + \"'>\" + ((project)pjObj).getDisplayName() + \"</a>\";\r\n\t\t\t\t\tPrmEvent.setValueToVar(evt, \"var1\", temp);\r\n\t\t\t\t\tPrmEvent.setValueToVar(evt, \"var2\", lnkStr);\r\n\t\t\t\t\tif (Prm.isPRM()) {\r\n\t\t\t\t\t\t// send to project memebers\r\n\t\t\t\t\t\tids = Util2.toIntArray(pjObj.getAttribute(\"TeamMembers\"));\r\n\t\t\t\t\t}\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tids = uMgr.findId(uObj, \"Towns=\" + s);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tct = PrmEvent.stackEvent(uObj, ids, evt);\r\n\t\t\t \tl.info(uid + \" RoboMail triggered Event [\" + PrmEvent.EVT_BLG_PROJ + \"] to \"\r\n\t\t\t \t\t\t+ ct + \" users for project (\" + projIdS + \") blog.\");\r\n\r\n \t\t// @ECC091108 recalculate project space\r\n \t\tif (bUploadedFile) {\r\n\t \tUtilThread th = new UtilThread(UtilThread.CAL_PROJ_SPACE, uObj);\r\n\t \tth.setParam(0, projIdS);\r\n\t \tth.start();\r\n \t\t}\r\n }\r\n }\t// end if there is any attachment\r\n else\r\n {\r\n \tl.info(\"There is no attachment for this command.\");\r\n }\r\n\t\t}\r\n\t\tcatch (Exception e)\r\n\t\t{\r\n\t\t\te.printStackTrace();\r\n\t\t\treject(m, \"Post/Upload command failed in upload() operation. \" + e.toString());\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "@Test\n void postTest() {\n URI uri = URI.create(endBody + \"/post\");\n\n // create a dummy body for easy JSON conversion\n QuestionText newQuestion = new QuestionText(\"Test\");\n\n // convert to json and send / store the response\n HttpResponse<String> response = HttpMethods.post(uri, gson.toJson(newQuestion));\n\n assertEquals(200, response.statusCode());\n }", "UploadInfo simpleUpload(SimpleFile file);", "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}", "private void writeNewPost(String userId, String username, String title, String body) {\n String key = mDatabase.child(\"posts\").push().getKey();\n Post post = new Post(userId, username, title, body);\n Map<String, Object> postValues = post.toMap();\n\n Map<String, Object> childUpdates = new HashMap<>();\n childUpdates.put(\"/posts/\" + key, postValues);\n childUpdates.put(\"/user-posts/\" + userId + \"/\" + key, postValues);\n\n mDatabase.updateChildren(childUpdates);\n }", "int insertSelective(WpPostsWithBLOBs record);", "private static String facebookPostMethod(String host, String urlPostfix, List <NameValuePair> nvps){\r\n System.out.println(\"@executing facebookPostMethod():\" + host + urlPostfix);\r\n String responseStr = null;\r\n try {\r\n HttpPost httpost = new HttpPost(host + urlPostfix);\r\n httpost.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));\r\n\r\n // execute postMethod\r\n HttpResponse postResponse = httpClient.execute(httpost);\r\n HttpEntity entity = postResponse.getEntity();\r\n\r\n System.out.println(\"facebookPostMethod: \" + postResponse.getStatusLine());\r\n if (entity != null) {\r\n responseStr = EntityUtils.toString(entity);\r\n //System.out.println(responseStr);\r\n entity.consumeContent();\r\n }\r\n System.out.println(\"Post Method done(\" + postResponse.getStatusLine().getStatusCode()+\"), response string length: \" + (responseStr==null? 0:responseStr.length()));\r\n } catch (IOException e) {\r\n System.out.println(e.getMessage());\r\n }\r\n //TODO process the respons string\r\n //if statusCode == 200: no error;(responsStr contains \"errorDescription\":\"No error.\")\r\n //else retry?\r\n return responseStr;\r\n }", "public interface APIService {\n\n @FormUrlEncoded\n @POST(\"\")\n Call<Post> savePost(@Field(\"\") String username,\n @Field(\"\") String password,\n @Field(\"\") String mobile,\n @Field(\"\") String device_token);\n\n\n }", "public void uploadUserDetailsToDatabase(String email, String password){\n User user = new User(email, password);\n FirebaseDatabase.getInstance().getReference(\"Users\").push()\n .setValue(user).addOnCompleteListener(new OnCompleteListener<Void>() {\n @Override\n public void onComplete(@NonNull Task<Void> task) {\n Log.i(\"details\", \"uploaded\");\n }\n }).addOnFailureListener(new OnFailureListener() {\n @Override\n public void onFailure(@NonNull Exception e) {\n Log.i(\"details\", \"upload failed\");\n }\n });\n }", "@Test\n\tpublic void createUserwithPOSTTest() {\n\t\tRestAssured.baseURI = \"https://gorest.co.in\";\n\t\tRequestSpecification request = RestAssured.given().log().all();\n\t request.header(\"Authorization\", \"Bearer 4242b4a465097df28229861ee3a53a1ab3e674935bb89e135543e470750c4e3b\");\n\t request.contentType(\"application/json\");\n\t File file = new File(\"/Users/testersinem/Documents/workspace/API/src/test/java/com/api/test/createuser.json\");\n\t request.body(file);\n\t Response response = request.post(\"/public-api/users\");\n\t System.out.println(response.prettyPrint());\n\t}", "public Long upload(MusicUploadData music) throws MusicAppException;", "public void postTweet(int userId, int tweetId) {\n\n }", "String uploadProfileImage(String fileNameWithOutRepository,String fileName) throws GwtException, ServerDownException;", "public interface RequeteService {\n @Multipart\n @POST(\"upImportDoc.do\")\n Call<ResponseBody> uploadSingleFile(\n @Header(\"Cookie\") String sessionid,\n @Header(\"User-Agent\") String userAgent,\n @Part MultipartBody.Part file,\n @Part(\"jsessionid\") RequestBody jsessionid,\n @Part(\"ptoken\") RequestBody ptoken,\n @Part(\"ajaupmo\") RequestBody ajaupmo,\n @Part(\"ContributionComment\") RequestBody ContributionComment,\n @Part(\"Document_numbasedoc\") RequestBody Document_numbasedoc,\n @Part(\"contribution\") RequestBody contribution);\n}", "public void createPost( BlogPost post );", "public long ashirPostCreating(AshirBlogPostingHelper post) {\n long result;\n\n SQLiteDatabase db = this.getWritableDatabase();\n ContentValues values = new ContentValues();\n values.put(Col_2, post.getPost());\n values.put(Col_3, post.getImage());\n //inserting valuse into table columns\n result = db.insert(NAME_OF_TABLE, null, values);\n db.close();\n return result;\n\n }", "@Test\n \tpublic void testToPostData() throws UnsupportedEncodingException{\n \t\t\n \t\tUserInfo user = DummyFactory.createDummyUserInfo();\n \t\tString postStr = String.format(\"type=%s&time=%s&member[0][uid]=%s&member[0][status]=%s\", \n \t\t\t\tURLEncoder.encode(\"PRIVATE\",\"utf-8\"),\n\t\t\t\tURLEncoder.encode(\"1970-01-01T09:00\",\"utf-8\"),\n \t\t\t\tURLEncoder.encode(\"xxxx\",\"utf-8\"),\n \t\t\t\tURLEncoder.encode(\"ON\",\"utf-8\")\n \t\t\t\t);\n \n \t\tAlarmInfo alarm = new AlarmInfo(user, 1000);\n \t\tassertEquals( postStr, alarm.toPostData() );\n \t}", "static public String postFile(String url, String userid, String fieldName, File textFile) throws Exception {\r\n // String param = \"value\";\r\n // File textFile = new File(\"/path/to/file.txt\");\r\n // File binaryFile = new File(\"/path/to/file.bin\");\r\n String boundary = Long.toHexString(System.currentTimeMillis()); // Just\r\n // generate\r\n // some\r\n // unique\r\n // random\r\n // value.\r\n String CRLF = \"\\r\\n\"; // Line separator required by multipart/form-data.\r\n\r\n URLConnection connection = new URL(url).openConnection();\r\n connection.setDoOutput(true);\r\n connection.setRequestProperty(\"Content-Type\", \"multipart/form-data; boundary=\" + boundary);\r\n PrintWriter writer = null;\r\n try {\r\n String charset = \"ISO-8859-1\"; // was ISO-8859-1\r\n OutputStream output = connection.getOutputStream();\r\n writer = new PrintWriter(new OutputStreamWriter(output, charset), true); // true\r\n // =\r\n // autoFlush,\r\n // important!\r\n\r\n // Send text file.\r\n writer.append(\"--\" + boundary).append(CRLF);\r\n writer.append(\"Content-Disposition: form-data; name=\\\"\" + fieldName + \"\\\"; filename=\\\"\" + textFile.getName() + \"\\\"\").append(CRLF);\r\n writer.append(\"Content-Type: text/plain; charset=\" + charset).append(CRLF);\r\n writer.append(CRLF).flush();\r\n BufferedReader reader = null;\r\n try {\r\n reader = new BufferedReader(new InputStreamReader(new FileInputStream(textFile), charset));\r\n for (String line; (line = reader.readLine()) != null;) {\r\n writer.append(line).append(CRLF);\r\n }\r\n } finally {\r\n if (reader != null)\r\n try {\r\n reader.close();\r\n } catch (IOException logOrIgnore) {\r\n }\r\n }\r\n\r\n // Send normal param.\r\n\r\n writer.append(\"--\" + boundary).append(CRLF);\r\n writer.append(\"Content-Disposition: form-data; name=\\\"user\\\"\").append(CRLF);\r\n writer.append(\"Content-Type: text/plain; charset=\" + charset).append(CRLF);\r\n writer.append(CRLF);\r\n writer.append(userid).append(CRLF).flush();\r\n\r\n writer.flush();\r\n\r\n /*\r\n * // Send binary file. writer.append(\"--\" + boundary).append(CRLF);\r\n * writer.append(\r\n * \"Content-Disposition: form-data; name=\\\"binaryFile\\\"; filename=\\\"\" +\r\n * binaryFile.getName() + \"\\\"\").append(CRLF); writer.append(\r\n * \"Content-Type: \" + URLConnection.guessContentTypeFromName\r\n * (binaryFile.getName())).append(CRLF); writer.append(\r\n * \"Content-Transfer-Encoding: binary\").append(CRLF);\r\n * writer.append(CRLF).flush(); InputStream input = null; try { input =\r\n * new FileInputStream(binaryFile); byte[] buffer = new byte[1024]; for\r\n * (int length = 0; (length = input.read(buffer)) > 0;) {\r\n * output.write(buffer, 0, length); } output.flush(); // Important! Output\r\n * cannot be closed. Close of writer will close output as well. } finally\r\n * { if (input != null) try { input.close(); } catch (IOException\r\n * logOrIgnore) {} } writer.append(CRLF).flush(); // CRLF is important! It\r\n * indicates end of binary boundary.\r\n */\r\n\r\n // End of multipart/form-data.\r\n writer.append(\"--\" + boundary + \"--\").append(CRLF);\r\n writer.append(CRLF).flush(); // CRLF is important! It indicates end\r\n // of binary boundary.\r\n\r\n byte[] data;\r\n InputStream in = null;\r\n in = new BufferedInputStream(connection.getInputStream());\r\n ByteArrayOutputStream bos = new ByteArrayOutputStream(16384);\r\n try {\r\n\r\n int BUFFER_SIZE = 16384;\r\n byte[] tmp = new byte[BUFFER_SIZE];\r\n int ret;\r\n while ((ret = in.read(tmp)) > 0) {\r\n bos.write(tmp, 0, ret);\r\n }\r\n } catch (IOException e) {\r\n Logging.logError(e);\r\n }\r\n\r\n data = bos.toByteArray();\r\n log.info(\"read {} bytes\", data.length);\r\n\r\n String s = new String(data);\r\n log.info(s);\r\n try {\r\n in.close();\r\n } catch (IOException e) {\r\n // don't care\r\n }\r\n\r\n return s;\r\n\r\n } finally {\r\n if (writer != null)\r\n writer.close();\r\n }\r\n }", "@POST\r\n @Consumes(MediaType.APPLICATION_JSON)\r\n @Produces(MediaType.APPLICATION_JSON)\r\n /*public String getJson(@FormParam(\"operador\")String operador,@FormParam(\"idFile\")int idFile, \r\n @FormParam(\"idUser\")int idUser,@FormParam(\"grupo\")boolean grupo,@FormParam(\"lat\")double latitud, \r\n @FormParam(\"lon\")double longitud, @FormParam(\"hora\")String hora, @FormParam(\"fecha\")String fecha,\r\n @FormParam(\"timeMask\")String timeMask,@FormParam(\"dateMask\")String dateMask,\r\n @FormParam(\"wifis\")String wifis) throws SQLException, URISyntaxException, ClassNotFoundException{*/\r\n public String getJson(Parametros parametros) throws SQLException, URISyntaxException, ClassNotFoundException{\r\n //TODO return proper representation object\r\n \r\n Integer idFile = parametros.idFile;\r\n Integer idUser = parametros.idUser;\r\n boolean grupo = parametros.grupo;\r\n String operador = parametros.operador;\r\n float longitud = parametros.lon;\r\n float latitud = parametros.lat;\r\n String hora = parametros.hora;\r\n String dateMask = parametros.dateMask;\r\n String fecha = parametros.fecha;\r\n String timeMask = parametros.timeMask;\r\n String wifis = parametros.wifis;\r\n \r\n boolean userRegistrado=false;\r\n Fichero fichero = new Fichero(0,0,\"hola\",\"estoy aqui\",\"a esta hora\",\"en esta fecha\",\"con estas wifis\");\r\n try{\r\n Calendar ahora = Calendar.getInstance();\r\n int grupoBBDD =0;\r\n double lat=0;\r\n double lon=0;\r\n String horaBBDD=\"8:00\";\r\n String timeMaskBBDD=\"4\";\r\n String dateMaskBBDD=\"4\";\r\n \r\n ahora.add(Calendar.HOUR, 1);//Cambio de hora por el servidor de Heroku\r\n Connection connection = null;\r\n try{\r\n Class.forName(\"org.postgresql.Driver\");\r\n\r\n String url =\"jdbc:postgresql://localhost:5432/postgres\";\r\n String usuario=\"postgres\";\r\n String contraseña=\"123\";\r\n\r\n connection = DriverManager.getConnection(url, usuario, contraseña);\r\n \r\n if(!connection.isClosed()){\r\n Statement stmt = connection.createStatement();\r\n ResultSet rs= stmt.executeQuery(\"SELECT Id, Departamento FROM Usuarios\");\r\n while(rs.next()){\r\n if((rs.getInt(\"Id\"))==idUser){\r\n userRegistrado=true;\r\n grupoBBDD=rs.getInt(\"Departamento\");\r\n if(grupo && grupoBBDD!=0){\r\n Statement stmt2 = connection.createStatement();\r\n ResultSet rs2= stmt2.executeQuery(\"SELECT * FROM Departamentos WHERE Id='\" +Integer.toString(grupoBBDD)+\"'\"); \r\n while(rs2.next()){\r\n horaBBDD=rs2.getString(\"Horario\");\r\n timeMaskBBDD=rs2.getString(\"Mascara_hora\");\r\n dateMaskBBDD=rs2.getString(\"Mascara_fecha\");\r\n break;\r\n }\r\n rs2.close();\r\n stmt2.close();\r\n }\r\n Statement stmt3 = connection.createStatement();\r\n ResultSet rs3= stmt3.executeQuery(\"SELECT ssid, potencia FROM wifis\");\r\n while(rs3.next()){\r\n wifisFijas.add(rs3.getString(\"ssid\"));\r\n wifisPotencias.add(Integer.toString(rs3.getInt(\"potencia\")));\r\n }\r\n rs3.close();\r\n stmt3.close();\r\n Statement stmt4 = connection.createStatement();\r\n ResultSet rs4= stmt4.executeQuery(\"SELECT * FROM coordenadas\");\r\n while(rs4.next()){\r\n lat=rs4.getFloat(\"Latitud\");\r\n lon=rs4.getFloat(\"Longitud\");\r\n radio=rs4.getInt(\"Radio\");\r\n }\r\n rs4.close();\r\n stmt4.close();\r\n break;\r\n }\r\n\r\n\r\n }\r\n //Gson gson = new Gson();\r\n //String ficheroJSON = gson.toJson(fichero);\r\n rs.close();\r\n stmt.close();\r\n connection.close();\r\n //return ficheroJSON;\r\n }\r\n } catch (Exception e) {\r\n e.printStackTrace();\r\n System.err.println(e.getClass().getName()+\": \"+e.getMessage());\r\n System.exit(0);\r\n \r\n }\r\n \r\n //for (int i=0;i<listaUsers.length;i++){\r\n //if(listaUsers[i][0]==idUser){\r\n if(userRegistrado){\r\n //userRegistrado = true;\r\n if(!grupo){\r\n fichero = new Fichero(idFile,idUser,claveOperador(operador, idFile, idUser),claveGPS(lat,lon,latitud,longitud,radio,idFile,idUser),claveHora(idFile, idUser,ahora,timeMask,hora),claveFecha(idFile, idUser,ahora,dateMask,fecha),claveWifi(wifis, idUser, idFile));\r\n //fichero.setClaveHora(\"Estoy entrando donde no hay grupo\");\r\n //break;\r\n }\r\n else{\r\n //if(listaUsers[i][1]==0){\r\n if(grupoBBDD==0){\r\n fichero = new Fichero(idFile,idUser,claveOperador(getCadenaAlfanumAleatoria(10), idFile, idUser),claveGPS(rnd.nextDouble()*100,rnd.nextDouble()*100,rnd.nextDouble()*100,rnd.nextDouble()*100,rnd.nextInt()*100,idFile,idUser),getCadenaAlfanumAleatoria(100),getCadenaAlfanumAleatoria(50),getCadenaAlfanumAleatoria(75));\r\n //fichero.setClaveHora(\"Estoy entrando donde el grupo es 0\");\r\n }\r\n else{\r\n //fichero = new Fichero(idFile,idUser,claveOperador(operador, idFile, listaUsers[i][1]),claveGPS(lat,lon,idFile,listaUsers[i][1]),claveHora(idFile, listaUsers[i][1],ahora,mapHora.get(listaUsers[i][1])[1],mapHora.get(listaUsers[i][1])[0]),claveFecha(idFile, listaUsers[i][1],ahora,mapHora.get(listaUsers[i][1])[2],fecha),claveWifi(wifis,listaUsers[i][1],idFile));\r\n fichero = new Fichero(idFile,idUser,claveOperador(operador, idFile, grupoBBDD),claveGPS(lat,lon,latitud,longitud,radio,grupoBBDD,grupoBBDD),claveHora(idFile, grupoBBDD,ahora,timeMaskBBDD,horaBBDD),claveFecha(idFile, grupoBBDD,ahora,dateMaskBBDD,fecha),claveWifi(wifis,grupoBBDD,idFile));\r\n //fichero.setClaveHora(\"Estoy entrando en mi cifrado de grupo\");\r\n }\r\n //break;\r\n }\r\n }\r\n //}\r\n if(!userRegistrado){\r\n fichero = new Fichero(idFile,idUser,claveOperador(getCadenaAlfanumAleatoria(10), idFile, idUser),claveGPS(rnd.nextDouble()*100,rnd.nextDouble()*100,rnd.nextDouble()*100,rnd.nextDouble()*100,rnd.nextInt()*100,idFile,idUser),getCadenaAlfanumAleatoria(100),getCadenaAlfanumAleatoria(50),getCadenaAlfanumAleatoria(75));\r\n //fichero.setClaveHora(\"No estoy registrado\");\r\n }\r\n }catch(Exception e){\r\n fichero = new Fichero(idFile,idUser,claveOperador(getCadenaAlfanumAleatoria(10), idFile, idUser),claveGPS(rnd.nextDouble()*100,rnd.nextDouble()*100,rnd.nextDouble()*100,rnd.nextDouble()*100,rnd.nextInt()*100,idFile,idUser),getCadenaAlfanumAleatoria(100),getCadenaAlfanumAleatoria(50),getCadenaAlfanumAleatoria(75));\r\n }\r\n \r\n \r\n Gson gson = new Gson();\r\n String ficheroJSON = gson.toJson(fichero);\r\n return ficheroJSON;\r\n }", "@Override\n protected Object doInBackground(Object[] objects) {\n URL url = null;\n String userID = (String) objects[0];\n String postID = (String) objects[1];\n String topicID = (String) objects[2];\n String postName = (String) objects[3];\n String postText = (String) objects[4];\n String postLink = (String) objects[5];\n String postDate = (String) objects[6];\n String filetype = (String) objects[8];\n String base64Image = \"data:image/;\" + filetype + \";base64,\" + ((String) objects[7]);\n Log.d(\"b64\", base64Image);\n try {\n char delim = 157;\n url = new URL(Constants.CREATE_POST + userID + delim + postID + delim + topicID + delim + postName + delim + postText + delim + postLink + delim + postDate);\n Log.d(\"URL\", url.toString());\n } catch (MalformedURLException e) {\n e.printStackTrace();\n Log.d(\"URL\", url.toString());\n return \"Error\";\n }\n HttpURLConnection con = null;\n JSONObject jsonObject = new JSONObject();\n try {\n jsonObject.put(\"imageString\", base64Image);\n } catch (JSONException e) {\n e.printStackTrace();\n Log.d(\"IMAGE\", base64Image.toString());\n return \"Error\";\n }\n String data = jsonObject.toString();\n try {\n con = (HttpURLConnection) url.openConnection();\n con.setDoOutput(true);\n con.setDoInput(true);\n con.setRequestMethod(\"POST\");\n con.setFixedLengthStreamingMode(data.getBytes().length);\n con.setRequestProperty(\"Content-Type\", \"application/json;charset=UTF-8\");\n OutputStream out = new BufferedOutputStream(con.getOutputStream());\n BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out, \"UTF-8\"));\n writer.write(data);\n writer.flush();\n writer.close();\n out.close();\n con.connect();\n } catch (IOException e) {\n e.printStackTrace();\n Log.d(\"WRITE\", \"Writing error\");\n return \"Error\";\n }\n int status = 0;\n BufferedReader in = null;\n StringBuilder content = new StringBuilder();\n try {\n in = new BufferedReader(new InputStreamReader(con.getInputStream()));\n String inputLine;\n while (true) {\n inputLine = in.readLine();\n if(inputLine == null){\n break;\n }\n content.append(inputLine);\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n Log.d(\"CONTENTLOG\",content.toString());\n try {\n if(in != null) {\n in.close();\n }\n } catch (IOException e) {\n e.printStackTrace();\n }\n userCredentials = content.toString();\n return \"Success\";\n }", "int insert(UserEntity record);", "int insert(UserAlbum record);", "public java.lang.CharSequence upload(java.lang.String appId, java.lang.String url, long duration, java.lang.String file) throws android.os.RemoteException;", "public interface ApiService {\n String BASE_URL = \"http://robika.ir/ultitled/practice/sujeyab/test_multi_upload/\";\n\n @Multipart\n @POST(\"upload.php\")\n Call<ResponseBody> uploadMultiple(\n @Part(\"id_ferestande\") RequestBody id_ferestande,\n @Part(\"onvan\") RequestBody onvan,\n @Part(\"mozo\") RequestBody mozo,\n @Part(\"tozihat\") RequestBody tozihat,\n @Part(\"type\") RequestBody type,\n @Part(\"shenase_rahgiri\") RequestBody shenase_rahgiri,\n @Part(\"id_farakhan\") RequestBody id_farakhan,\n @Part(\"size\") RequestBody size,\n @Part List<MultipartBody.Part> files);\n}", "CompletableFuture<PostResponse> createNewPost(Post post);", "@Test\n public void postTest(){\n Post post = new Post(\"Title 1\",\"Body 1\");\n\n given().accept(ContentType.JSON)\n .and().contentType(ContentType.JSON)\n .body(post)\n .when().post(\"/posts\")\n .then().statusCode(201)\n .body(\"title\",is(\"Title 1\"),\n \"body\",is(\"Body 1\"),\n \"id\",is(101));\n }", "int insert(PmPost record);", "public interface UploadFileApi {\n @POST\n Flowable<ResponseBody> uploadFile(@Url String url, @Body MultipartBody body);\n}", "public void create(Post post) {\r\n jdbcOp.update(SQL_INSERT_TICKET,\r\n post.getCustomerName(),\r\n post.getSubject(), \r\n post.getBody(),\r\n post.getCategories());\r\n// for (String role : user.getRoles()) {\r\n// jdbcOp.update(SQL_INSERT_ROLE,\r\n// user.getUsername(),\r\n// role); \r\n }", "public void uploadMultipart() {\n //getting the actual path of the image\n String path = getPath(filePath);\n\n //Uploading code\n try {\n String uploadId = UUID.randomUUID().toString();\n\n //Creating a multi part request\n new MultipartUploadRequest(this, uploadId, \"todo\")\n .addFileToUpload(path, \"image\") //Adding file\n .setNotificationConfig(new UploadNotificationConfig())\n .setMaxRetries(2)\n .startUpload(); //Starting the upload\n\n } catch (Exception exc) {\n Toast.makeText(this, exc.getMessage(), Toast.LENGTH_SHORT).show();\n }\n }", "public static void main(String[] args) {\n\t\tHttpClient client = new HttpClient();\n\t\tPostMethod myPost = new PostMethod(string );\n\t\ttry{\n\t\t\t//��������ͷ������ \n\t\t\tmyPost.setRequestHeader(\"Content-Type\", \"text/xml\");\n\t\t\tmyPost.setRequestHeader(\"charset\", \"utf-8\");\n\t\t\tmyPost.setRequestHeader(\"x-app-key\", \"c85d54f1\");\n\t\t\tmyPost.setRequestHeader(\"x-sdk-version\", \"3.1\");\n\n\t\t\tString date = new SimpleDateFormat(\"yyyy-MM-dd hh:mm:ss\").format(new Date());\n\t\t\tmyPost.setRequestHeader(\"x-request-date\", date);\n\t\t\tString x_task_config = \"capkey=hwr.cloud.letter\";\n\t\t\tmyPost.setRequestHeader(\"x-task-config\", x_task_config);\n//\t\t\tString b = new String(g_sShortData);\n\t\t\tString str = \"712ddd892cf9163e6383aa169e0454e3\" + date + x_task_config ;\n//\t\t\tSystem.out.println(str);\n\t\t\tmyPost.setRequestHeader(\"x-auth\", MD5.getMD5((str + g_sShortData.toString()).getBytes()));\n//\t\t\tmyPost.setRequestHeader(\"x-udid\", \"101:123456789\");\n\t\t\tSystem.out.println(g_sShortData.length);\n\t\t\tbyte[] b = new byte[g_sShortData.length];\n\t\t\tfor(int i=0; i<g_sShortData.length; i++){\n\t\t\t\tb[i] = (byte) g_sShortData[i];\n\t\t\t}\n\t\t\t\n\t\t\tRequestEntity entity = new StringRequestEntity(new String(b, \"iso-8859-1\"), \"application/octet-stream\", \"iso-8859-1\");\n\t\t\tmyPost.setRequestEntity(entity);\n\t\t\tint statusCode = client.executeMethod(myPost);\n\t\t\tString.format(\"%d\", statusCode);\n\t\t\tSystem.out.println(statusCode);\n\t\t\t\n\t\t\tif (statusCode == HttpStatus.SC_OK) {\n\t\t\t\tInputStream txtis = myPost.getResponseBodyAsStream(); \n\t\t\t\tBufferedReader br = new BufferedReader(new InputStreamReader(txtis, \"utf-8\"));\n\t\t\t\t\n\t\t\t\tString tempbf;\n\t\t\t\tStringBuffer html = new StringBuffer(256);\n\t\t\t\twhile((tempbf = br.readLine()) != null){\n\t\t\t\t\thtml.append(tempbf);\n\t\t\t\t}\n\t\t\t\tSystem.out.println(html.toString());\n\t\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}\n\t}", "entities.Torrent.UploadRequest getUploadRequest();", "@PostMapping(\"/\")\n private ResponseEntity<Post> createPost(@RequestBody Post post) {\n User user = getCurrentUser();\n post.setCreated(new Date());\n post.setUserId(user.getId());\n post = postService.add(post);\n\n return new ResponseEntity<>(post, HttpStatus.OK);\n }", "@Override public java.lang.CharSequence upload(java.lang.String appId, java.lang.String url, long duration, java.lang.String file) throws android.os.RemoteException\n{\nandroid.os.Parcel _data = android.os.Parcel.obtain();\nandroid.os.Parcel _reply = android.os.Parcel.obtain();\njava.lang.CharSequence _result;\ntry {\n_data.writeInterfaceToken(DESCRIPTOR);\n_data.writeString(appId);\n_data.writeString(url);\n_data.writeLong(duration);\n_data.writeString(file);\nmRemote.transact(Stub.TRANSACTION_upload, _data, _reply, 0);\n_reply.readException();\nif ((0!=_reply.readInt())) {\n_result = android.text.TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(_reply);\n}\nelse {\n_result = null;\n}\n}\nfinally {\n_reply.recycle();\n_data.recycle();\n}\nreturn _result;\n}", "int insert(ZlnfBiZzdkZzdkWithBLOBs record);", "int insert(WbUser record);", "public void catalogProductWebsiteLinkRepositoryV1SavePost (String sku, Body2 body, final Response.Listener<Boolean> responseListener, final Response.ErrorListener errorListener) {\n Object postBody = body;\n\n \n // verify the required parameter 'sku' is set\n if (sku == null) {\n VolleyError error = new VolleyError(\"Missing the required parameter 'sku' when calling catalogProductWebsiteLinkRepositoryV1SavePost\",\n new ApiException(400, \"Missing the required parameter 'sku' when calling catalogProductWebsiteLinkRepositoryV1SavePost\"));\n }\n \n\n // create path and map variables\n String path = \"/v1/products/{sku}/websites\".replaceAll(\"\\\\{format\\\\}\",\"json\").replaceAll(\"\\\\{\" + \"sku\" + \"\\\\}\", apiInvoker.escapeString(sku.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[] { };\n\n try {\n apiInvoker.invokeAPI(basePath, path, \"POST\", queryParams, postBody, headerParams, formParams, contentType, authNames,\n new Response.Listener<String>() {\n @Override\n public void onResponse(String localVarResponse) {\n try {\n responseListener.onResponse((Boolean) ApiInvoker.deserialize(localVarResponse, \"\", Boolean.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 }", "@Override\r\n\tprotected void doPost(HttpServletRequest req, HttpServletResponse resp)\r\n\t\t\tthrows ServletException, IOException {\n\t\tHttpSession session = req.getSession();\r\n\t\tConnection c = null;\r\n\t\tResultSet rs = null;\r\n\t\tString result = \"Fail\";\r\n\t\tString userImageKey = \"\";\r\n\t\tint resultid = -1;\r\n\t\tUserService userService = UserServiceFactory.getUserService();\r\n\t\tUser user = userService.getCurrentUser();\r\n\t\tif (user != null) {\r\n\t\t\tMap<String,List<BlobKey>> blobs = blobstoreService.getUploads(req);\r\n\t\t\tIterator<String> names = blobs.keySet().iterator();\r\n\t\t\twhile(names.hasNext()) {\r\n\t\t\t\tString name = names.next();\r\n\t\t\t\tif (name.equals(\"userImage\")) {\r\n\t\t\t\t\tList<BlobKey> blobkeys = blobs.get(name);\r\n\t\t\t\t\tif (blobkeys.size() > 0) {\r\n\t\t\t\t\t\tBlobKey blobkey = blobkeys.get(0);\r\n\t\t\t\t\t\tuserImageKey = blobkey.getKeyString();\r\n\t\t\t\t\t}\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tString name = req.getParameter(\"name\");\r\n\t\t\tif (name == null || name.equals(\"\") ) {\r\n\t\t\t\tname = \"UserName\";\r\n\t\t\t}\r\n\t\t\tString registrationId = req.getParameter(\"regid\");\r\n\t\t\tif (registrationId == null) {\r\n\t\t\t\tregistrationId = \"\";\r\n\t\t\t}\r\n\t\t\ttry {\r\n\t\t\t\tDriverManager.registerDriver(new AppEngineDriver());\r\n\t\t\t\tc = DriverManager.getConnection(\"jdbc:google:rdbms://dongjawebapp:boarddb/boarddb\");\r\n\t\t\t\tString query = \"SELECT id,imagekey FROM usertbl WHERE userid = ?\";\r\n\t\t\t\tPreparedStatement stmt = c.prepareStatement(query);\r\n\t\t\t\tstmt.setString(1, user.getEmail());\t\t\r\n\t\t\t\trs = stmt.executeQuery();\r\n\t\t\t\tif (rs.next()) {\r\n\t\t\t\t\t// update user info\r\n\t\t\t\t\tint userid = rs.getInt(\"id\");\r\n\t\t\t\t\tresultid = userid;\r\n\t\t\t\t\tif (userImageKey.equals(\"\")) {\r\n\t\t\t\t\t\tuserImageKey = rs.getString(\"imagekey\");\r\n\t\t\t\t\t}\r\n\t\t\t\t\trs.close();\r\n\t\t\t\t\t\r\n\t\t\t\t\tString statement = \"UPDATE usertbl SET userid = ?, username = ?, imagekey = ?, registrationid = ? WHERE id = ?\";\r\n\t\t\t\t\tPreparedStatement upstmt = c.prepareStatement(statement);\r\n\t\t\t\t\tupstmt.setString(1, user.getEmail());\r\n\t\t\t\t\tupstmt.setString(2, name);\r\n\t\t\t\t\tupstmt.setString(3, userImageKey);\r\n\t\t\t\t\tupstmt.setString(4, registrationId);\r\n\t\t\t\t\tupstmt.setInt(5, userid);\r\n\t\t\t\t\tupstmt.executeUpdate();\r\n\t\t\t\t\tif (session.getAttribute(\"userid\") == null) {\r\n\t\t\t\t\t\tsession.setAttribute(\"userid\", userid);\r\n\t\t\t\t\t}\r\n\t\t\t\t\tresult = \"Success\";\r\n\t\t\t\t\tresultid = userid;\r\n\t\t\t\t} else {\r\n\t\t\t\t\t// insert user info\r\n\t\t\t\t\tString statementFormat = \"INSERT INTO usertbl(userid,username,imagekey,registrationid) VALUES('%s','%s','%s','%s')\";\r\n\t\t\t\t\tString statement = String.format(statementFormat, user.getEmail(),name,userImageKey,registrationId);\r\n\t\t\t\t\tStatement instmt = c.createStatement();\r\n\t\t\t\t\tinstmt.executeUpdate(statement,Statement.RETURN_GENERATED_KEYS);\r\n\t\t\t\t\tResultSet rs2 = instmt.getGeneratedKeys();\r\n\t\t\t\t\tif (rs2.next()) {\r\n\t\t\t\t\t\tint userid = rs2.getInt(1);\r\n\t\t\t\t\t\tsession.setAttribute(\"userid\", userid);\r\n\t\t\t\t\t\tresult = \"Success\";\r\n\t\t\t\t\t\tresultid = userid;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tresult = \"Fail\";\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t} catch (SQLException e) {\r\n\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t\tresult = \"Fail\";\r\n\t\t\t} finally {\r\n\t\t\t\tif (c != null) {\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tc.close();\r\n\t\t\t\t\t} catch (SQLException e) {\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\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tresult = \"NotLogin\";\r\n\t\t}\r\n\r\n\t req.setAttribute(\"result\", result);\r\n\t req.setAttribute(\"resultid\", resultid);\r\n\t try {\r\n req.getRequestDispatcher(\"/UploadResult.jsp\").forward(req, resp);\r\n } catch (ServletException e) {\r\n }\r\n\t\t\r\n\t}", "@Test\n\tpublic void testSaveUser() {\n\t\tfinal User user = new User();\n\t\tuser.setUserid(15);\n\t\tResponseEntity<String> responseEntity = this.restTemplate.postForEntity(getRootUrl() + \"/save-user?userid=15\", user , String.class);\n\t\tassertEquals(200,responseEntity.getStatusCodeValue());\n\t}", "@Test\n public void uploadNoNameVideo() {\n Video video = new Video(\"\", \"www.youtube.com\", 212);\n Response response = target.request(MediaType.APPLICATION_JSON)\n .post(Entity.entity(video, MediaType.APPLICATION_JSON));\n\n assertThat(response.getStatus(), is(Status.BAD_REQUEST.getStatusCode()));\n\n }", "@org.junit.Test\r\n\tpublic void insert() {\n\t\tParameters parameters = new Parameters();\r\n\t\tparameters.setUrl(\"/org/save\");\r\n\t\tparameters.setList(new ArrayList<NameValuePair>());\r\n\t\tparameters.getList().add(new BasicNameValuePair(\"name\", \"112\"));\r\n\t\t@SuppressWarnings(\"unused\")\r\n\t\tString string = (String) MainUtilityTools.execute(parameters);\r\n\t\tSystem.out.println(string);\r\n\t}", "Long insert(User record);", "@Test\n public void createPost() {\n User bob = new User(\"Jasdeep\",\"Madan\",\"JD\",\"[email protected]\",\"password\", \"member\", true, true).save();\n\n //Create a new Category and save it\n Category category = new Category(\"Tech\", \"Some Description\").save();\n\n // Create a new post\n new Article(\"My first post\", \"Hello world\", bob, category, true, null, null).save();\n\n // Test that the post has been created\n assertEquals(1, Article.count());\n\n // Retrieve all posts created by Bob\n List<Article> bobPosts = Article.find(\"byAuthor\", bob).fetch();\n\n // Tests\n assertEquals(1, bobPosts.size());\n Article firstPost = bobPosts.get(0);\n assertNotNull(firstPost);\n assertEquals(bob, firstPost.author);\n assertEquals(\"My first post\", firstPost.title);\n assertEquals(\"Hello world\", firstPost.content);\n assertNotNull(firstPost.submit_date);\n }", "private String addMultiPost(String caption, String name, String type, int height, int width) throws IOException {\n String urlString;\n try {\n urlString = uploadToS3(resizeAndCompressImage(name, height, width), type, name);\n } catch (IOException | ImageProcessingException e) {\n e.printStackTrace();\n // if post failed\n // send an email to admins\n bizUtilities.sendPostErrorEmail(userDao.getAdminUsers(), caption);\n return \"\";\n }\n return awsConfig.getBucketUrl() + \"/\" + urlString;\n }", "int insert(OfUserWechat record);", "@Test\n\tpublic void test_1_post(){\n\t\tJSONObject request = new JSONObject();\n\t\trequest.put(\"name\", \"Rahul\");\n\t\trequest.put(\"job\", \"Engineer\");\n\t\tSystem.out.println(request.toJSONString());\n\t\t\n\t\tgiven().\n\t\t header(\"Content-Type\",\"application/json\").\n\t\t accept(ContentType.JSON).\n\t\t body(request.toJSONString()).\n\t\t when().\n\t\t \tpost(\"https://reqres.in/api/users/2\").\n\t\t then().\n\t\t statusCode(201);\n\t\t \n\t\t\n\t}", "@Test\n\tpublic void testCreatePostLive() throws Exception\n\t{\n\t}", "public Boolean catalogProductWebsiteLinkRepositoryV1SavePost (String sku, Body2 body) throws TimeoutException, ExecutionException, InterruptedException, ApiException {\n Object postBody = body;\n // verify the required parameter 'sku' is set\n if (sku == null) {\n VolleyError error = new VolleyError(\"Missing the required parameter 'sku' when calling catalogProductWebsiteLinkRepositoryV1SavePost\",\n new ApiException(400, \"Missing the required parameter 'sku' when calling catalogProductWebsiteLinkRepositoryV1SavePost\"));\n }\n\n // create path and map variables\n String path = \"/v1/products/{sku}/websites\".replaceAll(\"\\\\{format\\\\}\",\"json\").replaceAll(\"\\\\{\" + \"sku\" + \"\\\\}\", apiInvoker.escapeString(sku.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 String[] contentTypes = {\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 HttpEntity httpEntity = localVarBuilder.build();\n postBody = httpEntity;\n } else {\n // normal form params\n }\n\n String[] authNames = new String[] { };\n\n try {\n String localVarResponse = apiInvoker.invokeAPI (basePath, path, \"POST\", queryParams, postBody, headerParams, formParams, contentType, authNames);\n if (localVarResponse != null) {\n return (Boolean) ApiInvoker.deserialize(localVarResponse, \"\", Boolean.class);\n } else {\n return null;\n }\n } catch (ApiException ex) {\n throw ex;\n } catch (InterruptedException ex) {\n throw ex;\n } catch (ExecutionException ex) {\n if (ex.getCause() instanceof VolleyError) {\n VolleyError volleyError = (VolleyError)ex.getCause();\n if (volleyError.networkResponse != null) {\n throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());\n }\n }\n throw ex;\n } catch (TimeoutException ex) {\n throw ex;\n }\n }", "@Override\n\tprotected void handlePostBody(HashMap<String, HashMap<String, String>> params, DataFormat format) throws Exception {\n\t}", "public void savePost(VBeatPostModel post) {\n AppLocalDB.getInstance().db.postDao().insertAll(post);\n }", "public static void main(String[] args) throws Exception {\n testPost();\n }" ]
[ "0.6978259", "0.62852126", "0.6274799", "0.6229603", "0.61948085", "0.6186675", "0.61219484", "0.6096513", "0.602889", "0.60226893", "0.592868", "0.58915687", "0.5881311", "0.5873496", "0.586645", "0.58658504", "0.58535355", "0.58142954", "0.58012974", "0.5800722", "0.5790103", "0.57857805", "0.5768478", "0.5726076", "0.5706919", "0.5693654", "0.5688274", "0.5673087", "0.5664796", "0.5664444", "0.5659118", "0.5632205", "0.56315345", "0.56136286", "0.56076765", "0.56060344", "0.5601357", "0.55919725", "0.55908257", "0.55870926", "0.5581896", "0.55729985", "0.55602854", "0.5559757", "0.55525154", "0.55517244", "0.5551586", "0.55450416", "0.5542431", "0.55334705", "0.5531877", "0.55258", "0.55242646", "0.5522934", "0.5517212", "0.5510366", "0.5501372", "0.5497397", "0.5497163", "0.54968804", "0.54956913", "0.5493448", "0.54926646", "0.5490883", "0.5487069", "0.5481281", "0.5479918", "0.5476386", "0.5474756", "0.547406", "0.54694617", "0.54596704", "0.5457067", "0.54538226", "0.5453103", "0.54519016", "0.54512215", "0.54508513", "0.5446598", "0.5446014", "0.54410046", "0.5437414", "0.5427947", "0.54277474", "0.542174", "0.54122907", "0.5412205", "0.5403928", "0.5398611", "0.53978527", "0.5394372", "0.5391791", "0.538692", "0.53840804", "0.53806907", "0.53757334", "0.53730005", "0.53518575", "0.53490984", "0.5344293", "0.5339193" ]
0.0
-1
Time complexity : O(n) Space complexity : O(1)
public static int f(Relationship relationship) { int n = relationship.people(); int candidate = 0; for (int i = 1; i < n; i++) { if (relationship.knows(candidate, i)) { // if candidate knows i, candidate can not be the mayor candidate = i; } } // check that the last candidate can be the mayor for (int i = 0; i < n; i++) { if (!relationship.knows(i, candidate)) { return -1; } if (candidate != i && relationship.knows(candidate, i)) { return -1; } } return candidate; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static int f2(int N) { \n int x = 0; //O(1)\n for(int i = 0; i < N; i++) // O(n)\n // O(n)`\n for(int j = 0; j < i; j++) \n x++;\n return x;\n }", "public static int f1(int N) {\n int x = 0; //O(1)\n for(int i = 0; i < N; i++) // O(n) \n x++; \n return x; \n \n }", "public int[] squareUp(int n) {\r\n int[]arreglo=new int[(n*n)]; // O(1)\r\n if(n==0){ // O(1)\r\n return arreglo; // O(1)\r\n }\r\n for(int i=n-1;i<arreglo.length;i=i+n){ // O(n)\r\n for (int j=i;j>=i-(i/n);j--){ // O(1)\r\n arreglo[j]=1+(i-j); // O(1)\r\n }\r\n }\r\n return arreglo; // O(1)\r\n}", "public static int example2(int[] arr) { // O(1)\r\n\t\tint n = arr.length, total = 0; // O(1)\r\n\t\tfor (int j = 0; j < n; j += 2) // note the increment of 2 // O(1)\r\n\t\t\ttotal += arr[j];\r\n\t\treturn total;\r\n\r\n\t\t/*\r\n\t\t * Explanation: Once Again, we have a (for) loop and it runs (n) times and this\r\n\t\t * for loop dominates the runtime.So this is linear time and the answer is O(n).\r\n\t\t * \r\n\t\t */\r\n\t}", "public static void main(String args[] ) throws Exception {\n Scanner scanner = new Scanner(System.in);\n int n = scanner.nextInt();\n int[] seqArray = new int[n];\n for (int i = 0; i < n; i++) {\n seqArray[i] = scanner.nextInt();\n }\n // getSeqValue(seqArray); //this method is an accepted one on Hackerrank but time complexity is not order n; i.e. !O(n);\n getLinearOrderY(seqArray); // trying to get O(n) time complexity;\n }", "public static int example3(int[] arr) { // O(n)\r\n\t\tint n = arr.length, total = 0; // O(1)\r\n\t\tfor (int j = 0; j < n; j++) // loop from 0 to n-1 // O(n^2)\r\n\t\t\tfor (int k = 0; k <= j; k++) // loop from 0 to j\r\n\t\t\t\ttotal += arr[j];\r\n\t\treturn total;\r\n\r\n\t\t/*\r\n\t\t * Explanation: Since we have nested for loop which dominates here and it is\r\n\t\t * O(n^2) and we always take the maximum. so the answer is quadratic time O(n^2)\r\n\t\t * \r\n\t\t */\r\n\t}", "public static int example4(int[] arr) { // O(1)\r\n\t\tint n = arr.length, prefix = 0, total = 0; // O(1), O(1), (1)\r\n\t\tfor (int j = 0; j < n; j++) { // loop from 0 to n-1 // O(n)\r\n\t\t\tprefix += arr[j];\r\n\t\t\ttotal += prefix;\r\n\t\t}\r\n\t\treturn total;\r\n\r\n\t\t/*\r\n\t\t * Explanation: The method contains a (for) loop and it runs (n) times.This loop\r\n\t\t * dominates the runtime.We always aim for the worse-case and maximum time. The\r\n\t\t * answer is it is linear time of O(n) notation.\r\n\t\t * \r\n\t\t */\r\n\t}", "public static int example1(int[] arr) { // O(1)\r\n\t\tint n = arr.length, total = 0; // O(1)\r\n\t\tfor (int j = 0; j < n; j++) // loop from 0 to n-1 // O(n)\r\n\t\t\ttotal += arr[j];\r\n\t\treturn total;\r\n\t}", "public static void main(String[] args) {\n\t\t// TODO Auto-generated method stub\n\n\t\tint a[] = {2,1,3,-4,-2};\n\t\t//int a[] = {1 ,2, 3, 7, 5};\n\t\tboolean found = false;\n\t\t\n\t\t//this will solve in o n^2\n\t\tfor(int i = 0 ; i < a.length ; i++){\n\t\t\tint sum = 0;\n\t\t\tfor(int j = i ; j< a.length ; j++){\n\t\t\t\tsum += a[j] ;\n\t\t\t\tif(sum == 0){\n\t\t\t\t\tfound = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\tif(found)\n\t\t\t\tbreak;\n\t\t}\n\t\t\n\t\t\n\t\t// link : https://www.youtube.com/watch?v=PSpuM9cimxA&list=PLKKfKV1b9e8ps6dD3QA5KFfHdiWj9cB1s&index=49\n\t\tSystem.out.println(found + \" found\");\n\t\tfound = false;\n\t\t//solving with O of N with the help sets\n\t\t// x + 0 = y\n\t\tSet<Integer> set = new HashSet<>();\n\t\tint sum = 0;\n\t\tfor(int element : a){\n\t\t\tset.add(sum);\n\t\t\tsum += element;\n\t\t\tif(set.contains(sum)){\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println();\n\t\tSystem.out.println(set);\n\t\t\n\t\tSystem.out.println(found + \" found\");\n\t\t\n\t\t\n\t\tfound = false;\n\t\t// when the sum of subarray is K\n\t\t\n\t\t//solving with O of N with the help sets\n\t\t//x + k = y >>>\n\t\tSet<Integer> set1 = new HashSet<>();\n\t\tint k = 12;\n\t\tint summ = 0;\n\t\tfor(int element : a){\n\t\t\tset1.add(summ);\n\t\t\tsumm += element;\n\t\t\tif(set1.contains(summ - k)){ // y - k = x(alredy presnt or not)\n\t\t\t\tfound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t\n\t\tSystem.out.println(set1);\n\t\tSystem.out.println();\n\t\tSystem.out.println(found + \" found\");\n\t\t\n\t\t\n\t}", "public int[] fix34(int[] nums) {\r\n\tint i=0; // O(1)\r\n while(i<nums.length && nums[i]!=3) // O(n)\r\n i++; // n+1\r\n int j=i; // O(1)\r\n while(j+1<nums.length && nums[j+1]!=4) // O(n)\r\n j++; // n+1\r\n while(i<nums.length){ // O(n)\r\n if(nums[i]==3){ // O(1)\r\n int temp=nums[i+1]; // O(1)\r\n nums[i+1]=nums[j+1]; //O(1)\r\n nums[j+1]=temp; // O(1)\r\n while(j+1<nums.length && nums[j+1] != 4) //O(n)\r\n j++; // n+1\r\n }\r\n i++; // n+1\r\n }\r\n return nums; //O(1)\r\n}", "public static int[] exe1(int[] arr){ // Solution O(n) in time and constant in Memory\n int nzeros=0;\n\n for (int i=0; i<arr.length; i++) {\n arr[i-nzeros] = arr[i];\n if (arr[i] == 0) {\n nzeros++;\n }\n }\n for (int i=arr.length-1; i>arr.length-nzeros-1; i--) {\n arr[i] = 0;\n }\n\n return arr;\n }", "static int[] sol1(int[]a, int n){\r\n\t\tMap <Integer,Integer> map= new HashMap();\r\n\t\tfor (int i = 0; i< a.length; i++){\r\n\t\t\tmap.put(a[i],i);\r\n\t\t}\r\n\t\tArrays.sort(a);\r\n\t\tint i = 0; \r\n\t\tint j = a.length -1;\r\n\t\twhile (i <= j){\r\n\t\t\tif(a[i]+a[j]>n) j--;\r\n\t\t\telse if (a[i]+a[j]<n) i++;\r\n\t\t\telse break;\r\n\t\t}\r\n\t\tint[] ans= {map.get(a[i]),map.get(a[j])};\r\n\t\treturn ans;\r\n\t}", "static int[] OnepassSol1(int[]a, int n){\r\n Map<Integer, Integer> map = new HashMap<>();\r\n for (int i = 0; i < a.length; i++) {\r\n int complement = n - a[i];\r\n if (map.containsKey(complement)) {\r\n return new int[] { map.get(complement), i };\r\n }\r\n map.put(a[i], i);\r\n }\r\n int[] ans = {-1,-1};\r\n return ans;\r\n }", "public static boolean find3Numbers(int A[], int n, int X) { \n \n // Your code \n for(int i=0;i<n-2;i++)\n {\n HashSet<Integer> set = new HashSet<>();\n int toFind=X-A[i];\n for(int j=i+1;j<n;j++)\n {\n if(set.contains(toFind-A[j]))\n {\n return true;\n }\n set.add(A[j]);\n }\n }\n return false;\n }", "@Override\r\n public long problem2() {\r\n ArrayList<String> arrList = new ArrayList<>();\r\n long start = System.currentTimeMillis(); \r\n for(int i = 0; i<1234567; i++){\r\n arrList.add(Integer.toString(i));\r\n }\r\n long end = System.currentTimeMillis(); \r\n return end - start; \r\n }", "private final int m()\n\t { int n = 0;\n\t int i = 0;\n\t while(true)\n\t { if (i > j) return n;\n\t if (! cons(i)) break; i++;\n\t }\n\t i++;\n\t while(true)\n\t { while(true)\n\t { if (i > j) return n;\n\t if (cons(i)) break;\n\t i++;\n\t }\n\t i++;\n\t n++;\n\t while(true)\n\t { if (i > j) return n;\n\t if (! cons(i)) break;\n\t i++;\n\t }\n\t i++;\n\t }\n\t }", "public int findDuplicate(int[] nums) {\n if(nums == null || nums.length == 0) return 0;\n\n int slow = nums[0];\n int fast = nums[nums[0]];\n\n while(slow != fast) {\n slow = nums[slow];\n fast = nums[nums[fast]];\n }\n\n fast = 0;\n while(slow != fast) {\n slow = nums[slow];\n fast = nums[fast];\n }\n\n return slow;\n}", "int minOperations(int[] arr) {\n // Write your code here\n Set<String> set = new HashSet<>();//store visited string\n Queue<String> queue = new LinkedList<>(); // store next strs\n int counter = 0;\n\n queue.offer(getKey(arr));\n set.add(getKey(arr));\n\n while (!queue.isEmpty()) {\n int size = queue.size();\n List<String> curs = new ArrayList<>();\n while (size > 0) {\n curs.add(queue.poll());\n size--;\n }\n\n for(String cur : curs) {\n if (isIncreasing(cur)) {\n return counter;\n }\n\n for(int i = 0; i < cur.length(); i++) {\n String next = reverseString(cur, i);\n if (!set.contains(next)) {\n set.add(next);\n queue.offer(next);\n }\n }\n }\n\n counter++;\n }\n\n return counter;\n }", "public static int ulam(int n) {\n\n List<Integer> list = new ArrayList<>();\n list.add(1);\n list.add(2);\n\n int i = 3;\n while (list.size() < n) {\n\n int count = 0;\n for (int j = 0; j < list.size() - 1; j++) {\n\n for (int k = j + 1; k < list.size(); k++) {\n if (list.get(j) + list.get(k) == i)\n count++;\n if (count > 1)\n break;\n }\n if (count > 1)\n break;\n }\n if (count == 1)\n list.add(i);\n i++;\n }\n return list.get(n - 1);\n }", "private static int betterSolution(int n) {\n return n*n*n;\n }", "public static void main(String[] args) {\n\t\tint a[]= {15,3,7,1,9,2};\n\t\tsubarraysum(a,11);//Time complexity O(n^2) space O(1)\n\n\t\tsubarraysum_reducecomplexity(a,11,a.length); //Time complexity O(n) space O(1)\n\n\t}", "public void sum2(int n){\n int sum =0; //1\n for (int j = 0; j < n; j++) //2n+2\n for (int k = 0; k < n; k++) //2n+2\n sum += k + j; //1\n for (int l = 0; l < n; l++) //2n+2\n sum += l; //1\n }", "public static int f5(int N) { \n int x = 0;\n // log(n)\n for(int i = N; i > 0; i = i/2)\n // O(n) + O(n/2) + O(n/4)\n x += f1(i);\n \n return x; \n \n }", "public static int solveEfficient(int n) {\n if (n == 0 || n == 1)\n return 1;\n\n int n1 = 1;\n int n2 = 1;\n int sum = 0;\n\n for (int i = 2; i <= n; i++) {\n sum = n1 + n2;\n n1 = n2;\n n2 = sum;\n }\n return sum;\n }", "public int removeDuplicates(int[] nums) {\n if (nums.length == 0) return 0;\n int i = 0;\n for (int j = 1; j < nums.length; j++) {\n if (nums[j] != nums[i]) {\n i++;\n nums[i] = nums[j];\n }\n }\n return i + 1;\n}", "void h(List<List<Integer>> r, List<Integer> t, int n, int s){ \n for(int i = s; i*i <= n; i++){\n if(n % i != 0) continue; \n t.add(i);\n t.add(n / i);\n r.add(new ArrayList<>(t));\n t.remove(t.size() - 1);\n h(r, t, n/i, i);\n t.remove(t.size() - 1);\n }\n }", "public static void targetSumPair(int[] arr, int target){\n //write your code here\n Arrays.sort(arr); // O(nlogn)\n int i=0, j=arr.length-1;\n while(i < j) {\n if(arr[i]+arr[j] < target) {\n i++;\n }\n else if(arr[i] + arr[j] > target)\n j--;\n else {\n System.out.println(arr[i] + \", \" + arr[j]);\n i++; j--;\n }\n }\n }", "static int getMissingByAvoidingOverflow(int a[], int n)\n\t {\n\t int total = 2;\n\t for (int i = 3; i <= (n + 1); i++)\n\t {\n\t total =total+ i -a[i - 2];\n\t //total =total- a[i - 2];\n\t }\n\t return total;\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 }", "private static int solution2(String s) {\r\n int n = s.length();\r\n int ans = 0;\r\n for (int i = 0; i < n; i++)\r\n for (int j = i + 1; j <= n; j++)\r\n if (allUnique(s, i, j)) ans = Math.max(ans, j - i);\r\n return ans;\r\n }", "private static int f(int n, int complete, int other, int[] arr) {\n if(n<=0)\n return 0;\n int res=0;\n ArrayList<Integer>list=new ArrayList<Integer>();\n for(int a:arr)\n if(a>0)\n list.add(a);\n int brr[]=new int[list.size()];\n for(int i=0;i<brr.length;i++)\n brr[i]=list.get(i);\n while(brr.length!=0){\n int index=0;\n for(int i=1;i<brr.length;i++)\n if(brr[index]<brr[i])\n index=i;\n for(int i=0;i<brr.length;i++){\n if(index==i)\n brr[i]-=complete;\n else\n brr[i]-=other;\n }\n list=new ArrayList<Integer>();\n for(int a:brr)\n if(a>0)\n list.add(a);\n brr=new int[list.size()];\n for(int i=0;i<brr.length;i++)\n brr[i]=list.get(i);\n res++;\n }\n return res;\n }", "public static int solution(int[] arr) {\n int n = arr.length;\n for (int i = 0; i < n; i++) {\n while (arr[i] != i + 1 && arr[i] < n && arr[i] > 0) {\n int temp = arr[i];\n if (temp == arr[temp - 1])\n break;\n arr[i] = arr[temp - 1];\n arr[temp - 1] = temp;\n }\n }\n for (int i = 0; i < n; i++)\n if (arr[i] != i + 1)\n return i + 1;\n return n + 1;\n }", "public void triplet(int[] b,int n){\r\n\t\tint count=0;\r\n\t\tfor(int i=0;i<n;i++){\r\n\t\t\tfor(int j=i+1;j<n-1;j++){\r\n\t\t\t\tfor(int k=j+1;k<n-2;k++){\r\n\t\t\t\t\tif(b[i]+b[j]+b[k]==0){\r\n\t\t\t\t\t\tSystem.out.println(b[i]+\" \"+b[j]+\" \"+b[k]);\r\n\t\t\t\t\t\tcount++;\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\tSystem.out.println(\"no of distinct triplet is:\"+count);\t\r\n\r\n\t}", "private static void findMissingAndDuplicateNumberFrom1toN(int[] input) {\n\t\tint len = input.length;\n\t\tint i = 0;\n\n\t\twhile (i < len) {\n\t\t\t//if its already in correct place\n\t\t\tif (input[i] == i + 1) {\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t} else if (input[i] == input[input[i] - 1]) { //if the elment to be swapped with are same\n\t\t\t\ti++;\n\t\t\t\tcontinue;\n\t\t\t} else {\n\t\t\t\tint temp = input[i];\n\t\t\t\tinput[i] = input[input[i] - 1];\n\t\t\t\tinput[temp - 1] = temp;\n\t\t\t}\n\t\t}\n\n\t\tfor (i = 0; i < len; i++) {\n\t\t\tif (input[i] != i + 1) {\n\t\t\t\tSystem.out.println(\"Missing number : \" + (i + 1));\n\t\t\t\tSystem.out.println(\"Duplicate number : \" + input[i]);\n\t\t\t}\n\t\t}\n\n\t}", "static int countSubarrWithEqualZeroAndOne(int arr[], int n)\n {\n int count=0;\n int currentSum=0;\n HashMap<Integer,Integer> mp=new HashMap<>();\n for(int i=0;i<arr.length;i++)\n {\n if(arr[i]==0)\n arr[i]=-1;\n currentSum+=arr[i];\n \n if(currentSum==0)\n count++;\n if(mp.containsKey(currentSum))\n count+=mp.get(currentSum);\n if(!mp.containsKey(currentSum))\n mp.put(currentSum,1);\n else\n mp.put(currentSum,mp.get(currentSum)+1);\n \n \n }\n return count;\n }", "public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int T = sc.nextInt();\n for(int i = 0 ; i < T; i++) {\n int n = sc.nextInt();\n int a = sc.nextInt();\n int b = sc.nextInt();\n PriorityQueue<Integer> queue = new PriorityQueue<Integer>();\n int[][] m = new int[n][n];\n //n^2 * log(n)\n for(int row = 0; row < n; row++) {\n for(int col = 0; col < n; col++) {\n if(row == 0 && col == 0 && n != 1) {\n continue;\n }else if(row == 0) {\n m[row][col] = m[row][col - 1] + a;\n }else if(col == 0) {\n m[row][col] = m[row-1][col] + b;\n }else {\n m[row][col] = m[row-1][col-1] + a + b;\n }\n\n if(row + col == (n -1)) {\n pool.add(m[row][col]); //log(n)\n }\n }\n }\n //O(n*log(n))\n for (Integer item:pool) {\n queue.add(item); //O(logn)\n }\n while(!queue.isEmpty()) {\n System.out.print(queue.poll() + \" \"); //O(1)\n }\n System.out.println();\n queue.clear();\n pool.clear();\n }\n }", "public static void main(String[] args) {\nScanner s=new Scanner(System.in);\nint n=s.nextInt();\nint a[]=new int[n];\nint x=0;\nfor(int i=1;i<=n;i++)\n{\n\tif(i%2!=0)\n\t{\n\t\ta[x++]=i;\n\t}\n}\nint sum=0;\nsum=a[0];\nfor(int i=0;i<x;i++)\n{\n\tif((i+1)<x)\n\t{\n\tif(i%2==0)\n\t\tsum=sum+a[i+1];\n\telse\n\t\tsum=sum-a[i+1];\n\t}\n}\nSystem.out.println(sum);\n\t}", "private int d(@Nullable K ☃) {\r\n/* 127 */ return (xq.f(System.identityHashCode(☃)) & Integer.MAX_VALUE) % this.b.length;\r\n/* */ }\r\n/* */ private int b(@Nullable K ☃, int i) {\r\n/* */ int j;\r\n/* 131 */ for (j = i; j < this.b.length; j++) {\r\n/* 132 */ if (this.b[j] == ☃) {\r\n/* 133 */ return j;\r\n/* */ }\r\n/* 135 */ if (this.b[j] == a) {\r\n/* 136 */ return -1;\r\n/* */ }\r\n/* */ }", "static int getMissingNo (int a[], int n) \n { \n int x1 = a[0]; \n int x2 = 1; \n \n for (int i = 1; i <= n; i++) {\n if(i != n)\n x1 = x1 ^ a[i]; \n x2 = x2 ^ (i+1); \n \n }\n System.out.println(\"x2 :\"+x2);\n return (x1 ^ x2); \n \n /* //For xor of all the elements \n //in array \n for (int i = 1; i < n; i++) {\n \n System.out.print(x1+\" ^ \"+a[i]);\n x1 = x1 ^ a[i]; \n System.out.println(\"=\"+x1);\n \n }\n System.out.println(\"x1 :\"+x1);\n System.out.println(\"==\");\n //For xor of all the elements \n // from 1 to n+1 \n for (int i = 2; i <= n+1; i++) {\n \tSystem.out.print(x2+\" ^ \"+i);\n x2 = x2 ^ i; \n System.out.println(\"=\"+x2);\n }\n \n System.out.println(\"x2 :\"+x2);\n return (x1 ^ x2); */\n }", "public static int firstMissingEffective(int[] x){\n int i = 0;\n while(i<x.length){\n // first two conditions check that element can correspond to index of array\n // third condition checks that they are not in their required position\n // fourth condition checks that there is no duplicate already at their position\n if( x[i]>0 && x[i]<x.length && x[i]-1!=i && x[x[i]-1]!=x[i]) exch(x,i,x[i]-1);\n else i++;\n }\n\n // second pass\n for(int j=0; j < x.length; j++){\n if( x[j]-1!=j) return j+1;\n }\n return x.length+1;\n\n }", "public int findFirstUniqueNumber (List<Integer> numberList) {\n\n ////// Solution 1:\n LinkedHashMap<Integer, Integer> occurMap = new LinkedHashMap<>();\n\n for (int number: numberList) { // O(n)\n if (occurMap.containsKey(number) && occurMap.get(number) != 0) {\n occurMap.replace(number, occurMap.get(number), 0);\n }\n occurMap.putIfAbsent(number, 1);\n }\n\n for (Map.Entry<Integer, Integer> entry: occurMap.entrySet()) {\n if (entry.getValue() == 1) {\n return entry.getKey();\n }\n }\n\n ////// Solution 2: O(n * n)\n// for (int n: numberList) {\n// if (numberList.indexOf(n) == numberList.lastIndexOf(n)) { // O(n * n)\n// return n;\n// }\n// }\n\n return -1;\n }", "@Override\r\n public long problem1(int size) {\r\n StringBuilder sb = new StringBuilder();\r\n long start = System.currentTimeMillis();\r\n for (int i=0; i<size; i++) {\r\n sb.append(i);\r\n }\r\n long end = System.currentTimeMillis();\r\n return end - start;\r\n }", "public static ArrayList<ArrayList<Integer>> fourSum(ArrayList<Integer> a, int k) {\n Collections.sort(a);\n System.out.println(a);\n LinkedHashMap<Integer, List<List<Integer>>> m = new LinkedHashMap<Integer, List<List<Integer>>>();\n for (int i = 0; i <= a.size() - 3; i++) {\n for (int j = i + 1; j <= a.size() - 2; j++) {\n if (m.get(a.get(i) + a.get(j)) == null) {\n ArrayList<List<Integer>> v = new ArrayList<List<Integer>>();\n List<Integer> c = new ArrayList<Integer>();\n c.add(i);\n c.add(j);\n v.add(c);\n m.put(a.get(i) + a.get(j), v);\n } else {\n List<List<Integer>> v = m.get(a.get(i) + a.get(j));\n List<Integer> c = new ArrayList<Integer>();\n c.add(i);\n c.add(j);\n v.add(c);\n m.put(a.get(i) + a.get(j), v);\n }\n\n }\n }\n LinkedHashSet<ArrayList<Integer>> res = new LinkedHashSet<ArrayList<Integer>>();\n for (int i = 2; i <= a.size() - 1; i++) {\n for (int j = i + 1; j < a.size(); j++) {\n List<List<Integer>> v = m.get(k - (a.get(i) + a.get(j)));\n if (v != null && v.size() >= 1) {\n for (List<Integer> l : v) {\n\n if (l.get(0) < l.get(1) && l.get(1) < i && l.get(1) < j) {\n //System.out.println(l.get(0) + \" \" + l.get(1) + \" \" + i + \" \" + j);\n ArrayList<Integer> out = new ArrayList<Integer>();\n out.add(a.get(l.get(0)));\n out.add(a.get(l.get(1)));\n out.add(a.get(i));\n out.add(a.get(j));\n Collections.sort(out);\n //System.out.println(out);\n res.add(out);\n }\n }\n }\n }\n }\n return new ArrayList<ArrayList<Integer>>(res);\n }", "public static void process(int n){\n\t\tint right, left, i;\n\n\t\tright = i = 0;\n\t\twhile(i < n){\n\t\t\twhile (right < n && c[i] == c[right]) right++;\n\t\t\tfor(int j = i; j < right; ++j) max_right[j] = right;\n\t\t\ti = right;\n\t\t}\n\n\t\tleft = i = n-1;\n\t\twhile(i >= 0){\n\t\t\twhile (left >= 0 && c[i] == c[left]) left--;\n\t\t\tfor (int j = i; j > left; --j) max_left[j] = left;\n\t\t\ti = left;\n\t\t}\n\t}", "private static void get4ElementsSumCountFastest(String inputLine, int target) {\n String[] arr = inputLine.split(\" \");\n if (arr.length < 3) {\n System.out.println(0);\n return;\n }\n\n Map<Integer, Set<String>> pairSumMap = new HashMap<>();\n List<Integer> list = new ArrayList<>(arr.length);\n for (String s : arr) {\n list.add(Integer.parseInt(s.trim()));\n }\n\n int sum = 0, diff = 0;\n for (int i = 0; i < arr.length; i++) {\n for (int j = i + 1; j < arr.length; j++) {\n sum = list.get(i) + list.get(j);\n if (sum < target) {\n pairSumMap.putIfAbsent(sum, new HashSet<>());\n pairSumMap.get(sum).add(i + \"-\" + j);\n }\n }\n }\n\n for (Map.Entry<Integer, Set<String>> mk : pairSumMap.entrySet()) {\n diff = target - mk.getKey();\n if (pairSumMap.containsKey(diff)) {\n Set<String> indexesList = mk.getValue();\n for (String index : indexesList) {\n int indexOrgX = Integer.parseInt(index.split(\"-\")[0]);\n int indexOrgY = Integer.parseInt(index.split(\"-\")[1]);\n for (String newIdx : pairSumMap.get(diff)) {\n int indexNewX = Integer.parseInt(newIdx.split(\"-\")[0]);\n int indexNewY = Integer.parseInt(newIdx.split(\"-\")[1]);\n if (indexOrgX != indexNewX && indexOrgX != indexNewY && indexOrgY != indexNewX && indexOrgY != indexNewY) {\n System.out.println(1);\n return;\n }\n }\n }\n }\n }\n System.out.println(0);\n }", "public boolean linearIn(int[] outer, int[] inner) {\r\n int comp=0; // O(1)\r\n int count=0; // O(1)\r\n if(inner.length==0) // O(1)\r\n return true; // O(1)\r\n for(int i=0; i<outer.length; i++) { // O(n)\r\n if(outer[i]==inner[count]) { // O(1)\r\n comp++; // O(1)\r\n count++; // O(1)\r\n } else if(outer[i]>inner[count]) // O(1)\r\n return false; // O(1)\r\n if (comp==inner.length) // O(1)\r\n return true; // O(1)\r\n }\r\n return false; // O(1)\r\n}", "public static void main(String args[])\n {\n Scanner in = new Scanner(System.in);\n int n = in.nextInt();\n int ar[] = new int[n];\n for(int i=0 ; i<n ; i++)\n {\n \n ar[i] = in.nextInt(); \n }\n for(int j=1; j<=n;j++)\n { int count =0;\n for(int k=0 ; k<n ; k++) \n { \n if(j==ar[k])\n count++;\n \n }\n if(count == 0)\n {\n System.out.print(j); \n \n }\n }\n}", "static void UseArrayList(ArrayList<Integer> myList2){\r\n\t\tLong start = System.currentTimeMillis();\r\n\t\tfor (int n=0; n<myList2.size();n++)\r\n\t\t{\r\n\t\t\tfor (int m=n+1; m<myList2.size();m++){\r\n\t\t\t\tif( myList2.get(n)== myList2.get(m) ) {System.out.println(\"Duplicate found \"+myList2.get(n));}\r\n\t\t\t}\r\n\t\t}\r\n\t\tLong End = System.currentTimeMillis();\r\n\t\tSystem.out.println(\"Total time taken for executing this code is: \" + (End-start));\r\n\t}", "public void missingNumberEfficient2(int[] array, int n) {\n\t\t\n\t\tint X = 0;\n\t\tint Y = 0;\n\t\t\n\t\tfor(int i = 0; i < array.length; i++) {\n\t\t\tX ^= array[i];\n\t\t}\n\t\t\n\t\tfor(int i = 1; i <= n; i++) {\n\t\t\tY ^= i;\n\t\t}\n\t\t\n\t\tSystem.out.println(\"Missing Number is : \" + (X ^ Y));\n\t}", "public static List<Integer> solution2(int n) {\n List<Integer> rs=new ArrayList<Integer>();\n rs.add(0);\n for(int i=0;i<n;i++){\n int size=rs.size();\n for(int k=size-1;k>=0;k--)\n rs.add(rs.get(k) | 1<<i);\n }\n return rs;\n }", "public static void main(String[] args) {\n\n pairsSum();\n\n printAllSubArrays();\n\n tripletZero();\n\n // int[][] sub = subsets();\n\n PairsSum sum = new PairsSum();\n int[] arr = { 10, 1, 2, 3, 4, 5, 6, 1 };\n boolean flag = sum.almostIncreasingSequence(arr);\n System.out.println(flag);\n\n String s = \"\";\n for (int i = 0; i < 100000; i++) {\n // s += \"CodefightsIsAwesome\";\n }\n long start = System.currentTimeMillis();\n // int k = subStr(s, \"IsA\");\n System.out.println(System.currentTimeMillis() - start);\n // System.out.println(k);\n\n String[] a = { \"aba\", \"aa\", \"ad\", \"vcd\", \"aba\" };\n String[] b = sum.allLongestStrings(a);\n System.out.println(Arrays.deepToString(b));\n\n List<String> al = new ArrayList<>();\n al.toArray();\n\n Map<Integer, Integer> map = new HashMap<>();\n Set<Integer> keySet = map.keySet();\n for (Integer integer : keySet) {\n\n }\n\n String st = reverseBracksStack(\"a(bc(de)f)g\");\n System.out.println(st);\n\n int[] A = { 1, 2, 3, 2, 2, 3, 3, 33 };\n int[] B = { 1, 2, 2, 2, 2, 3, 2, 33 };\n\n System.out.println(sum.isIPv4Address(\"2.2.34\"));\n\n Integer[] AR = { 5, 3, 6, 7, 9 };\n int h = sum.avoidObstacles(AR);\n System.out.println(h);\n\n int[][] image = { { 36, 0, 18, 9 }, { 27, 54, 9, 0 }, { 81, 63, 72, 45 } };\n int[][] im = { { 7, 4, 0, 1 }, { 5, 6, 2, 2 }, { 6, 10, 7, 8 }, { 1, 4, 2, 0 } };\n int[][] res = sum.boxBlur(im);\n\n for (int i = 0; i < res.length; i++) {\n for (int j = 0; j < res[0].length; j++) {\n System.out.print(res[i][j] + \" \");\n }\n System.out.println();\n }\n\n boolean[][] ms = { { true, false, false, true }, { false, false, true, false }, { true, true, false, true } };\n int[][] mines = sum.minesweeper(ms);\n for (int i = 0; i < mines.length; i++) {\n for (int j = 0; j < mines[0].length; j++) {\n System.out.print(mines[i][j] + \" \");\n }\n System.out.println();\n }\n\n System.out.println(sum.variableName(\"var_1__Int\"));\n\n System.out.println(sum.chessBoard());\n\n System.out.println(sum.depositProfit(100, 20, 170));\n\n String[] inputArray = { \"abc\", \"abx\", \"axx\", \"abx\", \"abc\" };\n System.out.println(sum.stringsRearrangement(inputArray));\n\n int[][] queens = { { 1, 1 }, { 3, 2 } };\n int[][] queries = { { 1, 1 }, { 0, 3 }, { 0, 4 }, { 3, 4 }, { 2, 0 }, { 4, 3 }, { 4, 0 } };\n boolean[] r = sum.queensUnderAttack(5, queens, queries);\n\n }", "private int gameV(int i, int j, int x) {\n int count = 2;\n for (int ii = 0; ii < i; ii++) {\n for (int jj = ii + 1; jj < n; jj++) {\n if (ii != x && jj != x) count++;\n }\n }\n for (int jj = i + 1; jj < j; jj++) {\n if (jj != x) count++;\n }\n return count;\n }", "public static int degreeOfArray(List<Integer> arr) { arr.length = n\n // num of Keys = k\n // O(n + k)\n // max value count = m\n //\n PriorityQueue<Node> pq = new PriorityQueue<>((i, j)-> j.count - i.count);\n Map<Integer, NodePosition> posMap = new HashMap<>();\n Map<Integer, Node> countMap = new HashMap<>();\n // [1, 2, 3, 4, 5, 6]\n for (int i = 0; i < arr.size(); i++) {\n int cur = arr.get(i);\n\n if (!countMap.containsKey(cur)) {\n countMap.put(cur, new Node(cur, 1));\n } else {\n Node curNode = countMap.get(cur);\n curNode.count++;\n countMap.put(cur, curNode);\n }\n\n if (!posMap.containsKey(cur)) {\n posMap.put(cur, new NodePosition(i, i));\n } else {\n NodePosition curNodePos = posMap.get(cur);\n curNodePos.endIndex = i;\n posMap.put(cur, curNodePos);\n }\n }\n //Iterator<Map.Entry<Integer, Node> it = new Iterator<>(countMap);\n for (Map.Entry<Integer, Node> e : countMap.entrySet()) {\n pq.add(e.getValue());\n }\n\n // [1, 2, 1, 3 ,2]\n // 1 , 2 , 3\n Node curNode = pq.remove();\n int maxCount = curNode.count;\n\n int minRange = posMap.get(curNode.num).endIndex - posMap.get(curNode.num).startIndex;\n\n while (!pq.isEmpty() && maxCount == pq.peek().count) {\n curNode = pq.remove();\n NodePosition nPos = posMap.get(curNode.num);\n minRange = Math.min(minRange, nPos.endIndex - nPos.startIndex);\n }\n\n return minRange + 1;\n }", "public List<List<Integer>> threeSum(int[] nums) {\n List<List<Integer>> result = new ArrayList<>(nums.length);\n\n // Prepare\n Arrays.sort(nums);\n// int firstPositiveIndex = 0;\n// int negativeLength = 0;\n// List<Integer> numsFiltered = new ArrayList<>();\n// for (int i = 0; i < nums.length; i++) {\n// if (i == 0 || i == 1 || nums[i] == 0 || (nums[i] != nums[i-2])) {\n// numsFiltered.add(nums[i]);\n// if ((nums[i] >= 0) && (firstPositiveIndex == 0)) {\n// firstPositiveIndex = numsFiltered.size() - 1;\n// }\n// if ((nums[i] <= 0)) {\n// negativeLength = numsFiltered.size();\n// }\n// }\n// }\n// nums = numsFiltered.stream().mapToInt(i->i).toArray();\n\n // Func\n\n for(int i=0; (i < nums.length) && (nums[i] <= 0); i++) {\n if (i != 0 && nums[i] == nums[i-1]) {\n continue;\n }\n for(int j=i+1; j<nums.length; j++) {\n if (j != i+1 && nums[j] == nums[j-1]) {\n continue;\n }\n for(int k=nums.length-1; (k>j) && nums[k] >= 0; k--) {\n if (k != nums.length-1 && nums[k] == nums[k+1]) {\n continue;\n }\n int sum = nums[i]+nums[j]+nums[k];\n if (sum > 0) {\n continue;\n } else if (sum < 0) {\n break;\n }\n\n List<Integer> ok = new ArrayList<>();\n ok.add(nums[i]);\n ok.add(nums[j]);\n ok.add(nums[k]);\n result.add(ok);\n break;\n }\n }\n }\n\n// System.out.println(\"Finish time = \" + (System.nanoTime() - start) / 1_000_000);\n// System.out.println(\"result size = \" + result.size());\n\n return result;\n }", "public static void main(String[] args) {\r\n Scanner sc= new Scanner(System.in);\r\n int n = sc.nextInt();\r\n int[] arr = new int[n];\r\n //getting all the numbers\r\n for(int i=0;i<n;i++)\r\n arr[i]=sc.nextInt();\r\n //assigning 0th element as unique\r\n int unique=0;\r\n unique=arr[0];\r\n for(int i=1;i<arr.length;i++)\r\n {\r\n unique^=arr[i];\r\n }\r\n System.out.println(unique);\r\n\r\n\t}", "static int uniqueNumbers(int arr[], int n)\n {\n // Sorting the given array\n Arrays.sort(arr);\n\n // This array will store the frequency\n // of each number in the array\n // after performing the given operation\n int freq[] = new int[n + 2];\n\n // Initialising the array with all zeroes\n for(int i = 0; i < n + 2; i++)\n freq[i] = 0;\n\n // Loop to apply operation on\n // each element of the array\n for (int x = 0; x < n; x++) {\n\n // Incrementing the value at index x\n // if the value arr[x] - 1 is\n // not present in the array\n if (freq[arr[x] - 1] == 0) {\n freq[arr[x] - 1]++;\n }\n\n // If arr[x] itself is not present, then it\n // is left as it is\n else if (freq[arr[x]] == 0) {\n freq[arr[x]]++;\n }\n\n // If both arr[x] - 1 and arr[x] are present\n // then the value is incremented by 1\n else {\n freq[arr[x] + 1]++;\n }\n }\n\n // Variable to store the number of unique values\n int unique = 0;\n\n // Finding the unique values\n for (int x = 0; x <= n + 1; x++) {\n if (freq[x] != 0) {\n unique++;\n }\n }\n\n // Returning the number of unique values\n return unique;\n }", "private static void sortAccording(int A1[], int A2[], int m, int n)\n {\n // The temp array is used to store a copy \n // of A1[] and visited[] is used to mark the \n // visited elements in temp[].\n int temp[] = new int[m], visited[] = new int[m];\n for (int i = 0; i < m; i++)\n {\n temp[i] = A1[i];\n visited[i] = 0;\n }\n \n // Sort elements in temp\n Arrays.sort(temp);\n \n // for index of output which is sorted A1[]\n int ind = 0; \n \n // Consider all elements of A2[], find them\n // in temp[] and copy to A1[] in order.\n for (int i = 0; i < n; i++){\n\n // Find index of the first occurrence\n // of A2[i] in temp\n int f = first(temp, 0, m-1, A2[i], m);\n \n // If not present, no need to proceed\n if (f == -1) \n continue;\n \n // Copy all occurrences of A2[i] to A1[]\n for (int j = f; (j < m && temp[j] == A2[i]); j++){\n \n A1[ind++] = temp[j];\n visited[j] = 1;\n }\n }\n \n // Now copy all items of temp[] which are \n // not present in A2[]\n for (int i = 0; i < m; i++)\n if (visited[i] == 0)\n A1[ind++] = temp[i];\n }", "public static int f3(int N) {\n \n // O(1)\n if (N == 0) return 1;\n else{ \n \n int x = 0;\n // O(N)\n for(int i = 0; i < N; i++)\n x += f3(N-1);\n return x;\n }\n }", "public int solution(int[] A) {\n Set<Integer> set = new HashSet<>();\n\n for(int i=1; i < A.length+1; i++)\n set.add(i);\n\n for(int i=0; i < A.length; i++)\n {\n if(set.contains(A[i]))\n set.remove(A[i]);\n\n else\n set.add(A[i]); \n }\n\n if(set.isEmpty())\n return 1;\n\n return 0;\n }", "public static void findTriplets(int[] arr,int n)\n {\n boolean found = false;\n for (int i=0;i<n-2;i++)\n {\n for (int j=i+1; j<n-1; j++)\n {\n for(int k=j+1; k<n;k++)\n {\n if(arr[i]+arr[j]+arr[k] == 0)\n {\n System.out.println(arr[i]);\n System.out.println(\" \");\n System.out.println(arr[j]);\n System.out.println(\" \");\n System.out.println(arr[k]);\n System.out.println(\"\\n\");\n found = true;\n }\n }\n }\n }\n //if no triplet with 0 sum found in arrat\n if(found == false)\n System.out.println(\"not exist\");\n }", "public static void main(String[] args) {\nScanner sc=new Scanner(System.in);\r\nint n=sc.nextInt();\r\n\r\nList<Integer> l=new ArrayList<Integer>();\r\nfor(int i=1;i<=n;i++){\r\n\tif(i%2!=0)\r\n\t{\r\n\t\tl.add(i);\r\n\t}\r\n}\r\n\tSystem.out.println(l);\r\n\tint n1=l.get(0);\r\n\tfor(int i=0;i<l.size();i++){\r\n\tif(i%2==0)\r\n\t\r\n\t\tn1=n1-l.get(i);\r\n\t//System.out.println(s);\r\n\telse\r\n\t\tn1=n1+l.get(i);\r\n\t}\r\n\tSystem.out.println(n1+1);\r\n\t}", "private static void second(int[] arr, int sum){\n\n Map<Integer,Boolean> map = new Hashtable<>();\n\n for(int i:arr){\n\n if (map.containsKey(sum - i)){\n System.out.println(i + \" , \" + (sum-i));\n }\n else{\n map.put(i, true);\n }\n\n }\n\n }", "public int removeDuplicates(int[] nums) {\n int n = nums.length;\n if (n == 0 || n == 1) {\n return n;\n }\n int i = 1;\n int j = i;\n int last = nums[i - 1]; //Starting with the second pointer to avoid edge cases.\n while (i < n && j < n) {\n if (last == nums[j]) { //Comparing last seen.\n j++;\n } else {\n last = nums[j];\n nums[i] = last;\n i++;\n j++;\n }\n }\n return i; //i tracks the current location and hence the end of the array.\n }", "@Override public short getComplexity() {\n return 0;\n }", "private static void findDuplicatesByHashTable(int[] arr) {\n\t\t\n\t\t\n\t\tHashMap<Integer, Integer> map = new HashMap<Integer, Integer>();\n\t\t\n\t\tfor(int i=0; i<arr.length ; i++)\n\t\t{\n\t\t\tif(!map.containsKey(arr[i]))\n\t\t\t{\n\t\t\t\tmap.put(arr[i], 1);\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tmap.put(arr[i], map.get(arr[i])+1);\n\t\t\t}\n\t\t}\n\t\t\n\t\tfor ( Map.Entry<Integer, Integer> entry : map.entrySet() )\n\t\t{\n\t\t\tif(entry.getValue() > 1 )\n\t\t\t{\n\t\t\t\tSystem.out.println(\" Duplicate is by HashTable \" + entry.getKey());\n\t\t\t}\n\t\t}\n\t\t\n\t\t\n\t}", "static int[] find2(int a[]){\r\n int sum = a[0];\r\n int pro = a[0];\r\n for(int i=1;i<a.length;i++){\r\n sum += a[i];\r\n pro += a[i]*a[i];\r\n }\r\n int s = (n*(n+1))/2 - sum;\r\n int p = (n*(n+1)*(2*n+1))/6 - pro;\r\n return solveSP(s, p);\r\n }", "public static void main(String[] args) {\n\t\tScanner sc = new Scanner(System.in);\n\t\tint n = sc.nextInt();\n\t\tint arr[] = new int[n];\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tarr[i] = sc.nextInt();\n\t\t}\n\t\tint sum = sc.nextInt();\n\t\tHashMap<Integer,Integer> map = new HashMap<>();\n \t\tArrays.sort(arr);\n\t\tfor(int i=0;i<n;i++) {\n\t\t\tint temp = arr[i];\n\t\t\tint reqSum = sum-temp;\n\t\t\tarr[i]=0;\n\t\t\tint l=0;\n\t\t\tint r = n-1;\n\t\t\twhile(l<r) {\n\t\t\t\t//System.out.println(\"l \" + l + \" r \" + r + \" i = \"+ i);\n\t\t\t\tif(arr[l] + arr[r]==reqSum && arr[l]!=0 && arr[r]!=0 ) {\n\t\t\t\t\tint arr2[] = new int[3];\n\t\t\t\t\tarr2[0] = temp;\n\t\t\t\t\tarr2[1] = arr[l];\n\t\t\t\t\tarr2[2] = arr[r];\n\t\t\t\t\tif(map.containsKey(arr2[0]) || map.containsKey(arr2[1]) || map.containsKey(arr2[2])) {\n\t\t\t\t\t\t\n\t\t\t\t\t}else {\n\t\t\t\t\t\tArrays.sort(arr2);\n\t\t\t\t\t\tSystem.out.println(arr2[0] + \" \" + arr2[1] + \" \" + arr2[2]);\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t\tl++;\n\t\t\t\t}else if(arr[l] + arr[r] < reqSum) {\n\t\t\t\t\tl++;\n\t\t\t\t\t\n\t\t\t\t}else {\n\t\t\t\t\tr--;\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\tarr[i] = temp;\t\n\t\t\tmap.put(arr[i], 1);\n\t\t}\n\t}", "public static void main(String[] args) {\n int N = 100, i, j, min;\n System.out.println(\"Value of N: \" + N);\n\n for (i = 1; i <= N; i++)\n {\n for (j = 1; j <= N; j++)\n {\n min = i < j ? i : j;\n System.out.print(N - min + 1);\n }\n System.out.println();\n\n\n\n\n }\n}", "public void sum(int n) {\n int sum = 0;\n for (int j = 0; j < n; j++) // 2n+2\n sum += j;\n for (int k = 0; k < n; k++) // 2n+2\n sum += k;\n for (int l = 0; l < n; l++) //2n+2\n sum += l;\n }", "public static int[] twoSum(int[] numbers, int target) {\n // Start typing your Java solution below\n // DO NOT write main() function\n int[] aux = new int[numbers.length];\n HashMap<Integer, Integer> valueToIndex = new HashMap<Integer, Integer>();\n for (int i = 0; i < numbers.length; i++) {\n valueToIndex.put(numbers[i], i);\n aux[i] = numbers[i];\n }\n \n int i = 0, j = numbers.length - 1;\n boolean found = false;\n \n Arrays.sort(aux);\n \n while (i != j) {\n if (aux[i] + aux[j] < target) i++;\n else if (aux[i] + aux[j] > target) j--;\n else {\n found = true;\n break;\n }\n }\n \n if (!found) return null;\n \n int[] result = new int[2];\n if (aux[i] == aux[j]) { /* Handle duplicates */\n int first = -1, second = -1;\n for (int k = 0; k < numbers.length; k++) {\n if (numbers[k] == aux[i]) {\n if (first == -1) {\n first = k;\n } else if (second == -1) {\n second = k;\n break;\n }\n }\n }\n result[0] = first + 1;\n result[1] = second + 1;\n return result;\n }\n \n \n if (valueToIndex.get(aux[i]) < valueToIndex.get(aux[j])) {\n result[0] = valueToIndex.get(aux[i]) + 1;\n result[1] = valueToIndex.get(aux[j]) + 1;\n } else {\n result[0] = valueToIndex.get(aux[j]) + 1;\n result[1] = valueToIndex.get(aux[i]) + 1;\n }\n return result;\n }", "static int gen(int n)\n{ \n int []S = new int [n + 1];\n \n S[0] = 0;\n if(n != 0)\n S[1] = 1;\n \n for (int i = 2; i <= n; i++)\n { \n \n // S(2 * n) = 4 * S(n)\n if (i % 2 == 0)\n S[i] = 4 * S[i / 2];\n \n // S(2 * n + 1) = 4 * S(n) + 1\n else\n S[i] = 4 * S[i/2] + 1;\n }\n \n return S[n];\n}", "public static void printMajorityElement(int a[], int n) {\n Map<Integer, Integer> map = new HashMap<Integer, Integer>();\n for (int i = 0; i < n; i++) {\n Integer count = map.get(a[i]);\n count = (count == null) ? 1 : count + 1;\n if (count > n/2) {\n System.out.println(a[i]);\n return;\n }\n else\n map.put(a[i], count);\n }\n System.out.println(\"NONE\");\n }", "public void log(int[] numbers) {\n\t\tSystem.out.println(); // O(1)\n\t\tfor (int number: numbers) // O(n)\n\t\t\tSystem.out.println(number);\n\t\tSystem.out.println(); // O(1)\n\t\t\n\t\t// O(2n), O(n+n)\n\t\t// We can drop 2* constant, O(n). Both represent linear growth\n\t\t// as we care only about input size\n\t\tfor (int number: numbers) // O(n)\n\t\t\tSystem.out.println(number);\n\t\tfor (int number: numbers) // O(n)\n\t\t\tSystem.out.println(number);\n\t\t\n\t\t\n\t\t\n\t}", "private int getCondensedIndex(int n, int i, int j) {\n if (i < j) {\n return n * i - (i * (i + 1) / 2) + (j - i - 1);\n }\n else if (i > j) {\n return n * j - (j * (j + 1) / 2) + (i - j - 1);\n }\n else{\n return 0;\n }\n }", "static void subsetSums(int arr[], int n)\n {\n \n // There are totoal 2^n subsets\n int total = 1 << n;\n \n // Consider all numbers from 0 to 2^n - 1\n for (int i = 0; i < total; i++) {\n int sum = 0;\n \n // Consider binary reprsentation of\n // current i to decide which elements\n // to pick.\n for (int j = 0; j < n; j++)\n if ((i & (1 << j)) != 0)\n sum += arr[j];\n \n // Print sum of picked elements.\n System.out.print(sum + \" \");\n }\n }", "public static void solve(int n, List<Integer> a) {\n Collections.sort(a);\n Collections.reverse(a);\n double sum = a.stream().mapToDouble(num -> Double.valueOf(num)).sum();\n double currentN = Double.valueOf(n);\n double currentSum = sum;\n for(Integer next : a)\n {\n double nextDouble = Double.valueOf(next);\n if(nextDouble<=currentSum/currentN)\n {\n break;\n }\n currentSum -= nextDouble;\n currentN--;\n }\n System.out.println(currentSum/currentN);\n\n\n }", "public static boolean addUpToFast(int[] array, int n){\n\t\tHashSet<Integer> hs = new HashSet<Integer>();\n\t\tfor(int i = 0; i < array.length; i++){\n\t\t\tif(hs.contains(n-array[i]))\n\t\t\t\treturn true;\n\t\t\ths.add(array[i]);\n\t\t}\n\t\treturn false;\n\t}", "static void compute(List<Integer> slate, int[] input) {\n if (input.length == 0)\n System.out.println(slate);\n else {\n int[] copy = Arrays.copyOfRange(input, 1, input.length);\n compute(slate, copy);\n slate.add(input[0]);\n compute(slate, copy);\n slate.remove(slate.size() - 1);\n }\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 }", "static long findSum(int N)\n\t{\n\t\tif(N==0) return 0;\n\t\treturn (long)((N+1)>>1)*((N+1)>>1)+findSum((int)N>>1);\n\t\t\n\t}", "public static void main(String[] args) {\n\t\tScanner sc=new Scanner(System.in);\r\n\t\tint n=sc.nextInt();\r\n\t\tint arr[]=new int[n];\r\n\t\tint sum=0;\r\n\t\tfor(int i=0;i<n;i++)\r\n\t\t{\r\n\t\t\tarr[i]=sc.nextInt();\r\n\t\t\tSystem.out.println(arr[i]);\r\n\t\t}\r\n\t\tfor(int i=0;i<n;i++)\r\n\t\t{\r\n\t\t\tfor(int j=0;j<=i;j++)\r\n\t\t\t{\r\n\t\t\t\tif(j==i)\r\n\t\t\t\t{\r\n\t\t\t\t\tsum=sum+arr[i];\r\n\t\t\t\t}\r\n\t\t\t\tif(arr[i]==arr[j]) {\r\n\t\t\t\t\t\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\tSystem.out.println(\"sum of distinct elements=\"+sum);\r\n\t\t\r\n\t\r\n\t}", "public int get_odd_occurences_optimal_v2(int[] a) {\n\t\tint result = 0;\n\t\tfor (int i = 0; i < a.length; i++) {\n\t\t\tresult ^= i;\n\t\t}\n\t\treturn result;\n\t}", "public int findDuplicate(int[] nums) {\n if(nums == null) return 0;\n\n for(int i = 0; i < nums.length; i++) {\n int index = Math.abs(nums[i]);\n if(nums[index - 1] < 0) {\n return index;\n }\n nums[index - 1] = -nums[index - 1];\n }\n return 0;\n}", "static int trappingWater(int arr[], int n) {\r\n\r\n // Your code here\r\n /** *** tle\r\n for(int i=1;i<n-1;i++){\r\n int l=arr[i];\r\n for (int j = 0; j < i; j++) {\r\n l=l < arr[j] ? arr[j] : l;\r\n }\r\n int r=arr[i];\r\n for (int j = i+1; j <n ; j++) {\r\n r=r < arr[j] ? arr[j] : r;\r\n }\r\n\r\n s=s+(l>r? r:l) -arr[i];\r\n }\r\n return s;\r\n\r\n //////////////////////////////////////////////\r\n SC=O(N)\r\n if(n<=2)\r\n return 0;\r\n int[] left=new int[n];\r\n int[] right=new int[n];\r\n left[0]=0;\r\n int leftmax=arr[0];\r\n for (int i = 1; i <n ; ++i) {\r\n left[i]=leftmax;\r\n leftmax=Math.max(leftmax,arr[i]);\r\n }\r\n right[n-1]=0;\r\n int mxright=arr[n-1];\r\n for (int i = n-2; i >=0 ; --i) {\r\n right[i]=mxright;\r\n mxright=Math.max(mxright,arr[i]);\r\n }\r\n int s=0;\r\n for (int i = 1; i < n-1; ++i) {\r\n if(arr[i]<left[i] && arr[i]<right[i]){\r\n s+=Math.min(left[i],right[i])-arr[i];\r\n }\r\n }\r\n return s;\r\n /////////////////////////////////////////////////////\r\n **/\r\n\r\n if(n<=2)\r\n return 0;\r\n\r\n int leftMax = arr[0];\r\n int rightMax = arr[n-1];\r\n\r\n int left = 1;\r\n int right = n-2;\r\n int water = 0;\r\n\r\n while(left <= right) {\r\n if (leftMax < rightMax) {\r\n if (arr[left] >= leftMax) {\r\n leftMax = arr[left];\r\n } else\r\n water = water + (leftMax - arr[left]);\r\n\r\n //leftMax = Math.max(leftMax, arr[left]);\r\n left++;\r\n } else {\r\n if (arr[right] > rightMax) {\r\n rightMax = arr[right];\r\n }\r\n\r\n water = water + (rightMax - arr[right]);\r\n right--;\r\n }\r\n }\r\n return water;\r\n\r\n }", "private static int[] p2(int[] ar, int n) {\n int[] p2 = new int[n];\n Arrays.fill(p2, n);\n Stack<Integer> st = new Stack<>();\n for (int i = 0; i < n; i++) {\n while (st.size() != 0 && ar[i] < ar[st.peek()]) {\n p2[st.peek()] = i;\n st.pop();\n }\n st.push(i);\n }\n return p2;\n }", "private static int solution(final int[] A)\n {\n Arrays.sort(A);\n\n for(int i=0; i<A.length - 1; i=i+2)\n {\n if (A[i] != A[i + 1])\n {\n return A[i];\n }\n }\n\n return A[A.length - 1];\n }", "private static void findDuplicatesBruteForce(int[] arr) {\n\t\t\n\t\tfor(int i = 0; i< arr.length ; i++)\n\t\t{\n\t\t\tfor ( int j = i+1 ; j < arr.length ; j++)\n\t\t\t{\n\t\t\t\tif(arr[i] == arr[j])\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(arr[i] + \" is duplicate by brute force method\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t}", "public static void main(String[] args) {\n\t\tScanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));\r\n\t\tint n = sc.nextInt();\r\n\t\tint[] a = new int[n];\r\n\t\tfor(int i = 0; i < n; i++){\r\n\t\t\ta[i] = sc.nextInt();\r\n\t\t}\r\n\t\tint res = 0, p = 0, t = 0;\r\n\t\twhile(true){\r\n\t\t\tp = 0; t = 0;\r\n\t\t\tfor(int i = 0; i < a.length; i++){\r\n\t\t\t\t\r\n\t\t\t\tif(i == a.length-1){\r\n\t\t\t\t\ta[i] /= 2;\r\n\t\t\t\t\tt = a[i];\r\n\t\t\t\t\ta[i] += p;\r\n\t\t\t\t\tp = t;\r\n\t\t\t\t\ta[0] += p;\r\n\t\t\t\t}\r\n\t\t\t\telse{\r\n\t\t\t\t\ta[i] /= 2;\r\n\t\t\t\t\tt = a[i];\r\n\t\t\t\t\ta[i] += p;\r\n\t\t\t\t\tp = t;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tboolean flag = true;\r\n\t\t\tint temp = a[0];\r\n\t\t\tfor(int j = 1; j < a.length; j++){\r\n\t\t\t\tif(a[j] != temp){\r\n\t\t\t\t\tflag = false;\r\n\t\t\t\t\tbreak;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tif(flag){\r\n\t\t\t\tSystem.out.println(res);\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tfor(int j = 0; j < a.length; j++){\r\n\t\t\t\tif(a[j] % 2 != 0){\r\n\t\t\t\t\ta[j] += 1;\r\n\t\t\t\t\tres++;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}", "public static void cntArray(int A[], int N) \n { \n // initialize result with 0 \n int result = 0; \n \n for (int i = 0; i < N; i++) { \n \n // all size 1 sub-array \n // is part of our result \n result++; \n \n // element at current index \n int current_value = A[i]; \n \n for (int j = i + 1; j < N; j++) { \n \n // Check if A[j] = A[i] \n // increase result by 1 \n if (A[j] == current_value) { \n result++; \n } \n } \n } \n \n // print the result \n System.out.println(result); \n }", "static int recursiva1(int n)\n\t\t{\n\t\tif (n==0)\n\t\t\treturn 10; \n\t\tif (n==1)\n\t\t\treturn 20; \n\t\treturn recursiva1(n-1) - recursiva1 (n-2);\t\t\n\t\t}", "public static void main(String args[]) {\n Scanner sc = new Scanner(System.in);\n System.out.println(\"Enter the size of the array\");\n int n = sc.nextInt();\n int arr[] = new int[n];\n System.out.println(\"enter the elements in the array\");\n for (int i = 0; i < arr.length; i++) {\n arr[i] = sc.nextInt();\n }\n HashSet<Integer> set = new HashSet<Integer>();\n for (int k = 0; k < n; k++) {\n set.add(arr[k]);\n }\n LinkedList list = new LinkedList(set);\n for (int l = 0; l < list.size(); l++) {\n int val = ((Integer) list.get(l)).intValue();\n if (duplicate(arr, val) > 1)\n System.out.println(\"Occurence of \" + val + \" is \" + duplicate(arr, val));\n }\n }", "public static void getLeastNumbers_2(int[] input, int[] output) {\n int start = 0;\n int end = input.length - 1;\n int k = output.length;\n int index = partition(input, start, end);\n while(index != k - 1) {\n if(index > k - 1) {\n end = index - 1;\n index = partition(input, start, end);\n }\n else {\n start = index + 1;\n index = partition(input, start, end);\n }\n }\n \n for(int i = 0; i < k; ++i)\n output[i] = input[i];\n }", "public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int noOfElements = sc.nextInt();\n int[] arr = new int[noOfElements];\n int[] arr1 = new int[noOfElements];\n int diff = Integer.MAX_VALUE;\n int sIndex = 0;\n int j = 0;\n for (int i = 0; i < noOfElements; i++) {\n arr[i] = sc.nextInt();\n }\n for (int j1 = 1; j1 < noOfElements; j1++) {\n int i = j1 - 1;\n int key = arr[j1];\n while (i >= 0 && key < arr[i]) { // 1 2 3\n arr[i + 1] = arr[i];\n i--;\n }\n arr[i + 1] = key;\n }\n //Arrays.sort(arr);\n for (int i = 0; i < noOfElements - 1; i++) {\n int temp = Math.abs(arr[i] - arr[i + 1]);\n if (temp <= diff) {\n diff=temp;\n }\n\n }\n\n for (int i = 0; i < noOfElements - 1; i++) {\n if (Math.abs(arr[i] - arr[i+1]) == diff) {\n System.out.print(arr[i] + \" \" + arr[i+1] + \" \");\n }\n }\n// for (int a = 0; a < j; a++) {\n//\n// System.out.print(arr[arr1[a]] + \" \" + arr[arr1[a]+1] + \" \");\n// }\n\n }", "private static int[] p1(int[] ar, int n) {\n int[] p1 = new int[n];\n Arrays.fill(p1, -1);\n Stack<Integer> st = new Stack<>();\n for (int i = 0; i < n; i++) {\n while (st.size() != 0 && ar[i] <= ar[st.peek()]) {\n st.pop();\n }\n if (st.size() != 0) {\n p1[i] = st.peek();\n }\n st.push(i);\n }\n return p1;\n }", "public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int n = sc.nextInt();\n int[] arr = new int[n];\n ArrayList<Integer> set = new ArrayList<>();\n for(int i=0;i<n;i++)\n {\n arr[i] = sc.nextInt();\n \n if(!set.contains(arr[i]))\n set.add(arr[i]);\n }\n \n HashMap<Integer,Integer> map = new HashMap<>();\n for(int i:arr)\n {\n if(map.containsKey(i))\n map.put(i,map.get(i)+1);\n else\n map.put(i,1);\n }\n \n for(int i:set)\n {\n System.out.println(i+\" : \"+map.get(i));\n }\n \n \n }", "static int[] productExceptSelfSpaceOptimized(int[] nums) {\n int n = nums.length;\n int[] result = new int[n];\n Arrays.fill(result, 1);\n int curr = 1;\n\n for (int i = 0; i < n; i++) {\n result[i] *= curr;\n curr *= nums[i];\n }\n\n curr = 1;\n for (int i = n - 1; i >= 0; i--) {\n result[i] *= curr;\n curr *= nums[i];\n }\n\n return result;\n }", "static int findMajority(int arr[], int n) {\n int res = 0, count = 1;\n\n for (int i = 1; i < n; i++) {\n if (arr[res] == arr[i])\n count++;\n else\n count--;\n if (count == 0) {\n res = i;\n count = 1;\n }\n }\n\n count = 0;\n for (int i = 0; i < n; i++) {\n if (arr[res] == arr[i])\n count++;\n\n }\n if (count < n / 2)\n res = -1;\n return res;\n }", "public static void a2v2(int[] A)\n {\n Map<Integer, List<Integer>> hashMap = new HashMap<>();\n\n insert(hashMap, 0, -1);\n\n int sum = 0;\n\n for (int i = 0; i < A.length; i++)\n {\n sum += A[i];\n\n if (hashMap.containsKey(sum))\n {\n List<Integer> list = hashMap.get(sum);\n\n // find all subarrays with the same sum\n for (Integer value: list)\n {\n System.out.println(\"Subarray [\" + (value + 1) + \"…\" +\n i + \"]\");\n }\n }\n\n // insert (sum so far, current index) pair into the hashmap\n insert(hashMap, sum, i);\n }\n }", "public int findDuplicatesB(int[] input) {\n ArrayList<Integer> nonDuplicates = new ArrayList<>();\n for (int value : input) {\n if (!nonDuplicates.contains(value)) {\n nonDuplicates.add(value);\n }\n }\n return input.length - nonDuplicates.size();\n }", "static void heapify1(Vector<Integer> arr, int n, int i) {\r\n\t\tint s = i;\r\n\t\tint l = 2 * i + 1;\r\n\t\tint r = l + 1;\r\n\r\n\t\tif (r < n && arr.get(s) > arr.get(r)) {\r\n\t\t\ts = r;\r\n\t\t}\r\n\t\tif (l < n && arr.get(s) > arr.get(l)) {\r\n\t\t\ts = l;\r\n\t\t}\r\n\t\tif (s != i) {\r\n\t\t\tint temp = arr.get(i);\r\n\t\t\tarr.set(i, arr.get(s));\r\n\t\t\tarr.set(s, temp);\r\n\t\t\theapify1(arr, n, s);\r\n\t\t}\r\n\t}", "public int singles(int [] arr){\n HashMap<Integer, Integer> hm = new HashMap<>();\n long s1 = 0, s2 = 0;\n for(int x = 0; x < arr.length; x++){\n if(!hm.containsKey(arr[x])){\n s1 += arr[x];\n hm.put(arr[x], 1);\n }\n s2 += arr[x];\n }\n return (int)(2* s1 - s2);\n }" ]
[ "0.71008056", "0.7068778", "0.6518176", "0.63393646", "0.6095544", "0.6081848", "0.6060391", "0.6034665", "0.6032773", "0.6010068", "0.60010105", "0.5918397", "0.5863614", "0.58377576", "0.5806524", "0.5800207", "0.5766363", "0.572054", "0.56917137", "0.56645703", "0.56618", "0.5650327", "0.5641899", "0.56223613", "0.5586328", "0.5572819", "0.5569426", "0.5544909", "0.5541912", "0.55365837", "0.55293196", "0.55240893", "0.551748", "0.5513724", "0.5469584", "0.54615325", "0.54466325", "0.5434071", "0.54329056", "0.54129016", "0.53999585", "0.5394798", "0.53765184", "0.53756154", "0.53746665", "0.53711", "0.53566295", "0.53443396", "0.5339763", "0.5335892", "0.5333473", "0.5331652", "0.53294176", "0.5328544", "0.53281254", "0.5327551", "0.5326568", "0.53262067", "0.5319442", "0.5318481", "0.53083795", "0.5307837", "0.53076214", "0.53052765", "0.53039056", "0.52987415", "0.52971405", "0.52955455", "0.5294071", "0.52862746", "0.52761436", "0.52669793", "0.52604157", "0.5257175", "0.52558714", "0.52539974", "0.52510893", "0.52491045", "0.5248951", "0.5247466", "0.5243882", "0.5242645", "0.523879", "0.5237239", "0.52318066", "0.52285314", "0.5221654", "0.5221493", "0.52171016", "0.52160823", "0.5215953", "0.5215782", "0.5207918", "0.52050716", "0.52034914", "0.52024925", "0.52020127", "0.5200127", "0.5189005", "0.5185755", "0.5184923" ]
0.0
-1
First the sections content.
private void populateOutputFile(List<String> sectionIds, Map<String, DocumentSection> sections) { for (String sectionId : sectionIds) { String id = sections.get(sectionId).getId(); String description = sections.get(sectionId).getDescription(); Utils.println(id + " " + description); mOutputBuilder.addDocumentSection(id, description); } // Then the RTM content. mRTMSectionExtractor.populateOutputFile(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Section getSection();", "public String getSection(){\n return sectionsText;\n }", "@Override\r\n\tpublic T first() {\n\t\treturn head.content;\r\n\t}", "@Override\n\tpublic int getSectionForPosition(final int arg0) {\n\t\treturn 0;\n\t}", "public Element first() {\n if(isEmpty()) return null;\n else return header.getNextNode().getContent();\n }", "@Override\n public Object[] getSections() {\n return null;\n }", "public String getSection() {\n return section;\n }", "public String getSection() {\n return section;\n }", "@Test\n\tpublic void section1DisplaysParagraph() {\n\t\tassertTrue(AccordionLogic.section1DisplaysParagraph());\n\t}", "public String getSection(){\n return mSection;\n }", "public abstract Collection<String> getSections();", "public Section getSection(int pos) {\n\t\t\n\t\tif (pos < 0 || pos >= rawText.length()) {\n\t\t\tthrow new IndexOutOfBoundsException();\n\t\t}\n\t\t\n\t\tint i = 0;\n\t\twhile (i != sections.size() && pos > sections.get(i).getPosition()) {\n\t\t\ti++;\n\t\t}\n\t\tif (i == 0) {\n\t\t\treturn null;\n\t\t} else {\n\t\t\treturn sections.get(i-1);\n\t\t}\n\t}", "private void populateSection1() {\r\n\t\t\r\n\t\tJTextArea section1 = new JTextArea(\"Blah blah blah\");\r\n\t\t// set alignment\r\n\t\tsection1.setFont(new Font(\"DejaVu Sans\", Font.PLAIN, 10));\r\n\t\tsection1.setForeground(Color.WHITE);\r\n\t\tadd(section1);\r\n\t\t\r\n\t}", "public List<WebPage> getSections(HttpSession session) {\r\n\t\tUtilHttpSession hos = new UtilHttpSession(session);\r\n\t\tUsers user = getUser(hos.getloggedUserId());\r\n\t\tif(user.getProfile().getUpId().equals(1)){\r\n\t\t\treturn getSections();\r\n\t\t}\r\n\t\telse{\r\n\t\t\tList<WebPage> sections = new ArrayList<WebPage>();\r\n\t\t\tSet<AProfilePages> app = user.getProfile().getAProfilePageses();\r\n\t\t\tfor (Iterator<AProfilePages> iterator = app.iterator(); iterator.hasNext();) {\r\n\t\t\t\tAProfilePages profilePages = (AProfilePages) iterator.next();\r\n\t\t\t\tif(profilePages.getWebPage().getPageType().equals(PageType.SECTION())){\r\n\t\t\t\t\tsections.add((Section)getSection(profilePages.getWebPage().getWpId()));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\treturn sections;\t\r\n\t\t}\r\n\t\t\r\n\t}", "public Section getSection() {\n return _section;\n }", "public void startContent() {\n iTextContext.pageNumber().startMainMatter();\n }", "@Override\n public Object[] getSections() {\n if (getService().getAllMoviesSelectedSortIndex() == 0) {\n return actualSections.toArray();\n }\n if (getService().getAllMoviesSelectedSortIndex() == 2) {\n return actualSections.toArray();\n }\n return null;\n }", "@Override\n\tpublic Object visitSection(Section section) {\n\t\treturn null;\n\t}", "@Override\n\t\tpublic int getPositionForSection(int arg0) {\n\t\t\treturn 0;\n\t\t}", "public E first() {\n if(isEmpty()){\n return null;\n }else{\n return header.getNext().getElement();\n }\n }", "public DataSection defaultSection(String key)\n {\n if (isSection(key)) return getSection(key);\n return createSection(key);\n }", "public String getSectionText(int i) {\n\t\t\n\t\tif (i < 0 || i > sections.size()) {\n\t\t\tthrow new IndexOutOfBoundsException();\n\t\t}\n \t\t\n\t\tint pos1;\n\t\tint pos2;\n\t\t\n\t\tif (i == 0) {\n\t\t\tpos1 = 0;\n\t\t} else {\n\t\t\tpos1 = sections.get(i-1).getPosition();\n\t\t}\n\t\tif (i < sections.size()) {\n\t\t\tpos2 = sections.get(i).getPosition();\n\t\t} else {\n\t\t\tpos2 = rawText.length();\n\t\t}\n\t\t\n\t\treturn rawText.substring(pos1, pos2);\n\t}", "private TableViewSectionProxy getSectionByIndex(int index)\n\t{\n\t\treturn this.sections.get(index);\n\t}", "@Override\n\tpublic Object[] getSections() {\n\t\treturn sections;\n\t}", "Section(BufferedReader in) throws IOException, ReloadFault {\n String line = in.readLine();\n // find top of section and process it\n while (line != null) {\n if (line.startsWith(JTR_V2_SECTION)) {\n title = extractSlice(line, 0, \":\", null);\n break;\n } else\n // don't know what this line is, may be empty\n {\n line = in.readLine();\n }\n }\n\n if (title == null) {\n throw new ReloadFault(i18n, \"rslt.noSectionTitle\");\n }\n\n if (title.equals(MSG_SECTION_NAME)) {\n // use standard internal copy of string\n title = MSG_SECTION_NAME;\n }\n\n while ((line = in.readLine()).startsWith(JTR_V2_SECTSTREAM)) {\n OutputBuffer b = new FixedOutputBuffer(line, in);\n buffers = DynamicArray.append(buffers, b);\n }\n\n // if not in the message section, line should have the section result\n if (!Objects.equals(title, MSG_SECTION_NAME)) {\n if (line != null) {\n if (line.startsWith(JTR_V2_SECTRESULT)) {\n result = Status.parse(line.substring(JTR_V2_SECTRESULT.length()));\n } else {\n throw new ReloadFault(i18n, \"rslt.badLine\", line);\n }\n }\n if (result == null)\n // no test result\n {\n throw new ReloadFault(i18n, \"rslt.noSectionResult\");\n }\n }\n }", "String getSection() {\n\t\treturn this.mSection;\n\t}", "int getFirstItemOnPage();", "public Pageable first() {\n\t\t\t\treturn null;\r\n\t\t\t}", "@Override\r\n public final @Nonnull List<Section> getSections() {\r\n return ImmutableList.copyOf(sections);\r\n }", "public String getSectionTitle() {\n return sectionTitle;\n }", "@Test\n\tpublic void testSectionsLoaded() throws Exception {\n\t\ttry {\n\t\t\tcmService.getSection(\"biology_101_01_lec01\");\n\t\t} catch (IdNotFoundException ide) {\n\t\t\tAssert.fail();\n\t\t}\n\t}", "public Object getFirst() {\r\n if (size == 0)\r\n throw new NoSuchElementException();\r\n\r\n return header.next.element;\r\n }", "public Segment GetFirstSegment() { return cs1; }", "public List<String> getSections(){\n return new ArrayList<>(Arrays.asList(lab, tutorial, discussion));\n }", "protected abstract int getFirstFrag();", "public boolean isFirstPage();", "@GET(\"w/api.php?action=parse&format=json&noimage\")\n Call<JsonElement> getSectionFrom(@Query(\"pageid\") long pageid,@Query(\"section\") long section);", "public LinkedListItr first( )\n {\n return new LinkedListItr( header.next );\n }", "@Override\n public Object[] getSections () {\n return alphaIndexer.getSections();\n }", "@Override protected String getSection(final String param) {\n return getBrowser().getDrbdXML().getSection(param);\n }", "public List<WebPage> getSections() {\r\n\t\treturn secDao.findAll();\r\n\t}", "@Override\n public void sectionTitle()\n {\n }", "public Section newSection() {\n\t\tSection page = new Section();\r\n\t\tpage.setWpPublished(DateUtils.now());\r\n\t\treturn page;\r\n\t}", "public synchronized Section getSection(int index) throws ReloadFault {\n Section target;\n\n if (sections == null && execStatus != inProgress) {\n // try to reload from file\n try {\n reload();\n } catch (ReloadFault f) {\n throw f;\n } catch (Fault f) {\n throw new ReloadFault(i18n, \"rslt.badFile\", f.getMessage());\n }\n }\n\n if (index >= sections.length) {\n target = null;\n } else {\n target = sections[index];\n }\n\n return target;\n }", "public Section getSection() {\n\treturn belongedSection.clone();\n }", "public T getFirst() {\n return this.getHelper(this.indexCorrespondingToTheFirstElement).data;\n }", "public abstract boolean isFirstLineHeader();", "Section createSection();", "public WasmSection getSection(WasmSection.WasmSectionId id) {\n\t\tfor (WasmSection section: sections) {\n\t\t\tif (section.getId() == id) {\n\t\t\t\treturn section;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}", "@Override\n\t\tpublic Object[] getSections()\n\t\t{\n\t\t\treturn mAlphabetIndexer.getSections();\n\t\t}", "public Vector getSection(String sectionName)\n {\n Vector v = (Vector)sections.get(sectionName.toUpperCase());\n if (v == null)\n {\n return new Vector();\n }\n\n return v;\n }", "public Object firstElement();", "public node getFirst() {\n\t\treturn head;\n\t\t//OR\n\t\t//getAt(0);\n\t}", "public Section getSectionByNum(int i) {\n\t\treturn sections.get(i-1);\n\t}", "public final Scene getFirstScene() {\n if (scenes.size() > 0) {\n return scenes.get(0);\n } else {\n return null;\n }\n }", "@Override\n public Object[] getSections() {\n return sectionHeaders;\n }", "public void makeSectionInvisibleIfFirstInList(final int firstVisibleItem) {\n final String section = getSectionName(firstVisibleItem);\n // only make invisible the first section with that name in case there\n // are more with the same name\n boolean alreadySetFirstSectionIvisible = false;\n for (final Entry<View, String> itemView : currentViewSections.entrySet()) {\n if (itemView.getValue().equals(section) && !alreadySetFirstSectionIvisible) {\n itemView.getKey().setVisibility(View.INVISIBLE);\n alreadySetFirstSectionIvisible = true;\n } else {\n itemView.getKey().setVisibility(View.VISIBLE);\n }\n }\n for (final Entry<Integer, String> entry : sectionPositions.entrySet()) {\n if (entry.getKey() > firstVisibleItem + 1) {\n break;\n }\n setSectionText(entry.getValue(), getTransparentSectionView());\n }\n }", "public int getFirstPage() {\n\t\treturn firstPage;\n\t}", "@Override\n public int getItemCount() {\n return structuredContentSections.size();\n }", "public Object getFirst() {\n\t\tcurrent = start;\n\t\treturn start == null ? null : start.item;\n\t}", "private final void m75324a(SectionResponse sectionResponse) {\n int i = 0;\n if (!sectionResponse.paging.hasPrevious) {\n this.f53730h = false;\n }\n if (!sectionResponse.paging.hasNext) {\n this.f53731i = false;\n }\n switch (C15272b.f53896a[this.f53741t.ordinal()]) {\n case 1:\n this.f53730h = sectionResponse.paging.hasPrevious;\n this.f53731i = sectionResponse.paging.hasNext;\n this.f53728f.clear();\n this.f53733k = false;\n List<Section> list = sectionResponse.sectionList;\n C32569u.m150513a((Object) list, C6969H.m41409d(\"G7B86C60AB03EB82CA81D954BE6ECCCD9458AC60E\"));\n int i2 = 0;\n for (T t : list) {\n if (!this.f53730h && i2 == 0) {\n t.chapter.isFirst = true;\n }\n C32569u.m150513a((Object) t, C6969H.m41409d(\"G7A86D60EB63FA5\"));\n m75323a((Section) t, sectionResponse);\n i2++;\n }\n m75349e().notifyDataSetChanged();\n Iterator<T> it = this.f53728f.iterator();\n int i3 = 0;\n while (true) {\n if (it.hasNext()) {\n T next = it.next();\n if (!(!C32569u.m150517a((Object) this.f53727e, (Object) C6969H.m41409d(\"G6E8FDA18BE3C9420E216\")))) {\n if (!(next instanceof Section) || !next.learningRecord.isLastLearned) {\n i3++;\n } else {\n i = i3;\n }\n }\n }\n }\n ((RecyclerView) mo78146a(R.id.recyclerView)).scrollToPosition(i);\n break;\n case 2:\n ArrayList arrayList = new ArrayList();\n List<Section> list2 = sectionResponse.sectionList;\n C32569u.m150513a((Object) list2, C6969H.m41409d(\"G7B86C60AB03EB82CA81D954BE6ECCCD9458AC60E\"));\n int i4 = 0;\n for (T t2 : list2) {\n if (!this.f53730h && i4 == 0) {\n t2.chapter.isFirst = true;\n }\n Boolean bool = t2.isFirst;\n C32569u.m150513a((Object) bool, C6969H.m41409d(\"G7A86D60EB63FA567EF1DB641E0F6D7\"));\n if (bool.booleanValue() && sectionResponse.extra.showChapterName) {\n Chapter chapter = t2.chapter;\n C32569u.m150513a((Object) chapter, C6969H.m41409d(\"G7A86D60EB63FA567E5069158E6E0D1\"));\n arrayList.add(chapter);\n }\n C32569u.m150513a((Object) t2, C6969H.m41409d(\"G7A86D60EB63FA5\"));\n arrayList.add(t2);\n i4++;\n }\n this.f53728f.addAll(0, arrayList);\n m75349e().notifyItemRangeInserted(0, arrayList.size());\n break;\n case 3:\n int size = this.f53728f.size();\n List<Section> list3 = sectionResponse.sectionList;\n C32569u.m150513a((Object) list3, C6969H.m41409d(\"G7B86C60AB03EB82CA81D954BE6ECCCD9458AC60E\"));\n for (T t3 : list3) {\n C32569u.m150513a((Object) t3, C6969H.m41409d(\"G7A86D60EB63FA5\"));\n m75323a((Section) t3, sectionResponse);\n }\n m75349e().notifyItemRangeInserted(size, this.f53728f.size() - size);\n break;\n }\n if (!(TextUtils.isEmpty(sectionResponse.extra.updateText) || C32569u.m150517a((Object) this.f53735m, (Object) C6969H.m41409d(\"G7A8FDC19BA\")) || this.f53733k)) {\n if (!sectionResponse.paging.hasNext) {\n List<Object> list4 = this.f53728f;\n String str = sectionResponse.extra.updateText;\n C32569u.m150513a((Object) str, C6969H.m41409d(\"G7B86C60AB03EB82CA80B885CE0E48DC27987D40EBA04AE31F2\"));\n list4.add(str);\n this.f53733k = true;\n }\n m75349e().notifyItemRangeInserted(this.f53728f.size(), 1);\n }\n }", "public void firstSlide() {\r\n\t\tpresentation.setSlideNumber(0);\r\n\t}", "public LinkedListIterator<AnyType> first() {\n return new LinkedListIterator<AnyType>(header.next);\n }", "public int getMinimumSectionNumber ( )\r\n\t{\r\n\t\tTwoDDisplayContin dis = ( TwoDDisplayContin ) listOfOtherContins.first ( );\r\n\r\n\t\treturn dis.getSectionNumber ( );\r\n\t}", "public MPLS getFirstMPLS() {\r\n\t\treturn this.MPLSheader.peek();\r\n\t}", "public void buildSectionOne(Document document) throws DocumentException, IOException, JSONException {\n PdfPTable titleTable = new PdfPTable ( 1 );\n titleTable.setWidthPercentage ( 100 );\n\n // Strategy\n titleTable.addCell ( ReportTemplate.getSectionHeaderCell ( \"Featured Strategy: \" + selectedStrategy ) );\n\n /**\n * @changed - Abhishek\n * @date - 11-02-2016\n * @desc - Applied format of $xxx,xxx\n */\n // Estimate Income\n titleTable.addCell ( ReportTemplate.getSectionSubHeaderCellWithBoxBorder ( \"Estimated Income: $\" + estimatedIncome ) );\n\n document.add ( titleTable );\n\n // Add Charts Now\n PdfPTable contentTable = new PdfPTable ( 2 );\n contentTable.setWidthPercentage ( 100 );\n\n // Create 3d Pie Chart Section\n PdfPCell pieChartSectionCell = ReportTemplate.getBoxBorderCell ();\n pieChartSectionCell.addElement ( getPieChartSection () );\n contentTable.addCell ( pieChartSectionCell );\n\n // Create Bar Chart Section\n PdfPCell barChartSectionCell = ReportTemplate.getBoxBorderCell ();\n barChartSectionCell.addElement ( getResourceManagementTable () );\n contentTable.addCell ( barChartSectionCell );\n document.add ( contentTable );\n //document.newPage();\n\n PdfPTable contentTable2 = new PdfPTable ( 2 );\n contentTable2.setWidthPercentage ( 100 );\n\n // Add Risk Management Section\n PdfPCell riskManagementSectionCell = ReportTemplate.getBoxBorderWithoutLeftPaddingCell ();\n riskManagementSectionCell.addElement ( getRiskManagementTable () );\n contentTable2.addCell ( riskManagementSectionCell );\n\n // Add Conservation Management Section\n\n Paragraph conservationParagraph = new Paragraph ();\n\n conservationParagraph.add ( new Chunk ( \"Conservation Management\\n\\n\", ReportTemplate.TIMESROMAN_12_BOLD ) );\n conservationParagraph.add ( new Chunk ( \"Conservation Goals\\n\", ReportTemplate.TIMESROMAN_10_NORMAL) );\n /**\n * @changed - Abhishek\n * @date - 12-12-2015\n * @updated - 11-01-2016\n */\n ReportDataPage1.ConservationPracticeBean conservationBean = reportDataPage1.getLandUnderConservationPractice ();\n\n /**\n * @changed - Abhishek\n * @updated - 11-01-2016\n */\n conservationParagraph.add ( new Chunk ( AgricultureStandardUtils.doubleWithOneDecimal( Double.parseDouble (conservationBean.getProfitFromConservation () ) ) + \" % Est. Income under conservation practices\\n\" +\n AgricultureStandardUtils.doubleWithOneDecimal( Double.parseDouble (conservationBean.getLandUnderConservation () ) ) + \" % Acreage under conservation practices\", ReportTemplate.TIMESROMAN_10_NORMAL ) );\n\n PdfPCell conservationManagementSectionCell = ReportTemplate.getBoxBorderWithoutLeftPaddingCell ();\n conservationManagementSectionCell.addElement ( conservationParagraph );\n contentTable2.addCell ( conservationManagementSectionCell );\n\n contentTable2.setKeepTogether(true);\n document.add ( contentTable2 );\n\n\n /*getIncomeUnderConservationPractice(farmInfoView);*/\n\n }", "Node getFirst() {\n return this.first;\n }", "private void selectFirstTab() {\n Tab tab = view\n .getNationsTabPane()\n .getTabs().get(0);\n\n tabChanged(tab, tab);\n }", "public String first() {\n\t\t\n\t\treturn \"\\n#1: \" + contacts[0].toString();\n\t}", "public void defaultContent() {\n\t\tgetter().switchTo().defaultContent();\r\n\t}", "@Override\n\tpublic Object getGroup(int sectionPosition) {\n\t\treturn sections.get(sectionPosition).getTitle();\n\t}", "public PdfPage getFirstPage() {\n if (this.pages == null || this.pages.isEmpty()) {\n return null;\n }\n return this.pages.get(0);\n }", "private void populateSection2() {\r\n\t\t\r\n\t\tJTextArea section2 = new JTextArea(\"Blah blah blah\");\r\n\t\t// set alignment\r\n\t\tsection2.setFont(new Font(\"DejaVu Sans\", Font.PLAIN, 10));\r\n\t\tsection2.setForeground(Color.WHITE);\r\n\t\tadd(section2);\r\n\t\t\r\n\t}", "public Object getFirst()\n {\n if(first == null){\n throw new NoSuchElementException();}\n \n \n \n return first.data;\n }", "SectionList createSectionList();", "public Node getFirstNode() {\n\t return firstNode;\r\n\t }", "List<T> getSectionItems(int sectionIndex);", "@Override\n\tpublic IDataItem getSection(List<IRange> section)\n\t\t\tthrows InvalidRangeException {\n\t\treturn null;\n\t}", "public JspElement getFirst() {\r\n\treturn _first;\r\n}", "@Test\n\tpublic void section1DisplaysParagraphTab2() {\n\t\tassertTrue(AccordionLogic.section1DisplaysParagraphTab2());\n\t}", "public String getFirst() {\n if(first == null) return null;\n return first.data;\n }", "public T1 getFirst() {\n\t\treturn first;\n\t}", "public int getFirst() {\n return first;\n }", "public String printStory() {\r\n\t\tString output = \"\";\r\n\t\tboolean start = true;\r\n\t\tArrayList<String> list = null;\r\n\t\ttry {\r\n\t\t\tlist = load();\r\n\t\t} catch (Exception e) {\r\n\t\t\tSystem.out.println(\"Load has failed.\");\r\n\t\t\te.printStackTrace();\r\n\t\t}\r\n\t\tfor (String str : list) {\r\n\t\t\tif (start == true) { // if this is the first line passed in\r\n\t\t\t\toutput = output + str;\r\n\t\t\t\tstart = false;\r\n\t\t\t} else {\r\n\t\t\t\toutput = output + \" \" + str;\r\n\t\t\t\t// add this after the first story line has been passed in\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn output;\r\n\t}", "public synchronized String getFullText() {\n StringBuilder sb = new StringBuilder();\n for (DocumentSection s : sections) {\n sb.append(s.getText());\n }\n return sb.toString();\n }", "@Override\n public void sectionTitle_()\n {\n }", "@Override\n\tpublic void loadPrePage() {\n\t\t\n\t\tif(curr_content.isFirstPage){\n\t\t\tPigAndroidUtil.showToast(mContext, \"以是第一页:\", 3000);\n\t\t}else{\n\t\t\texchangePre(m_bookFactory.getPrePageContent(pre_content));\n\t\t}\n\t}", "public StrColumn getPageFirst() {\n return delegate.getColumn(\"page_first\", DelegatingStrColumn::new);\n }", "public int getFirstCategoryIndex() { return this.firstCategoryIndex; }", "public String getFirst(){\n return this.first;\n }", "public int getFirstIndex() {\n return firstIndex;\n }", "public int getFirst() {\n\t\treturn first;\n\t}", "public AIlogicalSerial subSection(int i);", "public boolean isFirst() {\n\t\treturn first;\n\t}", "@Override\r\n\tprotected void doFirst() {\n\t\t\r\n\t}", "public static Fragment Home_Tab_start(String Id, String section) {\n BodyTab_Sub fragment = new BodyTab_Sub();\n Bundle args = new Bundle();\n args.putString(ARG_PARAM1, Id);\n args.putString(ARG_PARAM2, section);\n fragment.setArguments(args);\n return fragment;\n }", "public Object getFirst()\n {\n return ((Node)nodes.elementAt(0)).data;\n }", "public void addFirst(Object o) {\r\n addBefore(o, header.next);\r\n }", "public boolean first() {\n initialize();\n return next();\n }", "@Kroll.getProperty\n\tpublic TableViewSectionProxy[] getSections()\n\t{\n\t\treturn this.sections.toArray(new TableViewSectionProxy[0]);\n\t}", "protected boolean loadSections() \n\t{\n\t\tpageTable = new TranslationEntry[numPages];\n\t\tfor(int i=0; i < numPages; ++i)\n\t\t{\n\t\t\tpageTable[i] = new TranslationEntry(i, -1, false, false, false, false);\n\t\t}\n\t\treturn true;\n\t}" ]
[ "0.629519", "0.6213155", "0.6207658", "0.5957308", "0.5887884", "0.58599913", "0.5701986", "0.5701986", "0.56733704", "0.56702155", "0.56475896", "0.56237", "0.55981654", "0.55928516", "0.5577602", "0.5573668", "0.5527401", "0.55165595", "0.5512742", "0.55058086", "0.5486175", "0.547916", "0.5475044", "0.54672724", "0.5428125", "0.5409964", "0.5403797", "0.5400004", "0.5388677", "0.5362046", "0.53517014", "0.5348165", "0.53417754", "0.5328897", "0.530603", "0.530516", "0.5304218", "0.53023314", "0.52815545", "0.52776015", "0.5274575", "0.52699685", "0.5268681", "0.52679265", "0.5251297", "0.5242279", "0.52240676", "0.52106893", "0.52092594", "0.51941246", "0.5191397", "0.51909894", "0.5186243", "0.51849616", "0.5184792", "0.5180466", "0.5174131", "0.51621634", "0.5160586", "0.5159997", "0.5155741", "0.51554585", "0.5153119", "0.51483154", "0.5140519", "0.51286954", "0.5122364", "0.51206493", "0.5117399", "0.5100236", "0.5098108", "0.5091549", "0.5090297", "0.508914", "0.5082661", "0.50823027", "0.5080814", "0.50735307", "0.5064136", "0.5058743", "0.5052057", "0.50481534", "0.50464183", "0.5043071", "0.5031252", "0.50293803", "0.50272673", "0.5026187", "0.50259715", "0.50242794", "0.50189316", "0.5008717", "0.50023645", "0.49942124", "0.49844593", "0.4983715", "0.49771655", "0.49748108", "0.496903", "0.4967439", "0.4966024" ]
0.0
-1
determine whether all items emitted by an Observable meet some criteria
@Test public void all() { Observable.just(1, 2, 3, 4, 5) .doOnNext(System.out::println) .all(x -> x < 10) .subscribe(mList::add); assertEquals(mList, Collections.singletonList(true)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void contains() {\n Observable.just(2, 30, 22, 5, 60, 1)\n .contains(22)\n .subscribe(mList::add);\n assertEquals(mList, Collections.singletonList(true));\n }", "public boolean isInterestedInAllItems();", "boolean hasAll();", "boolean hasAll();", "private boolean allTrue(CompositeTrue predicate) {\n if (kids.isEmpty()) {\n return false;\n }\n\n Iterator<E> i = kids.iterator();\n while (i.hasNext()) {\n E future = i.next();\n if (!predicate.isTrue(future)) {\n return false;\n }\n }\n return true;\n }", "boolean JoiningCriteriaMet() {\n\t\tfor(int i = timeService.getCurrentYear()-1; i > timeService.getCurrentYear() - KyotoEntryYears; i--) {\n\t\t\tif (carbonOutputMap.get(i) > emissionsTargetMap.get(i)) {\n\t\t\t\treturn(false);\n\t\t\t}\n\t\t}\n\t\treturn(true); // \n\t}", "boolean hasMatchedElements();", "@Nonnull\r\n\tpublic static <T> Observable<Boolean> any(\r\n\t\t\t@Nonnull final Observable<T> source) {\r\n\t\treturn any(source, Functions.alwaysTrue1());\r\n\t}", "@Override\n\tpublic boolean isComplete() {\n\t\tboolean empties = nbEmptyMetrics == 0;\n\t\t// 2. all submetrics are complete\n\t\tboolean subs = true;\n\t\tfor (AbstractMetric m : metrics)\n\t\t\tsubs = subs && m.isComplete();\n\t\t// 3. the sum of weights is 1\n\t\tdouble weight = 0;\n\t\tfor (int i = 0; i < metrics.size(); i++)\n\t\t\tweight += this.weight.get(i);\n\t\tboolean sum = weight == 1.0;\n\t\treturn empties && subs && sum;\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<Boolean> all(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func1<? super T, Boolean> predicate) {\r\n\t\treturn new Containment.All<T>(source, predicate);\r\n\t}", "@Override\r\n\tpublic boolean isAllHit() {\r\n\t\treturn priorityElements.isEmpty();\r\n\t}", "public static void main(String[] args) {\n // count operator counter number of elements emmitted,\n Observable<Integer> observable = Observable.just(1,2,3,4);\n observable.count().subscribe(s->System.out.println(s));\n\n // conditional opertors\n // all() -> this operator checks condition for all values and returns false if any condition fails\n observable.all(i->i<3).subscribe(s->System.out.println(s));\n\n // any() -> this operator checks condition for all values and returns true if any condition is true\n // empty() -> checks if observable have empty value and returns true/false \n // contains() -> checks if specified item is contained/emmitted by observable\n // sequenceEqual() -> checks if two sequences are equals (sequences contains same values)\n\n observable.any(i->i<3).subscribe(s->System.out.println(s));\n observable.filter(i->i<5).isEmpty().subscribe(s->System.out.println(s));\n }", "public abstract boolean isSatisfied();", "private boolean hasFailures(ArrayList items){\n Iterator<Map> iterator = items.iterator();\n while(iterator.hasNext()){\n if(hasFailures(iterator.next()))\n return true;\n }\n return false;\n }", "@Override\r\n\tpublic boolean IsSatisfiedBy(Member member) {\n\t\tboolean res=member.getLoans().stream().filter(Loan::hasNotBeenReturned).count()<3;\r\n\t\treturn res;\r\n\t}", "public boolean containsAll(Collection<? extends Type> items);", "public boolean hasAll() {\n return all_ != null;\n }", "public boolean hasAll() {\n return all_ != null;\n }", "public boolean containsAll(Collection<? extends T> items) {\n\n\t\tIterator<? extends T> itr = items.iterator();\n\n\t\twhile (itr.hasNext()) {\n\t\t\tif (!this.contains(itr.next())) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}", "Observable<Boolean> storeAllShifts(ArrayList<Shift> shifts);", "public boolean hasNext() {\n\t\treturn this.onAction.hasNext() || this.offAction.hasNext();\t\t\n\t}", "public boolean isSetItems() {\n return this.items != null;\n }", "private boolean isAllTrue(HashMap<Integer, Boolean> messages)\r\n {\r\n // Iterate through each value for each key in the map.\r\n for(boolean value : messages.values())\r\n {\r\n // If a value is false, then return false.\r\n if(!value)\r\n {\r\n return false;\r\n }\r\n }\r\n // If all values are true, then return true.\r\n return true;\r\n }", "boolean hasCollectResult();", "@Test\n public void observableGetBooleanLogicOperationAndReturnBooleanValue() {\n assertTrue(Observable.just(10)\n .map(intValue -> intValue == 10)\n .toBlocking()\n .single());\n }", "@Test\n public void allTrue() {\n assertTrue(getPredicateInstance(true, true).evaluate(getTestValue()),\n \"multiple true predicates evaluated to false\");\n assertTrue(getPredicateInstance(true, true, true).evaluate(getTestValue()),\n \"multiple true predicates evaluated to false\");\n }", "public boolean hasVisibleItems();", "default boolean every( Predicate<V> predicate ) {\n if ( ((Tensor<V>)this).isVirtual() ) return predicate.test( this.item() );\n return stream().allMatch(predicate);\n }", "@Test\n public void shouldEmitEvents() {\n Observable.just('A', 'B', 'C')\n .subscribeOn(scheduler)\n .subscribe(subscriber);\n\n scheduler.advanceTimeBy(100, TimeUnit.MILLISECONDS);\n subscriber.assertCompleted();\n subscriber.assertValueCount(3);\n subscriber.assertValues('A', 'B', 'C');\n\n TimeDelayer.sleepForOneSecond();\n }", "public boolean areAllAnswersCollect(){\n\t\tif(selectedA.isEmpty())\n\t\t\treturn false;\n\t\telse{\n\t\t\n\t\tfor(String Aanswer:selectedA){\n\t\t\tif(!(correctA.contains(Aanswer)))\n\t\t\t\treturn false;\n\t\t}\n\t\treturn (selectedA.size() == correctA.size());\n\t\t}\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<Boolean> any(\r\n\t\t\t@Nonnull final Observable<T> source,\r\n\t\t\t@Nonnull final Func1<? super T, Boolean> predicate) {\r\n\t\treturn new Containment.Any<T>(source, predicate);\r\n\t}", "@Test\n public void takeUntil() {\n Observable.just(1, 2, 3, 4)\n .takeUntil(integer -> integer > 2)\n .subscribe(mList::add);\n assertEquals(mList, Arrays.asList(1, 2, 3));\n\n mList.clear();\n Observable.just(1, 2, 3, 4)\n .takeUntil(integer -> integer < 10)\n .subscribe(mList::add);\n assertEquals(mList, Collections.singletonList(1));\n }", "protected boolean filterEvent(TrackingActivity activity) {\n\t\tboolean pass = true;\n\t\tif (filters.size() == 0)\n\t\t\treturn pass;\n\n\t\tfor (SinkEventFilter filter : filters) {\n\t\t\tpass = (pass && filter.filter(this, activity));\n\t\t\tif (!pass) {\n\t\t\t\tfilteredCount.incrementAndGet();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn pass;\n\t}", "protected boolean filterEvent(Snapshot snapshot) {\n\t\tboolean pass = true;\n\t\tif (filters.size() == 0)\n\t\t\treturn pass;\n\n\t\tfor (SinkEventFilter filter : filters) {\n\t\t\tpass = (pass && filter.filter(this, snapshot));\n\t\t\tif (!pass) {\n\t\t\t\tfilteredCount.incrementAndGet();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn pass;\n\t}", "@Override\n public StateContents<Boolean> isEmpty() {\n final List<StateContents<Boolean>> futures = new ArrayList<>(sources.size());\n for (CombiningValueStateInternal<InputT, AccumT, OutputT> source : sources) {\n futures.add(source.isEmpty());\n }\n\n // But defer the actual reads until later.\n return new StateContents<Boolean>() {\n @Override\n public Boolean read() {\n for (StateContents<Boolean> future : futures) {\n if (!future.read()) {\n return false;\n }\n }\n return true;\n }\n };\n }", "@Override\n public Publisher<Boolean> exists() {\n ImmutableQuery query = this.query;\n if (!query.limit().isPresent()) {\n // for exists operation we need at most one (1) element (if limit is not set already)\n query = query.withLimit(1);\n }\n Publisher<Long> countPublisher = of(query, session).count();\n return Publishers.map(countPublisher, count -> count > 0);\n }", "public boolean isGatheredAllRows() {\r\n return isFinalRowCount() && getTotalRowCount() == getActualRowCount();\r\n }", "boolean isSetCombine();", "boolean hasSubscribe();", "@SuppressWarnings(\"WeakerAccess\")\n public boolean hasObservers() {\n return mObservers.size() > 0;\n }", "default ObservableSupplier<Boolean> hasUnreadContent() {\n ObservableSupplierImpl<Boolean> result = new ObservableSupplierImpl<>();\n result.set(false);\n return result;\n }", "public boolean satisfiedByUids(@NonNull NetworkCapabilities nc) {\n if (null == nc.mUids || null == mUids) return true; // The network satisfies everything.\n for (UidRange requiredRange : mUids) {\n if (requiredRange.contains(nc.mEstablishingVpnAppUid)) return true;\n if (!nc.appliesToUidRange(requiredRange)) {\n return false;\n }\n }\n return true;\n }", "public boolean hasSubscribers() {\n return state.current.psm.array().length > 0;\n }", "boolean isAllInview();", "public boolean hasAll() {\n return allBuilder_ != null || all_ != null;\n }", "public boolean hasAll() {\n return allBuilder_ != null || all_ != null;\n }", "boolean anyAudioTriggered() {\n for (final Datum d : this.datumList) {\n if (d instanceof Cell) {\n final Cell c = (Cell)d;\n if (c.isAudioTriggered())\n return true;\n }\n }\n\n return false;\n }", "boolean isSetSubject();", "public boolean containsAll(Collection keys) {\r\n\r\n\t\treturn data.containsAll(keys);\r\n\t}", "boolean hasTotalElements();", "boolean isValidForBasket(Collection<Item> items);", "public boolean hasNextResults() {\n\t\tif(totalCount != null && totalCount <= currentOffset) return false;\n\t\treturn true;\n\t}", "@Test\n public void testAddTwoIterate() {\n final Registrar<Object> testSubject = onCreateTestSubject();\n final Object testObserver0 = new Object();\n final Object testObserver1 = new Object();\n\n testSubject.addListener(testObserver0);\n testSubject.addListener(testObserver1);\n\n boolean foundSubject0 = false;\n boolean foundSubject1 = false;\n\n int iterations = 0;\n for (Object listener : testSubject) {\n ++iterations;\n if (listener == testObserver0) {\n foundSubject0 = true;\n } else if (listener == testObserver1) {\n foundSubject1 = true;\n }\n }\n assertTrue(foundSubject0);\n assertTrue(foundSubject1);\n assertEquals(2, iterations);\n }", "@Nonnull\r\n\tpublic static Observable<Boolean> isEmpty(\r\n\t\t\t@Nonnull final Observable<?> source) {\r\n\t\treturn new Observable<Boolean>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super Boolean> observer) {\r\n\t\t\t\treturn source.register(new Observer<Object>() {\r\n\t\t\t\t\t/** We already determined the answer? */\r\n\t\t\t\t\tboolean done;\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tif (!done) {\r\n\t\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t\t}\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 finish() {\r\n\t\t\t\t\t\tif (!done) {\r\n\t\t\t\t\t\t\tdone = true;\r\n\t\t\t\t\t\t\tobserver.next(false);\r\n\t\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\t}\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 next(Object value) {\r\n\t\t\t\t\t\tif (!done) {\r\n\t\t\t\t\t\t\tdone = true;\r\n\t\t\t\t\t\t\tobserver.next(true);\r\n\t\t\t\t\t\t\tobserver.finish();\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\t\t\t}\r\n\t\t};\r\n\t}", "public boolean isSatisfied(int[] tuple) {\n return relation.isConsistent(tuple[0], tuple[1]); //table.get((v1.getVal() - offset) * n + (v0.getVal() - offset));\n }", "boolean hasUses();", "private boolean allPackagesDelivered(){\n\t\tPackageService service = this.getPackageService();\n\t\tSet<WorldDelivery> packages = service.getAllUndeliveredWorldDeliveries();\n\t\tfor(WorldDelivery delivery : packages){\n\t\t\tif(!delivery.isDelivered()){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t//TODO uncomment if packages are implemented\n\t\treturn false;\n\t}", "boolean isSetProbables();", "boolean hasProduces();", "boolean containsAll(Collection<?> c);", "boolean hasNextCollectTimestampMs();", "public boolean isSatisfied() {\n\t\treturn satisfied().isSatisfied();\n\t}", "boolean isAllInDownloadedArea();", "@Override\n public boolean isEmpty() {\n return filtered.isEmpty();\n }", "public boolean satisfiedBasedOnChildrenValues(boolean[] childValues)\r\n {\r\n boolean result = !this.isSome;\r\n if (this.isSome)\r\n {\r\n for (int i = 0; i < childValues.length; i++)\r\n {\r\n result = result || childValues[i];\r\n }\r\n } else\r\n {\r\n for (int i = 0; i < childValues.length; i++)\r\n {\r\n result = result && childValues[i];\r\n }\r\n }\r\n return result;\r\n }", "private static boolean isAllItemsAreNotSoldOut(List<Chef> foodItemList) {\n boolean result = false;\n for (int i = 0; i < foodItemList.size(); i++) {\n for (int j = 0; j < foodItemList.get(i).getFoodItemList().size(); j++) {\n if (foodItemList.get(i).getFoodItemList().get(j).getAvailQty() == 0 || !foodItemList.get(i).getFoodItemList().get(j).getAvailable()) {\n result = true;\n }\n }\n }\n return result;\n }", "public boolean satisfiedBasedOnChildrenValues(boolean[] childValues)\r\n {\r\n boolean result = !this.isSome;\r\n if (this.isSome)\r\n {\r\n for (int i = 0; i < childValues.length; i++)\r\n {\r\n result = result || childValues[i];\r\n }\r\n } else\r\n {\r\n for (int i = 0; i < childValues.length; i++)\r\n {\r\n result = result && childValues[i];\r\n }\r\n }\r\n return result;\r\n }", "boolean hasFrom();", "private void isFiltersSatisfied() {\n Filter[] filters = rule.getFilters();\n for (int i = 0; i < filters.length; i++) {\n linkedList.add(filters[i]);\n }\n recursiveFiltering(linkedList.peek().filter.split(\":\"),null);\n }", "private boolean isFullyMatched() {\n\t\treturn subBeatMatches > 0 && beatMatches > 0;\n\t}", "boolean hasTo();", "@Override\n public boolean isAlcoholic() {\n return liquids\n .stream()\n .anyMatch(liquid -> liquid.getAlcoholPercent() > 0);\n }", "public static boolean allHaveMatches(Participant[] participants) {\n for (Participant person : participants) {\n if (!person.hasRecipient() || !person.hasSender()) {\n return false;\n }\n }\n return true;\n }", "public boolean hasMoreItems();", "boolean hasImmediateOutputAllPrefetch();", "boolean isAny();", "@Override\n public boolean containsAll(final Collection<?> collection) {\n this.checkCollectionNotNull(collection);\n final Iterator<?> iterator = collection.iterator();\n\n while (iterator.hasNext()) {\n if (!this.contains(iterator.next())) {\n return false;\n }\n }\n\n return true;\n }", "private boolean checkNext(){\n boolean ret = this.hasNext;\n if ((this.allStatesIterator.hasNext()) || (this.allSubsetsIterator.hasNext()) || (this.allTransitionsIterator.hasNext())){\n hasNext = true;\n return hasNext;\n }\n hasNext = false;\n return ret;\n }", "@Override\n\tpublic boolean isCovered() {\n\t\treturn (falseCount > 0) && (trueCount > 0);\n\t}", "@Override\n\tpublic boolean satisfies(Match match, int... ind)\n\t{\n\t\tCollection<BioPAXElement> set = con.generate(match, ind);\n\t\t\n\t\tswitch (type)\n\t\t{\n\t\t\tcase EQUAL: return set.size() == size;\n\t\t\tcase GREATER: return set.size() > size;\n\t\t\tcase GREATER_OR_EQUAL: return set.size() >= size;\n\t\t\tcase LESS: return set.size() < size;\n\t\t\tcase LESS_OR_EQUAL: return set.size() <= size;\n\t\t\tdefault: throw new RuntimeException(\n\t\t\t\t\"Should not reach here. Did somebody modify Type enum?\");\n\t\t}\n\t}", "public boolean isProduced(){\n if(!step1.isEmpty()&&!step2.isEmpty()&&!step3.isEmpty()){\n return true;\n }else {\n return false;\n }\n }", "public boolean containsAll(Collection<?> arg0) {\n\t\treturn false;\n\t}", "boolean hasCount();", "protected final boolean anyMsg() {\n\t\tDoorPulseCriterion dpc = new DoorPulseCriterion(this.getPulse() - 1);\n\t\treturn this.existMessage(dpc);\n\t}", "private static void predicate(List<Product> productsList) {\n\t\tStream<Product> peek = productsList.stream().peek(System.out::println);\n\t\t\n\t\t//consume\n\t\tboolean allMatch = peek.allMatch(x -> x.price > 24000);\n\t\tSystem.out.println(\"All items price is more than 24000?: \" + allMatch);\n\t\t\n\t\t//consume\n\t\tboolean anyMatch = productsList.stream().anyMatch(x -> x.price < 25000);\n\t\tSystem.out.println(\"Any item is less than 25000?: \" + anyMatch);\n\n\t\t//process\n\t\tStream<Product> filteredStream = productsList.stream().filter(p -> p.price > 28000);\n\t\tfilteredStream.forEach(z -> {\n\t\t\tSystem.out.println(\"Item: \" + z.name + \" Price: \" + z.price);\n\t\t});\n\t\t\n\t\t\n\t\t//productsList.stream().\n\t\t\n\t}", "public synchronized boolean hasSubscribers ()\n {\n return !this.listeners.isEmpty ();\n }", "private static Observable<Optional<Boolean>> _getIsEnabledObservable(@NonNull Observable<Optional<List<ICommit>>> pSelectedCommitObservable,\n @NonNull Observable<Optional<IRepository>> pRepository)\n {\n Observable<Optional<IRepositoryState>> repoState = pRepository.switchMap(pRepoOpt -> pRepoOpt.map(IRepository::getRepositoryState)\n .orElse(Observable.just(Optional.empty())));\n return Observable.combineLatest(pSelectedCommitObservable, repoState, (pSelectedCommitOpt, pRepoStateOpt)\n -> Optional.of(pSelectedCommitOpt.orElse(Collections.emptyList()).size() == 1 && pRepoStateOpt.map(IRepositoryState::canResetHead).orElse(false)));\n }", "@Test\n public void sequenceEqual() {\n\n Observable<Long> o1 = Observable.just(1L, 2L, 3L, 4L, 5L)\n .delay(1000, TimeUnit.SECONDS, mTestScheduler);\n Observable<Long> o2 = Observable.interval(20, TimeUnit.SECONDS, mTestScheduler)\n .skip(1)\n .take(5);\n\n Observable.sequenceEqual(o1, o2)\n .subscribe(mList::add);\n\n mTestScheduler.advanceTimeBy(1200, TimeUnit.SECONDS);\n\n assertEquals(mList, Collections.singletonList(true));\n }", "public static void main(String[] args){\n Observable myObservable = Observable.create(new Observable.OnSubscribe(){\n\n @Override\n public void call(Object subscriber) {\n Subscriber mySubscriber = (Subscriber)subscriber;\n\n for(int i = 0 ; i < 10; i++){\n //if my subscriber was subscribed\n if(!mySubscriber.isUnsubscribed()){\n mySubscriber.onNext(\"Pushed value \" + i);\n }\n }\n\n if(!mySubscriber.isUnsubscribed()){\n mySubscriber.onCompleted();\n }\n\n }\n });\n\n //subscribe to your Observable\n myObservable.subscribe(new Action1<String>() {\n @Override\n public void call(String s) {\n System.out.println(s);\n }\n },\n new Action1<Throwable>() {\n @Override\n public void call(Throwable throwable) {\n System.out.println(\"Something went wrong the observable\");\n }\n },\n new Action0() {\n @Override\n public void call() {\n System.out.println(\"No more values will be pushed.\");\n }\n });\n\n }", "protected static boolean areAllPreconditionsMet(HashSet<GoapState> preconditions, HashSet<GoapState> effects) {\r\n\t\tboolean preconditionsMet = true;\r\n\r\n\t\tfor (GoapState precondition : preconditions) {\r\n\t\t\tboolean currentPreconditionMet = false;\r\n\r\n\t\t\tfor (GoapState effect : effects) {\r\n\t\t\t\tif (precondition.effect.equals(effect.effect)) {\r\n\t\t\t\t\tif (precondition.value.equals(effect.value)) {\r\n\t\t\t\t\t\tcurrentPreconditionMet = true;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tpreconditionsMet = false;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif (!preconditionsMet || !currentPreconditionMet) {\r\n\t\t\t\tpreconditionsMet = false;\r\n\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn preconditionsMet;\r\n\t}", "public boolean hasAnyMessages(int[] what) {\n synchronized (mHandler.getLooper().getQueue()) {\n for (int i : what) {\n if (mHandler.hasMessages(i)) {\n return true;\n }\n }\n }\n return false;\n }", "boolean hasFeedItemSet();", "private boolean checkForAction(){\n IndividualAction thisAction = checkTriggers();\n if(thisAction.getTriggers() == null){\n return false;\n }\n if(!checkSubjects(thisAction.getSubjects())){\n return false;\n }\n doConsumed(thisAction.getConsumed());\n doProduce(thisAction.getProduced());\n results.add(thisAction.getNarration());\n\n return true;\n }", "public boolean hasNext() {\n\t\t\n\t\treturn order.hasNext() || !candidates.isEmpty()\n\t\t\t\t|| !firstOrderCandidates.isEmpty();\n\t}", "private boolean allReady() {\n PlayerModel[] playersInLobby = this.lobbyModel.getPlayersInLobby();\n if (playersInLobby.length <= 1)\n return false;\n for (PlayerModel pl : playersInLobby) {\n if (!pl.isReady() && !(pl instanceof ClientPlayerModel))\n return false;\n }\n return true;\n }", "default boolean any( Predicate<V> predicate ) {\n if ( ((Tensor<V>)this).isVirtual() ) return predicate.test( this.item() );\n return stream().anyMatch(predicate);\n }", "boolean getProbables();", "private boolean containsAll(final NullnessAnnotation... search) {\n boolean result = true;\n if (annotations.isEmpty()) {\n // an empty list of annotations can never contain all\n result = false;\n }\n else {\n for (final NullnessAnnotation obj : search) {\n if (!annotations.contains(obj)) {\n result = false;\n break;\n }\n }\n }\n return result;\n }", "@Test\n void testObservers() {\n Collection<Game> games = Set.of(\n new Game(\n List.of(new TestPlayer(\"player-1\"), new TestPlayer(\"player-2\")),\n List.of(new Cards(), new Cards()), 20, 1000,\n List.of(new LooseIfDrawingFromEmptyDeck())),\n new Game(\n List.of(new TestPlayer(\"player-1\"), new TestPlayer(\"player-2\")),\n List.of(new Cards(), new Cards()), 20, 1000,\n Collections.emptyList()),\n new Game(\n List.of(new TestPlayer(\"player-1\"), new TestPlayer(\"player-2\")),\n List.of(new Cards(), new Cards()), 20, 1000,\n List.of(new LooseIfDrawingFromEmptyDeck(), new FinishIfLastPlayersAlive(3))),\n new Game(\n List.of(new TestPlayer(\"player-1\"), new TestPlayer(\"player-2\")),\n List.of(new Cards(), new Cards()), 20, 1000,\n List.of(new LooseIfDrawingFromEmptyDeck(), new PassOrFinishIfLost(), new FinishIfLastPlayersAlive(3)))\n );\n\n for (Game g : games) {\n List<Observer> os = g.observers();\n assertEquals(1, os.stream().filter(o -> o instanceof PassOrFinishIfLost).count());\n assertEquals(1, os.stream().filter(o -> o instanceof FinishIfLastPlayersAlive).count());\n }\n }", "public abstract boolean isConsumed();" ]
[ "0.62928134", "0.61174715", "0.6015697", "0.6015697", "0.5925942", "0.55633956", "0.5483238", "0.54624104", "0.5442704", "0.54270655", "0.5371708", "0.53533375", "0.53340274", "0.5326717", "0.5322112", "0.5310353", "0.5303436", "0.5303436", "0.53002834", "0.52739936", "0.5248326", "0.52071637", "0.5193999", "0.5181949", "0.51766264", "0.516034", "0.515136", "0.51395005", "0.5102449", "0.51020926", "0.5087421", "0.5072188", "0.50703996", "0.5059608", "0.5040922", "0.5024436", "0.50233096", "0.50153434", "0.50091004", "0.49955165", "0.49954104", "0.49900904", "0.4984839", "0.4981181", "0.49721235", "0.49721235", "0.4966793", "0.49659282", "0.49523413", "0.49523067", "0.49520266", "0.4925276", "0.4922735", "0.49212718", "0.4918902", "0.49165934", "0.49161226", "0.49105692", "0.48978084", "0.4895706", "0.48956043", "0.48935926", "0.48918402", "0.48910442", "0.48897678", "0.48889044", "0.48860288", "0.48850352", "0.48801097", "0.48762912", "0.4870351", "0.48689514", "0.48645866", "0.48638877", "0.48638612", "0.48638016", "0.48597258", "0.48594174", "0.48575747", "0.48465312", "0.48432028", "0.48427194", "0.4834511", "0.48200876", "0.48195803", "0.48189998", "0.4812166", "0.48120064", "0.4811328", "0.48111558", "0.48089877", "0.48021623", "0.48010337", "0.47997823", "0.4785902", "0.47832966", "0.47777984", "0.47777632", "0.47776788", "0.4776082" ]
0.6431606
0
determine whether an Observable emits a particular item or not
@Test public void contains() { Observable.just(2, 30, 22, 5, 60, 1) .contains(22) .subscribe(mList::add); assertEquals(mList, Collections.singletonList(true)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Test\n public void observableGetBooleanLogicOperationAndReturnBooleanValue() {\n assertTrue(Observable.just(10)\n .map(intValue -> intValue == 10)\n .toBlocking()\n .single());\n }", "boolean hasFeedItem();", "boolean hasSubscribe();", "public boolean hasItem() {\n return null != item;\n }", "public boolean hasItem() {\n return this.item != null;\n }", "public abstract boolean isConsumed();", "boolean hasReceived();", "boolean hasFeedItemTarget();", "Observable<Boolean> messageBodyRecipientCardViewIsGone();", "boolean hasItemId();", "boolean hasItemId();", "boolean hasItemId();", "boolean hasItemId();", "boolean hasItemId();", "boolean hasItemId();", "boolean hasItemId();", "boolean isSetSubject();", "default ObservableSupplier<Boolean> hasUnreadContent() {\n ObservableSupplierImpl<Boolean> result = new ObservableSupplierImpl<>();\n result.set(false);\n return result;\n }", "boolean hasSubscription();", "Observable<Boolean> messageBodySenderCardViewIsGone();", "@Override\n public boolean contains(T item) {\n return itemMap.containsKey(item);\n }", "boolean shouldAutoSubscribe();", "@Nonnull\r\n\tpublic static <T> Observable<Boolean> any(\r\n\t\t\t@Nonnull final Observable<T> source) {\r\n\t\treturn any(source, Functions.alwaysTrue1());\r\n\t}", "public boolean isObserved()\n {\n return isObserved;\n }", "public boolean hasItem() {\n return (this.curItem != null);\n }", "public boolean hasReceived() {\n\t if (LogWriter.needsLogging(LogWriter.TRACE_DEBUG))\n LogWriter.logMessage(LogWriter.TRACE_DEBUG, \"hasReceived()\" );\n Via via=(Via)sipHeader;\n return via.hasParameter(Via.RECEIVED);\n }", "public interface Item {\n\n boolean isTask();\n}", "@Override\n public boolean hasSubscriber(Subscriber subscriber) {\n return (subscriber.getId() == this.subscriber.getId());\n }", "public boolean containsAtMostOneItem() {\n boolean contains;\n if (start==null | start.next==null) {\n contains = true;\n }\n return contains;\n }", "boolean hasUnReceived();", "public abstract boolean shouldObserve(String key);", "@Test\n public void shouldEmitEvents() {\n Observable.just('A', 'B', 'C')\n .subscribeOn(scheduler)\n .subscribe(subscriber);\n\n scheduler.advanceTimeBy(100, TimeUnit.MILLISECONDS);\n subscriber.assertCompleted();\n subscriber.assertValueCount(3);\n subscriber.assertValues('A', 'B', 'C');\n\n TimeDelayer.sleepForOneSecond();\n }", "public abstract boolean isDelivered();", "boolean hasSendReading();", "boolean hasGetLatestReading();", "boolean hasFeedItemSet();", "private boolean canView(final AbstractItem item) throws AccessDeniedException {\n\t\tif (item.isRssAllowed())\n\t\t\treturn true;\n\t\tList<Subscriber> subscribers = Lists.newArrayList(subscriberRepository.findAll(SubscriberPredicates.onCtx(item\n\t\t\t\t.getContextKey())));\n\t\t// TODO we consider that all items have targets directly on\n\t\t// for targets defined only on classification a check will be needed\n\t\tif (subscribers.isEmpty()) {\n\t\t\tlog.trace(\"Subscribers on item {} are empty -> true\", item.getContextKey());\n\t\t\treturn true;\n\t\t}\n\t\tfinal CustomUserDetails user = SecurityUtils.getCurrentUserDetails();\n\t\tif (user == null) {\n\t\t\tlog.trace(\"user is not authenticated -> throw an error to redirect on authentication\");\n\t\t\tthrow new AccessDeniedException(\"Access is denied to anonymous !\");\n\t\t} else if (user.getRoles().contains(AuthoritiesConstants.ADMIN)\n\t\t\t\t|| user.getUser().getLogin().equalsIgnoreCase(item.getCreatedBy().getLogin())\n\t\t\t\t|| user.getUser().getLogin().equalsIgnoreCase(item.getLastModifiedBy().getLogin())) {\n\t\t\treturn true;\n\t\t}\n\n\t\tfinal UserDTO userDTO = user.getUser();\n\t\tif (userDTO != null) {\n\t\t\tList<String> groups = null;\n\t\t\tif (userDTO.getAttributes() != null) {\n\t\t\t\tgroups = userDTO.getAttributes().get(externalUserHelper.getUserGroupAttribute());\n\t\t\t}\n\t\t\tfor (Subscriber subscriber : subscribers) {\n\t\t\t\tlog.trace(\"Check if {} is in {}\", userDTO, subscriber);\n\t\t\t\tfinal SubjectKeyExtended subject = subscriber.getSubjectCtxId().getSubject();\n\t\t\t\tswitch (subject.getKeyType()) {\n\t\t\t\tcase GROUP:\n\t\t\t\t\tif (groups == null || groups.isEmpty()) {\n\t\t\t\t\t\tlog.trace(\"The user doesn't have a group -> break loop\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t// test on startWith as some groups in IsMemberOf has only a part the\n\t\t\t\t\t// real group name.\n\t\t\t\t\tfor (String val : groups) {\n\t\t\t\t\t\tif (val.startsWith(subject.getKeyValue())) {\n\t\t\t\t\t\t\tlog.trace(\"Check if the user group {} match subscriber group {} -> return true\", val,\n\t\t\t\t\t\t\t\t\tsubject.getKeyValue());\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\tbreak;\n\t\t\t\tcase PERSON:\n\t\t\t\t\tif (subject.getKeyValue().equalsIgnoreCase(userDTO.getLogin())) {\n\t\t\t\t\t\tlog.trace(\"Check if the user key {} match subscriber key {} -> true\", userDTO.getLogin(),\n\t\t\t\t\t\t\t\tsubject.getKeyValue());\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase PERSON_ATTR:\n\t\t\t\t\tif (subject.getKeyAttribute() != null\n\t\t\t\t\t\t\t&& userDTO.getAttributes().containsKey(subject.getKeyAttribute())\n\t\t\t\t\t\t\t&& userDTO.getAttributes().get(subject.getKeyAttribute()).contains(subject.getKeyValue())) {\n\t\t\t\t\t\tlog.trace(\"Check if the user attribute {} with values {} contains value {} -> true\",\n\t\t\t\t\t\t\t\tsubject.getKeyAttribute(), userDTO.getAttributes().get(subject.getKeyAttribute()),\n\t\t\t\t\t\t\t\tsubject.getKeyValue());\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase PERSON_ATTR_REGEX:\n\t\t\t\t\tif (subject.getKeyAttribute() != null\n\t\t\t\t\t\t\t&& userDTO.getAttributes().containsKey(subject.getKeyAttribute())) {\n\t\t\t\t\t\tfor (final String value : userDTO.getAttributes().get(subject.getKeyAttribute())) {\n\t\t\t\t\t\t\tif (value.matches(subject.getKeyValue())) {\n\t\t\t\t\t\t\t\tlog.trace(\"Check if the user attribute {} with values {} match regex {} -> true\",\n\t\t\t\t\t\t\t\t\t\tsubject.getKeyAttribute(),\n\t\t\t\t\t\t\t\t\t\tuserDTO.getAttributes().get(subject.getKeyAttribute()), subject.getKeyValue());\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\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new IllegalStateException(\"Warning Subject Type '\" + subject.getKeyType()\n\t\t\t\t\t\t\t+ \"' is not managed\");\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlog.trace(\"End of all checks -> false\");\n\t\treturn false;\n\t}", "@Override\n\tprotected boolean itemExists() {\n\t\treturn false;\n\t}", "public boolean isItem(int itemId) {\n return getKey().equals(itemId);\n }", "boolean nextItem();", "public boolean hasSubscribers() {\n return state.current.psm.array().length > 0;\n }", "protected final boolean anyMsg() {\n\t\tDoorPulseCriterion dpc = new DoorPulseCriterion(this.getPulse() - 1);\n\t\treturn this.existMessage(dpc);\n\t}", "boolean hasTo();", "boolean hasSignal();", "public boolean produce(Person person) {\n return this.streamBridge.send(\"produce-out-0\", person);\n }", "Observable<T> update(T item);", "public boolean wasConsumed() {\n return(_consumed);\n }", "public boolean offerFirst(E item);", "boolean isTransmitting();", "boolean isAlreadyTriggered();", "@Test\n public void all() {\n Observable.just(1, 2, 3, 4, 5)\n .doOnNext(System.out::println)\n .all(x -> x < 10)\n .subscribe(mList::add);\n assertEquals(mList, Collections.singletonList(true));\n }", "public boolean item(int i) {\n\t\treturn x[i] == 1;\n\t}", "public boolean isSetItems() {\n return this.items != null;\n }", "public boolean has(String itemName);", "public boolean hasNextEvent() throws IOException;", "Observable<Boolean> deliveryStatusTextViewIsGone();", "public abstract boolean isItemFiltered(pt.keep.oaiextended.AgentItem item);", "public boolean hasGrabbedItem(String item) {\n return grabbedItems.contains(item);\n }", "public boolean canBeConsumed() {\n return canBeConsumed;\n }", "boolean hasCollectResult();", "public boolean hasNext() {\n\t\treturn this.onAction.hasNext() || this.offAction.hasNext();\t\t\n\t}", "Observable<Boolean> storeShiftForUpdate(Shift shift);", "public boolean contains(int item) {\n if (item == datum() ) return true; // true upon finding the item\n else if (next() == null) return false; // false if item not found until the end of list\n else return next.contains(item); \n }", "boolean isSetCombine();", "@java.lang.Override\n public boolean hasDataItemPayload() {\n return dataItemPayload_ != null;\n }", "boolean isImmediate();", "private boolean checkForAction(){\n IndividualAction thisAction = checkTriggers();\n if(thisAction.getTriggers() == null){\n return false;\n }\n if(!checkSubjects(thisAction.getSubjects())){\n return false;\n }\n doConsumed(thisAction.getConsumed());\n doProduce(thisAction.getProduced());\n results.add(thisAction.getNarration());\n\n return true;\n }", "boolean hasEvent();", "@Test\n public void observableEvolveAndReturnToStringValue() {\n assertTrue(Observable.just(10)\n .map(String::valueOf)\n .toBlocking()\n .single()\n .equals(\"10\"));\n }", "boolean hasIosAppDataStream();", "boolean hasGetLatestSensorReadingForUser();", "boolean hasForRead();", "@Override\n public boolean contains(Object item) {\n if (item == null)\n return false;\n return map.containsKey(item);\n }", "public abstract boolean contains(Object item);", "boolean hasFrom();", "public boolean isInterestedInAllItems();", "@SuppressWarnings(\"WeakerAccess\")\n public boolean hasObservers() {\n return mObservers.size() > 0;\n }", "@Override\n public boolean subscribe(Task data) {\n return true;\n }", "private boolean isTransactionAlreadySeen(Transaction tx){\n return allTransactions.contains(tx);\n }", "boolean publish() {\n pendingOps.incrementAndGet();\n State currentState = state.get();\n if (currentState == State.FROZEN || currentState == State.RELEASED) {\n pendingOps.decrementAndGet();\n return false;\n }\n return true;\n }", "@Nonnull\r\n\tpublic static Observable<Boolean> isEmpty(\r\n\t\t\t@Nonnull final Observable<?> source) {\r\n\t\treturn new Observable<Boolean>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super Boolean> observer) {\r\n\t\t\t\treturn source.register(new Observer<Object>() {\r\n\t\t\t\t\t/** We already determined the answer? */\r\n\t\t\t\t\tboolean done;\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tif (!done) {\r\n\t\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t\t}\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 finish() {\r\n\t\t\t\t\t\tif (!done) {\r\n\t\t\t\t\t\t\tdone = true;\r\n\t\t\t\t\t\t\tobserver.next(false);\r\n\t\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\t}\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 next(Object value) {\r\n\t\t\t\t\t\tif (!done) {\r\n\t\t\t\t\t\t\tdone = true;\r\n\t\t\t\t\t\t\tobserver.next(true);\r\n\t\t\t\t\t\t\tobserver.finish();\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\t\t\t}\r\n\t\t};\r\n\t}", "boolean hasItemIndex();", "boolean hasItemIndex();", "boolean hasItemIndex();", "boolean hasFeed();", "boolean hasFeed();", "public boolean offerFirst(Object item) {\r\n\r\n\t\tdata.add(0, item);\r\n\r\n\t\treturn true;\r\n\t}", "public Boolean shouldRead() {\n return this.isComplete();\n }", "private void assertStreamItemViewHasTag(StreamItemEntry streamItem) {\n Object tag = mView.getTag();\n assertNotNull(\"should have a tag\", tag);\n assertTrue(\"should be a StreamItemEntry\", tag instanceof StreamItemEntry);\n StreamItemEntry streamItemTag = (StreamItemEntry) tag;\n // The streamItem itself should be in the tag.\n assertSame(streamItem, streamItemTag);\n }", "@Override\n public boolean hasSubscriber(Subscriber subscriber) {\n return ((subscriber.getId() == this.subscriberReconnect.getId()) || (subscriber.getId() == this.subscriberReceiver.getId()));\n }", "boolean isSetExchange();", "public Boolean hasItems() {\n return this.hasItems;\n }", "public boolean isAny() {\n return m_item.getSchemaComponent().type() == SchemaBase.ANY_TYPE;\n }", "@Nonnull\r\n\tpublic static <T> Observable<Boolean> contains(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\tfinal T value) {\r\n\t\treturn any(source, new Func1<T, Boolean>() {\r\n\t\t\t@Override\r\n\t\t\tpublic Boolean invoke(T param1) {\r\n\t\t\t\treturn param1 == value || (param1 != null && param1.equals(value));\r\n\t\t\t}\r\n\t\t});\r\n\t}", "public boolean isSubscriptionHandled() {\n return SUBSCRIPTIONHANDLED.equals(message);\n }", "public static void main(String[] args){\n Observable myObservable = Observable.create(new Observable.OnSubscribe(){\n\n @Override\n public void call(Object subscriber) {\n Subscriber mySubscriber = (Subscriber)subscriber;\n\n for(int i = 0 ; i < 10; i++){\n //if my subscriber was subscribed\n if(!mySubscriber.isUnsubscribed()){\n mySubscriber.onNext(\"Pushed value \" + i);\n }\n }\n\n if(!mySubscriber.isUnsubscribed()){\n mySubscriber.onCompleted();\n }\n\n }\n });\n\n //subscribe to your Observable\n myObservable.subscribe(new Action1<String>() {\n @Override\n public void call(String s) {\n System.out.println(s);\n }\n },\n new Action1<Throwable>() {\n @Override\n public void call(Throwable throwable) {\n System.out.println(\"Something went wrong the observable\");\n }\n },\n new Action0() {\n @Override\n public void call() {\n System.out.println(\"No more values will be pushed.\");\n }\n });\n\n }", "public boolean hasBeenShot(){\n return this.hasBeenShot;\n }", "public boolean isSetSoggettoEmittente()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n return get_store().count_elements(SOGGETTOEMITTENTE$10) != 0;\r\n }\r\n }", "public boolean isSingleReads() {\n\t\treturn singleReads;\n\t}", "public boolean checkOutItem(Item item)\n {\n \t return memberItems.add(item);\n }" ]
[ "0.5830063", "0.56573015", "0.55223143", "0.549936", "0.5440647", "0.5348925", "0.5298871", "0.5288653", "0.5275086", "0.52728194", "0.52728194", "0.52728194", "0.52728194", "0.52728194", "0.52728194", "0.52728194", "0.5201429", "0.51767933", "0.51765734", "0.5149197", "0.5137914", "0.5097136", "0.50948036", "0.50919604", "0.50679475", "0.5050629", "0.5050464", "0.50490236", "0.50283605", "0.501383", "0.49879992", "0.49387124", "0.49283844", "0.49112597", "0.4886435", "0.487954", "0.4875296", "0.4872206", "0.48517165", "0.48507184", "0.48490775", "0.48411876", "0.4828543", "0.48148918", "0.48084632", "0.48067906", "0.48058376", "0.48021793", "0.48005027", "0.4793457", "0.47910792", "0.47910595", "0.47891513", "0.4787872", "0.4782215", "0.47820526", "0.47798797", "0.47776294", "0.4753107", "0.4749133", "0.4743393", "0.47417343", "0.47377762", "0.4730812", "0.47218016", "0.47195178", "0.4719028", "0.47074538", "0.4703157", "0.47019228", "0.47015864", "0.46986893", "0.46986607", "0.46983874", "0.46918857", "0.46892774", "0.46843007", "0.468205", "0.46768194", "0.46713203", "0.46701038", "0.46676683", "0.46676683", "0.46676683", "0.46581697", "0.46581697", "0.46528885", "0.4651356", "0.4650036", "0.46491662", "0.46428302", "0.46356696", "0.46352416", "0.4633298", "0.46309587", "0.46235335", "0.46168658", "0.46166983", "0.46156847", "0.46117738" ]
0.5719111
1
determine whether two Observables emit the same sequence of items
@Test public void sequenceEqual() { Observable<Long> o1 = Observable.just(1L, 2L, 3L, 4L, 5L) .delay(1000, TimeUnit.SECONDS, mTestScheduler); Observable<Long> o2 = Observable.interval(20, TimeUnit.SECONDS, mTestScheduler) .skip(1) .take(5); Observable.sequenceEqual(o1, o2) .subscribe(mList::add); mTestScheduler.advanceTimeBy(1200, TimeUnit.SECONDS); assertEquals(mList, Collections.singletonList(true)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static <T> Observable<Boolean> sequenceEqual(\r\n\t\t\tfinal Iterable<? extends T> first,\r\n\t\t\tfinal Observable<? extends T> second) {\r\n\t\treturn sequenceEqual(first, second, Functions.equals());\r\n\t}", "@Nonnull \r\n\tpublic static <T> Observable<Boolean> sequenceEqual(\r\n\t\t\t@Nonnull final Observable<? extends T> first,\r\n\t\t\t@Nonnull final Observable<? extends T> second) {\r\n\t\treturn sequenceEqual(first, second, Functions.equals());\r\n\t}", "boolean hasIsEquivalent();", "@Test\n public void testAddTwoIterate() {\n final Registrar<Object> testSubject = onCreateTestSubject();\n final Object testObserver0 = new Object();\n final Object testObserver1 = new Object();\n\n testSubject.addListener(testObserver0);\n testSubject.addListener(testObserver1);\n\n boolean foundSubject0 = false;\n boolean foundSubject1 = false;\n\n int iterations = 0;\n for (Object listener : testSubject) {\n ++iterations;\n if (listener == testObserver0) {\n foundSubject0 = true;\n } else if (listener == testObserver1) {\n foundSubject1 = true;\n }\n }\n assertTrue(foundSubject0);\n assertTrue(foundSubject1);\n assertEquals(2, iterations);\n }", "@Override\n public boolean areContentsTheSame(Item one,\n Item two) {\n return one.equals(two);\n }", "@Test\r\n public void testNotificationSetEqualElement() {\r\n ObservableList first = FXCollections.observableArrayList(getPerson1());\r\n ObservableList second = FXCollections.observableArrayList(getPerson2());\r\n int index = 0;\r\n assertEquals(\"sanity: \", first.get(index), second.get(index));\r\n ListChangeReport report = new ListChangeReport(first);\r\n first.set(index, second.get(index));\r\n assertEquals(\"list must have fired on setting equal item\", 1, report.getEventCount());\r\n \r\n }", "static public boolean sequenceEquals(List source, List arg) {\n\t\tif ( source.size() != arg.size() ) {\n\t\t\treturn false;\n\t\t}\n\t\tIterator it1 = source.iterator();\n\t\tIterator it2 = arg.iterator();\n\t\twhile ( it1.hasNext() ) {\n\t\t\tObject elem1 = it1.next();\n\t\t\tObject elem2 = it2.next();\n\t\t\tif ( elem1 instanceof Integer ) {\n\t\t\t\tif ( ((Integer)elem1).intValue() != ((Integer)elem2).intValue() ) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( elem1 instanceof Float ) {\n\t\t\t\t\tif ( ((Float)elem1).floatValue() != ((Float)elem2).floatValue() ) {\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif ( elem1 instanceof Boolean ) {\n\t\t\t\t\t\tif ( ((Boolean)elem1).booleanValue() != ((Boolean)elem2).booleanValue() ) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif ( !elem1.equals(elem2) ) {\n\t\t\t\t\t\t\treturn 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\treturn true;\n\t}", "@Nonnull \r\n\tpublic static <T> Observable<Boolean> sequenceEqual(\r\n\t\t\t@Nonnull final Iterable<? extends T> first,\r\n\t\t\t@Nonnull final Observable<? extends T> second,\r\n\t\t\t@Nonnull final Func2<? super T, ? super T, Boolean> comparer) {\r\n\t\treturn select(\r\n\t\t\t\tany(\r\n\t\t\t\t\tzip(\r\n\t\t\t\t\t\t\tmaterialize(second), \r\n\t\t\t\t\t\t\tInteractive.materialize(first), \r\n\t\t\t\t\t\t\tnewOptionComparer(comparer)\r\n\t\t\t\t\t), \r\n\t\t\t\t\tFunctions.alwaysFalse1()\r\n\t\t\t\t), \r\n\t\t\tFunctions.negate());\r\n\t}", "public boolean equivalentInteractions(InteractionObject first, InteractionObject second) {\n\t\tboolean result = \n\t\t\tfirst.getType() == second.getType() &&\n\t\t\tfirst.getIndex() == second.getIndex();\n\t\treturn result;\n\t}", "@Nonnull \r\n\tpublic static <T> Observable<Boolean> sequenceEqual(\r\n\t\t\t@Nonnull final Observable<? extends T> first,\r\n\t\t\t@Nonnull final Observable<? extends T> second,\r\n\t\t\t@Nonnull final Func2<? super T, ? super T, Boolean> comparer) {\r\n\t\treturn select(\r\n\t\t\t\tany(\r\n\t\t\t\t\tzip(\r\n\t\t\t\t\t\t\tmaterialize(first), \r\n\t\t\t\t\t\t\tmaterialize(second), \r\n\t\t\t\t\t\t\tnewOptionComparer(comparer)\r\n\t\t\t\t\t), \r\n\t\t\t\t\tFunctions.negate()\r\n\t\t\t\t), \r\n\t\t\tFunctions.negate());\r\n\t}", "boolean hasSameAs();", "@Override\n public boolean isSame(Item other) {\n return this.equals(other);\n }", "@Override\r\n\tprotected boolean prerequisites() {\n\t\treturn _player1.getClient().getPlayer().getWrappedObject().getPosition()\r\n\t\t\t\t.equals(_player2.getClient().getPlayer().getWrappedObject().getPosition());\r\n\t}", "protected boolean isSameSnakSet(Iterator<Snak> snaks1, Iterator<Snak> snaks2) {\n\t\tArrayList<Snak> snakList1 = new ArrayList<>(5);\n\t\twhile (snaks1.hasNext()) {\n\t\t\tsnakList1.add(snaks1.next());\n\t\t}\n\n\t\tint snakCount2 = 0;\n\t\twhile (snaks2.hasNext()) {\n\t\t\tsnakCount2++;\n\t\t\tSnak snak2 = snaks2.next();\n\t\t\tboolean found = false;\n\t\t\tfor (int i = 0; i < snakList1.size(); i++) {\n\t\t\t\tif (snak2.equals(snakList1.get(i))) {\n\t\t\t\t\tsnakList1.set(i, null);\n\t\t\t\t\tfound = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!found) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn snakCount2 == snakList1.size();\n\t}", "@Override\n public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {\n Station oldStation = mOldStations.get(oldItemPosition);\n Station newStation = mNewStations.get(newItemPosition);\n return oldStation.getStreamUri().equals(newStation.getStreamUri());\n }", "@Test\n\tpublic void testEquivalentSequences(){\n\t\tchord = new Chord(1, Tonality.maj, 4);\n\t\tChord chord2 = new Chord(1, Tonality.maj, 4);\n\t\tassertTrue(chord.equals(chord2));\n\t\tassertTrue(chord2.equals(chord));\n\n\t\tLinkedList<Chord> sequence = new LinkedList<Chord>();\n\t\tLinkedList<Chord> sequence2 = new LinkedList<Chord>();\n\n\t\tsequence.add(chord);\n\t\tsequence.add(chord2);\n\t\tsequence2.add(chord);\n\t\tsequence2.add(chord2);\n\t\tassertEquals(sequence, sequence2);\n\n\t\tsequence2.clear();\n\t\tsequence2.addAll(sequence);\n\t\tassertEquals(sequence, sequence2);\n\t}", "protected boolean areItemsTheSame(T old, T news) {\n if (old == null)\n return news == null;\n return old.sameItems(news);\n }", "public boolean sameOutputInteractions(ISpecifiche specifiche, ISpecifiche specifiche2) \r\n\t\t{\r\n\t\tList<Interaction> list = getActionsOutputFromAttacs(specifiche.getAttacsDeclInput());\r\n\t\tList<Interaction> list2 = getActionsOutputFromAttacs(specifiche2.getAttacsDeclInput());\r\n\t\tif (list.size() != list2.size()) return false;\r\n\t\tfor (Interaction interaction : list)\r\n\t\t\t{\r\n\t\t\tif (!list2.contains(interaction)) return false;\r\n\t\t\t}\r\n\t\treturn true;\r\n\t\t}", "public static Observable<String> getObservableDistinctUntilChanges() {\n return observableSrcDuplicated;//todo\n }", "default boolean isSameStateAs(ReadOnlyTask other) {\n return other == this // short circuit if same object\n || (other != null // this is first to avoid NPE below\n && other.getContent().equals(this.getContent())); // state checks here onwards\n //&& other.getDate().equals(this.getDate())\n //&& other.getTime().equals(this.getTime()));\n }", "private boolean areTransitionsForSchemaEqual(Set<foreignkeyshistory.SchemaTransition> schemaTransitions, Map<String,Integer> otherTransitions)\n\t{\n\t\t\n\t\tfor (foreignkeyshistory.SchemaTransition schemaTransition : schemaTransitions)\n\t\t{\n\t\t\tif (!transitionExists(schemaTransition, otherTransitions)){ return false; }\n\t\t}\n\t\t\n\t\tfor (Map.Entry<String, Integer> entry : otherTransitions.entrySet())\n\t\t{\n\t\t\tif (!transitionExists(entry.getKey(), entry.getValue(), schemaTransitions)){ return false; }\n\t\t}\n\t\t\n\t\treturn true;\n\t}", "@Test\n public void shouldJoinOnlyIfMatchFoundOnStreamUpdates() {\n pushToTable(2, \"Y\");\n processor.checkAndClearProcessResult(EMPTY);\n\n // push all four items to the primary stream. this should produce two items.\n pushToStream(4, \"X\");\n processor.checkAndClearProcessResult(new KeyValueTimestamp<>(0, \"X0+Y0\", 0),\n new KeyValueTimestamp<>(1, \"X1+Y1\", 1));\n }", "public static boolean canCombineItemsets(ArrayList<String> is1, ArrayList<String> is2) {\n\t\tif(is1.size() != is2.size()) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tint commonElements = 0;\n\t\t\n\t\tfor(String item : is2) {\n\t\t\tif(is1.contains(item)) {\n\t\t\t\tcommonElements += 1;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn (commonElements == is1.size() - 1);\n\t}", "public boolean isAmbiguous() {\n return positionMap.size() > 1;\n }", "@Test\n public void testHasDups() {\n var arg = new String[] {\"a\",\"b\",\"c\"};\n Sequence instance = new Sequence();\n boolean expResult = false;\n boolean result = instance.hasDups(arg);\n assertEquals(expResult, result);\n }", "public static Observable<String> getObservableDistinct() {\n return observableSrcDuplicated;//todo\n }", "public boolean sequenceRangeExpressionMultiplicity() {\r\n SequenceRange self = this.getSelf();\r\n Expression rangeLower = self.getRangeLower();\r\n Expression rangeUpper = self.getRangeUpper();\r\n return rangeLower != null && rangeLower.getUpper() == 1 &&\r\n rangeUpper != null && rangeUpper.getUpper() == 1;\r\n }", "boolean checkError() {\n Iterator<Integer> seq = sequence.iterator();\n Iterator<Integer> in = input.iterator();\n\n while (seq.hasNext() && in.hasNext()) {\n int a = seq.next();\n int b = in.next();\n if (a != b) {\n attempts++;\n return true;\n }\n }\n return false;\n }", "public boolean isRepeated()\n {\n return start != end;\n }", "public final boolean equal() {\n\t\tif (size > 1) {\n\t\t\tdouble topMostValue = pop();\n\t\t\tdouble secondTopMostValue = pop();\n\t\t\tif (topMostValue == secondTopMostValue) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}", "Boolean same(MultiSet<X> s);", "private static boolean flush(ArrayList<CardSuit> suits) {\n //this for loop traverse the suits in order to check if there\n // are two cards of different suits\n for (int i = 1; i < suits.size(); i++) {\n if (suits.get(i) != suits.get(i -1)){\n return false;\n }\n }\n return true;\n }", "@Test\n public void shouldEmitEvents() {\n Observable.just('A', 'B', 'C')\n .subscribeOn(scheduler)\n .subscribe(subscriber);\n\n scheduler.advanceTimeBy(100, TimeUnit.MILLISECONDS);\n subscriber.assertCompleted();\n subscriber.assertValueCount(3);\n subscriber.assertValues('A', 'B', 'C');\n\n TimeDelayer.sleepForOneSecond();\n }", "public boolean isValid() {\n\n if (this.eTime == INFINITY) return false;\n\n int oldCountA = (a != null) ? a.getCount() : 0;\n int oldCountB = (b != null) ? b.getCount() : 0;\n\n if (countA != oldCountA || countB != oldCountB)\n return false;\n\n return true;\n }", "private boolean equalKeys(Object other) {\n if (this==other) {\n return true;\n }\n if (!(other instanceof Acquirente)) {\n return false;\n }\n Acquirente that = (Acquirente) other;\n if (this.getIdacquirente() != that.getIdacquirente()) {\n return false;\n }\n return true;\n }", "public static void combineLatest() {\n\n System.out.println(\"# 1\");\n\n /*\n Emits item every second\n */\n Observable sourceInterval = Observable.interval(1L, TimeUnit.MILLISECONDS).take(10);\n\n /*\n Emits string items\n */\n Observable sourceString = Observable.fromIterable(sData);\n\n Observable<?> combined = Observable.combineLatest((objects) -> {\n StringBuilder stringBuilder = new StringBuilder();\n Stream.of(objects).forEach(stringBuilder::append);\n return stringBuilder.toString();\n }, 1, sourceInterval, sourceString);\n\n combined.subscribe(new MyObserver<>());\n\n System.out.println(\"# 2\");\n\n /*\n Because empty observable immediately terminates hence whole sequence terminates.\n */\n combined = Observable.combineLatest((objects) -> {\n StringBuilder stringBuilder = new StringBuilder();\n Stream.of(objects).forEach(stringBuilder::append);\n return stringBuilder.toString();\n }, 1, sourceInterval, sourceString, Observable.empty());\n combined.subscribe(new MyObserver<>());\n\n System.out.println(\"# 3\");\n /*\n Same as above but instead collection of sources are used.\n */\n List<Observable<?>> collection = new ArrayList<>();\n collection.add(sourceInterval);\n collection.add(sourceString.repeat(1));\n combined = Observable.combineLatest(collection, (objects) -> {\n StringBuilder stringBuilder = new StringBuilder();\n Stream.of(objects).forEach(stringBuilder::append);\n return stringBuilder.toString();\n });\n combined.subscribe(new MyObserver<>());\n\n System.out.println(\"# 4\");\n /*\n Explicitly combine 2 sources, similarly it can be done up to 10 sources\n */\n combined = Observable.combineLatest(sourceInterval, sourceString.repeat(1),\n (first, second) -> first + \"-\" + second);\n combined.subscribe(new MyObserver<>());\n }", "private boolean isEqual(Iterator<?> instance, OasisList<?> baseList) {\n\n boolean equal = true;\n int i = 0;\n while (instance.hasNext()) {\n if (!baseList.get(i++).equals(instance.next())) {\n equal = false;\n break;\n }\n }\n\n return equal;\n }", "private static boolean identityEqual(final I_GameState state1, final I_GameState state2) {\n if (state1 == state2)\n return true;\n\n return Stream.of(new SimpleEntry<>(state1, state2))\n .flatMap( // transform the elements by making a new stream with the transformation to be used\n pair -> Arrays.stream(E_PileID.values()) // stream the pileIDs\n // make new pair of the elements of that pile from each state\n .map(pileID -> new SimpleEntry<>(\n pair.getKey().get(pileID),\n pair.getValue().get(pileID)\n )\n )\n )\n .allMatch(pair -> pair.getKey() == pair.getValue());\n }", "boolean animationEquals(Animation animation) {\n return (animation == currAnimation);\n }", "public static boolean same(int[] a, int[] b) {\r\n \treturn (a[0] == b[0] && a[1] == b[1]) || (a[0] == b[1] && a[1] == b[0]);\r\n }", "@Test\n public void amb() {\n Observable<Integer> o1 = Observable.just(20, 40, 60)\n .delay(500, TimeUnit.SECONDS, mTestScheduler);\n\n Observable<Integer> o2 = Observable.just(1, 2, 3)\n .delay(200, TimeUnit.SECONDS, mTestScheduler);\n\n Observable<Integer> o3 = Observable.just(0, 0, 0)\n .delay(1000, TimeUnit.SECONDS, mTestScheduler);\n\n Observable.amb(o1, o2, o3)\n .subscribe(mList::add);\n\n mTestScheduler.advanceTimeBy(1000, TimeUnit.SECONDS);\n assertEquals(mList, Arrays.asList(1, 2, 3));\n }", "private void assertSameTask(ReadOnlyTask task1, ReadOnlyTask task2) {\n if (task1 == null && task2 == null) {\n // both null\n return;\n }\n\n if (task1 == null) {\n fail(\"task1 is null but task2 is NOT null\");\n }\n\n if (task2 == null) {\n fail(\"task1 is NOT null but task2 is null\");\n }\n\n assertTrue(\"Expected: <\" + task1 + \"> but was <\" + task2 + \">\", task1.isSameStateAs(task2));\n }", "public boolean alreadyOwnsIdenticalRoute(){\n City city1 = mSelectedRoute.getCity1();\n City city2 = mSelectedRoute.getCity2();\n for(int i=0; i<mUser.getClaimedRoutes().size(); i++){\n City ownedCity1 = mUser.getClaimedRoutes().get(i).getCity1();\n City ownedCity2 = mUser.getClaimedRoutes().get(i).getCity2();\n if(city1.equals(ownedCity1) && city2.equals(ownedCity2))\n return true;\n }\n return false;\n }", "private static boolean sameDestination(Reservation a, Reservation b){\n\t\tif( (a.seatOwner() == b.seatOwner() ) && ( a.seatDestination() == b.seatDestination() ) ){\n\t\t\treturn true;\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}", "@Test\r\n\tpublic void testL1IsSubSeqOfL2WithSeveralOccurenceOfOneInL2() {\r\n\t\tl1 = Arrays.asList(2, 4, 5,5,5,5);\r\n\t\tl2 = Arrays.asList(2, 3, 1, 5, 1, 3);\r\n\t\tassertFalse(\"The list L1 is a subseq of L2\", sequencer.subSeq(l1, l2));\r\n\t}", "private boolean comparePersistentIdEntrys(@Nonnull PairwiseId one, @Nonnull PairwiseId other)\n {\n // Do not compare times\n //\n return Objects.equals(one.getPairwiseId(), other.getPairwiseId()) &&\n Objects.equals(one.getIssuerEntityID(), other.getIssuerEntityID()) &&\n Objects.equals(one.getRecipientEntityID(), other.getRecipientEntityID()) &&\n Objects.equals(one.getSourceSystemId(), other.getSourceSystemId()) &&\n Objects.equals(one.getPrincipalName(), other.getPrincipalName()) &&\n Objects.equals(one.getPeerProvidedId(), other.getPeerProvidedId());\n }", "private static boolean compare(BufferedInputStream b1, BufferedInputStream b2) throws IOException {\n\t\tint cmp1 = 0, cmp2;\r\n\t\tbyte[] i = new byte[100];\r\n\t\tbyte[] j = new byte[100];\r\n\t\t\r\n\t\twhile(cmp1 != -1){\r\n\t\t\tcmp1 = b1.read(i, 0, i.length);\r\n\t\t\tcmp2 = b2.read(j, 0, j.length);\r\n\t\t\tif(cmp1 != cmp2){\r\n\t\t\t\treturn false;\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tfor(int k = 0; k < cmp1; k++){\r\n\t\t\t\tif(i[k] != j[k]){\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn true;\r\n\t}", "boolean hasSeq();", "public static void zipObservables(CountDownLatch latch) {\n\n Observable<Observable<String>> source = Observable.create(observableEmitter -> {\n System.out.println(\"create\");\n observableEmitter.onNext(Observable.just(\"abc\", \"def\"));\n observableEmitter.onNext(Observable.just(\"123\", \"456\"));\n observableEmitter.onNext(Observable.just(\"alpha\", \"beta\", \"gama\"));\n observableEmitter.onComplete();\n });\n\n source.doOnSubscribe(d -> System.out.println(\"source doOnSubscribe\"));\n source.doOnNext(i -> System.out.println(\"source doOnNext = \" + i.toString()));\n source.doOnComplete(() -> System.out.println(\"source doOnComplete\"));\n\n\n Observable.zip(source, items -> items[0] + \"-\" + items[1] + \"-\" + items[2])\n .doOnSubscribe(d -> System.out.println(\"zip doOnSubscribe\"))\n .doOnNext(i -> System.out.println(\"zip doOnNext\"))\n .subscribe(new MyObserver<>(latch));\n }", "private boolean oneEquals(AccessPath that) {\n //if (this._n != that._n) return false;\n if (this._field != that._field) return false;\n if (this._last != that._last) return false;\n if (this.succ.size() != that.succ.size()) return false;\n return true;\n }", "public static boolean isSameItemset(ArrayList<String> set1, ArrayList<String> set2) {\n\t\tif(set1.size() != set2.size()) {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\tCollections.sort(set1);\n\t\tCollections.sort(set2);\n\t\t\n\t\tfor(int i=0;i<set1.size();i++) {\n\t\t\tif(!set1.get(i).equals(set2.get(i))) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn true;\n\t}", "@Override\n public boolean areItemsTheSame(Concert oldConcert, Concert newConcert) {\n return oldConcert.getId() == newConcert.getId();\n }", "@Override\r\n\t\tpublic boolean equalsWithOrder(\r\n\t\t\t\tPair<? extends T, ? extends S> anotherPair) {\n\t\t\tsynchronized (mutex) {\r\n\t\t\t\treturn pair.equalsWithOrder(anotherPair);\r\n\t\t\t}\r\n\t\t}", "public boolean isequal(Transition t){\n\t\tif( !this.sourcestate.isequal(t.sourcestate)){\n\t\t\treturn false;\n\t\t}\n\t\tif( !this.targetstate.isequal(t.targetstate)){\n\t\t\treturn false;\n\t\t}\n\t\tint len = this.triggers.size();\n\t\tif( len == t.getTriggers().size()){\n\t\t\tfor(int i = 0; i < len; i ++){\n\t\t\t\tString tempTriggers = this.triggers.get(i);\n\t\t\t\t\n\t\t\t\tboolean temp = false;//This means one condition has the same condition in the other transition.\n\t\t\t\tfor(int j = 0; j < len; j ++){\n\t\t\t\t\tif(tempTriggers.equals(t.getTriggers().get(j))){\n\t\t\t\t\t\ttemp = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(temp == false){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t\n\t\treturn true;\n\t}", "@Test\r\n public void testObjectPropertyWithEqualOrSameList() {\r\n ObservableList<String> list = createObservableList(true);\r\n ObjectProperty<ObservableList<String>> property = new SimpleObjectProperty<>(list);\r\n ObjectProperty<ObservableList<String>> otherPropertySameList = new SimpleObjectProperty<>(list);\r\n assertFalse(\"sanity: two properties with same list are not equal\", \r\n property.equals(otherPropertySameList));\r\n ObjectProperty<ObservableList<String>> otherPropertyEqualList =\r\n new SimpleObjectProperty(createObservableList(true));\r\n assertFalse(\"sanity: two properties with equal list are not equal\", \r\n property.equals(otherPropertyEqualList));\r\n }", "public boolean allDuplicatesEqual() {\n int[] input = {1, 2, 2, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5};\n int dupA = findDuplicatesA(input);\n int dupB = findDuplicatesB(input);\n int dupC = findDuplicatesC(input);\n int dupD = findDuplicatesD(input);\n int dupE = findDuplicatesE(input);\n return dupA == dupB && dupA == dupC && dupA == dupD && dupA == dupE;\n }", "default boolean isRepeatState() {\n return isRepeatState(FULL_EQUAL);\n }", "@Override\n public boolean areItemsTheSame(int oldItemPosition, int newItemPosition) {\n return DiffRecyclerAdapter.this.areItemsTheSame(backupList.get(oldItemPosition), displayList.get(newItemPosition));\n }", "private boolean duplicationCheck(String userName) {\n\t\tboolean ret = true;\n\t\tif(obs.isEmpty()) {\n\t\t\tret = true;\n\t\t}\n\t\telse {\n\t\t\tfor(int i=0; i<obs.size(); i++) {\n\t\t\t\tif(obs.get(i).getUserName().compareTo(userName) == 0) {\n\t\t\t\t\tret = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t\tret = true;\n\t\t\t}\n\t\t}\n\t\treturn ret;\n\t}", "@Override\n public boolean connected(Station station1, Station station2) {\n if (station1.id() >= links.length || station2.id() >= links.length) {\n return station1.id() == station2.id();\n }\n return links[station1.id()] == links[station2.id()];\n }", "@Test\n\tpublic void testMultipleAddConsistency() {\n\n\t\tcontroller.addNewNodes(2);\n\t\tSignalNode first = controller.getNodesToTest().getFirst();\n\t\tSignalNode last = controller.getNodesToTest().getLast();\n\n\t\tcontroller.addSignalsToNode(first, 10000);\n\n\t\ttry {\n\t\t\tSignal sig = src.next();\n\t\t\tResult r1 = first.findSimilarTo(sig);\n\t\t\tResult r2 = last.findSimilarTo(sig);\n\t\t\tAssert.assertEquals(r1, r2);\n\t\t} catch (RemoteException e) {\n\t\t\te.printStackTrace();\n\t\t}\n\n\t}", "@Override\n public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {\n Station oldStation = mOldStations.get(oldItemPosition);\n Station newStation = mNewStations.get(newItemPosition);\n if (oldStation.getStationName().equals(newStation.getStationName()) &&\n oldStation.getPlaybackState() == newStation.getPlaybackState() &&\n oldStation.getStationImageSize() == newStation.getStationImageSize()) {\n return true;\n } else {\n return false;\n }\n }", "@Test\n public void getCapturedResponses_discardsDuplicates() throws Exception {\n\n // Fire two instances of the same response document\n SsmlDocument response1 = ssmlDocument().withFilename(\"ssmlTextResponse_helloWorld.xml\").build();\n SsmlDocument response2 = ssmlDocument().withFilename(\"ssmlTextResponse_helloWorld.xml\").build();\n listener.outputSsml(null, response1);\n listener.outputSsml(null, response2);\n List<SsmlDocument> responses = listener.getCapturedResponses();\n assertThat(responses, hasSize(1));\n }", "public boolean isEquivalentTo(ComparableSubject subject) {\n\t\t\tboolean result = false;\n\n\t\t\tif (subject != null) {\n\n\t\t\t\tint countPropertiesS2inThis = 0; // Counts how many of the properties in subject are in this and have\n\t\t\t\t\t\t\t\t\t\t\t\t\t// the same value in both resources\n\n\t\t\t\t// For each property in subject, check if it is contained in this and if it has\n\t\t\t\t// the same value here\n\t\t\t\tfor (Entry<String, String> curProperty : subject.mapProperties.entrySet()) {\n\t\t\t\t\tString curEquivProperty = this.mapProperties.get(curProperty.getKey());\n\n\t\t\t\t\t// Compare the properties values using their string representation\n\t\t\t\t\tif (curEquivProperty != null && curEquivProperty.equals(curProperty.getValue())) {\n\t\t\t\t\t\tcountPropertiesS2inThis++;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Consider both resources equivalent if they have the same number of properties\n\t\t\t\t// and all properties in r2\n\t\t\t\t// exist in r1 and have the same value in both resources\n\t\t\t\tif ((countPropertiesS2inThis == subject.mapProperties.size())\n\t\t\t\t\t\t&& (this.mapProperties.size() == countPropertiesS2inThis)) {\n\t\t\t\t\tresult = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn result;\n\t\t}", "private static void mergingSync() {\n Observable.merge(getDataSync(1), getDataSync(2)).blockingForEach(System.out::println);\n }", "private boolean areHistoriesEqual(SchemaHistory schemaHistory, ArrayList<DBVersion> lifetime, ArrayList<Map<String,Integer>> transitions)\n\t{\n\t\treturn areSchemasEqual(schemaHistory, lifetime) && areTransitionsEqual(schemaHistory, transitions);\n\t}", "private boolean isThereEquivalenceBetweenNorms(Norm norm1, Norm norm2) {\n\t\tboolean conflictContext = contextChecker(norm1, norm2);\n\t\tif (!conflictContext) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// returns true if the if the entities are the same OR one is ALL\n\t\tboolean conflictEntity = entityChecker(norm1, norm2);\n\t\tif (!conflictEntity) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// returns true if there is not conflict between activation and deactivation constraint\n\t\tboolean conflictConstraint = constraintChecker(norm1, norm2);\n\t\tif (!conflictConstraint) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// returns true if the action are the same\n\t\tboolean conflictAction = actionChecker(norm1, norm2);\n\t\tif (!conflictAction) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// at this moment all conditions are valid and the norms are in conflict\n\t\treturn true;\n\t}", "public boolean compareObjects(Object object1, Object object2, AbstractSession session) {\n Object firstCollection = getRealCollectionAttributeValueFromObject(object1, session);\n Object secondCollection = getRealCollectionAttributeValueFromObject(object2, session);\n ContainerPolicy containerPolicy = getContainerPolicy();\n\n if (containerPolicy.sizeFor(firstCollection) != containerPolicy.sizeFor(secondCollection)) {\n return false;\n }\n\n if (containerPolicy.sizeFor(firstCollection) == 0) {\n return true;\n }\n Object iterFirst = containerPolicy.iteratorFor(firstCollection);\n Object iterSecond = containerPolicy.iteratorFor(secondCollection);\n\n //loop through the elements in both collections and compare elements at the\n //same index. This ensures that a change to order registers as a change.\n while (containerPolicy.hasNext(iterFirst)) {\n //fetch the next object from the first iterator.\n Object firstAggregateObject = containerPolicy.next(iterFirst, session);\n Object secondAggregateObject = containerPolicy.next(iterSecond, session);\n\n //fetch the next object from the second iterator.\n //matched object found, break to outer FOR loop\t\t\t\n if (!getReferenceDescriptor().getObjectBuilder().compareObjects(firstAggregateObject, secondAggregateObject, session)) {\n return false;\n }\n }\n return true;\n }", "public boolean isSelfLoop() {\n\t\treturn _source == _sink;\n\t}", "public boolean equals(TransitionRecord test){\r\n return (fromstate == test.getFromState() && \r\n tostate == test.getToState());\r\n }", "@Test\n public void testEqualsReturnsTrueOnIdenticalRecords() {\n boolean equals = record.equals(otherRecord);\n\n assertThat(equals, is(true));\n }", "boolean isSame(MethodInvocation propagator) {\r\n\t\treturn this == propagator;\r\n\t}", "private boolean hasOtherOutput(DeviceId inDeviceId, StaticPacketTrace trace, ConnectPoint cp) {\n return trace.getHitChains(inDeviceId).stream().filter(groupsInDevice ->\n !groupsInDevice.outputPort().equals(cp)).count() > 0;\n }", "@Test\n public void equal() {\n assertTrue(commandItem.equals(commandItemCopy));\n assertTrue(commandItem.isSameCommand(commandItemCopy));\n //not commanditem return false\n assertFalse(commandItem.equals(commandWord));\n }", "static boolean areIdentical(Line l1, Line l2) {\n return areParallel(l1, l2) && (Math.abs(l1.c - l2.c) < EPS);\n }", "@Test\n public void contains() {\n Observable.just(2, 30, 22, 5, 60, 1)\n .contains(22)\n .subscribe(mList::add);\n assertEquals(mList, Collections.singletonList(true));\n }", "private static boolean haveSameSkeleton(JsonObject object1, JsonObject object2){\n\t\tboolean res = (object1.entrySet().size() == object2.entrySet().size());\n\t\tSystem.err.println(res);\n\t\tif (res){\n\t\t\tfor(java.util.Map.Entry<String, JsonElement> entry : object1.entrySet()){\n\t\t\t\tif (!object2.has(entry.getKey())) return false;\n\t\t\t}\n\t\t\treturn true;\t\t\t\n\t\t}\n\t\telse return false;\n\t}", "@Override\n public boolean areItemsTheSame(@NonNull Note oldItem, @NonNull Note newItem) {\n // Two Note item are same if there ID are same - uniquely identify each entry\n return oldItem.getId() == newItem.getId();\n }", "public static <T> boolean streamEqual(final Stream<? extends T> expected, final Stream<? extends T> actual) {\n Stream<? extends T> sort_expected = expected.sorted();\n Stream<? extends T> sort_actual = actual.sorted();\n List<? extends T> lhs = sort_expected.collect(Collectors.toList());\n List<? extends T> rhs = sort_actual.collect(Collectors.toList());\n return lhs.equals(rhs);\n }", "private boolean samePosition(ITarget t1, ITarget t2) {\n assert t1.getTag() == t2.getTag() : \"Programmer error; tags must match.\";\n switch (t1.getTag()) {\n case JPL_MINOR_BODY:\n case MPC_MINOR_PLANET:\n case NAMED:\n\n // SUPER SUPER SKETCHY\n // The .equals logic in NonSiderealTarget actually does what we want here, at\n // least according to the old implementation here. So we'll leave it for now.\n // This will be easier with the new model.\n return t1.equals(t2);\n\n case SIDEREAL:\n final HmsDegTarget hms1 = (HmsDegTarget) t1;\n final HmsDegTarget hms2 = (HmsDegTarget) t2;\n return hasSameCoordinates(hms1, hms2) &&\n hasSameProperMotion(hms1, hms2) &&\n hasSameTrackingDetails(hms1, hms2);\n\n default:\n throw new Error(\"Unpossible target tag: \" + t1.getTag());\n }\n }", "boolean allActionsOfLastTwoPeriodsAreIdentical(List<Firm> firms) {\n for (Firm firm : firms) {\n // One false is enough to interrupt, since periods have to be identical for all firms\n if (!firm.actionsOfLastTwoPeriodsAreIdentical()) {\n return false;\n }\n }\n\n return true;\n }", "boolean isDone(){\n\t\t\n\t\treturn (x0==x1 && y0==y1);\n\t}", "public boolean hasCycle(Node<T> first) {\n Iterator itOne = this.iterator();\n Iterator itTwo = this.iterator();\n try {\n while (true) {\n T one = (T) itOne.next();\n itTwo.next();\n T two = (T) itTwo.next();\n if (one.equals(two)) {\n return true;\n }\n }\n } catch (NullPointerException ex) {\n ex.printStackTrace();\n }\n return false;\n }", "@Test\n public void all() {\n Observable.just(1, 2, 3, 4, 5)\n .doOnNext(System.out::println)\n .all(x -> x < 10)\n .subscribe(mList::add);\n assertEquals(mList, Collections.singletonList(true));\n }", "@Override public boolean isConsistent(List<TraceLockEntry> seq)\n{\n for (TraceLockEntry te : seq) {\n TraceLockLocation tll = te.getLocation();\n switch (te.getEntryType()) {\n\t case PREJOIN :\n\t location_set.add(tll);\n\t break;\n\t case NOJOIN :\n\t location_set.add(tll);\n\t break;\n\t case JOIN :\n\t location_set.add(tll);\n\t have_join = true;\n\t break;\n\t default :\n\t break;\n }\n }\n\n return true;\n}", "private boolean areOutputsSpent(Transaction tx){\n // Need to see if tx inputs are contained in the blockchain UTXOs\n for(TransactionInput i : tx.inputs){\n if(!currentBlockchain.UTXOs.containsKey(i.previousOutId)){\n return true;\n }\n }\n return false;\n }", "public boolean canMerge(Item other);", "private static void mergingSyncMadeAsync() {\n Observable.merge(getDataSync(1).subscribeOn(Schedulers.io()), getDataSync(2).subscribeOn(Schedulers.io())).blockingForEach(System.out::println);\n }", "private boolean overlappingEvents(BpmnShape s1, BpmnShape s2) {\n\t\t\n\t\tdouble firstHeight = s1.getBounds().getHeight() / 2;\n\t\tdouble firstWidth = s1.getBounds().getWidth() / 2;\n\t\tdouble firstX = s1.getBounds().getX();\n\t\tdouble firstY = s1.getBounds().getY() + firstHeight;\n\t\t\n\t\tdouble secondWidth = s2.getBounds().getWidth() / 2;\n\t\tdouble secondHeight = s2.getBounds().getHeight() / 2;\n\t\tdouble secondX = s2.getBounds().getX();\n\t\tdouble secondY = s2.getBounds().getY() + secondHeight;\n\t\t\n\t\tif (firstX > secondX && firstY > secondY){\n\t\t\tif (firstX - firstWidth < secondX + secondWidth && firstY - firstHeight < secondY + secondHeight)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (firstX > secondX && firstY < secondY){\n\t\t\tif (firstX - firstWidth < secondX + secondWidth && firstY + firstHeight > secondY - secondHeight)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (firstX < secondX && firstY > secondY){\n\t\t\tif (firstX + firstWidth > secondX - secondWidth && firstY - firstHeight < secondY + secondHeight)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (firstX < secondX && firstY < secondY){\n\t\t\tif (firstX + firstWidth > secondX - secondWidth && firstY + firstHeight > secondY - secondHeight)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (firstX == secondX && firstY == secondY)\n\t\t\t\treturn true;\n\t\t\n\t\tif (firstX == secondX && firstY > secondY){\n\t\t\tif (firstY - firstHeight < secondY + secondHeight)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (firstX > secondX && firstY == secondY){\n\t\t\tif (firstX - firstWidth < secondX + secondWidth)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (firstX == secondX && firstY < secondY){\n\t\t\tif (firstY + firstHeight > secondY - secondHeight)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\t\n\t\tif (firstX < secondX && firstY == secondY){\n\t\t\tif (firstX + firstWidth > secondX - secondWidth)\n\t\t\t\treturn true;\n\t\t\telse\n\t\t\t\treturn false;\n\t\t}\n\t\treturn false;\n\t}", "@Test\r\n\tpublic void exerciseInterruptible() {\n\t\t\r\n\t\tList<String> articlesTopicA = Arrays.asList(\"Article A-1\",\"Article A-2\",\"Article A-3\");\r\n\t\tList<String> articlesTopicB = Arrays.asList(\"Article B-1\",\"Article B-2\",\"Article B-3\");\r\n\t\tList<String> articlesTopicC = Arrays.asList(\"Article C-1\",\"Article C-2\",\"Article C-3\");\r\n\t\t\r\n\t\tList<Observable<String>> topicObservables = Arrays.asList(\r\n\t\t\t\tObservable.interval(0, 80L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicA.get(i.intValue())),\r\n\t\t\t\tObservable.interval(50, 60L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicB.get(i.intValue())),\r\n\t\t\t\tObservable.interval(0, 40L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicC.get(i.intValue())));\r\n\t\t\r\n\t\tObservable<Observable<String>> topics = Observable.interval(0, 100L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> topicObservables.get(i.intValue()));\r\n\t\t\r\n\t\t//\t\t t[ms]: 0 100 200 300\r\n\t\t//\t\ttopics: A---------B---------C---------| \r\n\t\t//\t\t A: 1-------2-|-----3---|---------|\r\n\t\t//\t\t B: |---------|----1----|2-----3--|\r\n\t\t//\t\t C: |---------|---------1---2---3-|\r\n\t\t//\t\tResult: A-1 A-2 B-1 C-1 C-2 C-3\r\n\t\t\t\t\r\n\t\t// TODO: always switch to the latest topic\r\n\t\t// HINT: http://reactivex.io/documentation/operators/switch.html\r\n\t\tObservable<String> latestInteresting = Observable.empty();\r\n\r\n\t\t// verify\r\n\t\tTestSubscriber<String> testSubscriber = new TestSubscriber<>();\r\n\t\tlatestInteresting\r\n\t\t\t.doOnNext(article -> log(String.format(\" doOnNext(): %s Time: %d\", article, testScheduler.now())))\r\n\t\t\t.subscribe(testSubscriber);\r\n\t\t\r\n\t\t// let the time elapse until completion\r\n\t\ttestScheduler.advanceTimeBy(300, TimeUnit.MILLISECONDS);\r\n\t\t\r\n\t\ttestSubscriber.assertCompleted();\r\n\t\ttestSubscriber.assertNoErrors();\r\n\t\tList<String> expectedArticles = Arrays.asList(\r\n\t\t\t\t\"Article A-1\",\"Article A-2\", \r\n\t\t\t\t\"Article B-1\", \r\n\t\t\t\t\"Article C-1\", \"Article C-2\", \"Article C-3\");\r\n\t\ttestSubscriber.assertReceivedOnNext(expectedArticles);\r\n\t\t\r\n\t}", "boolean checkWin() {\n Iterator<Integer> seq = sequence.iterator();\n Iterator<Integer> in = input.iterator();\n\n while (seq.hasNext() && in.hasNext()) {\n seq.next();\n in.next();\n if (!seq.hasNext() && !in.hasNext()) {\n return true;\n }\n }\n return false;\n }", "@Test\n public void isSameLog_sameLog_returnTrue() {\n assertTrue(LOG_A.isSameLog(LOG_A));\n }", "public static java.util.Comparator getIS_SAME_TRANSITION() {\n if (org.xms.g.utils.GlobalEnvSetting.isHms()) {\n org.xms.g.utils.XmsLog.d(\"XMSRouter\", \"com.huawei.hms.location.ActivityConversionRequest.IS_EQUAL_CONVERSION\");\n return com.huawei.hms.location.ActivityConversionRequest.IS_EQUAL_CONVERSION;\n } else {\n org.xms.g.utils.XmsLog.d(\"XMSRouter\", \"com.google.android.gms.location.ActivityTransitionRequest.IS_SAME_TRANSITION\");\n return com.google.android.gms.location.ActivityTransitionRequest.IS_SAME_TRANSITION;\n }\n }", "Observable<Boolean> storeAllShifts(ArrayList<Shift> shifts);", "@Override // com.google.common.base.Equivalence\n public boolean doEquivalent(Object a, Object b) {\n return false;\n }", "public void testEquals() {\n TaskSeries s1 = new TaskSeries(\"S\");\n s1.add(new Task(\"T1\", new Date(1), new Date(2)));\n s1.add(new Task(\"T2\", new Date(11), new Date(22)));\n TaskSeries s2 = new TaskSeries(\"S\");\n s2.add(new Task(\"T1\", new Date(1), new Date(2)));\n s2.add(new Task(\"T2\", new Date(11), new Date(22)));\n TaskSeriesCollection c1 = new TaskSeriesCollection();\n c1.add(s1);\n c1.add(s2);\n TaskSeries s1b = new TaskSeries(\"S\");\n s1b.add(new Task(\"T1\", new Date(1), new Date(2)));\n s1b.add(new Task(\"T2\", new Date(11), new Date(22)));\n TaskSeries s2b = new TaskSeries(\"S\");\n s2b.add(new Task(\"T1\", new Date(1), new Date(2)));\n s2b.add(new Task(\"T2\", new Date(11), new Date(22)));\n TaskSeriesCollection c2 = new TaskSeriesCollection();\n c2.add(s1b);\n c2.add(s2b);\n }", "public int assertEvents(SerializedObserverTest.TestConcurrencySubscriberEvent expectedEndingEvent) throws IllegalStateException {\n int nextCount = 0;\n boolean finished = false;\n for (SerializedObserverTest.TestConcurrencySubscriberEvent e : events) {\n if (e == (SerializedObserverTest.TestConcurrencySubscriberEvent.onNext)) {\n if (finished) {\n // already finished, we shouldn't get this again\n throw new IllegalStateException(\"Received onNext but we're already finished.\");\n }\n nextCount++;\n } else\n if (e == (SerializedObserverTest.TestConcurrencySubscriberEvent.onError)) {\n if (finished) {\n // already finished, we shouldn't get this again\n throw new IllegalStateException(\"Received onError but we're already finished.\");\n }\n if ((expectedEndingEvent != null) && ((SerializedObserverTest.TestConcurrencySubscriberEvent.onError) != expectedEndingEvent)) {\n throw new IllegalStateException((\"Received onError ending event but expected \" + expectedEndingEvent));\n }\n finished = true;\n } else\n if (e == (SerializedObserverTest.TestConcurrencySubscriberEvent.onComplete)) {\n if (finished) {\n // already finished, we shouldn't get this again\n throw new IllegalStateException(\"Received onComplete but we're already finished.\");\n }\n if ((expectedEndingEvent != null) && ((SerializedObserverTest.TestConcurrencySubscriberEvent.onComplete) != expectedEndingEvent)) {\n throw new IllegalStateException((\"Received onComplete ending event but expected \" + expectedEndingEvent));\n }\n finished = true;\n }\n\n\n }\n return nextCount;\n }", "public static boolean equalsUnordered( Collection<?> collection1, Collection<?> collection2 )\r\n {\r\n //\r\n boolean retval = collection1.size() == collection2.size();\r\n \r\n //\r\n for ( Object iObject : collection1 )\r\n {\r\n retval &= collection2.contains( iObject );\r\n }\r\n \r\n //\r\n return retval;\r\n }", "private boolean isDoubleMatch(AnnotatedPluginDocument destination, AnnotatedPluginDocument insert) throws DocumentOperationException {\n List<SequenceAnnotation> destinationAnnotations = getFlankingOverhangs(destination);\n List<SequenceAnnotation> insertAnnotations = getFlankingOverhangs(insert);\n //Both lists will have a size of 2\n LinkedList<SequenceAnnotation> matchingOverhangs = new LinkedList<SequenceAnnotation>();\n for (SequenceAnnotation dAnno : destinationAnnotations) {\n for (SequenceAnnotation iAnno : insertAnnotations) {\n if (iAnno.getQualifierValue(\"sequence\").equalsIgnoreCase(dAnno.getQualifierValue(\"sequence\"))\n && iAnno.getInterval().getDirection() != dAnno.getInterval().getDirection()) {\n matchingOverhangs.add(iAnno);\n matchingOverhangs.add(dAnno);\n }\n }\n }\n //If there is a double match, all four flanking annotations should have been added to the list.\n if (matchingOverhangs.containsAll(destinationAnnotations) && matchingOverhangs.containsAll(insertAnnotations)) {\n return true;\n }\n return false;\n }", "public boolean hasAdjacentEqualPair()\n { \n \tfor( int i = 0; i < purchases.size()-1; i++ )\n \t{\n \t\tGizmo curr = purchases.get( i );\n \t\tGizmo nxt = purchases.get( i + 1 );\n \t\tif( curr.equals( nxt ) )\n \t\t\treturn true;\n \t}\n \treturn false; \t\n }" ]
[ "0.6903077", "0.68513095", "0.57861686", "0.5726465", "0.566286", "0.5648589", "0.558773", "0.5585471", "0.54760545", "0.5452018", "0.54351336", "0.53699374", "0.53461105", "0.5317674", "0.5290966", "0.5286816", "0.52699345", "0.5267013", "0.52380323", "0.51913446", "0.51470846", "0.5140753", "0.5138842", "0.51313037", "0.5121929", "0.5120846", "0.5116392", "0.5115877", "0.511081", "0.51045734", "0.509668", "0.50850564", "0.50811154", "0.507257", "0.5071141", "0.50536096", "0.50438297", "0.5040545", "0.50252545", "0.501117", "0.49995545", "0.49897325", "0.49820983", "0.49817562", "0.49688733", "0.49623975", "0.495503", "0.4950787", "0.4948824", "0.49416268", "0.49406317", "0.49367452", "0.49354395", "0.49266714", "0.4925499", "0.49235886", "0.49202734", "0.49112415", "0.4910776", "0.49048048", "0.49028638", "0.48881385", "0.4879865", "0.48780143", "0.48778617", "0.48770323", "0.48633415", "0.48573518", "0.48566377", "0.48507607", "0.4844331", "0.48431286", "0.48298997", "0.48239535", "0.4823803", "0.48223653", "0.48176005", "0.4813872", "0.48122358", "0.48087764", "0.48056984", "0.4805035", "0.47996032", "0.4799362", "0.47990173", "0.4798853", "0.47940937", "0.47904152", "0.4789912", "0.47891265", "0.47890747", "0.47834575", "0.4772268", "0.47696853", "0.47643262", "0.47587746", "0.47574377", "0.47532138", "0.4752925", "0.47511765" ]
0.6993693
0
given two or more source Observables, emit all of the items from only the first of these Observables to emit an item
@Test public void amb() { Observable<Integer> o1 = Observable.just(20, 40, 60) .delay(500, TimeUnit.SECONDS, mTestScheduler); Observable<Integer> o2 = Observable.just(1, 2, 3) .delay(200, TimeUnit.SECONDS, mTestScheduler); Observable<Integer> o3 = Observable.just(0, 0, 0) .delay(1000, TimeUnit.SECONDS, mTestScheduler); Observable.amb(o1, o2, o3) .subscribe(mList::add); mTestScheduler.advanceTimeBy(1000, TimeUnit.SECONDS); assertEquals(mList, Arrays.asList(1, 2, 3)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void combineLatest() {\n\n System.out.println(\"# 1\");\n\n /*\n Emits item every second\n */\n Observable sourceInterval = Observable.interval(1L, TimeUnit.MILLISECONDS).take(10);\n\n /*\n Emits string items\n */\n Observable sourceString = Observable.fromIterable(sData);\n\n Observable<?> combined = Observable.combineLatest((objects) -> {\n StringBuilder stringBuilder = new StringBuilder();\n Stream.of(objects).forEach(stringBuilder::append);\n return stringBuilder.toString();\n }, 1, sourceInterval, sourceString);\n\n combined.subscribe(new MyObserver<>());\n\n System.out.println(\"# 2\");\n\n /*\n Because empty observable immediately terminates hence whole sequence terminates.\n */\n combined = Observable.combineLatest((objects) -> {\n StringBuilder stringBuilder = new StringBuilder();\n Stream.of(objects).forEach(stringBuilder::append);\n return stringBuilder.toString();\n }, 1, sourceInterval, sourceString, Observable.empty());\n combined.subscribe(new MyObserver<>());\n\n System.out.println(\"# 3\");\n /*\n Same as above but instead collection of sources are used.\n */\n List<Observable<?>> collection = new ArrayList<>();\n collection.add(sourceInterval);\n collection.add(sourceString.repeat(1));\n combined = Observable.combineLatest(collection, (objects) -> {\n StringBuilder stringBuilder = new StringBuilder();\n Stream.of(objects).forEach(stringBuilder::append);\n return stringBuilder.toString();\n });\n combined.subscribe(new MyObserver<>());\n\n System.out.println(\"# 4\");\n /*\n Explicitly combine 2 sources, similarly it can be done up to 10 sources\n */\n combined = Observable.combineLatest(sourceInterval, sourceString.repeat(1),\n (first, second) -> first + \"-\" + second);\n combined.subscribe(new MyObserver<>());\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> merge(\r\n\t\t\t@Nonnull final Iterable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\tfinal CompositeCloseable closeables = new CompositeCloseable();\r\n\t\t\t\t\r\n\t\t\t\tList<Observable<? extends T>> sourcesList = new ArrayList<Observable<? extends T>>();\r\n\t\t\t\tfor (Observable<? extends T> os : sources) {\r\n\t\t\t\t\tsourcesList.add(os);\r\n\t\t\t\t}\r\n\t\t\t\tfinal AtomicInteger wip = new AtomicInteger(sourcesList.size() + 1);\r\n\t\t\t\tfinal List<DefaultObserverEx<T>> observers = new ArrayList<DefaultObserverEx<T>>();\r\n\t\t\t\tfinal Lock lock = new ReentrantLock();\r\n\t\t\t\tfor (int i = 0; i < sourcesList.size(); i++) {\r\n\t\t\t\t\tfinal int j = i;\r\n\t\t\t\t\tDefaultObserverEx<T> obs = new DefaultObserverEx<T>(lock, true) {\r\n\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\tpublic void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t\t\tfor (int k = 0; k < observers.size(); k++) {\r\n\t\t\t\t\t\t\t\tif (k != j) {\r\n\t\t\t\t\t\t\t\t\tobservers.get(k).close();\r\n\t\t\t\t\t\t\t\t}\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\t@Override\r\n\t\t\t\t\t\tpublic void onFinish() {\r\n\t\t\t\t\t\t\tif (wip.decrementAndGet() == 0) {\r\n\t\t\t\t\t\t\t\tobserver.finish();\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\t@Override\r\n\t\t\t\t\t\tpublic void onNext(T value) {\r\n\t\t\t\t\t\t\tobserver.next(value);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t};\r\n\t\t\t\t\tobservers.add(obs);\r\n\t\t\t\t\tcloseables.add(obs);\r\n\t\t\t\t}\r\n\t\t\t\tfor (int i = 0; i < observers.size(); i++) {\r\n\t\t\t\t\tDefaultObserverEx<T> obs = observers.get(i);\r\n\t\t\t\t\tObservable<? extends T> ov = sourcesList.get(i);\r\n\t\t\t\t\tobs.registerWith(ov);\r\n\t\t\t\t}\r\n\t\t\t\tif (wip.decrementAndGet() == 0) {\r\n\t\t\t\t\tobserver.finish();\r\n\t\t\t\t}\r\n\t\t\t\treturn closeables;\r\n\t\t\t}\r\n\t\t};\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> concat(\r\n\t\t\t@Nonnull final Iterable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Concat.FromIterable.Selector<Observable<? extends T>, T>(\r\n\t\t\t\tsources, Functions.<Observable<? extends T>>identity());\r\n\t}", "public static void flatMap() {\n List<String> data = Utils.getData();\n Observable.fromIterable(data)\n .flatMap((item) -> Observable.just(item + \" flat mapped\").repeat(2)\n ).subscribe(new MyObserver<>());\n }", "public static void zipObservables(CountDownLatch latch) {\n\n Observable<Observable<String>> source = Observable.create(observableEmitter -> {\n System.out.println(\"create\");\n observableEmitter.onNext(Observable.just(\"abc\", \"def\"));\n observableEmitter.onNext(Observable.just(\"123\", \"456\"));\n observableEmitter.onNext(Observable.just(\"alpha\", \"beta\", \"gama\"));\n observableEmitter.onComplete();\n });\n\n source.doOnSubscribe(d -> System.out.println(\"source doOnSubscribe\"));\n source.doOnNext(i -> System.out.println(\"source doOnNext = \" + i.toString()));\n source.doOnComplete(() -> System.out.println(\"source doOnComplete\"));\n\n\n Observable.zip(source, items -> items[0] + \"-\" + items[1] + \"-\" + items[2])\n .doOnSubscribe(d -> System.out.println(\"zip doOnSubscribe\"))\n .doOnNext(i -> System.out.println(\"zip doOnNext\"))\n .subscribe(new MyObserver<>(latch));\n }", "@Nonnull\r\n\tpublic static <T> Observable<List<T>> forkJoin(\r\n\t\t\t@Nonnull final Iterable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Observable<List<T>>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super List<T>> observer) {\r\n\t\t\t\tfinal CompositeCloseable closeables = new CompositeCloseable();\r\n\t\t\t\tfinal List<AtomicReference<T>> lastValues = new ArrayList<AtomicReference<T>>();\r\n\t\t\t\tfinal List<Observable<? extends T>> observableList = new ArrayList<Observable<? extends T>>();\r\n\t\t\t\tfinal List<Observer<T>> observers = new ArrayList<Observer<T>>();\r\n\t\t\t\tfinal AtomicInteger wip = new AtomicInteger(observableList.size() + 1);\r\n\r\n\t\t\t\tint i = 0;\r\n\t\t\t\tfor (Observable<? extends T> o : sources) {\r\n\t\t\t\t\tfinal int j = i;\r\n\t\t\t\t\tobservableList.add(o);\r\n\t\t\t\t\tlastValues.add(new AtomicReference<T>());\r\n\t\t\t\t\tobservers.add(new Observer<T>() {\r\n\t\t\t\t\t\t/** The last value. */\r\n\t\t\t\t\t\tT last;\r\n\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t\t\tcloseables.closeSilently();\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 finish() {\r\n\t\t\t\t\t\t\tlastValues.get(j).set(last);\r\n\t\t\t\t\t\t\trunIfComplete(observer, lastValues, wip);\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 next(T value) {\r\n\t\t\t\t\t\t\tlast = value;\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\ti = 0;\r\n\t\t\t\tfor (Observable<? extends T> o : observableList) {\r\n\t\t\t\t\tcloseables.add(Observers.registerSafe(o, observers.get(i)));\r\n\t\t\t\t\ti++;\r\n\t\t\t\t}\r\n\t\t\t\trunIfComplete(observer, lastValues, wip);\r\n\t\t\t\treturn closeables;\r\n\t\t\t}\r\n\t\t\t/**\r\n\t\t\t * Runs the completion sequence once the WIP drops to zero.\r\n\t\t\t * @param observer the observer who will receive the values\r\n\t\t\t * @param lastValues the array of last values\r\n\t\t\t * @param wip the work in progress counter\r\n\t\t\t */\r\n\t\t\tpublic void runIfComplete(\r\n\t\t\t\t\tfinal Observer<? super List<T>> observer,\r\n\t\t\t\t\tfinal List<AtomicReference<T>> lastValues,\r\n\t\t\t\t\tfinal AtomicInteger wip) {\r\n\t\t\t\tif (wip.decrementAndGet() == 0) {\r\n\t\t\t\t\tList<T> values = new ArrayList<T>();\r\n\t\t\t\t\tfor (AtomicReference<T> r : lastValues) {\r\n\t\t\t\t\t\tvalues.add(r.get());\r\n\t\t\t\t\t}\r\n\t\t\t\t\tobserver.next(values);\r\n\t\t\t\t\tobserver.finish();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public void flatMap() {\r\n\t\tList<Integer> list = Arrays.asList(1, 2, 3, 7, 8, 9, 10);\r\n\t\tList<Integer> list2 = Arrays.asList(4, 5, 6);\r\n\t\tObservable.just(list, list2).flatMap(x -> Observable.from(x)).map(x -> x * 10).subscribe(integerSubscribe());\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> concat(\r\n\t\t\t@Nonnull final Observable<? extends T>... sources) {\r\n\t\treturn new Concat.FromIterable.Selector<Observable<? extends T>, T>(\r\n\t\t\t\tArrays.asList(sources), Functions.<Observable<? extends T>>identity());\r\n\t}", "@SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n @BackpressureSupport(BackpressureKind.FULL)\n @SchedulerSupport(SchedulerKind.NONE)\n public static <T> Observable<T> concatArray(Publisher<? extends T>... sources) {\n if (sources.length == 0) {\n return empty();\n } else\n if (sources.length == 1) {\n return fromPublisher(sources[0]);\n }\n return fromArray(sources).concatMap((Function)Functions.identity());\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> concat(\r\n\t\t\t@Nonnull Observable<? extends T> first,\r\n\t\t\t@Nonnull Observable<? extends T> second) {\r\n\t\tList<Observable<? extends T>> list = new ArrayList<Observable<? extends T>>();\r\n\t\tlist.add(first);\r\n\t\tlist.add(second);\r\n\t\treturn concat(list);\r\n\t}", "@Test\n public void example() {\n Func1<Integer, Observable<Integer>> db1 = param -> Observable.range(1, param);\n\n // ws-kald som funktion der returner en Observable\n Func1<Integer, Observable<Integer>> ws1 = param -> Observable.just(param);\n\n // ws-kald som funktion der returner en Observable\n Func1<Integer, Observable<Integer>> ws2 = param -> Observable.just(param);\n\n // ws-kald som funktion der returner en Observable\n Func1<List<Integer>, Observable<Object>> ws3 = param -> Observable.empty();\n\n db1.call(5)\n .flatMap(row -> {\n if (row % 2 == 0) {\n // ws2 kaldes kun, hvis ws1 ikke var tom\n return Observable.concat(ws1.call(row), ws2.call(row)).first();\n } else {\n // ws1 og ws2 udføres parallelt\n return Observable.zip(ws1.call(10), ws2.call(20), (e1, e2) -> e1 + e2);\n }\n })\n .onErrorResumeNext(err -> {\n log.error(\"error - resume next \", err);\n return Observable.empty();\n })\n .doOnNext(n -> log.info(\"element {}\", n))\n // samle/batche 2 elementer i en liste (men højst vente 1 sekund)\n .buffer(2, 1, TimeUnit.SECONDS)\n // output sendes til en ws3\n .flatMap(ws3)\n // subscribe starter kæden\n .subscribe();\n }", "public static void concatMap() {\n List<String> data = Utils.getData();\n Observable.fromIterable(data)\n .concatMap((item) -> Observable.just(item + \" concat mapped\").repeat(2)\n ).subscribe(new MyObserver<>());\n }", "@Nonnull \r\n\tpublic static <T, U> Observable<U> zip(\r\n\t\t\t@Nonnull final Iterable<? extends Observable<? extends T>> srcs,\r\n\t\t\t@Nonnull final Func1<? super List<T>, ? extends U> selector) {\r\n\t\treturn new Zip.ManyObservables<T, U>(srcs, selector);\r\n\t}", "@Nonnull \r\n\tpublic static <T> Observable<T> concat(\r\n\t\t\t@Nonnull final Observable<? extends Observable<? extends T>> sources\r\n\t) {\r\n\t\treturn new Concat.FromObservable.Selector<T, T>(sources, Functions.<Observable<? extends T>>identity());\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> merge(\r\n\t\t\t@Nonnull Observable<? extends T> first,\r\n\t\t\t@Nonnull Observable<? extends T> second) {\r\n\t\tList<Observable<? extends T>> list = new ArrayList<Observable<? extends T>>();\r\n\t\tlist.add(first);\r\n\t\tlist.add(second);\r\n\t\treturn merge(list);\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> amb(\r\n\t\t\t@Nonnull final Iterable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Ambiguous<T>(sources);\r\n\t}", "public void concatMap() {\r\n\t\tList<Integer> list1 = Arrays.asList(1, 2, 3, 7, 8, 9, 10);\r\n\t\tList<Integer> list2 = Arrays.asList(4, 5, 6);\r\n\t\tObservable.just(list1, list2).concatMap(x -> Observable.from(x)).map(x -> x * 10).subscribe(integerSubscribe());\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> merge(\r\n\t\t\t@Nonnull final Observable<? extends T>... sources) {\r\n\t\treturn merge(Arrays.asList(sources));\r\n\t}", "public static <T> Observable<T> merge(\r\n\t\t\tfinal Observable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\tfinal AtomicInteger wip = new AtomicInteger(1);\r\n\t\t\t\tDefaultObserverEx<Observable<? extends T>> obs = new DefaultObserverEx<Observable<? extends T>>(false) {\r\n\t\t\t\t\t/** Signal finish if the sources and inner observables have all finished. */\r\n\t\t\t\t\tvoid ifDoneFinish() {\r\n\t\t\t\t\t\tif (wip.decrementAndGet() == 0) {\r\n\t\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\t\tclose();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t/**\r\n\t\t\t\t\t * The inner exception to forward.\r\n\t\t\t\t\t * @param ex the exception\r\n\t\t\t\t\t */\r\n\t\t\t\t\tvoid innerError(Throwable ex) {\r\n\t\t\t\t\t\terror(ex);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onFinish() {\r\n\t\t\t\t\t\tifDoneFinish();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onNext(Observable<? extends T> value) {\r\n\t\t\t\t\t\tfinal Object token = new Object();\r\n\t\t\t\t\t\twip.incrementAndGet();\r\n\t\t\t\t\t\tadd(token, value.register(new DefaultObserver<T>(lock, true) {\r\n\t\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\t\tpublic void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\t\t\tinnerError(ex);\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\t\tpublic void onFinish() {\r\n\t\t\t\t\t\t\t\tremove(token);\r\n\t\t\t\t\t\t\t\tifDoneFinish();\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\t\tpublic void onNext(T value) {\r\n\t\t\t\t\t\t\t\tobserver.next(value);\r\n\t\t\t\t\t\t\t}\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\t\t\t\treturn obs.registerWith(sources);\r\n\t\t\t}\r\n\t\t};\r\n\t}", "@Nonnull \r\n\tpublic static <T> Observable<List<T>> combine(\r\n\t\t\t@Nonnull final Func0<? extends T> supplier, \r\n\t\t\t@Nonnull Observable<? extends T> src) {\r\n\t\treturn select(src, new Func1<T, List<T>>() {\r\n\t\t\t@Override\r\n\t\t\tpublic List<T> invoke(T param1) {\r\n\t\t\t\tList<T> result = new ArrayList<T>();\r\n\t\t\t\tresult.add(supplier.invoke());\r\n\t\t\t\tresult.add(param1);\r\n\t\t\t\treturn result;\r\n\t\t\t}\r\n\t\t});\r\n\t}", "@Nonnull \r\n\tpublic static <T> Observable<List<T>> zip(\r\n\t\t\t@Nonnull final Iterable<? extends Observable<? extends T>> srcs) {\r\n\t\treturn zip(srcs, Functions.<List<T>>identity());\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> amb(\r\n\t\t\t@Nonnull final Observable<? extends T>... sources) {\r\n\t\treturn new Ambiguous<T>(Arrays.asList(sources));\r\n\t}", "@Nonnull\r\n\tpublic static <T, U> Observable<U> concat(\r\n\t\t\t@Nonnull final Iterable<? extends T> source, \r\n\t\t\t@Nonnull final Func1<? super T, ? extends Observable<? extends U>> resultSelector) {\r\n\t\treturn new Concat.FromIterable.Selector<T, U>(source, resultSelector);\r\n\t}", "public static void just() {\n Observable<List<String>> myObservable = Observable.just(Utils.getData());\n myObservable.subscribe(consumerList);\n }", "@Test\r\n\tpublic void exerciseInterruptible() {\n\t\t\r\n\t\tList<String> articlesTopicA = Arrays.asList(\"Article A-1\",\"Article A-2\",\"Article A-3\");\r\n\t\tList<String> articlesTopicB = Arrays.asList(\"Article B-1\",\"Article B-2\",\"Article B-3\");\r\n\t\tList<String> articlesTopicC = Arrays.asList(\"Article C-1\",\"Article C-2\",\"Article C-3\");\r\n\t\t\r\n\t\tList<Observable<String>> topicObservables = Arrays.asList(\r\n\t\t\t\tObservable.interval(0, 80L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicA.get(i.intValue())),\r\n\t\t\t\tObservable.interval(50, 60L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicB.get(i.intValue())),\r\n\t\t\t\tObservable.interval(0, 40L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicC.get(i.intValue())));\r\n\t\t\r\n\t\tObservable<Observable<String>> topics = Observable.interval(0, 100L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> topicObservables.get(i.intValue()));\r\n\t\t\r\n\t\t//\t\t t[ms]: 0 100 200 300\r\n\t\t//\t\ttopics: A---------B---------C---------| \r\n\t\t//\t\t A: 1-------2-|-----3---|---------|\r\n\t\t//\t\t B: |---------|----1----|2-----3--|\r\n\t\t//\t\t C: |---------|---------1---2---3-|\r\n\t\t//\t\tResult: A-1 A-2 B-1 C-1 C-2 C-3\r\n\t\t\t\t\r\n\t\t// TODO: always switch to the latest topic\r\n\t\t// HINT: http://reactivex.io/documentation/operators/switch.html\r\n\t\tObservable<String> latestInteresting = Observable.empty();\r\n\r\n\t\t// verify\r\n\t\tTestSubscriber<String> testSubscriber = new TestSubscriber<>();\r\n\t\tlatestInteresting\r\n\t\t\t.doOnNext(article -> log(String.format(\" doOnNext(): %s Time: %d\", article, testScheduler.now())))\r\n\t\t\t.subscribe(testSubscriber);\r\n\t\t\r\n\t\t// let the time elapse until completion\r\n\t\ttestScheduler.advanceTimeBy(300, TimeUnit.MILLISECONDS);\r\n\t\t\r\n\t\ttestSubscriber.assertCompleted();\r\n\t\ttestSubscriber.assertNoErrors();\r\n\t\tList<String> expectedArticles = Arrays.asList(\r\n\t\t\t\t\"Article A-1\",\"Article A-2\", \r\n\t\t\t\t\"Article B-1\", \r\n\t\t\t\t\"Article C-1\", \"Article C-2\", \"Article C-3\");\r\n\t\ttestSubscriber.assertReceivedOnNext(expectedArticles);\r\n\t\t\r\n\t}", "public static Observable<String> getObservableDistinct() {\n return observableSrcDuplicated;//todo\n }", "public static Observable<String> getObservableSkipWhileElement() {\n return observableSrc;//todo\n }", "public static Observable<String> getObservableSkipLastElement() {\n return observableSrc;//todo\n }", "@Nonnull \r\n\tpublic static <T, U> Observable<U> concat(\r\n\t\t\t@Nonnull final Observable<? extends Observable<? extends T>> sources,\r\n\t\t\t@Nonnull Func1<? super Observable<? extends T>, ? extends Observable<? extends U>> resultSelector\r\n\t) {\r\n\t\treturn new Concat.FromObservable.Selector<T, U>(sources, resultSelector);\r\n\t}", "private static void mergingSync() {\n Observable.merge(getDataSync(1), getDataSync(2)).blockingForEach(System.out::println);\n }", "@Nonnull\r\n\tpublic static <T, U> Observable<U> concat(\r\n\t\t\t@Nonnull final Iterable<? extends T> source, \r\n\t\t\t@Nonnull final Func2<? super T, ? super Integer, ? extends Observable<? extends U>> resultSelector) {\r\n\t\treturn new Concat.FromIterable.IndexedSelector<T, U>(source, resultSelector);\r\n\t}", "public static void test001()\r\n {\r\n System.out.println(\"RxJavaTest04::test001\");\r\n Observable<String> peopleStream = myListPeople();\r\n Single<List<String>> peopleList = peopleStream.toList();\r\n List<String> people = peopleList.blockingGet();\r\n for (String person : people) {\r\n System.out.println(person);\r\n }\r\n }", "@Nonnull \r\n\tpublic static <T, U> Observable<U> concat(\r\n\t\t\t@Nonnull final Observable<? extends Observable<? extends T>> sources,\r\n\t\t\t@Nonnull Func2<? super Observable<? extends T>, ? super Integer, ? extends Observable<? extends U>> resultSelector\r\n\t) {\r\n\t\treturn new Concat.FromObservable.IndexedSelector<T, U>(sources, resultSelector);\r\n\t}", "public static Observable<String> getObservableDistinctUntilChanges() {\n return observableSrcDuplicated;//todo\n }", "public static void main(String[] args){\n Observable myObservable = Observable.create(new Observable.OnSubscribe(){\n\n @Override\n public void call(Object subscriber) {\n Subscriber mySubscriber = (Subscriber)subscriber;\n\n for(int i = 0 ; i < 10; i++){\n //if my subscriber was subscribed\n if(!mySubscriber.isUnsubscribed()){\n mySubscriber.onNext(\"Pushed value \" + i);\n }\n }\n\n if(!mySubscriber.isUnsubscribed()){\n mySubscriber.onCompleted();\n }\n\n }\n });\n\n //subscribe to your Observable\n myObservable.subscribe(new Action1<String>() {\n @Override\n public void call(String s) {\n System.out.println(s);\n }\n },\n new Action1<Throwable>() {\n @Override\n public void call(Throwable throwable) {\n System.out.println(\"Something went wrong the observable\");\n }\n },\n new Action0() {\n @Override\n public void call() {\n System.out.println(\"No more values will be pushed.\");\n }\n });\n\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> amb(\r\n\t\t\t@Nonnull final Observable<? extends T> left,\r\n\t\t\t@Nonnull final Observable<? extends T> right\r\n\t\t\t) {\r\n\t\tList<Observable<? extends T>> sources = new ArrayList<Observable<? extends T>>();\r\n\t\tsources.add(left);\r\n\t\tsources.add(right);\r\n\t\treturn amb(sources);\r\n\t}", "public static <T> Observable<T> switchToNext(final Observable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\tDefaultObserver<Observable<? extends T>> outer\r\n\t\t\t\t= new DefaultObserver<Observable<? extends T>>(false) {\r\n\t\t\t\t\t/** The inner observer. */\r\n\t\t\t\t\t@GuardedBy(\"lock\")\r\n\t\t\t\t\tCloseable inner;\r\n\r\n\t\t\t\t\tDefaultObserver<T> innerObserver = new DefaultObserver<T>(lock, true) {\r\n\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\tprotected void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\t\tinnerError(ex);\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\tprotected void onFinish() {\r\n\t\t\t\t\t\t\tinnerFinish();\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\tprotected void onNext(T value) {\r\n\t\t\t\t\t\t\tobserver.next(value);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t};\r\n\t\t\t\t\t/** Called from the inner observer when an error condition occurs. */\r\n\t\t\t\t\tvoid innerError(Throwable ex) {\r\n\t\t\t\t\t\terror(ex);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t/** Called from the inner observer when it finished. */\r\n\t\t\t\t\tvoid innerFinish() {\r\n\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\tclose();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onClose() {\r\n\t\t\t\t\t\tCloseables.closeSilently(inner);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t\tclose();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onFinish() {\r\n\t\t\t\t\t\t// nothing to do\r\n\t\t\t\t\t}\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onNext(Observable<? extends T> value) {\r\n\t\t\t\t\t\tCloseables.closeSilently(inner);\r\n\t\t\t\t\t\tinner = value.register(innerObserver);\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\treturn sources.register(outer);\r\n\t\t\t}\r\n\t\t};\r\n\t}", "@Nonnull\r\n\tpublic static <T, U> Observable<U> concat(\r\n\t\t\t@Nonnull final Func1<? super T, ? extends Observable<? extends U>> resultSelector,\r\n\t\t\t\t@Nonnull final T... source\r\n\t\t\t\t\t) {\r\n\t\treturn new Concat.FromIterable.Selector<T, U>(Arrays.asList(source), resultSelector);\r\n\t}", "public static void main(String[] args) throws Exception {\n\t\tFlowable<String> obs4 = Flowable.just(\"un\", \"deux\", \"trois\", \"quatre\", \"sank\", \"six\", \"sept\", \"huit\", \"neuf\", \"deese\");\n//\t\tobs4.map(mapper -> {\n//\t\t\tif (\"deux\".equals(mapper))\n//\t\t\t\tThread.sleep(2000);\n//\t\t\treturn mapper+\" -- \"+Thread.currentThread().getName();\n//\t\t})\t\n//\t\t.subscribe(System.out::println);\n\t\t\n\t\tObserver<String> observer1 = new Observer<String>() {\n\n\t\t\t@Override\n\t\t\tpublic void onComplete() {\n\t\t\t\tSystem.out.println(\"Completed...\");\n\t\t\t\t\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onError(Throwable arg0) {\n\t\t\t\targ0.printStackTrace();\n\t\t\t\t\n\t\t\t}\n\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onSubscribe(Disposable arg0) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onNext(String arg0) {\n\t\t\t\tSystem.out.println(\"on next -- \"+arg0);\n\t\t\t\t\n\t\t\t}\n\t\t};\n\t\t\n\t\tList<String> list1 = Arrays.asList(\"un\",\"deux\",\"trois\",\"quatre\",\"sank\");\n\t\t\n\t\tObservable obs5 = Observable.fromIterable(list1);\n\t\t\n\t\t//obs5.subscribe(observer1);\n\t\t\n\t\t//Flowable.range(3, 10).subscribe(System.out::println);\n\t\t\n\t\tnew Thread(\n\t\t()->{\n\t\t\tobs4\n\t\t\t.map(mapper ->{\n\t\t\t\tif (\"deux\".equals(mapper) || \"quatre\".equals(mapper))\n\t\t\t\t\tThread.sleep(2000);\n\t\t\t\treturn mapper+\" -- \"+Thread.currentThread().getName();\n\t\t\t})\n\t\t\t.subscribe(System.out::println);\n\t\t\t\n\t\t}).start();\n\t\t\n//\t\tnew Thread() {\n//\t\t\tpublic void run() {\n//\t\t\t\tobs4\n//\t\t\t\t\t.map(mapper ->{\n//\t\t\t\t\t\tif (\"deux\".equals(mapper) || \"quatre\".equals(mapper))\n//\t\t\t\t\t\t\tThread.sleep(2000);\n//\t\t\t\t\t\treturn mapper+\" -- \"+Thread.currentThread().getName();\n//\t\t\t\t\t})\n//\t\t\t\t\t.subscribe(System.out::println);\n//\t\t\t}\n//\t\t}.start();\n\t\t\n//\t\tExecutor exe = Executors.newCachedThreadPool();\n//\t\t\n//\t\texe.execute(()->{\n//\t\t\t\n//\t\t\tobs4\n//\t\t\t.map(mapper ->{\n//\t\t\t\tif (\"deux\".equals(mapper) || \"quatre\".equals(mapper))\n//\t\t\t\t\tThread.sleep(2000);\n//\t\t\t\treturn mapper+\" -- \"+Thread.currentThread().getName();\n//\t\t\t})\n//\t\t\t.subscribe(System.out::println);\n\t\t\t\n//\t\t\tobs4.subscribe();\n//\t\t\tFlowable.zip(obs4, Flowable.interval(2, TimeUnit.SECONDS),(k,v)->k)\n//\t\t\t.subscribe((data)->{\n//\t\t\t\tSystem.out.println(\" \"+data+\" -- \"+Thread.currentThread().getName());\n//\t\t\t});\n//\t\t\tFlowable.interval(1, TimeUnit.SECONDS)\n//\t\t\t.map(mapper -> {\n//\t\t\t\tif (mapper == 3)\n//\t\t\t\t\tthrow new Exception(\" Time is Over !!! \");\n//\t\t\t\treturn mapper;\n//\t\t\t})\n//\t\t\t.subscribe((data)->{\n//\t\t\t\tSystem.out.println(data +\" -- \"+Thread.currentThread().getName());\n//\t\t\t},(e)->{\n//\t\t\t\te.printStackTrace();\n//\t\t\t});\n\t\t\t\n\t\t//});\n\t\t\n//\t\t//Thread.sleep(5000);\t\n//\t\tFlowable<String> flw1 = Flowable.just(\"un\",\"deux\",\"trois\",\"quatre\",\"sank\",\"six\",\"sept\");\n//\t\tflw1\n//\t\t//.subscribeOn(Schedulers.from(Executors.newFixedThreadPool(4)))\n//\t\t.map(mapper ->{\n//\t\t\tif (\"deux\".equals(mapper))\n//\t\t\t\tThread.sleep(1000);\n//\t\t\tif (\"quatre\".equals(mapper))\n//\t\t\t\tThread.sleep(500);\n//\t\t\treturn mapper +\" -- \"+Thread.currentThread().getName();\n//\t\t})\n//\t\t.subscribe(System.out::println);\n//\t\t\n//\t\tThread.sleep(2000);\n\t}", "@Nonnull \r\n\tpublic static <T, U> Observable<U> manySelect(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func1<? super Observable<T>, ? extends Observable<U>> selector\r\n\t) {\r\n\t\treturn merge(select(source, new Func1<T, Observable<U>>() {\r\n\t\t\t/** The skip position. */\r\n\t\t\tint counter;\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic Observable<U> invoke(T param1) {\r\n\t\t\t\tint i = counter++;\r\n\t\t\t\treturn selector.invoke(skip(source, i));\r\n\t\t\t}\r\n\r\n\t\t}));\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<List<T>> forkJoin(\r\n\t\t\t@Nonnull final Observable<? extends T>... sources) {\r\n\t\treturn forkJoin(Arrays.asList(sources));\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> startWith(\r\n\t\t\t@Nonnull Observable<? extends T> source,\r\n\t\t\t@Nonnull Iterable<? extends T> values,\r\n\t\t\t@Nonnull Scheduler pool) {\r\n\t\treturn concat(toObservable(values, pool), source);\r\n\t}", "public static void sample() {\n System.out.println(\"# 1\");\n Observable.fromIterable(sData)\n .timestamp()\n .sample(1000, TimeUnit.MICROSECONDS)\n .subscribe(new MyObserver<>());\n\n /*\n Emission controlled by sampler inner observable\n */\n System.out.println(\"# 2\");\n Observable.fromIterable(sData)\n .sample((observer) -> {\n System.out.println(\"emitter\");\n Observable.just(\"123\").subscribe(observer);\n }, true).subscribe(new MyObserver<>());\n }", "public static void switchOnNext(CountDownLatch latch) {\n\n List<Observable<Long>> collectionOfObservable = new ArrayList<>();\n\n Observable<Long> first = Observable.interval(1L, TimeUnit.SECONDS).take(5)\n .doOnNext((item) -> System.out.println(\"first doOnNext item = \" + item));\n\n Observable<Long> second = Observable.interval(1L, TimeUnit.SECONDS)\n .map(item -> item + 100).take(10);\n\n collectionOfObservable.add(first);\n collectionOfObservable.add(second);\n\n Observable.switchOnNext(Observable.fromIterable(collectionOfObservable))\n .subscribeOn(Schedulers.io()).subscribe(new MyObserver<>(latch));\n }", "@Nonnull\r\n\tpublic static <T, U> Observable<U> selectMany(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func1<? super T, ? extends Observable<? extends U>> selector) {\r\n\t\treturn selectMany(source, selector, Functions.<T, U>identitySecond());\r\n\t}", "@Nonnull\r\n\tpublic static <T, U> Observable<U> concat(\r\n\t\t\t@Nonnull final Func2<? super T, ? super Integer, ? extends Observable<? extends U>> resultSelector,\r\n\t\t\t@Nonnull T... source) {\r\n\t\treturn new Concat.FromIterable.IndexedSelector<T, U>(Arrays.asList(source), resultSelector);\r\n\t}", "private static void scenario() {\n\n Observable<String> stringObservable = Observable.just(\"One\",\"Two\",\"Three\",\"Four\",\"Five\",\"Six\",\"Seven\",\"Eight\",\"Nine\");\n\n Observable<String> stringProcessor = stringObservable.concatMap(data -> Observable.just(data).delay(randomSleepTime(),\n TimeUnit.MILLISECONDS));\n\n stringProcessor.subscribe(System.out::println);\n\n sleep(20000);\n\n /* OUTPUT :\n One\n Two\n Three\n Four\n Five\n Six\n Seven\n Eight\n Nine\n */\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> startWith(\r\n\t\t\t@Nonnull Observable<? extends T> source,\r\n\t\t\t@Nonnull Iterable<? extends T> values) {\r\n\t\treturn startWith(source, values, scheduler());\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> resumeAlways(\r\n\t\t\t@Nonnull final Iterable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Resume.Always<T>(sources);\r\n\t}", "public static void compose() {\n Observable.fromIterable(Utils.getData())\n .compose((source) -> {\n source.subscribe(new MyObserver<>());\n return source;\n });\n\n System.out.println(\"# 2\");\n\n Observable.fromIterable(Utils.getData())\n .compose((source) -> {\n Observable<String> observable = Observable.just(\"composed\");\n observable.subscribe(new MyObserver<>());\n return observable;\n });\n }", "@Nonnull \r\n\tpublic static <T, U> Observable<U> manySelect(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func1<? super Observable<T>, ? extends U> selector,\r\n\t\t\t@Nonnull final Scheduler scheduler) {\r\n\t\treturn new Observable<U>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super U> observer) {\r\n\t\t\t\tfinal AtomicInteger wip = new AtomicInteger(1);\r\n\t\t\t\tCloseable c = source.register(new DefaultObserverEx<T>(true) {\r\n\t\t\t\t\t/** The skip position. */\r\n\t\t\t\t\tint counter;\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t\tclose();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onFinish() {\r\n\t\t\t\t\t\tif (wip.decrementAndGet() == 0) {\r\n\t\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onNext(T value) {\r\n\t\t\t\t\t\tfinal Observable<T> ot = skip(source, counter);\r\n\t\t\t\t\t\twip.incrementAndGet();\r\n\t\t\t\t\t\tadd(counter, scheduler.schedule(new Runnable() {\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\tobserver.next(selector.invoke(ot));\r\n\t\t\t\t\t\t\t\tif (wip.decrementAndGet() == 0) {\r\n\t\t\t\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}));\r\n\t\t\t\t\t\tcounter++;\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t});\r\n\t\t\t\treturn c;\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public static <T> Observable<Boolean> sequenceEqual(\r\n\t\t\tfinal Iterable<? extends T> first,\r\n\t\t\tfinal Observable<? extends T> second) {\r\n\t\treturn sequenceEqual(first, second, Functions.equals());\r\n\t}", "public static Observable<String> getObservableFiltered() {\n return observableSrc;//todo\n }", "@Override\n protected void subscribeActual(Subscriber<? super T> object) {\n MaybeSource<? extends T>[] arrmaybeSource = this.sources;\n int n = arrmaybeSource.length;\n SimpleQueue simpleQueue = n <= MaybeMergeArray.bufferSize() ? new MpscFillOnceSimpleQueue(n) : new ClqSimpleQueue();\n simpleQueue = new MergeMaybeObserver(object, n, (SimpleQueueWithConsumerIndex<Object>)simpleQueue);\n object.onSubscribe((Subscription)((Object)simpleQueue));\n object = ((MergeMaybeObserver)simpleQueue).error;\n int n2 = arrmaybeSource.length;\n n = 0;\n do {\n MaybeSource maybeSource;\n block4: {\n block3: {\n if (n >= n2) break block3;\n maybeSource = arrmaybeSource[n];\n if (!((MergeMaybeObserver)simpleQueue).isCancelled() && ((AtomicReference)object).get() == null) break block4;\n }\n return;\n }\n maybeSource.subscribe(simpleQueue);\n ++n;\n } while (true);\n }", "@Test\n public void testSummingUpTwoAsyncStreamsOfIntegers() throws Exception {\n FunctionalReactives<Integer> fr1 =\n FunctionalReactives.createAsync(\n aSubscribableWillAsyncFireIntegerOneToFive() //one async stream of Integers\n );\n FunctionalReactives<Integer> fr2 =\n fr1.fromAnother(\n aSubscribableWillAsyncFireIntegerOneToFive() //another async stream of Integers\n );\n\n FunctionalReactives<Void> fr =\n fr1.zipStrict(fr2, new Function2<Integer, Integer, Integer>() {\n @Override\n public Optional<Integer> apply(Integer input1, Integer input2) {\n return Optional.of(input1 + input2);\n }\n })\n .forEach(println()); //print out reaction results each in a line\n\n fr.start(); //will trigger Subscribable.doSubscribe()\n fr.shutdown(); //will trigger Subscribable.unsubscribe() which in above case will await for all the integers scheduled\n\n //Reaction walk through:\n // Source1: 1 -> 2 -> 3 -> 4 -> 5 -> |\n // Source2: 1 -> 2 -> 3 -> 4 -> 5 -> |\n // Print sum of two sources: 2 -> 4 -> 6 -> 8 -> 10 ->|\n\n }", "@Override\n public void subscribe(ObservableEmitter<Integer> e) throws Exception {\n\n e.onNext(1);\n SystemClock.sleep(1000);\n e.onNext(2);\n SystemClock.sleep(1000);\n e.onNext(3);\n SystemClock.sleep(1000);\n e.onNext(4);\n\n //Once the Observable has emitted all items in the sequence, call onComplete//\n e.onComplete();\n //e.onError(new Throwable(\"Some Error!!\"));\n }", "public static Observable<String> getObservableSkipElement() {\n return observableSrc;//todo\n }", "private static void mergingSyncMadeAsync() {\n Observable.merge(getDataSync(1).subscribeOn(Schedulers.io()), getDataSync(2).subscribeOn(Schedulers.io())).blockingForEach(System.out::println);\n }", "@Nonnull \r\n\tpublic static <T, U, V> Observable<V> combineLatest(\r\n\t\t\t@Nonnull final Observable<? extends T> left,\r\n\t\t\t@Nonnull final Observable<? extends U> right,\r\n\t\t\t@Nonnull final Func2<? super T, ? super U, ? extends V> selector\r\n\t) {\r\n\t\treturn new CombineLatest.Sent<V, T, U>(left, right, selector);\r\n\t}", "@Nonnull \r\n\tpublic static <T, U> Observable<U> manySelect0(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func1<? super Observable<T>, ? extends U> selector) {\r\n\t\treturn manySelect(source, selector, scheduler());\r\n\t}", "public static void main(String[] args) {\n\t\tObservable<String> mObservable = Observable.create(new Observable.OnSubscribe<String>() {\n\t\t\t@Override\n\t\t\tpublic void call(Subscriber<? super String> subscriber) {\n\t\t\t\tsubscriber.onNext(\"hello world\");\n\t\t\t\tsubscriber.onCompleted();\n\t\t\t}\n\t\t}) ;\n\n\t\tSubscriber<String> mSubscriber = new Subscriber<String>() {\n\t\t\t@Override\n\t\t\tpublic void onCompleted() {}\n\n\t\t\t@Override\n\t\t\tpublic void onError(Throwable e) {}\n\n\t\t\t@Override\n\t\t\tpublic void onNext(String s) {System.out.println(s);}\n\t\t} ;\n\n\t\tmObservable.subscribe(mSubscriber);\n\t\t//1.2 abbreviate\n\t\t// TODO: 7/2/15 myObservable.subscribe(onNextAction, onErrorAction, onCompleteAction);\n\t\tObservable<String> mObservable2 = Observable.just(\"Hello RxJava\") ;\n\t\tAction1<String> onNextAction = new Action1<String>() {\n\t\t\t@Override\n\t\t\tpublic void call(String s) {\n\t\t\t\tSystem.out.println(s) ;\n\t\t\t}\n\t\t} ;\n\t\tmObservable2.subscribe(onNextAction);\n\t\t//1.3 simpler code\n\t\tObservable.just(\"simpler code\").subscribe(new Action1<String>() {\n\t\t\t@Override\n\t\t\tpublic void call(String s) {\n\t\t\t\tSystem.out.println(s) ;\n\t\t\t}\n\t\t});\n\t\t//1.4. Java8 lambda\n\t\tObservable.just(\"Hello Rx and lambda\").subscribe(s -> System.out.println(s)) ;\n\t\t//2. transformation\n\t\tObservable.just(\"Hello trans\").subscribe(s -> System.out.println(s+\"formation\")) ;\n\t\t//2.1 map()\n\t\tObservable.just(\"Hello trans\").map(new Func1<String, String>() {\n\t\t\t@Override\n\t\t\tpublic String call(String s) {\n\t\t\t\treturn s+\"formation\";\n\t\t\t}\n\t\t}).subscribe(s -> System.out.println(s));\n//\t\t}).subscribe(System.out::println);\n\t\t//2.2 trans + lambda\n\t\tObservable.just(\"Hello trans\").map(s -> s+\"fromation\").subscribe(s -> System.out.println(s));\n\t\t//or\n\t\tObservable.just(\"Hello trans\").map(s -> s+\"fromation\").subscribe(System.out::println);\n\t\t//2.3 trans String to Integer\n\t\tObservable.just(\"Hello trans!\").map(new Func1<String, Integer>() {\n\t\t\t@Override\n\t\t\tpublic Integer call(String s) {\n\t\t\t\treturn s.hashCode();\n\t\t\t}\n\t\t}).subscribe(i-> System.out.println(Integer.toString(i)));\n\t\tObservable.just(\"Hello trans!\").map(s -> s.hashCode())\n\t\t\t\t.subscribe(i -> System.out.println(Integer.toString(i)));\n\t\tObservable.just(\"Hello trans!\").map(String::hashCode)\n\t\t\t\t.subscribe(i->System.out.println(Integer.toString(i)));\n\t\tObservable.just(\"Hello trans!\").map(String::hashCode).map(i->Integer.toString(i))\n\t\t\t\t.subscribe(System.out::println);\n\t}", "public static void test015()\r\n {\r\n System.out.println(\"RxJavaTest04::test015\");\r\n ExecutorService poolA = Executors.newFixedThreadPool(10, newThreadFactory(\"Sched-A-%d\"));\r\n Scheduler schedulerA = Schedulers.from(poolA);\r\n RxGroceries rxGroceries = new RxGroceries();\r\n\r\n Maybe<BigDecimal> totalPrice = Observable\r\n .fromIterable(Arrays.asList(\"bread\", \"butter\", \"milk\", \"tomato\", \"cheese\"))\r\n .subscribeOn(schedulerA)\r\n .flatMap(prod -> rxGroceries.purchase(prod, 1))\r\n .reduce(BigDecimal::add);\r\n totalPrice\r\n .subscribe(System.out::println);\r\n poolA.shutdown();\r\n }", "@Test\n public void onlyWithMap(){\n Observable<Observable<PhoneNumber>> usersPhonesNumbers = costService\n .findUserInDepartment(DEPARTMENT_ID)\n .map(costService::findPhoneNumber);//<-- returns observable\n\n //Strange type here :o\n Observable<Observable<BigDecimal>> priceStream = usersPhonesNumbers\n .map(phones -> phones.map(costService::getPricePerSmsForNumber));\n\n Observable<BigDecimal> costPerPerson = priceStream.map(userPhones -> userPhones.reduce(ZERO, BigDecimal::add).blockingGet());//blockingGet<---only one difference in comparison to streams\n\n BigDecimal totalCost = costPerPerson.reduce(ZERO, BigDecimal::add).blockingGet(); //blockingGet<---only one difference in comparison to streams\n log.info(\"Total cost of sending SMSes to all users all phones {}\", totalCost);\n }", "@Override\n public ObservableSource<? extends String> call() throws Exception {\n SystemClock.sleep(2000);\n return Observable.just(\"one\", \"two\", \"three\", \"four\", \"five\");\n }", "@Nonnull \r\n\tpublic static <T> Observable<List<T>> zip(\r\n\t\t\t@Nonnull Observable<? extends T> src, final T constant) {\r\n\t\treturn select(src, new Func1<T, List<T>>() {\r\n\t\t\t@Override\r\n\t\t\tpublic List<T> invoke(T param1) {\r\n\t\t\t\tList<T> result = new ArrayList<T>();\r\n\t\t\t\tresult.add(param1);\r\n\t\t\t\tresult.add(constant);\r\n\t\t\t\treturn result;\r\n\t\t\t}\r\n\t\t});\r\n\t}", "@Nonnull\r\n\tpublic static <T, U, V> Observable<V> zip(\r\n\t\t\t@Nonnull final Observable<? extends T> left,\r\n\t\t\t@Nonnull final Iterable<? extends U> right,\r\n\t\t\t@Nonnull final Func2<? super T, ? super U, ? extends V> selector) {\r\n\t\treturn new Zip.ObservableAndIterable<T, U, V>(left, right, selector);\r\n\t}", "private static void createColdObservable() {\n var observable = Observable.just(1, 2, 3, 4, 5);\n\n observable.subscribe(item -> LOG.info(\"Observer 1: {}\", item));\n\n pause(1000);\n\n observable.subscribe(item -> LOG.info(\"Observer 2: {}\", item));\n }", "@Test\n public void flatMapExample() {\n final Book book1 = new Book(\"Java EE 7 Essentials\", 2013, Arrays.asList(\"Arun Gupta\"));\n final Book book2 = new Book(\"Algorithms\", 2011, Arrays.asList(\"Robert Sedgewick\", \"Kevin Wayne\"));\n final Book book3 = new Book(\"Clean code\", 2014, Arrays.asList(\"Robert Martin\"));\n final List<String> expectedAuthors =\n Arrays.asList(\"Arun Gupta\", \"Robert Sedgewick\", \"Kevin Wayne\", \"Robert Martin\");\n\n final List<Book> javaBooks = Stream.of(book1, book2, book3).collect(Collectors.toList());\n\n final List<String> actualAuthors = javaBooks.stream()\n .flatMap(book -> book.getAuthors().stream())\n .distinct()\n .collect(Collectors.toList());\n\n Assert.assertEquals(actualAuthors.size(), expectedAuthors.size());\n actualAuthors.forEach(book -> Assert.assertTrue(expectedAuthors.contains(book)));\n }", "@Test\n public void downloadThrottled() throws Exception {\n //given\n Flowable<URL> urls = Urls.all().take(20);\n //ojo al parametro del flatmap que indica el maximo de concurrencia\n Flowable<Pair<URI, String>> pairs = urls.flatMap(url -> UrlDownloader.downloadThrottled(url)\n .subscribeOn(Schedulers.io())\n .map(htmlstr -> Pair.of(toUri(url), htmlstr)), 10);\n Single<Map<URI, String>> var = pairs.toMap((Pair<URI, String> pair) -> pair.getLeft(), (Pair<URI, String> pair) -> pair.getRight());\n Map<URI, String> bodies2 = var.blockingGet();\n Map<URI, String> bodies = pairs.toMap(Pair::getLeft, Pair::getRight).blockingGet();\n\n\n Map<URI, String> bodies3 = urls.flatMap(url -> UrlDownloader.downloadThrottled(url)\n .subscribeOn(Schedulers.io())\n .map(htmlstr -> Pair.of(toUri(url), htmlstr)), 10).toMap(Pair::getLeft, Pair::getRight).blockingGet();\n\n //when\n //Use UrlDownloader.downloadThrottled()\n\n\n //then\n assertThat(bodies).containsEntry(new URI(\"http://www.twitter.com\"), \"<html>www.twitter.com</html>\");\n assertThat(bodies).containsEntry(new URI(\"http://www.adobe.com\"), \"<html>www.adobe.com</html>\");\n assertThat(bodies).containsEntry(new URI(\"http://www.bing.com\"), \"<html>www.bing.com</html>\");\n }", "@Test\n public void shouldDownloadAllUrls() throws Exception {\n //given\n Flowable<URL> urls = Urls.all();\n\n\n/* final Flowable<String> htmls2 = urls\n .flatMap(url -> UrlDownloader.download(url)\n .subscribeOn(Schedulers.io())); //ojo al subscribeon\n\n\n Flowable<Pair<String, String>> gel = urls.map(s -> {\n final String[] html = {\"\"};\n final String[] gelote = new String[1];\n\n UrlDownloader.download(s).subscribe(value -> {\n gelote[0] = value;\n });\n String result = gelote[0];\n return Pair.of(s.toURI().toString(), gelote[0]);\n });\n\n //\n Flowable<String> htmls =\n urls.flatMap(url -> UrlDownloader.download(url).subscribeOn(Schedulers.io()));\n\n Flowable<Pair<URL, Flowable<String>>> broken = urls.map(url -> Pair.of(url, UrlDownloader.download(url)));\n\n urls.flatMap(url -> {\n final Flowable<String> html = UrlDownloader.download(url);\n Flowable<Pair<URL,String>> var =html.map(htmlstr->Pair.of(url,htmlstr));\n return var;\n });\n\n */\n Flowable<Pair<URI, String>> pairs = urls.flatMap(url -> UrlDownloader.download(url)\n .subscribeOn(Schedulers.io())\n .map(htmlstr -> Pair.of(toUri(url), htmlstr)));\n\n\n //no confundir toMap con map\n //Maybe: 0..1 values\n //Single 1 value\n //Completable 0 values\n //Flowable 0...infinity\n //single es un stream que solo tiene un valor\n Single<Map<URI, String>> var = pairs.toMap((Pair<URI, String> pair) -> pair.getLeft(), (Pair<URI, String> pair) -> pair.getRight());\n Map<URI, String> bodies2 = var.blockingGet();\n Map<URI, String> bodies = pairs.toMap(Pair::getLeft, Pair::getRight).blockingGet();\n TimeUnit.SECONDS.sleep(20);\n\n //when\n //WARNING: URL key in HashMap is a bad idea here\n\n //No mutar el mapa del suscribe , en vez de eso, use toMap()\n //con confundir con el operador map()\n //blocking*\n\n\n /*Map<URI, String> bodies = new HashMap<>();*/\n\n/*\n gel.toMap(s.getLeft());\n gel.subscribe(System.out::println);\n*/\n\n //then\n assertThat(bodies).hasSize(996);\n assertThat(bodies).containsEntry(new URI(\"http://www.twitter.com\"), \"<html>www.twitter.com</html>\");\n assertThat(bodies).containsEntry(new URI(\"http://www.aol.com\"), \"<html>www.aol.com</html>\");\n assertThat(bodies).containsEntry(new URI(\"http://www.mozilla.org\"), \"<html>www.mozilla.org</html>\");\n }", "public static void scan() {\n Observable.range(1, 10)\n .scan((previous, current) -> {\n System.out.println(\"previous = \" + previous);\n System.out.println(\"current = \" + current);\n return previous + current;\n }).subscribe(new MyObserver<>());\n }", "private static void createHotAndConnectableObservable() {\n var observable = Observable.just(1, 2, 3, 4, 5).publish();\n\n observable.subscribe(item -> LOG.info(\"Connectable Observer 1: {}\", item));\n observable.subscribe(item -> LOG.info(\"Connectable Observer 2: {}\", item));\n\n pause(1000);\n // calling connect starts emitting immediately - any order\n observable.connect();\n\n // if we subscribe now it'll now be emitted - hot observable\n observable.subscribe(item -> LOG.info(\"Connectable Observer 3: {}\", item));\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> singleAsync(\r\n\t\t\t@Nonnull final Observable<? extends T> source) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull\r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\treturn (new DefaultObserverEx<T>() {\r\n\t\t\t\t\t/** True if the first element received. */\r\n\t\t\t\t\tboolean firstReceived;\r\n\t\t\t\t\t/** The first element encountered. */\r\n\t\t\t\t\tT first;\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onFinish() {\r\n\t\t\t\t\t\tif (firstReceived) {\r\n\t\t\t\t\t\t\tobserver.next(first);\r\n\t\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tobserver.error(new NoSuchElementException());\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onNext(T value) {\r\n\t\t\t\t\t\tif (!firstReceived) {\r\n\t\t\t\t\t\t\tfirst = value;\r\n\t\t\t\t\t\t\tfirstReceived = true;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\terror(new TooManyElementsException());\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}).registerWith(source);\r\n\t\t\t}\r\n\t\t};\r\n\t}", "@io.reactivex.annotations.CheckReturnValue\n @io.reactivex.annotations.BackpressureSupport(io.reactivex.annotations.BackpressureKind.FULL)\n @org.jetbrains.annotations.NotNull\n @io.reactivex.annotations.SchedulerSupport(\"none\")\n /* Code decompiled incorrectly, please refer to instructions dump. */\n public static final <T, R, U> io.reactivex.Flowable<kotlin.Triple<T, R, U>> combineLatest(@org.jetbrains.annotations.NotNull io.reactivex.Flowable<T> r2, @org.jetbrains.annotations.NotNull io.reactivex.Flowable<R> r3, @org.jetbrains.annotations.NotNull io.reactivex.Flowable<U> r4) {\n /*\n java.lang.String r0 = \"$receiver\"\n kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull(r2, r0)\n java.lang.String r0 = \"flowable1\"\n kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull(r3, r0)\n java.lang.String r0 = \"flowable2\"\n kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull(r4, r0)\n org.a.b r2 = (org.a.b) r2\n org.a.b r3 = (org.a.b) r3\n org.a.b r4 = (org.a.b) r4\n io.reactivex.rxkotlin.FlowableKt$combineLatest$3 r0 = io.reactivex.rxkotlin.FlowableKt$combineLatest$3.INSTANCE\n kotlin.jvm.functions.Function3 r0 = (kotlin.jvm.functions.Function3) r0\n if (r0 == 0) goto L_0x0021\n io.reactivex.rxkotlin.FlowableKt$sam$io_reactivex_functions_Function3$0 r1 = new io.reactivex.rxkotlin.FlowableKt$sam$io_reactivex_functions_Function3$0\n r1.<init>(r0)\n r0 = r1\n L_0x0021:\n io.reactivex.functions.Function3 r0 = (io.reactivex.functions.Function3) r0\n io.reactivex.Flowable r2 = io.reactivex.Flowable.combineLatest(r2, r3, r4, r0)\n java.lang.String r3 = \"Flowable.combineLatest(t…le2, Function3(::Triple))\"\n kotlin.jvm.internal.Intrinsics.checkExpressionValueIsNotNull(r2, r3)\n return r2\n */\n throw new UnsupportedOperationException(\"Method not decompiled: io.reactivex.rxkotlin.FlowableKt.combineLatest(io.reactivex.Flowable, io.reactivex.Flowable, io.reactivex.Flowable):io.reactivex.Flowable\");\n }", "@Nonnull \r\n\tpublic static <T> Observable<List<T>> zip(final T constant, \r\n\t\t\t@Nonnull Observable<? extends T> src) {\r\n\t\treturn select(src, new Func1<T, List<T>>() {\r\n\t\t\t@Override\r\n\t\t\tpublic List<T> invoke(T param1) {\r\n\t\t\t\tList<T> result = new ArrayList<T>();\r\n\t\t\t\tresult.add(constant);\r\n\t\t\t\tresult.add(param1);\r\n\t\t\t\treturn result;\r\n\t\t\t}\r\n\t\t});\r\n\t}", "@Test\n public void skipUntil() {\n\n Observable<Long> o1 = Observable.interval(100, TimeUnit.SECONDS, mTestScheduler)\n .map(num -> num + 1)\n .take(9);\n\n Observable<Integer> o2 = Observable.just(0, 0)\n .delay(550, TimeUnit.SECONDS, mTestScheduler);\n\n o1.skipUntil(o2)\n .subscribe(mList::add);\n\n mTestScheduler.advanceTimeBy(2000, TimeUnit.SECONDS);\n assertEquals(mList, Arrays.asList(6L, 7L, 8L, 9L));\n }", "public static void test009()\r\n {\r\n System.out.println(\"RxJavaTest04::test009\");\r\n List<String> tickets = new ArrayList<String>(Arrays.asList(\"one\", \"two\", \"three\", \"four\", \"five\"));\r\n List<String> failures = Observable.fromIterable(tickets)\r\n .flatMap(ticket ->\r\n myRxSendEmail(ticket)\r\n .flatMap(response -> Observable.<String>empty())\r\n .doOnError(e -> System.out.printf(\"Failed to send %s: %s\\n\", ticket, e))\r\n .onErrorReturn(err -> ticket)\r\n .subscribeOn(Schedulers.io())\r\n )\r\n .toList()\r\n .blockingGet();\r\n for (String failure : failures) {\r\n System.out.println(failure);\r\n }\r\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> singleAsync(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func0<? extends T> defaultSupplier) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull\r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\treturn (new DefaultObserverEx<T>() {\r\n\t\t\t\t\t/** True if the first element received. */\r\n\t\t\t\t\tboolean firstReceived;\r\n\t\t\t\t\t/** The first element encountered. */\r\n\t\t\t\t\tT first;\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onFinish() {\r\n\t\t\t\t\t\tif (firstReceived) {\r\n\t\t\t\t\t\t\tobserver.next(first);\r\n\t\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tobserver.next(defaultSupplier.invoke());\r\n\t\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onNext(T value) {\r\n\t\t\t\t\t\tif (!firstReceived) {\r\n\t\t\t\t\t\t\tfirst = value;\r\n\t\t\t\t\t\t\tfirstReceived = true;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\terror(new TooManyElementsException());\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}).registerWith(source);\r\n\t\t\t}\r\n\t\t};\r\n\t}", "@Nonnull \r\n\tpublic static <T> List<List<T>> invokeAll(\r\n\t\t\t@Nonnull final Observable<? extends T> source1,\r\n\t\t\t@Nonnull final Observable<? extends T> source2\r\n\t\t\t) throws InterruptedException {\r\n\t\treturn invokeAll(source1, source2, scheduler());\r\n\t}", "@Override\n public Tuple nonDistinctNext() {\n //function takes tuples from o2, merges them with t1 from o1 and\n //evaluates them, if it finds a fitting Tuple, returns the result of merge;\n while (tuple1 != null) {\n Tuple tuple2 = o2.nonDistinctNext();\n\n while (tuple2 != null) {\n Tuple result = tupleTrans.transform(new Tuple(tuple1, tuple2));\n if (result != null) {\n return result;\n }\n tuple2 = o2.nonDistinctNext();\n }\n\n //if o2 runs out of Tupes, new t1 is taken from o1 and o2 is reset\n tuple1 = o1.nonDistinctNext();\n o2.reset();\n }\n //if o1 runs out of tuples (t1 == null), the operator is at the end\n return null;\n }", "@Test\n public void sequenceEqual() {\n\n Observable<Long> o1 = Observable.just(1L, 2L, 3L, 4L, 5L)\n .delay(1000, TimeUnit.SECONDS, mTestScheduler);\n Observable<Long> o2 = Observable.interval(20, TimeUnit.SECONDS, mTestScheduler)\n .skip(1)\n .take(5);\n\n Observable.sequenceEqual(o1, o2)\n .subscribe(mList::add);\n\n mTestScheduler.advanceTimeBy(1200, TimeUnit.SECONDS);\n\n assertEquals(mList, Collections.singletonList(true));\n }", "public static void test017()\r\n {\r\n System.out.println(\"RxJavaTest04::test017\");\r\n ExecutorService poolA = Executors.newFixedThreadPool(10, newThreadFactory(\"Sched-A-%d\"));\r\n Scheduler schedulerA = Schedulers.from(poolA);\r\n RxGroceries store = new RxGroceries();\r\n\r\n Maybe<BigDecimal> totalPrice = Observable\r\n .just(\"bread\", \"butter\", \"egg\", \"milk\", \"tomato\",\r\n \"cheese\", \"tomato\", \"egg\", \"egg\")\r\n .groupBy(prod -> prod)\r\n .flatMapSingle(grouped -> grouped\r\n .count()\r\n .map(quantity -> {\r\n String productName = grouped.getKey();\r\n return Pair.of(productName, quantity);\r\n })\r\n )\r\n .flatMap(order -> store\r\n .purchase(order.getLeft(), (int)order.getRight().longValue())\r\n .subscribeOn(schedulerA)\r\n )\r\n .reduce(BigDecimal::add);\r\n\r\n totalPrice\r\n .subscribe(System.out::println);\r\n myWait(2000);\r\n poolA.shutdown();\r\n }", "@Test\n public void all() {\n Observable.just(1, 2, 3, 4, 5)\n .doOnNext(System.out::println)\n .all(x -> x < 10)\n .subscribe(mList::add);\n assertEquals(mList, Collections.singletonList(true));\n }", "public void observaleJust() {\n\t\tObservable.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).subscribe(integerSubscribe());\r\n\t}", "@io.reactivex.annotations.CheckReturnValue\n @io.reactivex.annotations.BackpressureSupport(io.reactivex.annotations.BackpressureKind.FULL)\n @org.jetbrains.annotations.NotNull\n @io.reactivex.annotations.SchedulerSupport(\"none\")\n /* Code decompiled incorrectly, please refer to instructions dump. */\n public static final <T, R> io.reactivex.Flowable<kotlin.Pair<T, R>> combineLatest(@org.jetbrains.annotations.NotNull io.reactivex.Flowable<T> r2, @org.jetbrains.annotations.NotNull io.reactivex.Flowable<R> r3) {\n /*\n java.lang.String r0 = \"$receiver\"\n kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull(r2, r0)\n java.lang.String r0 = \"flowable\"\n kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull(r3, r0)\n org.a.b r2 = (org.a.b) r2\n org.a.b r3 = (org.a.b) r3\n io.reactivex.rxkotlin.FlowableKt$combineLatest$2 r0 = io.reactivex.rxkotlin.FlowableKt$combineLatest$2.INSTANCE\n kotlin.jvm.functions.Function2 r0 = (kotlin.jvm.functions.Function2) r0\n if (r0 == 0) goto L_0x001a\n io.reactivex.rxkotlin.FlowableKt$sam$io_reactivex_functions_BiFunction$0 r1 = new io.reactivex.rxkotlin.FlowableKt$sam$io_reactivex_functions_BiFunction$0\n r1.<init>(r0)\n r0 = r1\n L_0x001a:\n io.reactivex.functions.BiFunction r0 = (io.reactivex.functions.BiFunction) r0\n io.reactivex.Flowable r2 = io.reactivex.Flowable.combineLatest((org.a.b<? extends T1>) r2, (org.a.b<? extends T2>) r3, (io.reactivex.functions.BiFunction<? super T1, ? super T2, ? extends R>) r0)\n java.lang.String r3 = \"Flowable.combineLatest(t…able, BiFunction(::Pair))\"\n kotlin.jvm.internal.Intrinsics.checkExpressionValueIsNotNull(r2, r3)\n return r2\n */\n throw new UnsupportedOperationException(\"Method not decompiled: io.reactivex.rxkotlin.FlowableKt.combineLatest(io.reactivex.Flowable, io.reactivex.Flowable):io.reactivex.Flowable\");\n }", "Observable<List<T>> getAll();", "@Test\n public void takeUntil() {\n Observable.just(1, 2, 3, 4)\n .takeUntil(integer -> integer > 2)\n .subscribe(mList::add);\n assertEquals(mList, Arrays.asList(1, 2, 3));\n\n mList.clear();\n Observable.just(1, 2, 3, 4)\n .takeUntil(integer -> integer < 10)\n .subscribe(mList::add);\n assertEquals(mList, Collections.singletonList(1));\n }", "private static void exSwitchMapTwo() {\n\n Observable.interval(5,TimeUnit.SECONDS)\n .switchMap(call -> Observable.just(getResponse()).doOnDispose(() -> System.out.println(\"Disposed\")))\n .subscribe(System.out::println);\n\n //An Observable which performs network call.\n sleep(40000);\n\n\n /* OUTPUT :\n 6\n 10\n 13\n 17\n 26\n 32\n 35\n 42\n\n */\n }", "Observable<Integer> add(Iterable<T> items);", "@Nonnull\r\n\tpublic static <T> Observable<T> distinct(\r\n\t\t\t@Nonnull final Observable<? extends T> source) {\r\n\t\treturn distinct(source, Functions.<T>identity());\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> resumeOnError(\r\n\t\t\t@Nonnull final Iterable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Resume.OnError<T>(sources);\r\n\t}", "public static Observable<String> getObservableTakeElement() {\n return observableSrc;//todo\n }", "private static void exSwitchMapThree(){\n Observable<String> intense =\n Observable.just(\"Savi\",\"Healer\",\"Three\",\"Four\",\"Wednesday\",\"Friday\",\"You\",\"Me\")\n .concatMap(result -> Observable.just(result).delay(randomSleepTime(),TimeUnit.MILLISECONDS))\n .doOnDispose(() -> System.out.println(\" * * Disposed * *\"));\n\n //Observable to execute intense task every 5 seconds\n Observable.interval(5,TimeUnit.SECONDS)\n .switchMap(r -> intense)\n .subscribe(System.out::println);\n\n //Sleep the main thread for few seconds\n Take.sleep(20000);\n\n /*\n After every 5 seconds it will dispose the ongoing intense (variable name) process and\n start the same process again.\n */\n\n //Output\n /*\n Savi\n Healer\n Three\n Four\n * * Disposed * *\n Savi\n Healer\n Three\n Four\n Wednesday\n Friday\n You\n * * Disposed * *\n Savi\n Healer\n Three\n Four\n Wednesday\n * * Disposed * *\n */\n }", "public static Observable<ArrayList<Image>> getImageListStartAt(String mainLink, int page) {\n Observable<ArrayList<Image>> obs1 = getImageListFromUrl(mainLink + \"?page=\" + page);\n obs1.subscribeOn(Schedulers.io());\n Observable<ArrayList<Image>> obs2 = getImageListFromUrl(mainLink + \"?page=\" + (page + 1));\n obs2.subscribeOn(Schedulers.io());\n Observable<ArrayList<Image>> obs3 = getImageListFromUrl(mainLink + \"?page=\" + (page + 2));\n obs3.subscribeOn(Schedulers.io());\n\n return Observable.zip(obs1, obs2, obs3,\n new Func3<ArrayList<Image>, ArrayList<Image>, ArrayList<Image>, ArrayList<Image>>() {\n\n @Override\n public ArrayList<Image> call(ArrayList<Image> o, ArrayList<Image> o2,\n ArrayList<Image> o3) {\n o.addAll(o2);\n o.addAll(o3);\n// Log.e(\"thanh.dao\", \"call: o size = \" + o.size());\n// Log.e(\"thanh.dao\", \"call: o2 size = \" + o2.size());\n// Log.e(\"thanh.dao\", \"call: o3 size = \" + o3.size());\n//\n// Log.e(\"thanh.dao\",\n// \"call: total time = \" + (System.currentTimeMillis() - allStartTime));\n return o;\n }\n }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> firstAsync(\r\n\t\t\t@Nonnull final Observable<? extends T> source) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull\r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\treturn (new DefaultObserverEx<T>() {\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onFinish() {\r\n\t\t\t\t\t\terror(new NoSuchElementException());\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onNext(T value) {\r\n\t\t\t\t\t\tobserver.next(value);\r\n\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\tclose();\r\n\t\t\t\t\t} \r\n\t\t\t\t\t\r\n\t\t\t\t}).registerWith(source);\r\n\t\t\t}\r\n\t\t};\r\n\t}", "@Nonnull \r\n\tpublic static <T> CloseableIterable<T> next(\r\n\t\t\t@Nonnull final Observable<? extends T> source) {\r\n\t\treturn new Next<T>(source);\r\n\t}", "public static void test016()\r\n {\r\n System.out.println(\"RxJavaTest04::test016\");\r\n ExecutorService poolA = Executors.newFixedThreadPool(10, newThreadFactory(\"Sched-A-%d\"));\r\n Scheduler schedulerA = Schedulers.from(poolA);\r\n RxGroceries rxGroceries = new RxGroceries();\r\n\r\n Maybe<BigDecimal> totalPrice = Observable\r\n .fromIterable(Arrays.asList(\"bread\", \"butter\", \"milk\", \"tomato\", \"cheese\"))\r\n .subscribeOn(schedulerA)\r\n .flatMap(prod -> rxGroceries\r\n .purchase(prod, 1)\r\n .subscribeOn(schedulerA)\r\n )\r\n .reduce(BigDecimal::add);\r\n totalPrice\r\n .subscribe(\r\n x -> log(\"Got \" + x),\r\n Throwable::printStackTrace,\r\n () -> log(\"Completed\")\r\n );\r\n myWait(2000); // We have to wait before shutting down the pool,\r\n // otherwise it will throw exception \r\n // [java] io.reactivex.exceptions.UndeliverableException:\r\n // java.util.concurrent.RejectedExecutionException:\r\n // Task java.util.concurrent.FutureTask@38d8f9d0 rejected\r\n // from java.util.concurrent.ThreadPoolExecutor@6a724a6c\r\n // [Shutting down, pool size = 1, active threads = 1, queued\r\n // tasks = 0, completed tasks = 0]\r\n poolA.shutdown();\r\n }", "public static void join() {\n Observable<Long> left = Observable.just(1L, 2L, 3L);\n Observable<Long> right = Observable.just(100L, 200L, 300L);\n\n left.join(right,\n leftValue -> Observable.interval(1L, TimeUnit.MICROSECONDS),\n rightValue -> Observable.interval(1L, TimeUnit.MICROSECONDS),\n (a, b) -> a + b).subscribe(new MyObserver<>());\n }", "@Test\n public void shouldJoinOnlyIfMatchFoundOnStreamUpdates() {\n pushToTable(2, \"Y\");\n processor.checkAndClearProcessResult(EMPTY);\n\n // push all four items to the primary stream. this should produce two items.\n pushToStream(4, \"X\");\n processor.checkAndClearProcessResult(new KeyValueTimestamp<>(0, \"X0+Y0\", 0),\n new KeyValueTimestamp<>(1, \"X1+Y1\", 1));\n }", "@Test\n\tpublic void testPassThroughHandler_SingleSourceQuery() throws Exception {\n\t\tprepareTest(Arrays.asList(\"/tests/basic/data01endpoint1.ttl\", \"/tests/basic/data01endpoint2.ttl\"));\n\n\t\ttry (RepositoryConnection conn = fedxRule.getRepository().getConnection()) {\n\n\t\t\t// SELECT query\n\t\t\tTupleQuery tq = conn\n\t\t\t\t\t.prepareTupleQuery(\"SELECT ?person WHERE { ?person <http://xmlns.com/foaf/0.1/name> ?name . }\");\n\t\t\ttq.setBinding(\"name\", l(\"Alan\"));\n\n\t\t\tAtomicBoolean started = new AtomicBoolean(false);\n\t\t\tAtomicInteger numberOfResults = new AtomicInteger(0);\n\n\t\t\ttq.evaluate(new AbstractTupleQueryResultHandler() {\n\n\t\t\t\t@Override\n\t\t\t\tpublic void startQueryResult(List<String> bindingNames) throws TupleQueryResultHandlerException {\n\t\t\t\t\tif (started.get()) {\n\t\t\t\t\t\tthrow new IllegalStateException(\"Must not start query result twice.\");\n\t\t\t\t\t}\n\t\t\t\t\tstarted.set(true);\n\n\t\t\t\t\t/*\n\t\t\t\t\t * Expected trace is expected to come from some original repository (e.g. SPARQL) => we explicitly\n\t\t\t\t\t * do not expect QueryResults#report to be the second element (compare test\n\t\t\t\t\t * testPassThroughHandler_MultiSourceQuery)\n\t\t\t\t\t */\n\t\t\t\t\tAssertions.assertNotEquals(QueryResults.class, new Exception().getStackTrace()[1].getClass());\n\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void handleSolution(BindingSet bs) throws TupleQueryResultHandlerException {\n\t\t\t\t\tAssertions.assertEquals(bs.getValue(\"person\"), iri(\"http://example.org/\", \"a\"));\n\t\t\t\t\tnumberOfResults.incrementAndGet();\n\t\t\t\t};\n\t\t\t});\n\n\t\t\tAssertions.assertTrue(started.get());\n\t\t\tAssertions.assertEquals(1, numberOfResults.get());\n\t\t}\n\t}" ]
[ "0.66469926", "0.61594313", "0.60391575", "0.6023723", "0.5931326", "0.5930799", "0.5920521", "0.5846604", "0.58452606", "0.57642984", "0.5739642", "0.5728281", "0.57160664", "0.5692876", "0.5681739", "0.56561697", "0.5589964", "0.5586143", "0.55635756", "0.55519444", "0.54612386", "0.5454586", "0.54276955", "0.540161", "0.53860664", "0.53520054", "0.5320325", "0.52932554", "0.5272711", "0.5264784", "0.5260538", "0.52322453", "0.5210943", "0.5209055", "0.51839614", "0.5180318", "0.5177859", "0.5166899", "0.5138149", "0.51133364", "0.5097163", "0.50924283", "0.5085434", "0.50836456", "0.50773764", "0.507525", "0.50741595", "0.50583124", "0.50503236", "0.50233215", "0.50198525", "0.49923927", "0.49896663", "0.49714476", "0.49703637", "0.49385327", "0.49360645", "0.49112183", "0.49107876", "0.49013865", "0.48978275", "0.48890162", "0.4882344", "0.48790547", "0.4874635", "0.48551464", "0.48551252", "0.48547897", "0.48547444", "0.48523858", "0.48373717", "0.48317966", "0.47953847", "0.47782162", "0.47486922", "0.47401148", "0.47275788", "0.47249237", "0.47231317", "0.47113705", "0.47110435", "0.4710921", "0.47105634", "0.47085935", "0.47031057", "0.47013828", "0.46865144", "0.46820918", "0.4681977", "0.46718347", "0.46672547", "0.46659085", "0.46655944", "0.4662125", "0.46578175", "0.46575886", "0.46441048", "0.4641874", "0.46081161", "0.46066645" ]
0.52277833
32
emit items from the source Observable, or a default item if the source Observable emits nothing
@Test public void defaultIfEmpty() { Observable.empty() .defaultIfEmpty("geniusmart") .subscribe(mList::add); assertEquals(mList, Collections.singletonList("geniusmart")); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void just() {\n Observable<List<String>> myObservable = Observable.just(Utils.getData());\n myObservable.subscribe(consumerList);\n }", "public static <T> T single(\r\n\t\t\t@Nonnull Observable<? extends T> source,\r\n\t\t\t@Nonnull Func0<? extends T> defaultSupplier) {\r\n\t\tCloseableIterator<T> it = toIterable(source).iterator();\r\n\t\ttry {\r\n\t\t\tif (it.hasNext()) {\r\n\t\t\t\tT one = it.next();\r\n\t\t\t\tif (!it.hasNext()) {\r\n\t\t\t\t\treturn one;\r\n\t\t\t\t}\r\n\t\t\t\tthrow new TooManyElementsException();\r\n\t\t\t}\r\n\t\t} finally {\r\n\t\t\tCloseables.closeSilently(it);\r\n\t\t}\r\n\t\treturn defaultSupplier.invoke();\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> singleAsync(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func0<? extends T> defaultSupplier) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull\r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\treturn (new DefaultObserverEx<T>() {\r\n\t\t\t\t\t/** True if the first element received. */\r\n\t\t\t\t\tboolean firstReceived;\r\n\t\t\t\t\t/** The first element encountered. */\r\n\t\t\t\t\tT first;\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onFinish() {\r\n\t\t\t\t\t\tif (firstReceived) {\r\n\t\t\t\t\t\t\tobserver.next(first);\r\n\t\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tobserver.next(defaultSupplier.invoke());\r\n\t\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onNext(T value) {\r\n\t\t\t\t\t\tif (!firstReceived) {\r\n\t\t\t\t\t\t\tfirst = value;\r\n\t\t\t\t\t\t\tfirstReceived = true;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\terror(new TooManyElementsException());\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}).registerWith(source);\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public static void combineLatest() {\n\n System.out.println(\"# 1\");\n\n /*\n Emits item every second\n */\n Observable sourceInterval = Observable.interval(1L, TimeUnit.MILLISECONDS).take(10);\n\n /*\n Emits string items\n */\n Observable sourceString = Observable.fromIterable(sData);\n\n Observable<?> combined = Observable.combineLatest((objects) -> {\n StringBuilder stringBuilder = new StringBuilder();\n Stream.of(objects).forEach(stringBuilder::append);\n return stringBuilder.toString();\n }, 1, sourceInterval, sourceString);\n\n combined.subscribe(new MyObserver<>());\n\n System.out.println(\"# 2\");\n\n /*\n Because empty observable immediately terminates hence whole sequence terminates.\n */\n combined = Observable.combineLatest((objects) -> {\n StringBuilder stringBuilder = new StringBuilder();\n Stream.of(objects).forEach(stringBuilder::append);\n return stringBuilder.toString();\n }, 1, sourceInterval, sourceString, Observable.empty());\n combined.subscribe(new MyObserver<>());\n\n System.out.println(\"# 3\");\n /*\n Same as above but instead collection of sources are used.\n */\n List<Observable<?>> collection = new ArrayList<>();\n collection.add(sourceInterval);\n collection.add(sourceString.repeat(1));\n combined = Observable.combineLatest(collection, (objects) -> {\n StringBuilder stringBuilder = new StringBuilder();\n Stream.of(objects).forEach(stringBuilder::append);\n return stringBuilder.toString();\n });\n combined.subscribe(new MyObserver<>());\n\n System.out.println(\"# 4\");\n /*\n Explicitly combine 2 sources, similarly it can be done up to 10 sources\n */\n combined = Observable.combineLatest(sourceInterval, sourceString.repeat(1),\n (first, second) -> first + \"-\" + second);\n combined.subscribe(new MyObserver<>());\n }", "public static Observable<String> getObservableSkipLastElement() {\n return observableSrc;//todo\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> merge(\r\n\t\t\t@Nonnull final Iterable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\tfinal CompositeCloseable closeables = new CompositeCloseable();\r\n\t\t\t\t\r\n\t\t\t\tList<Observable<? extends T>> sourcesList = new ArrayList<Observable<? extends T>>();\r\n\t\t\t\tfor (Observable<? extends T> os : sources) {\r\n\t\t\t\t\tsourcesList.add(os);\r\n\t\t\t\t}\r\n\t\t\t\tfinal AtomicInteger wip = new AtomicInteger(sourcesList.size() + 1);\r\n\t\t\t\tfinal List<DefaultObserverEx<T>> observers = new ArrayList<DefaultObserverEx<T>>();\r\n\t\t\t\tfinal Lock lock = new ReentrantLock();\r\n\t\t\t\tfor (int i = 0; i < sourcesList.size(); i++) {\r\n\t\t\t\t\tfinal int j = i;\r\n\t\t\t\t\tDefaultObserverEx<T> obs = new DefaultObserverEx<T>(lock, true) {\r\n\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\tpublic void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t\t\tfor (int k = 0; k < observers.size(); k++) {\r\n\t\t\t\t\t\t\t\tif (k != j) {\r\n\t\t\t\t\t\t\t\t\tobservers.get(k).close();\r\n\t\t\t\t\t\t\t\t}\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\t@Override\r\n\t\t\t\t\t\tpublic void onFinish() {\r\n\t\t\t\t\t\t\tif (wip.decrementAndGet() == 0) {\r\n\t\t\t\t\t\t\t\tobserver.finish();\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\t@Override\r\n\t\t\t\t\t\tpublic void onNext(T value) {\r\n\t\t\t\t\t\t\tobserver.next(value);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t};\r\n\t\t\t\t\tobservers.add(obs);\r\n\t\t\t\t\tcloseables.add(obs);\r\n\t\t\t\t}\r\n\t\t\t\tfor (int i = 0; i < observers.size(); i++) {\r\n\t\t\t\t\tDefaultObserverEx<T> obs = observers.get(i);\r\n\t\t\t\t\tObservable<? extends T> ov = sourcesList.get(i);\r\n\t\t\t\t\tobs.registerWith(ov);\r\n\t\t\t\t}\r\n\t\t\t\tif (wip.decrementAndGet() == 0) {\r\n\t\t\t\t\tobserver.finish();\r\n\t\t\t\t}\r\n\t\t\t\treturn closeables;\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public static void flatMap() {\n List<String> data = Utils.getData();\n Observable.fromIterable(data)\n .flatMap((item) -> Observable.just(item + \" flat mapped\").repeat(2)\n ).subscribe(new MyObserver<>());\n }", "public Optional<List<SalesOrderItem>> getItemOrNull() {\r\n return Optional.fromNullable(toItem);\r\n }", "private static void createObservableUsingEmpty() {\n Observable<?> observable = Observable.empty();\n\n observable.subscribe(x -> LOG.info(\"{}\", x), error -> LOG.info(\"Error 1: {}\", error.hashCode()));\n observable.subscribe(x -> LOG.info(\"{}\", x),\n error -> LOG.info(\"{}\", error.getLocalizedMessage()),\n () -> LOG.info(\"Completed\"));\n }", "public static <T> T first(\r\n\t\t\t@Nonnull final Observable<? extends T> source, \r\n\t\t\t@Nonnull final Func0<? extends T> defaultSupplier) {\r\n\t\tCloseableIterator<T> it = toIterable(source).iterator();\r\n\t\ttry {\r\n\t\t\tif (it.hasNext()) {\r\n\t\t\t\treturn it.next();\r\n\t\t\t}\r\n\t\t} finally {\r\n\t\t\tCloseables.closeSilently(it);\r\n\t\t}\r\n\t\treturn defaultSupplier.invoke();\r\n\t}", "public static Observable<String> getObservableSkipElement() {\n return observableSrc;//todo\n }", "public void observaleJust() {\n\t\tObservable.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).subscribe(integerSubscribe());\r\n\t}", "public Item sample()\n {\n checkNotEmpty();\n\n return items[nextIndex()];\n }", "public static void main(String[] args){\n Observable myObservable = Observable.create(new Observable.OnSubscribe(){\n\n @Override\n public void call(Object subscriber) {\n Subscriber mySubscriber = (Subscriber)subscriber;\n\n for(int i = 0 ; i < 10; i++){\n //if my subscriber was subscribed\n if(!mySubscriber.isUnsubscribed()){\n mySubscriber.onNext(\"Pushed value \" + i);\n }\n }\n\n if(!mySubscriber.isUnsubscribed()){\n mySubscriber.onCompleted();\n }\n\n }\n });\n\n //subscribe to your Observable\n myObservable.subscribe(new Action1<String>() {\n @Override\n public void call(String s) {\n System.out.println(s);\n }\n },\n new Action1<Throwable>() {\n @Override\n public void call(Throwable throwable) {\n System.out.println(\"Something went wrong the observable\");\n }\n },\n new Action0() {\n @Override\n public void call() {\n System.out.println(\"No more values will be pushed.\");\n }\n });\n\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> elementAt(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\tfinal int index,\r\n\t\t\t@Nonnull final Func0<? extends T> defaultSupplier\r\n\t\t\t) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull\r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\treturn (new DefaultObserverEx<T>() {\r\n\t\t\t\t\tint i = index;\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onFinish() {\r\n\t\t\t\t\t\tobserver.next(defaultSupplier.invoke());\r\n\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onNext(T value) {\r\n\t\t\t\t\t\tif (i == 0) {\r\n\t\t\t\t\t\t\tobserver.next(value);\r\n\t\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\t\tclose();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ti--;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}).registerWith(source);\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public static Observable<String> getObservableSkipWhileElement() {\n return observableSrc;//todo\n }", "public static Observable<String> getObservableDistinct() {\n return observableSrcDuplicated;//todo\n }", "@Nonnull \r\n\tpublic static <T> Observable<List<T>> combine(\r\n\t\t\t@Nonnull final Func0<? extends T> supplier, \r\n\t\t\t@Nonnull Observable<? extends T> src) {\r\n\t\treturn select(src, new Func1<T, List<T>>() {\r\n\t\t\t@Override\r\n\t\t\tpublic List<T> invoke(T param1) {\r\n\t\t\t\tList<T> result = new ArrayList<T>();\r\n\t\t\t\tresult.add(supplier.invoke());\r\n\t\t\t\tresult.add(param1);\r\n\t\t\t\treturn result;\r\n\t\t\t}\r\n\t\t});\r\n\t}", "Observable<T> add(T item);", "public static void empty() {\n Observable<String> myObservable = Observable.empty();\n myObservable.subscribe(genericObserver1);\n }", "Observable<T> update(T item);", "public static Observable<String> getObservableTakeElement() {\n return observableSrc;//todo\n }", "@Override // org.reactivestreams.Subscriber\n public void onNext(T t) {\n if (this.done) {\n return;\n }\n if (this.sourceMode == 0) {\n try {\n this.actual.onNext(ObjectHelper.requireNonNull(this.a.apply(t), \"The mapper returned a null value\"));\n } catch (Throwable th) {\n fail(th);\n }\n } else {\n this.actual.onNext(null);\n }\n }", "Observable<Integer> add(Iterable<T> items);", "@Nonnull\r\n\tpublic static <T> Observable<T> defaultIfEmpty(\r\n\t\t\t@Nonnull final Observable<? extends T> source, \r\n\t\t\tT defaultValue) {\r\n\t\treturn defaultIfEmpty(source, Functions.constant0(defaultValue));\r\n\t}", "@Nonnull \r\n\tpublic static <T, U> Observable<U> publish(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func1<? super Observable<? extends T>, ? extends Observable<? extends U>> selector,\r\n\t\t\tfinal T initialValue\r\n\t\t\t) {\r\n\t\treturn multicast(source, new Func0<Subject<T, T>>() {\r\n\t\t\t@Override\r\n\t\t\tpublic Subject<T, T> invoke() {\r\n\t\t\t\treturn new Subject<T, T>() {\r\n\t\t\t\t\t/** The observable handling the registrations. */\r\n\t\t\t\t\tfinal DefaultObservable<T> obs = new DefaultObservable<T>(); \r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobs.error(ex);\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 finish() {\r\n\t\t\t\t\t\tobs.finish();\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 next(T value) {\r\n\t\t\t\t\t\tobs.next(value);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\t@Nonnull\r\n\t\t\t\t\tpublic Closeable register(@Nonnull Observer<? super T> observer) {\r\n\t\t\t\t\t\tobserver.next(initialValue);\r\n\t\t\t\t\t\treturn obs.register(observer);\r\n\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}, selector);\r\n\t}", "@SuppressWarnings(\"unused\")\n public Item item(final QueryContext qc) throws QueryException, IOException {\n return super.item(qc, null);\n }", "@Nonnull\r\n\tpublic static <T> Observable<Option<T>> materializeForever(\r\n\t\t\t@Nonnull final Observable<? extends T> source) {\r\n\t\treturn new Observable<Option<T>>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super Option<T>> observer) {\r\n\t\t\t\treturn source.register(new Observer<T>() {\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.next(Option.<T>error(ex));\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 finish() {\r\n\t\t\t\t\t\tobserver.next(Option.<T>none());\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 next(T value) {\r\n\t\t\t\t\t\tobserver.next(Option.some(value));\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public Item sample() {\n if (isEmpty()) throw new NoSuchElementException();\n return items[index()];\n }", "@Override\n public ObservableSource<? extends String> call() throws Exception {\n SystemClock.sleep(2000);\n return Observable.just(\"one\", \"two\", \"three\", \"four\", \"five\");\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> firstAsync(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func0<? extends T> defaultSupplier) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull\r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\treturn (new DefaultObserverEx<T>() {\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onFinish() {\r\n\t\t\t\t\t\tobserver.next(defaultSupplier.invoke());\r\n\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onNext(T value) {\r\n\t\t\t\t\t\tobserver.next(value);\r\n\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\tclose();\r\n\t\t\t\t\t} \r\n\t\t\t\t\t\r\n\t\t\t\t}).registerWith(source);\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public static void concatMap() {\n List<String> data = Utils.getData();\n Observable.fromIterable(data)\n .concatMap((item) -> Observable.just(item + \" concat mapped\").repeat(2)\n ).subscribe(new MyObserver<>());\n }", "public static void test001()\r\n {\r\n System.out.println(\"RxJavaTest04::test001\");\r\n Observable<String> peopleStream = myListPeople();\r\n Single<List<String>> peopleList = peopleStream.toList();\r\n List<String> people = peopleList.blockingGet();\r\n for (String person : people) {\r\n System.out.println(person);\r\n }\r\n }", "@Override\n protected void subscribeActual(Subscriber<? super T> object) {\n MaybeSource<? extends T>[] arrmaybeSource = this.sources;\n int n = arrmaybeSource.length;\n SimpleQueue simpleQueue = n <= MaybeMergeArray.bufferSize() ? new MpscFillOnceSimpleQueue(n) : new ClqSimpleQueue();\n simpleQueue = new MergeMaybeObserver(object, n, (SimpleQueueWithConsumerIndex<Object>)simpleQueue);\n object.onSubscribe((Subscription)((Object)simpleQueue));\n object = ((MergeMaybeObserver)simpleQueue).error;\n int n2 = arrmaybeSource.length;\n n = 0;\n do {\n MaybeSource maybeSource;\n block4: {\n block3: {\n if (n >= n2) break block3;\n maybeSource = arrmaybeSource[n];\n if (!((MergeMaybeObserver)simpleQueue).isCancelled() && ((AtomicReference)object).get() == null) break block4;\n }\n return;\n }\n maybeSource.subscribe(simpleQueue);\n ++n;\n } while (true);\n }", "public static Observable<String> getObservableFiltered() {\n return observableSrc;//todo\n }", "public static Observable<String> getObservableDistinctUntilChanges() {\n return observableSrcDuplicated;//todo\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> amb(\r\n\t\t\t@Nonnull final Iterable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Ambiguous<T>(sources);\r\n\t}", "@Nonnull \r\n\tpublic static <T, U> Observable<U> switchCase(\r\n\t\t\t@Nonnull final Func0<? extends T> selector, \r\n\t\t\t@Nonnull final Map<? super T, ? extends Observable<U>> sources, \r\n\t\t\t@Nonnull final Observable<U> defaultSource) {\r\n\t\treturn new Observable<U>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull\r\n\t\t\tpublic Closeable register(@Nonnull Observer<? super U> observer) {\r\n\t\t\t\tT key = selector.invoke();\r\n\t\t\t\tObservable<U> obs = sources.get(key);\r\n\t\t\t\tif (obs == null) {\r\n\t\t\t\t\tobs = defaultSource;\r\n\t\t\t\t}\r\n\t\t\t\treturn obs.register(observer);\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public static void test015()\r\n {\r\n System.out.println(\"RxJavaTest04::test015\");\r\n ExecutorService poolA = Executors.newFixedThreadPool(10, newThreadFactory(\"Sched-A-%d\"));\r\n Scheduler schedulerA = Schedulers.from(poolA);\r\n RxGroceries rxGroceries = new RxGroceries();\r\n\r\n Maybe<BigDecimal> totalPrice = Observable\r\n .fromIterable(Arrays.asList(\"bread\", \"butter\", \"milk\", \"tomato\", \"cheese\"))\r\n .subscribeOn(schedulerA)\r\n .flatMap(prod -> rxGroceries.purchase(prod, 1))\r\n .reduce(BigDecimal::add);\r\n totalPrice\r\n .subscribe(System.out::println);\r\n poolA.shutdown();\r\n }", "public static <T> Observable<T> merge(\r\n\t\t\tfinal Observable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\tfinal AtomicInteger wip = new AtomicInteger(1);\r\n\t\t\t\tDefaultObserverEx<Observable<? extends T>> obs = new DefaultObserverEx<Observable<? extends T>>(false) {\r\n\t\t\t\t\t/** Signal finish if the sources and inner observables have all finished. */\r\n\t\t\t\t\tvoid ifDoneFinish() {\r\n\t\t\t\t\t\tif (wip.decrementAndGet() == 0) {\r\n\t\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\t\tclose();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t/**\r\n\t\t\t\t\t * The inner exception to forward.\r\n\t\t\t\t\t * @param ex the exception\r\n\t\t\t\t\t */\r\n\t\t\t\t\tvoid innerError(Throwable ex) {\r\n\t\t\t\t\t\terror(ex);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onFinish() {\r\n\t\t\t\t\t\tifDoneFinish();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onNext(Observable<? extends T> value) {\r\n\t\t\t\t\t\tfinal Object token = new Object();\r\n\t\t\t\t\t\twip.incrementAndGet();\r\n\t\t\t\t\t\tadd(token, value.register(new DefaultObserver<T>(lock, true) {\r\n\t\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\t\tpublic void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\t\t\tinnerError(ex);\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\t\tpublic void onFinish() {\r\n\t\t\t\t\t\t\t\tremove(token);\r\n\t\t\t\t\t\t\t\tifDoneFinish();\r\n\t\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\t\tpublic void onNext(T value) {\r\n\t\t\t\t\t\t\t\tobserver.next(value);\r\n\t\t\t\t\t\t\t}\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\t\t\t\treturn obs.registerWith(sources);\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public static void sample() {\n System.out.println(\"# 1\");\n Observable.fromIterable(sData)\n .timestamp()\n .sample(1000, TimeUnit.MICROSECONDS)\n .subscribe(new MyObserver<>());\n\n /*\n Emission controlled by sampler inner observable\n */\n System.out.println(\"# 2\");\n Observable.fromIterable(sData)\n .sample((observer) -> {\n System.out.println(\"emitter\");\n Observable.just(\"123\").subscribe(observer);\n }, true).subscribe(new MyObserver<>());\n }", "public static <T> T single(\r\n\t\t\t@Nonnull Observable<? extends T> source) {\r\n\t\tCloseableIterator<T> it = toIterable(source).iterator();\r\n\t\ttry {\r\n\t\t\tif (it.hasNext()) {\r\n\t\t\t\tT one = it.next();\r\n\t\t\t\tif (!it.hasNext()) {\r\n\t\t\t\t\treturn one;\r\n\t\t\t\t}\r\n\t\t\t\tthrow new TooManyElementsException();\r\n\t\t\t}\r\n\t\t\tthrow new NoSuchElementException();\r\n\t\t} finally {\r\n\t\t\tCloseables.closeSilently(it);\r\n\t\t}\r\n\t}", "public Item sample() {\n\t\t\n\t\tif(isEmpty()) throw new NoSuchElementException();\n\t\t\n\t\tint index = StdRandom.uniform(N);\n\t\t\t\n\t\t\t/*while(items[index] == null) {\n\t\t\t\tindex = StdRandom.uniform(length());\n\t\t\t}*/\n\n\t\treturn items[index];\n\t}", "@Override\n public Object getItem(int arg0) {\n return FilteredObjects.get(arg0);\n }", "Observable<AttestationProviderListResult> listDefaultAsync();", "@SuppressWarnings({ \"unchecked\", \"rawtypes\" })\n @BackpressureSupport(BackpressureKind.FULL)\n @SchedulerSupport(SchedulerKind.NONE)\n public static <T> Observable<T> concatArray(Publisher<? extends T>... sources) {\n if (sources.length == 0) {\n return empty();\n } else\n if (sources.length == 1) {\n return fromPublisher(sources[0]);\n }\n return fromArray(sources).concatMap((Function)Functions.identity());\n }", "void onNext(T item);", "private static void createHotAndConnectableObservable() {\n var observable = Observable.just(1, 2, 3, 4, 5).publish();\n\n observable.subscribe(item -> LOG.info(\"Connectable Observer 1: {}\", item));\n observable.subscribe(item -> LOG.info(\"Connectable Observer 2: {}\", item));\n\n pause(1000);\n // calling connect starts emitting immediately - any order\n observable.connect();\n\n // if we subscribe now it'll now be emitted - hot observable\n observable.subscribe(item -> LOG.info(\"Connectable Observer 3: {}\", item));\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> resumeAlways(\r\n\t\t\t@Nonnull final Iterable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Resume.Always<T>(sources);\r\n\t}", "public static void never() {\n Observable<String> myObservable = Observable.never();\n myObservable.subscribe(genericObserver1);\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> lastAsync(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func0<? extends T> defaultSupplier) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull\r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\treturn source.register(new Observer<T>() {\r\n\t\t\t\t\t/** The first value is pending? */\r\n\t\t\t\t\tboolean first = true;\r\n\t\t\t\t\t/** The current value. */\r\n\t\t\t\t\tT current;\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\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 finish() {\r\n\t\t\t\t\t\tif (first) {\r\n\t\t\t\t\t\t\tobserver.next(defaultSupplier.invoke());\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tobserver.next(current);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\tobserver.finish();\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 next(T value) {\r\n\t\t\t\t\t\tcurrent = value;\r\n\t\t\t\t\t\tfirst = false;\r\n\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}", "public Item sample() {\n \t\tif (size == 0) {\n \t\t\tthrow new NoSuchElementException();\n \t\t}\n \t\treturn (Item) items[StdRandom.uniform(size)];\n \t}", "@Nonnull\r\n\tpublic static <T, U> Observable<U> concat(\r\n\t\t\t@Nonnull final Iterable<? extends T> source, \r\n\t\t\t@Nonnull final Func1<? super T, ? extends Observable<? extends U>> resultSelector) {\r\n\t\treturn new Concat.FromIterable.Selector<T, U>(source, resultSelector);\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> defaultIfEmpty(\r\n\t\t\t@Nonnull final Observable<? extends T> source, \r\n\t\t\tFunc0<? extends T> defaultValueFunc) {\r\n\t\treturn new Select.DefaultIfEmptyFunc<T>(source, defaultValueFunc);\r\n\t}", "public T item() throws IOException, NoSuchElementException;", "@Nonnull\r\n\tpublic static <T, U> Observable<U> concat(\r\n\t\t\t@Nonnull final Iterable<? extends T> source, \r\n\t\t\t@Nonnull final Func2<? super T, ? super Integer, ? extends Observable<? extends U>> resultSelector) {\r\n\t\treturn new Concat.FromIterable.IndexedSelector<T, U>(source, resultSelector);\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> amb(\r\n\t\t\t@Nonnull final Observable<? extends T>... sources) {\r\n\t\treturn new Ambiguous<T>(Arrays.asList(sources));\r\n\t}", "public Optional<T> getFirstItem() {\n return getData().stream().findFirst();\n }", "@Override\n public void subscribe(ObservableEmitter<Integer> e) throws Exception {\n\n e.onNext(1);\n SystemClock.sleep(1000);\n e.onNext(2);\n SystemClock.sleep(1000);\n e.onNext(3);\n SystemClock.sleep(1000);\n e.onNext(4);\n\n //Once the Observable has emitted all items in the sequence, call onComplete//\n e.onComplete();\n //e.onError(new Throwable(\"Some Error!!\"));\n }", "@Override // io.reactivex.rxjava3.functions.Function\n public ObservableSource<? extends Integer> apply(Throwable th) {\n return Observable.just(0);\n }", "@Nonnull\r\n\tpublic static <T> Observable<List<T>> forkJoin(\r\n\t\t\t@Nonnull final Iterable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Observable<List<T>>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super List<T>> observer) {\r\n\t\t\t\tfinal CompositeCloseable closeables = new CompositeCloseable();\r\n\t\t\t\tfinal List<AtomicReference<T>> lastValues = new ArrayList<AtomicReference<T>>();\r\n\t\t\t\tfinal List<Observable<? extends T>> observableList = new ArrayList<Observable<? extends T>>();\r\n\t\t\t\tfinal List<Observer<T>> observers = new ArrayList<Observer<T>>();\r\n\t\t\t\tfinal AtomicInteger wip = new AtomicInteger(observableList.size() + 1);\r\n\r\n\t\t\t\tint i = 0;\r\n\t\t\t\tfor (Observable<? extends T> o : sources) {\r\n\t\t\t\t\tfinal int j = i;\r\n\t\t\t\t\tobservableList.add(o);\r\n\t\t\t\t\tlastValues.add(new AtomicReference<T>());\r\n\t\t\t\t\tobservers.add(new Observer<T>() {\r\n\t\t\t\t\t\t/** The last value. */\r\n\t\t\t\t\t\tT last;\r\n\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t\t\tcloseables.closeSilently();\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 finish() {\r\n\t\t\t\t\t\t\tlastValues.get(j).set(last);\r\n\t\t\t\t\t\t\trunIfComplete(observer, lastValues, wip);\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 next(T value) {\r\n\t\t\t\t\t\t\tlast = value;\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\ti = 0;\r\n\t\t\t\tfor (Observable<? extends T> o : observableList) {\r\n\t\t\t\t\tcloseables.add(Observers.registerSafe(o, observers.get(i)));\r\n\t\t\t\t\ti++;\r\n\t\t\t\t}\r\n\t\t\t\trunIfComplete(observer, lastValues, wip);\r\n\t\t\t\treturn closeables;\r\n\t\t\t}\r\n\t\t\t/**\r\n\t\t\t * Runs the completion sequence once the WIP drops to zero.\r\n\t\t\t * @param observer the observer who will receive the values\r\n\t\t\t * @param lastValues the array of last values\r\n\t\t\t * @param wip the work in progress counter\r\n\t\t\t */\r\n\t\t\tpublic void runIfComplete(\r\n\t\t\t\t\tfinal Observer<? super List<T>> observer,\r\n\t\t\t\t\tfinal List<AtomicReference<T>> lastValues,\r\n\t\t\t\t\tfinal AtomicInteger wip) {\r\n\t\t\t\tif (wip.decrementAndGet() == 0) {\r\n\t\t\t\t\tList<T> values = new ArrayList<T>();\r\n\t\t\t\t\tfor (AtomicReference<T> r : lastValues) {\r\n\t\t\t\t\t\tvalues.add(r.get());\r\n\t\t\t\t\t}\r\n\t\t\t\t\tobserver.next(values);\r\n\t\t\t\t\tobserver.finish();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t}", "@Nonnull\r\n\tpublic static <T> ConnectableObservable<T> publish(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\tfinal T initialValue\r\n\t\t\t) {\r\n\t\treturn multicast(source, new Subject<T, T>() {\r\n\t\t\t/** The observable handling the registrations. */\r\n\t\t\tfinal DefaultObservable<T> obs = new DefaultObservable<T>(); \r\n\t\t\t@Override\r\n\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\tobs.error(ex);\r\n\t\t\t}\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void finish() {\r\n\t\t\t\tobs.finish();\r\n\t\t\t}\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void next(T value) {\r\n\t\t\t\tobs.next(value);\r\n\t\t\t}\r\n\r\n\t\t\t@Override\r\n\t\t\t@Nonnull\r\n\t\t\tpublic Closeable register(@Nonnull Observer<? super T> observer) {\r\n\t\t\t\tobserver.next(initialValue);\r\n\t\t\t\treturn obs.register(observer);\r\n\t\t\t}\r\n\t\t\t\r\n\t\t});\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> concat(\r\n\t\t\t@Nonnull final Iterable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Concat.FromIterable.Selector<Observable<? extends T>, T>(\r\n\t\t\t\tsources, Functions.<Observable<? extends T>>identity());\r\n\t}", "public Item sample() {\n if (isEmpty()) {\n throw new NoSuchElementException();\n }\n double rand = Math.random() * N;\n int idx = (int) Math.floor(rand);\n Item item = s[idx];\n return item;\n }", "Observable<List<T>> getAll();", "public static <T> T first(\r\n\t\t\t@Nonnull final Observable<? extends T> source) {\r\n\t\tCloseableIterator<T> it = toIterable(source).iterator();\r\n\t\ttry {\r\n\t\t\tif (it.hasNext()) {\r\n\t\t\t\treturn it.next();\r\n\t\t\t}\r\n\t\t\tthrow new NoSuchElementException();\r\n\t\t} finally {\r\n\t\t\tCloseables.closeSilently(it);\r\n\t\t}\r\n\t}", "public void flatMap() {\r\n\t\tList<Integer> list = Arrays.asList(1, 2, 3, 7, 8, 9, 10);\r\n\t\tList<Integer> list2 = Arrays.asList(4, 5, 6);\r\n\t\tObservable.just(list, list2).flatMap(x -> Observable.from(x)).map(x -> x * 10).subscribe(integerSubscribe());\r\n\t}", "public static <T> T single(\r\n\t\t\t@Nonnull Observable<? extends T> source,\r\n\t\t\tT defaultValue) {\r\n\t\treturn single(source, Functions.constant0(defaultValue));\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> singleAsync(\r\n\t\t\t@Nonnull final Observable<? extends T> source) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull\r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\treturn (new DefaultObserverEx<T>() {\r\n\t\t\t\t\t/** True if the first element received. */\r\n\t\t\t\t\tboolean firstReceived;\r\n\t\t\t\t\t/** The first element encountered. */\r\n\t\t\t\t\tT first;\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onFinish() {\r\n\t\t\t\t\t\tif (firstReceived) {\r\n\t\t\t\t\t\t\tobserver.next(first);\r\n\t\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tobserver.error(new NoSuchElementException());\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onNext(T value) {\r\n\t\t\t\t\t\tif (!firstReceived) {\r\n\t\t\t\t\t\t\tfirst = value;\r\n\t\t\t\t\t\t\tfirstReceived = true;\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\terror(new TooManyElementsException());\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}).registerWith(source);\r\n\t\t\t}\r\n\t\t};\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> elementAt(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\tint index,\r\n\t\t\tT defaultValue\r\n\t\t\t) {\r\n\t\treturn elementAt(source, index, Functions.constant0(defaultValue));\r\n\t}", "public static void scanWithInitialValue() {\n Observable.range(1, 10)\n .scan(100, (previous, current) -> {\n System.out.println(\"previous = \" + previous);\n System.out.println(\"current = \" + current);\n return previous + current;\n }).subscribe(new MyObserver<>());\n\n System.out.println(\"# 2\");\n\n /*\n Same as above but initial value is returned via callable.\n */\n\n Observable.range(1, 10)\n .scanWith(() -> 1000, (previous, current) -> {\n System.out.println(\"previous = \" + previous);\n System.out.println(\"current = \" + current);\n return previous + current;\n }).subscribe(new MyObserver<>());\n\n }", "public Item sample() {\n if (isEmpty()) {\n throw new NoSuchElementException();\n }\n return a[StdRandom.uniform(N)];\n }", "public Item sample() {\n if (this.isEmpty()) {\n throw new NoSuchElementException();\n }\n if (this.size == 1) {\n return this.storage[0];\n }\n else {\n return this.storage[StdRandom.uniform(this.currentIndex)];\n }\n }", "public static void test017()\r\n {\r\n System.out.println(\"RxJavaTest04::test017\");\r\n ExecutorService poolA = Executors.newFixedThreadPool(10, newThreadFactory(\"Sched-A-%d\"));\r\n Scheduler schedulerA = Schedulers.from(poolA);\r\n RxGroceries store = new RxGroceries();\r\n\r\n Maybe<BigDecimal> totalPrice = Observable\r\n .just(\"bread\", \"butter\", \"egg\", \"milk\", \"tomato\",\r\n \"cheese\", \"tomato\", \"egg\", \"egg\")\r\n .groupBy(prod -> prod)\r\n .flatMapSingle(grouped -> grouped\r\n .count()\r\n .map(quantity -> {\r\n String productName = grouped.getKey();\r\n return Pair.of(productName, quantity);\r\n })\r\n )\r\n .flatMap(order -> store\r\n .purchase(order.getLeft(), (int)order.getRight().longValue())\r\n .subscribeOn(schedulerA)\r\n )\r\n .reduce(BigDecimal::add);\r\n\r\n totalPrice\r\n .subscribe(System.out::println);\r\n myWait(2000);\r\n poolA.shutdown();\r\n }", "@Nonnull \r\n\tpublic static <T, U> Observable<U> publish(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func1<? super Observable<? extends T>, ? extends Observable<? extends U>> selector\r\n\t\t\t) {\r\n\t\treturn multicast(source, new Func0<Subject<T, T>>() {\r\n\t\t\t@Override\r\n\t\t\tpublic Subject<T, T> invoke() {\r\n\t\t\t\treturn Subjects.newSubject();\r\n\t\t\t}\r\n\t\t}, selector);\r\n\t}", "public List<SalesOrderItem> getItemOrFetch()\r\n throws ODataException\r\n {\r\n if (toItem == null) {\r\n toItem = fetchItem();\r\n }\r\n return toItem;\r\n }", "@Override\n protected Flowable<Resource<List<Movie>>> buildUseCaseObservable() {\n return covertObservableToFlowable(searchQuery.getQuery())\n .switchMap(new Function<String, Publisher<Resource<List<Movie>>>>() {\n @Override\n public Publisher<Resource<List<Movie>>> apply(String s) throws Exception {\n searchQuery.setStringQuery(s);\n return repository.getSearch(searchQuery)\n .map(movieApiResponse -> Resource.success(movieApiResponse.getResults()));\n }\n }).startWith(Resource.loading(\"Write something to search films\"));\n }", "public Item sample() {\n if (size == 0) throw new java.util.NoSuchElementException(\"Queue is empty!\");\n\n return items[StdRandom.uniform(size)];\n }", "@Test\n public void observableEvolveAndReturnToStringValue() {\n assertTrue(Observable.just(10)\n .map(String::valueOf)\n .toBlocking()\n .single()\n .equals(\"10\"));\n }", "public static <T> Observable<T> switchToNext(final Observable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\tDefaultObserver<Observable<? extends T>> outer\r\n\t\t\t\t= new DefaultObserver<Observable<? extends T>>(false) {\r\n\t\t\t\t\t/** The inner observer. */\r\n\t\t\t\t\t@GuardedBy(\"lock\")\r\n\t\t\t\t\tCloseable inner;\r\n\r\n\t\t\t\t\tDefaultObserver<T> innerObserver = new DefaultObserver<T>(lock, true) {\r\n\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\tprotected void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\t\tinnerError(ex);\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\tprotected void onFinish() {\r\n\t\t\t\t\t\t\tinnerFinish();\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\tprotected void onNext(T value) {\r\n\t\t\t\t\t\t\tobserver.next(value);\r\n\t\t\t\t\t\t}\r\n\r\n\t\t\t\t\t};\r\n\t\t\t\t\t/** Called from the inner observer when an error condition occurs. */\r\n\t\t\t\t\tvoid innerError(Throwable ex) {\r\n\t\t\t\t\t\terror(ex);\r\n\t\t\t\t\t}\r\n\t\t\t\t\t/** Called from the inner observer when it finished. */\r\n\t\t\t\t\tvoid innerFinish() {\r\n\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\tclose();\r\n\t\t\t\t\t}\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onClose() {\r\n\t\t\t\t\t\tCloseables.closeSilently(inner);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t\tclose();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onFinish() {\r\n\t\t\t\t\t\t// nothing to do\r\n\t\t\t\t\t}\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tprotected void onNext(Observable<? extends T> value) {\r\n\t\t\t\t\t\tCloseables.closeSilently(inner);\r\n\t\t\t\t\t\tinner = value.register(innerObserver);\r\n\t\t\t\t\t}\r\n\t\t\t\t};\r\n\t\t\t\treturn sources.register(outer);\r\n\t\t\t}\r\n\t\t};\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<Option<T>> materialize(\r\n\t\t\t@Nonnull final Observable<? extends T> source) {\r\n\t\treturn new Observable<Option<T>>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super Option<T>> observer) {\r\n\t\t\t\treturn source.register(new Observer<T>() {\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.next(Option.<T>error(ex));\r\n\t\t\t\t\t\tobserver.finish();\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 finish() {\r\n\t\t\t\t\t\tobserver.next(Option.<T>none());\r\n\t\t\t\t\t\tobserver.finish();\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 next(T value) {\r\n\t\t\t\t\t\tobserver.next(Option.some(value));\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}", "@Test\n public void example() {\n Func1<Integer, Observable<Integer>> db1 = param -> Observable.range(1, param);\n\n // ws-kald som funktion der returner en Observable\n Func1<Integer, Observable<Integer>> ws1 = param -> Observable.just(param);\n\n // ws-kald som funktion der returner en Observable\n Func1<Integer, Observable<Integer>> ws2 = param -> Observable.just(param);\n\n // ws-kald som funktion der returner en Observable\n Func1<List<Integer>, Observable<Object>> ws3 = param -> Observable.empty();\n\n db1.call(5)\n .flatMap(row -> {\n if (row % 2 == 0) {\n // ws2 kaldes kun, hvis ws1 ikke var tom\n return Observable.concat(ws1.call(row), ws2.call(row)).first();\n } else {\n // ws1 og ws2 udføres parallelt\n return Observable.zip(ws1.call(10), ws2.call(20), (e1, e2) -> e1 + e2);\n }\n })\n .onErrorResumeNext(err -> {\n log.error(\"error - resume next \", err);\n return Observable.empty();\n })\n .doOnNext(n -> log.info(\"element {}\", n))\n // samle/batche 2 elementer i en liste (men højst vente 1 sekund)\n .buffer(2, 1, TimeUnit.SECONDS)\n // output sendes til en ws3\n .flatMap(ws3)\n // subscribe starter kæden\n .subscribe();\n }", "@Nonnull \r\n\tpublic static <T, U> Observable<U> publishLast(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func1<? super Observable<? extends T>, ? extends Observable<? extends U>> selector\r\n\t\t\t) {\r\n\t\treturn multicast(source, new Func0<Subject<T, T>>() { \r\n\t\t\t@Override\r\n\t\t\tpublic Subject<T, T> invoke() {\r\n\t\t\t\treturn new AsyncSubject<T>();\r\n\t\t\t}\r\n\t\t}, selector);\r\n\t}", "public static Observable<Integer> addOne(int x) {\n return Observable.just(x + 1);\n }", "public static <T> T last(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func0<? extends T> defaultSupplier) {\r\n\t\tfinal LinkedBlockingQueue<Option<T>> queue = new LinkedBlockingQueue<Option<T>>();\r\n\t\tCloseable c = source.register(new Observer<T>() {\r\n\t\t\t/** The current value. */\r\n\t\t\tT current;\r\n\t\t\t/** Are we the first? */\r\n\t\t\tboolean first = true;\r\n\t\t\t@Override\r\n\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\tqueue.add(Option.<T>none());\r\n\t\t\t}\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void finish() {\r\n\t\t\t\tif (first) {\r\n\t\t\t\t\tqueue.add(Option.<T>some(defaultSupplier.invoke()));\r\n\t\t\t\t} else {\r\n\t\t\t\t\tqueue.add(Option.some(current));\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic void next(T value) {\r\n\t\t\t\tfirst = false;\r\n\t\t\t\tcurrent = value;\r\n\t\t\t}\r\n\r\n\t\t});\r\n\t\ttry {\r\n\t\t\tOption<T> value = queue.take();\r\n\t\t\tif (value == Option.none()) {\r\n\t\t\t\tthrow new NoSuchElementException();\r\n\t\t\t}\r\n\t\t\treturn value.value();\r\n\t\t} catch (InterruptedException e) {\r\n\t\t\tthrow new RuntimeException(e);\r\n\t\t} finally {\r\n\t\t\tCloseables.closeSilently(c);\r\n\t\t}\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> dematerialize(\r\n\t\t\t@Nonnull final Observable<? extends Option<T>> source) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\treturn source.register(new Observer<Option<T>>() {\r\n\t\t\t\t\t/** Keeps track of the observer's state. */\r\n\t\t\t\t\tfinal AtomicBoolean done = new AtomicBoolean();\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tif (!done.get()) {\r\n\t\t\t\t\t\t\tdone.set(true);\r\n\t\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t\t}\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 finish() {\r\n\t\t\t\t\t\tif (!done.get()) {\r\n\t\t\t\t\t\t\tdone.set(true);\r\n\t\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\t}\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 next(Option<T> value) {\r\n\t\t\t\t\t\tif (!done.get()) {\r\n\t\t\t\t\t\t\tif (Option.isNone(value)) {\r\n\t\t\t\t\t\t\t\tdone.set(true);\r\n\t\t\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\t\t} else\r\n\t\t\t\t\t\t\tif (Option.isSome(value)) {\r\n\t\t\t\t\t\t\t\tobserver.next(value.value());\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tdone.set(true);\r\n\t\t\t\t\t\t\t\tobserver.error(Option.getError(value));\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});\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public void Collect(Item item){\n\t}", "@Override\n public Object getItem(int arg0) {\n return mData.get(arg0);\n }", "public interface ProductListDataSource {\n Observable<List<ProductItem>> getProducts();\n}", "private static void createObservableUsingNever() {\n Observable<?> observable = Observable.never();\n\n observable.subscribe(x -> LOG.info(\"{}\", x),\n error -> LOG.info(\"{}\", error.getLocalizedMessage()),\n () -> LOG.info(\"Completed\"));\n\n // Pause the main thread for the hope that it will print something\n sleep(3000);\n }", "private void getItemsInBasket(){\n Disposable disposable = mViewModel.getItemsInBasket()\n .subscribeOn(Schedulers.io())\n .observeOn(AndroidSchedulers.mainThread())\n .doOnError(throwable -> Log.e(\"BasketFragment\",throwable.getMessage()))\n .subscribe(basketItems -> basketListAdapter.submitList(basketItems));\n mDisposable.add(disposable);\n }", "public interface NotificationDataSource {\n Observable<List<Notification>> getNotifications();\n}", "@Override\r\n\tpublic Item sample() {\r\n\t\tint index = StdRandom.uniform(count);\r\n\t\tItem item = arr[index];\r\n\t\treturn item;\r\n\t}", "public Item sample() {\n if (isEmpty()) {\n throw new java.util.NoSuchElementException();\n }\n int sampleIndex = StdRandom.uniform(1, size + 1);\n Item item;\n //case 1: return first item\n if (sampleIndex == 1) {\n item = first.item;\n }\n //case 2 :return last item\n else if (sampleIndex == size) {\n item = last.item;\n }\n //case 3: general case in between\n else {\n Node temp = first;\n while (sampleIndex != 1) {\n temp = temp.next;\n sampleIndex--;\n }\n item = temp.item;\n }\n return item;\n }", "@Override\n public Set<T> getItems() {\n return items;\n }", "public Item sample() {\n if (N == 0) throw new java.util.NoSuchElementException();\n return collection[rnd.nextInt(N)];\n }", "@Nonnull \r\n\tpublic static <T> ConnectableObservable<T> publishLast(\r\n\t\t\t@Nonnull final Observable<T> source\r\n\t\t\t) {\r\n\t\treturn multicast(source, new AsyncSubject<T>());\r\n\t}", "interface DataSource {\n Single<NewsModel> requestNews();\n}", "@Override\r\n\t\tpublic List<Item> getItems() {\n\t\t\treturn null;\r\n\t\t}", "@Test\r\n\tpublic void exerciseInterruptible() {\n\t\t\r\n\t\tList<String> articlesTopicA = Arrays.asList(\"Article A-1\",\"Article A-2\",\"Article A-3\");\r\n\t\tList<String> articlesTopicB = Arrays.asList(\"Article B-1\",\"Article B-2\",\"Article B-3\");\r\n\t\tList<String> articlesTopicC = Arrays.asList(\"Article C-1\",\"Article C-2\",\"Article C-3\");\r\n\t\t\r\n\t\tList<Observable<String>> topicObservables = Arrays.asList(\r\n\t\t\t\tObservable.interval(0, 80L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicA.get(i.intValue())),\r\n\t\t\t\tObservable.interval(50, 60L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicB.get(i.intValue())),\r\n\t\t\t\tObservable.interval(0, 40L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicC.get(i.intValue())));\r\n\t\t\r\n\t\tObservable<Observable<String>> topics = Observable.interval(0, 100L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> topicObservables.get(i.intValue()));\r\n\t\t\r\n\t\t//\t\t t[ms]: 0 100 200 300\r\n\t\t//\t\ttopics: A---------B---------C---------| \r\n\t\t//\t\t A: 1-------2-|-----3---|---------|\r\n\t\t//\t\t B: |---------|----1----|2-----3--|\r\n\t\t//\t\t C: |---------|---------1---2---3-|\r\n\t\t//\t\tResult: A-1 A-2 B-1 C-1 C-2 C-3\r\n\t\t\t\t\r\n\t\t// TODO: always switch to the latest topic\r\n\t\t// HINT: http://reactivex.io/documentation/operators/switch.html\r\n\t\tObservable<String> latestInteresting = Observable.empty();\r\n\r\n\t\t// verify\r\n\t\tTestSubscriber<String> testSubscriber = new TestSubscriber<>();\r\n\t\tlatestInteresting\r\n\t\t\t.doOnNext(article -> log(String.format(\" doOnNext(): %s Time: %d\", article, testScheduler.now())))\r\n\t\t\t.subscribe(testSubscriber);\r\n\t\t\r\n\t\t// let the time elapse until completion\r\n\t\ttestScheduler.advanceTimeBy(300, TimeUnit.MILLISECONDS);\r\n\t\t\r\n\t\ttestSubscriber.assertCompleted();\r\n\t\ttestSubscriber.assertNoErrors();\r\n\t\tList<String> expectedArticles = Arrays.asList(\r\n\t\t\t\t\"Article A-1\",\"Article A-2\", \r\n\t\t\t\t\"Article B-1\", \r\n\t\t\t\t\"Article C-1\", \"Article C-2\", \"Article C-3\");\r\n\t\ttestSubscriber.assertReceivedOnNext(expectedArticles);\r\n\t\t\r\n\t}" ]
[ "0.5813816", "0.54221344", "0.5303871", "0.52481997", "0.52066034", "0.5166435", "0.51394546", "0.51177526", "0.50643444", "0.50517976", "0.5029685", "0.50000346", "0.4968154", "0.49528793", "0.4950649", "0.49500054", "0.4945329", "0.49338666", "0.4920562", "0.49134523", "0.4906633", "0.4872234", "0.48693722", "0.4849689", "0.48496667", "0.48433837", "0.48390648", "0.48347142", "0.48300868", "0.4829968", "0.48075736", "0.48046425", "0.47947195", "0.47842532", "0.47784862", "0.4765426", "0.4760599", "0.475762", "0.47455767", "0.47451037", "0.47449005", "0.47394532", "0.4732792", "0.4718787", "0.47014073", "0.46794248", "0.46719405", "0.46670648", "0.4656605", "0.46556315", "0.46393916", "0.4639165", "0.4633479", "0.46305078", "0.46286646", "0.46263552", "0.46141994", "0.4600908", "0.45959738", "0.4589363", "0.45821282", "0.45819575", "0.45752335", "0.45624736", "0.45605835", "0.45529616", "0.45528504", "0.45518976", "0.45506164", "0.45312414", "0.45298204", "0.45177028", "0.45169333", "0.45146006", "0.4508892", "0.45079973", "0.45017532", "0.4494914", "0.44938216", "0.44911775", "0.44894725", "0.44872165", "0.4486478", "0.44833237", "0.44713327", "0.44660723", "0.44660574", "0.4460284", "0.44575283", "0.44572577", "0.44542485", "0.44462717", "0.44460142", "0.44453266", "0.44360638", "0.44314796", "0.44313213", "0.44303", "0.4429026", "0.4426525" ]
0.57069767
1
discard items emitted by an Observable until a second Observable emits an item
@Test public void skipUntil() { Observable<Long> o1 = Observable.interval(100, TimeUnit.SECONDS, mTestScheduler) .map(num -> num + 1) .take(9); Observable<Integer> o2 = Observable.just(0, 0) .delay(550, TimeUnit.SECONDS, mTestScheduler); o1.skipUntil(o2) .subscribe(mList::add); mTestScheduler.advanceTimeBy(2000, TimeUnit.SECONDS); assertEquals(mList, Arrays.asList(6L, 7L, 8L, 9L)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void skipWhile() {\n Observable.fromIterable(sData)\n .skipWhile((item) -> {\n System.out.println(\"item = \" + item);\n return item.equalsIgnoreCase(\"abc\");\n }).subscribe(new MyObserver<>());\n }", "@Test\n public void takeUntil() {\n Observable.just(1, 2, 3, 4)\n .takeUntil(integer -> integer > 2)\n .subscribe(mList::add);\n assertEquals(mList, Arrays.asList(1, 2, 3));\n\n mList.clear();\n Observable.just(1, 2, 3, 4)\n .takeUntil(integer -> integer < 10)\n .subscribe(mList::add);\n assertEquals(mList, Collections.singletonList(1));\n }", "private static void exSwitchMapTwo() {\n\n Observable.interval(5,TimeUnit.SECONDS)\n .switchMap(call -> Observable.just(getResponse()).doOnDispose(() -> System.out.println(\"Disposed\")))\n .subscribe(System.out::println);\n\n //An Observable which performs network call.\n sleep(40000);\n\n\n /* OUTPUT :\n 6\n 10\n 13\n 17\n 26\n 32\n 35\n 42\n\n */\n }", "private static void createColdObservable() {\n var observable = Observable.just(1, 2, 3, 4, 5);\n\n observable.subscribe(item -> LOG.info(\"Observer 1: {}\", item));\n\n pause(1000);\n\n observable.subscribe(item -> LOG.info(\"Observer 2: {}\", item));\n }", "public static void ignoreElements() {\n Observable.fromIterable(Utils.getData())\n .ignoreElements()\n .subscribe(new MyCompletableObserver());\n }", "public static void never() {\n Observable<String> myObservable = Observable.never();\n myObservable.subscribe(genericObserver1);\n }", "@Test\r\n\tpublic void exerciseInterruptible() {\n\t\t\r\n\t\tList<String> articlesTopicA = Arrays.asList(\"Article A-1\",\"Article A-2\",\"Article A-3\");\r\n\t\tList<String> articlesTopicB = Arrays.asList(\"Article B-1\",\"Article B-2\",\"Article B-3\");\r\n\t\tList<String> articlesTopicC = Arrays.asList(\"Article C-1\",\"Article C-2\",\"Article C-3\");\r\n\t\t\r\n\t\tList<Observable<String>> topicObservables = Arrays.asList(\r\n\t\t\t\tObservable.interval(0, 80L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicA.get(i.intValue())),\r\n\t\t\t\tObservable.interval(50, 60L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicB.get(i.intValue())),\r\n\t\t\t\tObservable.interval(0, 40L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicC.get(i.intValue())));\r\n\t\t\r\n\t\tObservable<Observable<String>> topics = Observable.interval(0, 100L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> topicObservables.get(i.intValue()));\r\n\t\t\r\n\t\t//\t\t t[ms]: 0 100 200 300\r\n\t\t//\t\ttopics: A---------B---------C---------| \r\n\t\t//\t\t A: 1-------2-|-----3---|---------|\r\n\t\t//\t\t B: |---------|----1----|2-----3--|\r\n\t\t//\t\t C: |---------|---------1---2---3-|\r\n\t\t//\t\tResult: A-1 A-2 B-1 C-1 C-2 C-3\r\n\t\t\t\t\r\n\t\t// TODO: always switch to the latest topic\r\n\t\t// HINT: http://reactivex.io/documentation/operators/switch.html\r\n\t\tObservable<String> latestInteresting = Observable.empty();\r\n\r\n\t\t// verify\r\n\t\tTestSubscriber<String> testSubscriber = new TestSubscriber<>();\r\n\t\tlatestInteresting\r\n\t\t\t.doOnNext(article -> log(String.format(\" doOnNext(): %s Time: %d\", article, testScheduler.now())))\r\n\t\t\t.subscribe(testSubscriber);\r\n\t\t\r\n\t\t// let the time elapse until completion\r\n\t\ttestScheduler.advanceTimeBy(300, TimeUnit.MILLISECONDS);\r\n\t\t\r\n\t\ttestSubscriber.assertCompleted();\r\n\t\ttestSubscriber.assertNoErrors();\r\n\t\tList<String> expectedArticles = Arrays.asList(\r\n\t\t\t\t\"Article A-1\",\"Article A-2\", \r\n\t\t\t\t\"Article B-1\", \r\n\t\t\t\t\"Article C-1\", \"Article C-2\", \"Article C-3\");\r\n\t\ttestSubscriber.assertReceivedOnNext(expectedArticles);\r\n\t\t\r\n\t}", "public static Observable<String> getObservableSkipWhileElement() {\n return observableSrc;//todo\n }", "@Test\n public void skipWhile() {\n Observable.interval(100, TimeUnit.SECONDS, mTestScheduler)\n .map(num -> num + 1)\n .take(7)\n .skipWhile(aLong -> aLong != 4)\n .subscribe(mList::add);\n\n mTestScheduler.advanceTimeBy(1000, TimeUnit.SECONDS);\n assertEquals(mList, Arrays.asList(4L, 5L, 6L, 7L));\n }", "private static void exSwitchMapThree(){\n Observable<String> intense =\n Observable.just(\"Savi\",\"Healer\",\"Three\",\"Four\",\"Wednesday\",\"Friday\",\"You\",\"Me\")\n .concatMap(result -> Observable.just(result).delay(randomSleepTime(),TimeUnit.MILLISECONDS))\n .doOnDispose(() -> System.out.println(\" * * Disposed * *\"));\n\n //Observable to execute intense task every 5 seconds\n Observable.interval(5,TimeUnit.SECONDS)\n .switchMap(r -> intense)\n .subscribe(System.out::println);\n\n //Sleep the main thread for few seconds\n Take.sleep(20000);\n\n /*\n After every 5 seconds it will dispose the ongoing intense (variable name) process and\n start the same process again.\n */\n\n //Output\n /*\n Savi\n Healer\n Three\n Four\n * * Disposed * *\n Savi\n Healer\n Three\n Four\n Wednesday\n Friday\n You\n * * Disposed * *\n Savi\n Healer\n Three\n Four\n Wednesday\n * * Disposed * *\n */\n }", "@Test\r\n public void testReplayRemoveSubjectConcurrentObservations() throws InterruptedException {\r\n\r\n final ReplayRemoveSubject<Long> replay = ReplayRemoveSubject.create();\r\n\r\n final int THREAD_COUNT = 20;\r\n final int START_SOURCE_AFTER_THREADS = 3;\r\n final int THREADS_TO_RECEIVE_ALL_BEFORE_REMOVE_STARTED = 5;\r\n final int AWAITER_1_THREAD_COUNT = 10;\r\n final int AWAITER_2_THREAD_COUNT = 12;\r\n final int AWAITER_3_THREAD_COUNT = 14;\r\n\r\n final CountDownLatch sourceAwaiterMain = new CountDownLatch(THREADS_TO_RECEIVE_ALL_BEFORE_REMOVE_STARTED);\r\n\r\n final CountDownLatch threadCreationAwaiter1 = new CountDownLatch(1);\r\n final CountDownLatch sourceAwaiter1 = new CountDownLatch(3);\r\n\r\n final CountDownLatch threadCreationAwaiter2 = new CountDownLatch(1);\r\n final CountDownLatch sourceAwaiter2 = new CountDownLatch(3);\r\n\r\n final CountDownLatch threadCreationAwaiter3 = new CountDownLatch(1);\r\n\r\n final List<Long> valuesToRemove = new ArrayList<>();\r\n valuesToRemove.add(1L);\r\n valuesToRemove.add(20L);\r\n valuesToRemove.add(300L);\r\n\r\n AtomicLong fullCounter = new AtomicLong();\r\n\r\n Thread source = new Thread(() -> {\r\n try {\r\n System.out.println(\"********* Start Source Data ***********\");\r\n for (long l = 1; l <= 10000; l++) {\r\n if (l % 100 == 0)\r\n System.out.println(\"Emitting \" + l);\r\n\r\n fullCounter.addAndGet(l);\r\n replay.onNext(l);\r\n\r\n // just random value, could be any:\r\n if (l == 567) {\r\n sourceAwaiterMain.await();\r\n\r\n replay.onRemove(valuesToRemove.get(0));\r\n threadCreationAwaiter1.countDown();\r\n sourceAwaiter1.await();\r\n\r\n replay.onRemove(valuesToRemove.get(1));\r\n threadCreationAwaiter2.countDown();\r\n sourceAwaiter2.await();\r\n\r\n replay.onRemove(valuesToRemove.get(2));\r\n threadCreationAwaiter3.countDown();\r\n }\r\n\r\n }\r\n System.out.println(\"********* Finished Source Data ***********\");\r\n replay.onComplete();\r\n\r\n } catch (Exception e) {\r\n fail(e.getMessage());\r\n }\r\n });\r\n\r\n // used to collect results of each thread\r\n final List<Pair<Long, List<Long>>> listOfListsOfValues = Collections.synchronizedList(new ArrayList<>());\r\n\r\n\r\n CountDownLatch countDownLatch = new CountDownLatch(THREAD_COUNT);\r\n\r\n for (int i = 1; i <= THREAD_COUNT; i++) {\r\n\r\n final int count = i;\r\n\r\n if (count == START_SOURCE_AFTER_THREADS) {\r\n // start source data after we have some already subscribed\r\n // and while others are in process of subscribing\r\n source.start();\r\n }\r\n\r\n if (count == AWAITER_1_THREAD_COUNT)\r\n threadCreationAwaiter1.await();\r\n\r\n if (count == AWAITER_2_THREAD_COUNT)\r\n threadCreationAwaiter2.await();\r\n\r\n if (count == AWAITER_3_THREAD_COUNT)\r\n threadCreationAwaiter3.await();\r\n\r\n try {\r\n AtomicLong phase = new AtomicLong();\r\n\r\n //noinspection ResultOfMethodCallIgnored\r\n replay\r\n .observeOn(Schedulers.newThread())\r\n .doOnNext(val -> {\r\n final int indexOfRemovable =\r\n valuesToRemove.indexOf(val);\r\n\r\n if (indexOfRemovable >= 0) {\r\n phase.addAndGet(val);\r\n }\r\n\r\n if (val.equals(300L))\r\n sourceAwaiterMain.countDown();\r\n\r\n if (count >= 10)\r\n sourceAwaiter1.countDown();\r\n\r\n if (count >= 12)\r\n sourceAwaiter2.countDown();\r\n\r\n\r\n })\r\n .toList()\r\n .subscribe(values -> {\r\n listOfListsOfValues.add(Pair.of(phase.get(), values));\r\n countDownLatch.countDown();\r\n System.out.println(\"Finished thread: \" + count);\r\n });\r\n } catch (Exception e) {\r\n fail(e.getMessage());\r\n }\r\n\r\n System.out.println(\"Started thread: \" + i);\r\n }\r\n\r\n countDownLatch.await();\r\n\r\n listOfListsOfValues.stream().map(Pair::getLeft).collect(Collectors.toSet()).\r\n forEach(System.out::println);\r\n\r\n long maxRemoved = valuesToRemove.stream().reduce(0L, Long::sum);\r\n\r\n // assert all threads got the same results\r\n Map<Long, Long> sums = new HashMap<>();\r\n for (Pair<Long, List<Long>> pair : listOfListsOfValues) {\r\n long v = 0;\r\n for (long l : pair.getRight()) {\r\n v += l;\r\n }\r\n\r\n long phase = pair.getKey();\r\n assertEquals(fullCounter.get() - (maxRemoved - phase), v);\r\n\r\n sums.put(pair.getLeft(), v);\r\n }\r\n\r\n assertEquals(valuesToRemove.size() + 1, sums.size());\r\n Long phaseAcc = 0L;\r\n for (int i = valuesToRemove.size() - 1; i >= 0; i--) {\r\n assertTrue(sums.containsKey(phaseAcc));\r\n phaseAcc += valuesToRemove.get(i);\r\n assertTrue(sums.containsKey(phaseAcc));\r\n }\r\n\r\n }", "public static void timeoutOperatorWithSecondObservable(Observable<Player> playerObservable) {\n playerObservable.delay(2, TimeUnit.SECONDS)\n .timeout(1000, TimeUnit.MILLISECONDS, playerObservable.filter(player -> {\n return player.getPosition().equals(\"Forward\");\n }))\n .subscribe(player -> {\n Log.d(\"output: \", player.toString());\n });\n }", "@Override\n public void subscribe(ObservableEmitter<Integer> e) throws Exception {\n\n e.onNext(1);\n SystemClock.sleep(1000);\n e.onNext(2);\n SystemClock.sleep(1000);\n e.onNext(3);\n SystemClock.sleep(1000);\n e.onNext(4);\n\n //Once the Observable has emitted all items in the sequence, call onComplete//\n e.onComplete();\n //e.onError(new Throwable(\"Some Error!!\"));\n }", "public static Observable<String> getObservableSkipElement() {\n return observableSrc;//todo\n }", "public static void debounce() {\n List<String> data = Utils.getData();\n\n System.out.println(\"# 1\");\n\n /*\n An item needs to be most recent for at least 1 microseconds to be considered for\n transmission.\n */\n Observable.fromIterable(data)\n .debounce(1, TimeUnit.MICROSECONDS)\n .subscribe(new MyObserver<>());\n\n System.out.println(\"# 2\");\n\n /*\n Item \"def\" is being intentionally delayed, so it will not most recent and \"ghi\" will\n emitted before it, Hence \"def\" will not be emitted.\n */\n Observable.fromIterable(data)\n .debounce((item) -> {\n if (item.equalsIgnoreCase(\"def\")) {\n return Observable.just(item).delay(1000L, TimeUnit.MICROSECONDS);\n } else {\n return Observable.just(item);\n }\n }).subscribe(new MyObserver<>());\n }", "public static void switchOnNext(CountDownLatch latch) {\n\n List<Observable<Long>> collectionOfObservable = new ArrayList<>();\n\n Observable<Long> first = Observable.interval(1L, TimeUnit.SECONDS).take(5)\n .doOnNext((item) -> System.out.println(\"first doOnNext item = \" + item));\n\n Observable<Long> second = Observable.interval(1L, TimeUnit.SECONDS)\n .map(item -> item + 100).take(10);\n\n collectionOfObservable.add(first);\n collectionOfObservable.add(second);\n\n Observable.switchOnNext(Observable.fromIterable(collectionOfObservable))\n .subscribeOn(Schedulers.io()).subscribe(new MyObserver<>(latch));\n }", "public static void buffer() {\n\n List<String> data = Utils.getData();\n\n int numberOfBuffers = 11;\n\n CountDownLatch latch = new CountDownLatch(numberOfBuffers);\n\n\n Observable.fromIterable(data).buffer(3).subscribe(new MyObserver<>(latch));\n\n Observable.fromIterable(data).buffer(2, 3).subscribe(new MyObserver<>(latch));\n\n Observable.fromIterable(data).buffer(2, 3, ArrayList::new).subscribe(new MyObserver<>(latch));\n\n Observable.fromIterable(data).buffer(2, HashSet::new).subscribe(new MyObserver<>(latch));\n\n /*\n Opening and closing windows defined\n */\n Observable.fromIterable(data).buffer((observer) -> {\n System.out.println(\"opening\");\n // Starts buffer collection window\n // For every onNext a buffer window is created.\n observer.onNext(\"opening-1\");\n observer.onNext(\"opening-2\");\n }, (value) -> {\n System.out.println(\"closing, value = \" + value);\n // Closes buffer collection window\n // Gets invoked for each onNext in opening indicator\n return Observable.just(value).delay(100L, TimeUnit.MICROSECONDS);\n }, HashSet::new).subscribe(new MyObserver<>(latch));\n\n /*\n Buffer with boundary observable\n */\n Observable.fromIterable(data).buffer((Observer<? super Integer> observer) -> {\n System.out.println(\"onNext - 1\");\n observer.onNext(1);\n observer.onNext(2);\n }).subscribe(new MyObserver<>(latch));\n\n /*\n 1. Buffer with boundary observable by providing some other in built observable\n 2. Create a buffer of 100 Microseconds\n */\n Observable.fromIterable(data)\n .buffer(Observable.interval(100L, TimeUnit.MICROSECONDS))\n .subscribe(new MyObserver<>(latch));\n\n Observable.fromIterable(data)\n .buffer(Observable.interval(100L, TimeUnit.MICROSECONDS), 4)\n .subscribe(new MyObserver<>(latch));\n\n Observable.fromIterable(data)\n .buffer(Observable.interval(100L, TimeUnit.MICROSECONDS), () -> new HashSet<>())\n .subscribe(new MyObserver<>(latch));\n\n\n /*\n Boundary supplier is being passed from callable.\n */\n Observable.fromIterable(data)\n .buffer(() -> Observable.interval(100L, TimeUnit.MICROSECONDS))\n .subscribe(new MyObserver<>(latch));\n\n\n Observable.fromIterable(data)\n .buffer(() -> Observable.interval(100L, TimeUnit.MICROSECONDS), HashSet::new)\n .subscribe(new MyObserver<>(latch));\n\n try {\n latch.await();\n } catch (InterruptedException e) {\n System.out.println(e.getMessage());\n }\n }", "@Test\n public void takeWhile() {\n Observable.interval(100, TimeUnit.SECONDS, mTestScheduler)\n .map(num -> num + 1)\n .take(7)\n .takeWhile(aLong -> aLong != 4)\n .subscribe(mList::add);\n\n mTestScheduler.advanceTimeBy(1000, TimeUnit.SECONDS);\n assertEquals(mList, Arrays.asList(1L, 2L, 3L));\n }", "private static void exKeepingAppAliveTwo() {\n\n Observable.interval(1, TimeUnit.SECONDS)\n .take(3)\n .blockingSubscribe(System.out::println);\n\n\n\n /* OUTPUT :\n 0\n 1\n 2\n */\n }", "private static void fluxConnectToSecondSubscriberWithoutUseCache() throws InterruptedException {\n Flux<Long> startTheExecutionFlux = Flux.interval(Duration.ofSeconds(1)).share();\n\n Flux FluxOne = Flux.from(startTheExecutionFlux);\n //a cada cinco segundos é gerado um novo numero\n Disposable disposable = FluxOne.subscribe(out -> System.out.println(\"FluxOne value: \" + out));\n new CountDownLatch(1).await(5, TimeUnit.SECONDS);\n\n Flux fluxTwo = Flux.from(startTheExecutionFlux);\n Disposable secondDisposable = fluxTwo.subscribe(out -> System.out.println(\"fluxTwo value: \" + out));\n new CountDownLatch(1).await(5, TimeUnit.SECONDS);\n\n disposable.dispose();\n secondDisposable.dispose();\n //imprime ambos os valores sem uso de cache\n }", "public static void just() {\n Observable<List<String>> myObservable = Observable.just(Utils.getData());\n myObservable.subscribe(consumerList);\n }", "public static Observable<String> getObservableSkipLastElement() {\n return observableSrc;//todo\n }", "@Test\n public void example() {\n Func1<Integer, Observable<Integer>> db1 = param -> Observable.range(1, param);\n\n // ws-kald som funktion der returner en Observable\n Func1<Integer, Observable<Integer>> ws1 = param -> Observable.just(param);\n\n // ws-kald som funktion der returner en Observable\n Func1<Integer, Observable<Integer>> ws2 = param -> Observable.just(param);\n\n // ws-kald som funktion der returner en Observable\n Func1<List<Integer>, Observable<Object>> ws3 = param -> Observable.empty();\n\n db1.call(5)\n .flatMap(row -> {\n if (row % 2 == 0) {\n // ws2 kaldes kun, hvis ws1 ikke var tom\n return Observable.concat(ws1.call(row), ws2.call(row)).first();\n } else {\n // ws1 og ws2 udføres parallelt\n return Observable.zip(ws1.call(10), ws2.call(20), (e1, e2) -> e1 + e2);\n }\n })\n .onErrorResumeNext(err -> {\n log.error(\"error - resume next \", err);\n return Observable.empty();\n })\n .doOnNext(n -> log.info(\"element {}\", n))\n // samle/batche 2 elementer i en liste (men højst vente 1 sekund)\n .buffer(2, 1, TimeUnit.SECONDS)\n // output sendes til en ws3\n .flatMap(ws3)\n // subscribe starter kæden\n .subscribe();\n }", "public void emitLoop() {\n Subscriber<? super R> subscriber = this.child;\n Queue<Object> queue2 = this.queue;\n AtomicLong atomicLong = this.requested;\n long j = atomicLong.get();\n while (!checkTerminated(this.done, queue2.isEmpty(), subscriber)) {\n long j2 = 0;\n while (j2 != j) {\n boolean z = this.done;\n Object poll = queue2.poll();\n boolean z2 = poll == null;\n if (!checkTerminated(z, z2, subscriber)) {\n if (z2) {\n break;\n }\n Object value = NotificationLite.getValue(poll);\n try {\n subscriber.onNext(value);\n j2++;\n } catch (Throwable th) {\n Exceptions.throwOrReport(th, (Observer<?>) subscriber, value);\n return;\n }\n } else {\n return;\n }\n }\n if (!(j2 == 0 || j == Long.MAX_VALUE)) {\n j = BackpressureUtils.produced(atomicLong, j2);\n }\n synchronized (this) {\n if (!this.missed) {\n this.emitting = false;\n return;\n }\n this.missed = false;\n }\n }\n }", "@Test\n public void amb() {\n Observable<Integer> o1 = Observable.just(20, 40, 60)\n .delay(500, TimeUnit.SECONDS, mTestScheduler);\n\n Observable<Integer> o2 = Observable.just(1, 2, 3)\n .delay(200, TimeUnit.SECONDS, mTestScheduler);\n\n Observable<Integer> o3 = Observable.just(0, 0, 0)\n .delay(1000, TimeUnit.SECONDS, mTestScheduler);\n\n Observable.amb(o1, o2, o3)\n .subscribe(mList::add);\n\n mTestScheduler.advanceTimeBy(1000, TimeUnit.SECONDS);\n assertEquals(mList, Arrays.asList(1, 2, 3));\n }", "@Test\n public void downloadThrottled() throws Exception {\n //given\n Flowable<URL> urls = Urls.all().take(20);\n //ojo al parametro del flatmap que indica el maximo de concurrencia\n Flowable<Pair<URI, String>> pairs = urls.flatMap(url -> UrlDownloader.downloadThrottled(url)\n .subscribeOn(Schedulers.io())\n .map(htmlstr -> Pair.of(toUri(url), htmlstr)), 10);\n Single<Map<URI, String>> var = pairs.toMap((Pair<URI, String> pair) -> pair.getLeft(), (Pair<URI, String> pair) -> pair.getRight());\n Map<URI, String> bodies2 = var.blockingGet();\n Map<URI, String> bodies = pairs.toMap(Pair::getLeft, Pair::getRight).blockingGet();\n\n\n Map<URI, String> bodies3 = urls.flatMap(url -> UrlDownloader.downloadThrottled(url)\n .subscribeOn(Schedulers.io())\n .map(htmlstr -> Pair.of(toUri(url), htmlstr)), 10).toMap(Pair::getLeft, Pair::getRight).blockingGet();\n\n //when\n //Use UrlDownloader.downloadThrottled()\n\n\n //then\n assertThat(bodies).containsEntry(new URI(\"http://www.twitter.com\"), \"<html>www.twitter.com</html>\");\n assertThat(bodies).containsEntry(new URI(\"http://www.adobe.com\"), \"<html>www.adobe.com</html>\");\n assertThat(bodies).containsEntry(new URI(\"http://www.bing.com\"), \"<html>www.bing.com</html>\");\n }", "private static void scenario() {\n\n Observable<String> stringObservable = Observable.just(\"One\",\"Two\",\"Three\",\"Four\",\"Five\",\"Six\",\"Seven\",\"Eight\",\"Nine\");\n\n Observable<String> stringProcessor = stringObservable.concatMap(data -> Observable.just(data).delay(randomSleepTime(),\n TimeUnit.MILLISECONDS));\n\n stringProcessor.subscribe(System.out::println);\n\n sleep(20000);\n\n /* OUTPUT :\n One\n Two\n Three\n Four\n Five\n Six\n Seven\n Eight\n Nine\n */\n }", "public static void empty() {\n Observable<String> myObservable = Observable.empty();\n myObservable.subscribe(genericObserver1);\n }", "public static void zipObservables(CountDownLatch latch) {\n\n Observable<Observable<String>> source = Observable.create(observableEmitter -> {\n System.out.println(\"create\");\n observableEmitter.onNext(Observable.just(\"abc\", \"def\"));\n observableEmitter.onNext(Observable.just(\"123\", \"456\"));\n observableEmitter.onNext(Observable.just(\"alpha\", \"beta\", \"gama\"));\n observableEmitter.onComplete();\n });\n\n source.doOnSubscribe(d -> System.out.println(\"source doOnSubscribe\"));\n source.doOnNext(i -> System.out.println(\"source doOnNext = \" + i.toString()));\n source.doOnComplete(() -> System.out.println(\"source doOnComplete\"));\n\n\n Observable.zip(source, items -> items[0] + \"-\" + items[1] + \"-\" + items[2])\n .doOnSubscribe(d -> System.out.println(\"zip doOnSubscribe\"))\n .doOnNext(i -> System.out.println(\"zip doOnNext\"))\n .subscribe(new MyObserver<>(latch));\n }", "private static void backPressureChallenge() {\n\t\tObservable.range(1, 1000000)\n\t\t//below map will run in sequential\n\t\t//since sequential it has to complete whole task then only it can allow consumer to start\n\t\t\t.map(item -> {\n\t\t\t\tSystem.out.println(\"Produced item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t\treturn item;\n\t\t\t})\n\t\t\t.observeOn(Schedulers.io())\n\t\t\t//.subscribeOn(Schedulers.io())//with this whole pipelein runs in seprate thread paralleley\n\t\t\t//below will run in concurrent\n\t\t\t.subscribe(item ->{\n\t\t\t\t//mimcing slowness\n\t\t\t\tThreadUtil.sleep(300);\n\t\t\t\tSystem.out.println(\"Consumed item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t})\n\t\t\t\n\t\t\t;\n\t\t\n\t\t//since running in async we need to sleep\n\t\tThreadUtil.sleep(10000000);\n\t}", "@Test\n public void sequenceEqual() {\n\n Observable<Long> o1 = Observable.just(1L, 2L, 3L, 4L, 5L)\n .delay(1000, TimeUnit.SECONDS, mTestScheduler);\n Observable<Long> o2 = Observable.interval(20, TimeUnit.SECONDS, mTestScheduler)\n .skip(1)\n .take(5);\n\n Observable.sequenceEqual(o1, o2)\n .subscribe(mList::add);\n\n mTestScheduler.advanceTimeBy(1200, TimeUnit.SECONDS);\n\n assertEquals(mList, Collections.singletonList(true));\n }", "@Test\n public void testDefer() throws InterruptedException {\n Observable<LocalTime> localTimeObservable =\n Observable.defer(\n () -> Observable\n .just(LocalTime.now()))\n .repeat(3);\n localTimeObservable.subscribe(System.out::println);\n Thread.sleep(3000);\n System.out.println(\"Next Subscriber\");\n localTimeObservable.subscribe(System.out::println);\n }", "private static void createObservableUsingDefer() {\n LOG.info(LINE);\n // it prints from start up to (start + count - 1)\n final int start = 5;\n\n var observable = Observable.range(start, count);\n observable.subscribe(item -> LOG.info(\"Observer 1: {}\", item)); // only 5 6\n count = 3;\n observable.subscribe(item -> LOG.info(\"Observer 2: {}\", item)); // only 5 6 - count change is not reffered\n\n LOG.info(LINE);\n\n count = 2;\n observable = Observable.defer(() -> {\n System.out.println(\"New Observable is created with start = \" + start + \" and count = \" + count);\n return Observable.range(start, count);\n });\n\n observable.subscribe(item -> LOG.info(\"Observer 1: {}\", item)); // only 5 6\n count = 3;\n observable.subscribe(item -> LOG.info(\"Observer 2: {}\", item)); // 5 6 7 - count change used by new range object\n }", "public static void flatMap() {\n List<String> data = Utils.getData();\n Observable.fromIterable(data)\n .flatMap((item) -> Observable.just(item + \" flat mapped\").repeat(2)\n ).subscribe(new MyObserver<>());\n }", "@BackpressureSupport(BackpressureKind.FULL)\n @SchedulerSupport(SchedulerKind.CUSTOM)\n public final Observable<T> skip(long time, TimeUnit unit, Scheduler scheduler) {\n return skipUntil(timer(time, unit, scheduler));\n }", "void drainFused() {\n int n;\n int n2 = 1;\n Subscriber<T> subscriber = this.actual;\n SimpleQueueWithConsumerIndex<Object> simpleQueueWithConsumerIndex = this.queue;\n do {\n if (this.cancelled) {\n simpleQueueWithConsumerIndex.clear();\n return;\n }\n Throwable throwable = (Throwable)this.error.get();\n if (throwable != null) {\n simpleQueueWithConsumerIndex.clear();\n subscriber.onError(throwable);\n return;\n }\n n = simpleQueueWithConsumerIndex.producerIndex() == this.sourceCount ? 1 : 0;\n if (!simpleQueueWithConsumerIndex.isEmpty()) {\n subscriber.onNext(null);\n }\n if (n != 0) {\n subscriber.onComplete();\n return;\n }\n n2 = n = this.addAndGet(-n2);\n } while (n != 0);\n }", "@Test\n public void shouldDownloadAllUrls() throws Exception {\n //given\n Flowable<URL> urls = Urls.all();\n\n\n/* final Flowable<String> htmls2 = urls\n .flatMap(url -> UrlDownloader.download(url)\n .subscribeOn(Schedulers.io())); //ojo al subscribeon\n\n\n Flowable<Pair<String, String>> gel = urls.map(s -> {\n final String[] html = {\"\"};\n final String[] gelote = new String[1];\n\n UrlDownloader.download(s).subscribe(value -> {\n gelote[0] = value;\n });\n String result = gelote[0];\n return Pair.of(s.toURI().toString(), gelote[0]);\n });\n\n //\n Flowable<String> htmls =\n urls.flatMap(url -> UrlDownloader.download(url).subscribeOn(Schedulers.io()));\n\n Flowable<Pair<URL, Flowable<String>>> broken = urls.map(url -> Pair.of(url, UrlDownloader.download(url)));\n\n urls.flatMap(url -> {\n final Flowable<String> html = UrlDownloader.download(url);\n Flowable<Pair<URL,String>> var =html.map(htmlstr->Pair.of(url,htmlstr));\n return var;\n });\n\n */\n Flowable<Pair<URI, String>> pairs = urls.flatMap(url -> UrlDownloader.download(url)\n .subscribeOn(Schedulers.io())\n .map(htmlstr -> Pair.of(toUri(url), htmlstr)));\n\n\n //no confundir toMap con map\n //Maybe: 0..1 values\n //Single 1 value\n //Completable 0 values\n //Flowable 0...infinity\n //single es un stream que solo tiene un valor\n Single<Map<URI, String>> var = pairs.toMap((Pair<URI, String> pair) -> pair.getLeft(), (Pair<URI, String> pair) -> pair.getRight());\n Map<URI, String> bodies2 = var.blockingGet();\n Map<URI, String> bodies = pairs.toMap(Pair::getLeft, Pair::getRight).blockingGet();\n TimeUnit.SECONDS.sleep(20);\n\n //when\n //WARNING: URL key in HashMap is a bad idea here\n\n //No mutar el mapa del suscribe , en vez de eso, use toMap()\n //con confundir con el operador map()\n //blocking*\n\n\n /*Map<URI, String> bodies = new HashMap<>();*/\n\n/*\n gel.toMap(s.getLeft());\n gel.subscribe(System.out::println);\n*/\n\n //then\n assertThat(bodies).hasSize(996);\n assertThat(bodies).containsEntry(new URI(\"http://www.twitter.com\"), \"<html>www.twitter.com</html>\");\n assertThat(bodies).containsEntry(new URI(\"http://www.aol.com\"), \"<html>www.aol.com</html>\");\n assertThat(bodies).containsEntry(new URI(\"http://www.mozilla.org\"), \"<html>www.mozilla.org</html>\");\n }", "private static void createObservableUsingNever() {\n Observable<?> observable = Observable.never();\n\n observable.subscribe(x -> LOG.info(\"{}\", x),\n error -> LOG.info(\"{}\", error.getLocalizedMessage()),\n () -> LOG.info(\"Completed\"));\n\n // Pause the main thread for the hope that it will print something\n sleep(3000);\n }", "public static void combineLatest() {\n\n System.out.println(\"# 1\");\n\n /*\n Emits item every second\n */\n Observable sourceInterval = Observable.interval(1L, TimeUnit.MILLISECONDS).take(10);\n\n /*\n Emits string items\n */\n Observable sourceString = Observable.fromIterable(sData);\n\n Observable<?> combined = Observable.combineLatest((objects) -> {\n StringBuilder stringBuilder = new StringBuilder();\n Stream.of(objects).forEach(stringBuilder::append);\n return stringBuilder.toString();\n }, 1, sourceInterval, sourceString);\n\n combined.subscribe(new MyObserver<>());\n\n System.out.println(\"# 2\");\n\n /*\n Because empty observable immediately terminates hence whole sequence terminates.\n */\n combined = Observable.combineLatest((objects) -> {\n StringBuilder stringBuilder = new StringBuilder();\n Stream.of(objects).forEach(stringBuilder::append);\n return stringBuilder.toString();\n }, 1, sourceInterval, sourceString, Observable.empty());\n combined.subscribe(new MyObserver<>());\n\n System.out.println(\"# 3\");\n /*\n Same as above but instead collection of sources are used.\n */\n List<Observable<?>> collection = new ArrayList<>();\n collection.add(sourceInterval);\n collection.add(sourceString.repeat(1));\n combined = Observable.combineLatest(collection, (objects) -> {\n StringBuilder stringBuilder = new StringBuilder();\n Stream.of(objects).forEach(stringBuilder::append);\n return stringBuilder.toString();\n });\n combined.subscribe(new MyObserver<>());\n\n System.out.println(\"# 4\");\n /*\n Explicitly combine 2 sources, similarly it can be done up to 10 sources\n */\n combined = Observable.combineLatest(sourceInterval, sourceString.repeat(1),\n (first, second) -> first + \"-\" + second);\n combined.subscribe(new MyObserver<>());\n }", "public void emitLoop() {\n Subscriber<? super R> child2 = this.child;\n Queue<Object> queue2 = this.queue;\n NotificationLite<R> nl = NotificationLite.instance();\n AtomicLong requested2 = this.requested;\n long r = requested2.get();\n while (true) {\n boolean max = r == LongCompanionObject.MAX_VALUE;\n if (!checkTerminated(this.done, queue2.isEmpty(), child2)) {\n long e = 0;\n while (r != 0) {\n boolean d = this.done;\n Object o = queue2.poll();\n boolean empty = o == null;\n if (checkTerminated(d, empty, child2)) {\n return;\n }\n if (empty) {\n break;\n }\n R v = nl.getValue(o);\n try {\n child2.onNext(v);\n r--;\n e--;\n } catch (Throwable ex) {\n Exceptions.throwOrReport(ex, child2, v);\n return;\n }\n }\n if (e != 0 && !max) {\n r = requested2.addAndGet(e);\n }\n synchronized (this) {\n if (!this.missed) {\n this.emitting = false;\n return;\n }\n this.missed = false;\n }\n } else {\n return;\n }\n }\n }", "public static void sample() {\n System.out.println(\"# 1\");\n Observable.fromIterable(sData)\n .timestamp()\n .sample(1000, TimeUnit.MICROSECONDS)\n .subscribe(new MyObserver<>());\n\n /*\n Emission controlled by sampler inner observable\n */\n System.out.println(\"# 2\");\n Observable.fromIterable(sData)\n .sample((observer) -> {\n System.out.println(\"emitter\");\n Observable.just(\"123\").subscribe(observer);\n }, true).subscribe(new MyObserver<>());\n }", "public static void test016()\r\n {\r\n System.out.println(\"RxJavaTest04::test016\");\r\n ExecutorService poolA = Executors.newFixedThreadPool(10, newThreadFactory(\"Sched-A-%d\"));\r\n Scheduler schedulerA = Schedulers.from(poolA);\r\n RxGroceries rxGroceries = new RxGroceries();\r\n\r\n Maybe<BigDecimal> totalPrice = Observable\r\n .fromIterable(Arrays.asList(\"bread\", \"butter\", \"milk\", \"tomato\", \"cheese\"))\r\n .subscribeOn(schedulerA)\r\n .flatMap(prod -> rxGroceries\r\n .purchase(prod, 1)\r\n .subscribeOn(schedulerA)\r\n )\r\n .reduce(BigDecimal::add);\r\n totalPrice\r\n .subscribe(\r\n x -> log(\"Got \" + x),\r\n Throwable::printStackTrace,\r\n () -> log(\"Completed\")\r\n );\r\n myWait(2000); // We have to wait before shutting down the pool,\r\n // otherwise it will throw exception \r\n // [java] io.reactivex.exceptions.UndeliverableException:\r\n // java.util.concurrent.RejectedExecutionException:\r\n // Task java.util.concurrent.FutureTask@38d8f9d0 rejected\r\n // from java.util.concurrent.ThreadPoolExecutor@6a724a6c\r\n // [Shutting down, pool size = 1, active threads = 1, queued\r\n // tasks = 0, completed tasks = 0]\r\n poolA.shutdown();\r\n }", "private static void createHotAndConnectableObservable() {\n var observable = Observable.just(1, 2, 3, 4, 5).publish();\n\n observable.subscribe(item -> LOG.info(\"Connectable Observer 1: {}\", item));\n observable.subscribe(item -> LOG.info(\"Connectable Observer 2: {}\", item));\n\n pause(1000);\n // calling connect starts emitting immediately - any order\n observable.connect();\n\n // if we subscribe now it'll now be emitted - hot observable\n observable.subscribe(item -> LOG.info(\"Connectable Observer 3: {}\", item));\n }", "public static Observable<String> getObservableDistinctUntilChanges() {\n return observableSrcDuplicated;//todo\n }", "public void drain() {\r\n if (getAndIncrement() == 0) {\r\n SimpleQueue<T> simpleQueue = this.queue;\r\n int i = this.consumed;\r\n int i2 = this.bufferSize;\r\n int i3 = i2 - (i2 >> 2);\r\n boolean z = this.sourceMode != 1;\r\n int i4 = 1;\r\n int i5 = i;\r\n SimpleQueue<T> simpleQueue2 = simpleQueue;\r\n int i6 = i5;\r\n while (true) {\r\n if (simpleQueue2 != null) {\r\n long j = LongCompanionObject.MAX_VALUE;\r\n InnerSubscription[] innerSubscriptionArr = (InnerSubscription[]) this.subscribers.get();\r\n boolean z2 = false;\r\n for (InnerSubscription innerSubscription : innerSubscriptionArr) {\r\n long j2 = innerSubscription.get();\r\n if (j2 != Long.MIN_VALUE) {\r\n j = Math.min(j2 - innerSubscription.emitted, j);\r\n z2 = true;\r\n }\r\n }\r\n long j3 = 0;\r\n if (!z2) {\r\n j = 0;\r\n }\r\n while (true) {\r\n if (j == j3) {\r\n break;\r\n }\r\n boolean z3 = this.done;\r\n try {\r\n Object poll = simpleQueue2.poll();\r\n boolean z4 = poll == null;\r\n if (!checkTerminated(z3, z4)) {\r\n if (z4) {\r\n break;\r\n }\r\n int length = innerSubscriptionArr.length;\r\n for (int i7 = 0; i7 < length; i7++) {\r\n InnerSubscription innerSubscription2 = innerSubscriptionArr[i7];\r\n if (!innerSubscription2.isCancelled()) {\r\n innerSubscription2.downstream.onNext(poll);\r\n innerSubscription2.emitted++;\r\n }\r\n }\r\n if (z) {\r\n i6++;\r\n if (i6 == i3) {\r\n ((Subscription) this.upstream.get()).request((long) i3);\r\n i6 = 0;\r\n }\r\n }\r\n j--;\r\n if (innerSubscriptionArr != this.subscribers.get()) {\r\n break;\r\n }\r\n j3 = 0;\r\n } else {\r\n return;\r\n }\r\n } catch (Throwable th) {\r\n Throwable th2 = th;\r\n Exceptions.throwIfFatal(th2);\r\n ((Subscription) this.upstream.get()).cancel();\r\n simpleQueue2.clear();\r\n this.done = true;\r\n signalError(th2);\r\n return;\r\n }\r\n }\r\n if (checkTerminated(this.done, simpleQueue2.isEmpty())) {\r\n return;\r\n }\r\n }\r\n this.consumed = i6;\r\n i4 = addAndGet(-i4);\r\n if (i4 != 0) {\r\n if (simpleQueue2 == null) {\r\n simpleQueue2 = this.queue;\r\n }\r\n } else {\r\n return;\r\n }\r\n }\r\n }\r\n }", "public static void concatMap() {\n List<String> data = Utils.getData();\n Observable.fromIterable(data)\n .concatMap((item) -> Observable.just(item + \" concat mapped\").repeat(2)\n ).subscribe(new MyObserver<>());\n }", "@BackpressureSupport(BackpressureKind.ERROR)\n @SchedulerSupport(SchedulerKind.NONE)\n public final <B> Observable<List<T>> buffer(Publisher<B> boundary) {\n return buffer(boundary, new Supplier<List<T>>() {\n @Override\n public List<T> get() {\n return new ArrayList<T>();\n }\n });\n }", "@Nonnull\r\n\tpublic static <T, U> Observable<T> skipUntil(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Observable<U> signaller) {\r\n\t\treturn new Skip.Until<T, U>(source, signaller);\r\n\t}", "@Nonnull \r\n\tpublic static <T> Observable<T> prune(\r\n\t\t\tfinal Observable<? extends T> source\r\n\t) {\r\n\t\treturn replay(source, 1);\r\n\t}", "private static void backPressureFix() {\n\t\tFlowable.range(1, 1000000)\n\t\t//below map will run in sequential\n\t\t//since sequential it has to complete whole task then only it can allow consumer to start\n\t\t\t.map(item -> {\n\t\t\t\tSystem.out.println(\"Produced item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t\treturn item;\n\t\t\t})\n\t\t\t.observeOn(Schedulers.io())\n\t\t\t//.subscribeOn(Schedulers.io())//with this whole pipelein runs in seprate thread paralleley\n\t\t\t//below will run in concurrent\n\t\t\t.subscribe(item ->{\n\t\t\t\t//mimcing slowness\n\t\t\t\tThreadUtil.sleep(300);\n\t\t\t\tSystem.out.println(\"Consumed item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t})\n\t\t\t\n\t\t\t;\n\t\t\n\t\t//since running in async we need to sleep\n\t\tThreadUtil.sleep(10000000);\n\t\t\t\n\t}", "public static void test009()\r\n {\r\n System.out.println(\"RxJavaTest04::test009\");\r\n List<String> tickets = new ArrayList<String>(Arrays.asList(\"one\", \"two\", \"three\", \"four\", \"five\"));\r\n List<String> failures = Observable.fromIterable(tickets)\r\n .flatMap(ticket ->\r\n myRxSendEmail(ticket)\r\n .flatMap(response -> Observable.<String>empty())\r\n .doOnError(e -> System.out.printf(\"Failed to send %s: %s\\n\", ticket, e))\r\n .onErrorReturn(err -> ticket)\r\n .subscribeOn(Schedulers.io())\r\n )\r\n .toList()\r\n .blockingGet();\r\n for (String failure : failures) {\r\n System.out.println(failure);\r\n }\r\n }", "public static Observable<Long> getObservableTakeWhile() {\n return observableIntervalSrc;//todo\n }", "private void getItemsInBasket(){\n Disposable disposable = mViewModel.getItemsInBasket()\n .subscribeOn(Schedulers.io())\n .observeOn(AndroidSchedulers.mainThread())\n .doOnError(throwable -> Log.e(\"BasketFragment\",throwable.getMessage()))\n .subscribe(basketItems -> basketListAdapter.submitList(basketItems));\n mDisposable.add(disposable);\n }", "private void assertNotConsumed() {\n if (this.consumed) {\n throw new IllegalStateException(\"Response content has been already consumed\");\n }\n }", "private void subscribeToDeleteEvents() {\n mDisposable.add(basketListAdapter.deleteItemSubject\n .observeOn(Schedulers.io())\n .flatMapCompletable(basketItemWithProduct -> mViewModel.deleteItemFromBasket(basketItemWithProduct.basketItem))\n .subscribeOn(AndroidSchedulers.mainThread())\n .subscribe(this::onItemDeleted, this::onItemDeleteFailed)\n );\n }", "public static void main(String[] args){\n Observable myObservable = Observable.create(new Observable.OnSubscribe(){\n\n @Override\n public void call(Object subscriber) {\n Subscriber mySubscriber = (Subscriber)subscriber;\n\n for(int i = 0 ; i < 10; i++){\n //if my subscriber was subscribed\n if(!mySubscriber.isUnsubscribed()){\n mySubscriber.onNext(\"Pushed value \" + i);\n }\n }\n\n if(!mySubscriber.isUnsubscribed()){\n mySubscriber.onCompleted();\n }\n\n }\n });\n\n //subscribe to your Observable\n myObservable.subscribe(new Action1<String>() {\n @Override\n public void call(String s) {\n System.out.println(s);\n }\n },\n new Action1<Throwable>() {\n @Override\n public void call(Throwable throwable) {\n System.out.println(\"Something went wrong the observable\");\n }\n },\n new Action0() {\n @Override\n public void call() {\n System.out.println(\"No more values will be pushed.\");\n }\n });\n\n }", "@Test\n public void onlyWithMap(){\n Observable<Observable<PhoneNumber>> usersPhonesNumbers = costService\n .findUserInDepartment(DEPARTMENT_ID)\n .map(costService::findPhoneNumber);//<-- returns observable\n\n //Strange type here :o\n Observable<Observable<BigDecimal>> priceStream = usersPhonesNumbers\n .map(phones -> phones.map(costService::getPricePerSmsForNumber));\n\n Observable<BigDecimal> costPerPerson = priceStream.map(userPhones -> userPhones.reduce(ZERO, BigDecimal::add).blockingGet());//blockingGet<---only one difference in comparison to streams\n\n BigDecimal totalCost = costPerPerson.reduce(ZERO, BigDecimal::add).blockingGet(); //blockingGet<---only one difference in comparison to streams\n log.info(\"Total cost of sending SMSes to all users all phones {}\", totalCost);\n }", "ObservableList<Task> getUnfilteredTaskList();", "@Test\n public void when_wmOnSingleQueueOnly_then_emittedAfterDelay_multipleWm() {\n for (int time = 0; time < 40; time++) {\n add(q1, wm(100 + time));\n Object[] expectedItems = time < 16 ? new Object[0] : new Object[]{wm(time + 100 - 16)};\n drainAndAssert(time, MADE_PROGRESS, expectedItems);\n }\n }", "@Override\r\n public Subscription onSubscribe(final Observer<? super String> observer) {\n final Thread t = new Thread(new Runnable() {\r\n @Override\r\n public void run() {\r\n for (int i = 0; i < 75; i++) {\r\n observer.onNext(\"anotherValue_\" + i);\r\n }\r\n // After sending all values we complete the sequence\r\n observer.onCompleted();\r\n }\r\n });\r\n t.start();\r\n \r\n return new Subscription() {\r\n @Override\r\n public void unsubscribe() {\r\n // Ask the thread to stop doing work.\r\n // For this simple example it just interrupts.\r\n t.interrupt();\r\n }\r\n };\r\n }", "public static void test008()\r\n {\r\n System.out.println(\"RxJavaTest04::test008\");\r\n List<String> tickets = new ArrayList<String>(Arrays.asList(\"one\", \"two\", \"three\", \"four\", \"five\"));\r\n List<String> failures = Observable.fromIterable(tickets)\r\n .flatMap(ticket ->\r\n myRxSendEmail(ticket)\r\n .flatMap(response -> Observable.<String>empty())\r\n .doOnError(e -> System.out.printf(\"Failed to send %s: %s\\n\", ticket, e))\r\n .onErrorReturn(err -> ticket))\r\n .toList()\r\n .blockingGet();\r\n for (String failure : failures) {\r\n System.out.println(failure);\r\n }\r\n }", "@Test\n public void testSummingUpTwoAsyncStreamsOfIntegers() throws Exception {\n FunctionalReactives<Integer> fr1 =\n FunctionalReactives.createAsync(\n aSubscribableWillAsyncFireIntegerOneToFive() //one async stream of Integers\n );\n FunctionalReactives<Integer> fr2 =\n fr1.fromAnother(\n aSubscribableWillAsyncFireIntegerOneToFive() //another async stream of Integers\n );\n\n FunctionalReactives<Void> fr =\n fr1.zipStrict(fr2, new Function2<Integer, Integer, Integer>() {\n @Override\n public Optional<Integer> apply(Integer input1, Integer input2) {\n return Optional.of(input1 + input2);\n }\n })\n .forEach(println()); //print out reaction results each in a line\n\n fr.start(); //will trigger Subscribable.doSubscribe()\n fr.shutdown(); //will trigger Subscribable.unsubscribe() which in above case will await for all the integers scheduled\n\n //Reaction walk through:\n // Source1: 1 -> 2 -> 3 -> 4 -> 5 -> |\n // Source2: 1 -> 2 -> 3 -> 4 -> 5 -> |\n // Print sum of two sources: 2 -> 4 -> 6 -> 8 -> 10 ->|\n\n }", "public static void test015()\r\n {\r\n System.out.println(\"RxJavaTest04::test015\");\r\n ExecutorService poolA = Executors.newFixedThreadPool(10, newThreadFactory(\"Sched-A-%d\"));\r\n Scheduler schedulerA = Schedulers.from(poolA);\r\n RxGroceries rxGroceries = new RxGroceries();\r\n\r\n Maybe<BigDecimal> totalPrice = Observable\r\n .fromIterable(Arrays.asList(\"bread\", \"butter\", \"milk\", \"tomato\", \"cheese\"))\r\n .subscribeOn(schedulerA)\r\n .flatMap(prod -> rxGroceries.purchase(prod, 1))\r\n .reduce(BigDecimal::add);\r\n totalPrice\r\n .subscribe(System.out::println);\r\n poolA.shutdown();\r\n }", "ObservableList<Deliverable> getFilteredDeliverableList();", "public static void scan() {\n Observable.range(1, 10)\n .scan((previous, current) -> {\n System.out.println(\"previous = \" + previous);\n System.out.println(\"current = \" + current);\n return previous + current;\n }).subscribe(new MyObserver<>());\n }", "@Nonnull\r\n\tpublic static <T> Observable<List<T>> forkJoin(\r\n\t\t\t@Nonnull final Iterable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Observable<List<T>>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super List<T>> observer) {\r\n\t\t\t\tfinal CompositeCloseable closeables = new CompositeCloseable();\r\n\t\t\t\tfinal List<AtomicReference<T>> lastValues = new ArrayList<AtomicReference<T>>();\r\n\t\t\t\tfinal List<Observable<? extends T>> observableList = new ArrayList<Observable<? extends T>>();\r\n\t\t\t\tfinal List<Observer<T>> observers = new ArrayList<Observer<T>>();\r\n\t\t\t\tfinal AtomicInteger wip = new AtomicInteger(observableList.size() + 1);\r\n\r\n\t\t\t\tint i = 0;\r\n\t\t\t\tfor (Observable<? extends T> o : sources) {\r\n\t\t\t\t\tfinal int j = i;\r\n\t\t\t\t\tobservableList.add(o);\r\n\t\t\t\t\tlastValues.add(new AtomicReference<T>());\r\n\t\t\t\t\tobservers.add(new Observer<T>() {\r\n\t\t\t\t\t\t/** The last value. */\r\n\t\t\t\t\t\tT last;\r\n\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t\t\tcloseables.closeSilently();\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 finish() {\r\n\t\t\t\t\t\t\tlastValues.get(j).set(last);\r\n\t\t\t\t\t\t\trunIfComplete(observer, lastValues, wip);\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 next(T value) {\r\n\t\t\t\t\t\t\tlast = value;\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\ti = 0;\r\n\t\t\t\tfor (Observable<? extends T> o : observableList) {\r\n\t\t\t\t\tcloseables.add(Observers.registerSafe(o, observers.get(i)));\r\n\t\t\t\t\ti++;\r\n\t\t\t\t}\r\n\t\t\t\trunIfComplete(observer, lastValues, wip);\r\n\t\t\t\treturn closeables;\r\n\t\t\t}\r\n\t\t\t/**\r\n\t\t\t * Runs the completion sequence once the WIP drops to zero.\r\n\t\t\t * @param observer the observer who will receive the values\r\n\t\t\t * @param lastValues the array of last values\r\n\t\t\t * @param wip the work in progress counter\r\n\t\t\t */\r\n\t\t\tpublic void runIfComplete(\r\n\t\t\t\t\tfinal Observer<? super List<T>> observer,\r\n\t\t\t\t\tfinal List<AtomicReference<T>> lastValues,\r\n\t\t\t\t\tfinal AtomicInteger wip) {\r\n\t\t\t\tif (wip.decrementAndGet() == 0) {\r\n\t\t\t\t\tList<T> values = new ArrayList<T>();\r\n\t\t\t\t\tfor (AtomicReference<T> r : lastValues) {\r\n\t\t\t\t\t\tvalues.add(r.get());\r\n\t\t\t\t\t}\r\n\t\t\t\t\tobserver.next(values);\r\n\t\t\t\t\tobserver.finish();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public void observaleJust() {\n\t\tObservable.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).subscribe(integerSubscribe());\r\n\t}", "@Nonnull \r\n\tpublic static <T, U> Observable<U> prune(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func1<? super Observable<? extends T>, ? extends Observable<U>> selector\r\n\t) {\r\n\t\treturn replay(source, selector, 1);\r\n\t}", "public static void test001()\r\n {\r\n System.out.println(\"RxJavaTest04::test001\");\r\n Observable<String> peopleStream = myListPeople();\r\n Single<List<String>> peopleList = peopleStream.toList();\r\n List<String> people = peopleList.blockingGet();\r\n for (String person : people) {\r\n System.out.println(person);\r\n }\r\n }", "ObservableList<Link> getUnfilteredLinkList();", "public void flatMap() {\r\n\t\tList<Integer> list = Arrays.asList(1, 2, 3, 7, 8, 9, 10);\r\n\t\tList<Integer> list2 = Arrays.asList(4, 5, 6);\r\n\t\tObservable.just(list, list2).flatMap(x -> Observable.from(x)).map(x -> x * 10).subscribe(integerSubscribe());\r\n\t}", "protected void discard() {\r\n discarded = true;\r\n onDiscard();\r\n }", "public void metodoSkip() {\n List<Dish> dishes = menu.stream()\n .filter(d -> d.getCalories() > 300)\n .skip(2)\n .collect(toList());\n\n List<Dish> dishes1 =\n menu.stream()\n .filter(dish -> dish.getType() == (Dish.Type.MEAT))\n .limit(2)\n .collect(toList());\n }", "private static void mergingSyncMadeAsync() {\n Observable.merge(getDataSync(1).subscribeOn(Schedulers.io()), getDataSync(2).subscribeOn(Schedulers.io())).blockingForEach(System.out::println);\n }", "@Override\n\t\t\t\t\tpublic void onSubscribe(Disposable p1) {\n\t\t\t\t\t}", "@Test\n public void async_2() throws InterruptedException {\n Func1<Integer, Observable<String>> wsKald = param -> Observable.<String>create(s -> {\n s.onStart();\n s.onNext(\"called with \" + param);\n s.onCompleted();\n }).subscribeOn(Schedulers.io());\n\n Func1<Long, Observable<Integer>> multi = param -> Observable.<Integer>create(s -> {\n s.onStart();\n IntStream.range(1, param.intValue()).forEach(s::onNext);\n s.onCompleted();\n }).subscribeOn(Schedulers.io());\n\n // asynkron tæller, hvert ½ sekund\n Observable<Long> ticker = Observable.interval(500, TimeUnit.MILLISECONDS);\n\n ticker.take(10)\n .flatMap(multi)\n .flatMap(wsKald)\n .toBlocking()\n .subscribe(log::info);\n }", "private static void createObservableUsingEmpty() {\n Observable<?> observable = Observable.empty();\n\n observable.subscribe(x -> LOG.info(\"{}\", x), error -> LOG.info(\"Error 1: {}\", error.hashCode()));\n observable.subscribe(x -> LOG.info(\"{}\", x),\n error -> LOG.info(\"{}\", error.getLocalizedMessage()),\n () -> LOG.info(\"Completed\"));\n }", "public void drain() {\n int missed;\n if (getAndIncrement() == 0) {\n SpscLinkedArrayQueue<Object> q = this.queue;\n Subscriber<? super R> a = this.actual;\n int missed2 = 1;\n while (this.cancelled == 0) {\n if (this.error.get() != null) {\n q.clear();\n cancelAll();\n errorAll(a);\n return;\n }\n boolean d = this.active.get() == 0;\n Integer mode = (Integer) q.poll();\n boolean empty = mode == null;\n if (d && empty) {\n this.lefts.clear();\n this.rights.clear();\n this.disposables.dispose();\n a.onComplete();\n return;\n } else if (empty) {\n missed2 = addAndGet(-missed2);\n if (missed2 == 0) {\n return;\n }\n } else {\n TRight val = q.poll();\n if (mode == LEFT_VALUE) {\n TRight tright = val;\n int i = this.leftIndex;\n this.leftIndex = i + 1;\n int idx = i;\n this.lefts.put(Integer.valueOf(idx), tright);\n try {\n Publisher publisher = (Publisher) ObjectHelper.requireNonNull(this.leftEnd.apply(tright), \"The leftEnd returned a null Publisher\");\n TRight right = new FlowableGroupJoin.LeftRightEndSubscriber(this, true, idx);\n this.disposables.add(right);\n publisher.subscribe(right);\n Throwable ex = this.error.get();\n if (ex != null) {\n q.clear();\n cancelAll();\n errorAll(a);\n return;\n }\n long r = this.requested.get();\n Iterator<TRight> it = this.rights.values().iterator();\n missed = missed2;\n Throwable th = ex;\n long e = 0;\n while (it.hasNext()) {\n TRight end = right;\n Iterator<TRight> it2 = it;\n try {\n R w = ObjectHelper.requireNonNull(this.resultSelector.apply(tright, it.next()), \"The resultSelector returned a null value\");\n if (e != r) {\n a.onNext(w);\n e++;\n right = end;\n it = it2;\n } else {\n R r2 = w;\n ExceptionHelper.addThrowable(this.error, new MissingBackpressureException(\"Could not emit value due to lack of requests\"));\n q.clear();\n cancelAll();\n errorAll(a);\n return;\n }\n } catch (Throwable exc) {\n fail(exc, a, q);\n return;\n }\n }\n TRight end2 = right;\n if (e != 0) {\n BackpressureHelper.produced(this.requested, e);\n }\n } catch (Throwable exc2) {\n int i2 = missed2;\n fail(exc2, a, q);\n return;\n }\n } else {\n missed = missed2;\n if (mode == RIGHT_VALUE) {\n TRight right2 = val;\n int i3 = this.rightIndex;\n this.rightIndex = i3 + 1;\n int idx2 = i3;\n this.rights.put(Integer.valueOf(idx2), right2);\n try {\n Publisher publisher2 = (Publisher) ObjectHelper.requireNonNull(this.rightEnd.apply(right2), \"The rightEnd returned a null Publisher\");\n FlowableGroupJoin.LeftRightEndSubscriber end3 = new FlowableGroupJoin.LeftRightEndSubscriber(this, false, idx2);\n this.disposables.add(end3);\n publisher2.subscribe(end3);\n Throwable ex2 = this.error.get();\n if (ex2 != null) {\n q.clear();\n cancelAll();\n errorAll(a);\n return;\n }\n long r3 = this.requested.get();\n Iterator<TLeft> it3 = this.lefts.values().iterator();\n Throwable th2 = ex2;\n FlowableGroupJoin.LeftRightEndSubscriber leftRightEndSubscriber = end3;\n long e2 = 0;\n while (it3.hasNext()) {\n int idx3 = idx2;\n Iterator<TLeft> it4 = it3;\n try {\n R w2 = ObjectHelper.requireNonNull(this.resultSelector.apply(it3.next(), right2), \"The resultSelector returned a null value\");\n if (e2 != r3) {\n a.onNext(w2);\n e2++;\n idx2 = idx3;\n it3 = it4;\n } else {\n R r4 = w2;\n ExceptionHelper.addThrowable(this.error, new MissingBackpressureException(\"Could not emit value due to lack of requests\"));\n q.clear();\n cancelAll();\n errorAll(a);\n return;\n }\n } catch (Throwable exc3) {\n fail(exc3, a, q);\n return;\n }\n }\n if (e2 != 0) {\n BackpressureHelper.produced(this.requested, e2);\n }\n } catch (Throwable exc4) {\n int i4 = idx2;\n fail(exc4, a, q);\n return;\n }\n } else if (mode == LEFT_CLOSE) {\n FlowableGroupJoin.LeftRightEndSubscriber end4 = (FlowableGroupJoin.LeftRightEndSubscriber) val;\n this.lefts.remove(Integer.valueOf(end4.index));\n this.disposables.remove(end4);\n } else if (mode == RIGHT_CLOSE) {\n FlowableGroupJoin.LeftRightEndSubscriber end5 = (FlowableGroupJoin.LeftRightEndSubscriber) val;\n this.rights.remove(Integer.valueOf(end5.index));\n this.disposables.remove(end5);\n }\n }\n missed2 = missed;\n }\n }\n q.clear();\n }\n }", "public void observableDefer() {\r\n\t\tPerson person = new Person();\r\n\t\tObservable<String> nameOfPerson = Observable.defer(() -> Observable.just(person.getName()));\r\n\t\tObservable<Integer> ageOfPerson = Observable.defer(new Func0<Observable<Integer>>() {\r\n\r\n\t\t\t@Override\r\n\t\t\tpublic Observable<Integer> call() {\r\n\t\t\t\treturn Observable.just(person.getAge());\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\tperson.setAge(35);\r\n\t\tperson.setName(\"Bob\");\r\n\r\n\t\tsubscribe(nameOfPerson, ageOfPerson);\r\n\r\n\t}", "private static void fluxConnectToSecondSubscriberUsingCache() throws InterruptedException {\n Flux<Long> startTheExecutionFlux = Flux.interval(Duration.ofSeconds(1)).share().cache();\n\n //segue o mesmo processo de criacao de numeros do anterior mas agora utiliza cache\n Flux FluxOne = Flux.from(startTheExecutionFlux);\n Disposable disposable = FluxOne.subscribe(out -> System.out.println(\"FluxOne value: \" + out));\n new CountDownLatch(1).await(5, TimeUnit.SECONDS);\n\n Flux fluxTwo = startTheExecutionFlux.share();\n Disposable secondDisposable = fluxTwo.subscribe(out -> System.out.println(\"fluxTwo value: \" + out));\n new CountDownLatch(1).await(5, TimeUnit.SECONDS);\n//na primeira excecuao do fluxtwo ele inicialmente irá retornanr o valor anterior (em cache)\n disposable.dispose();\n secondDisposable.dispose();\n }", "@Test\n public void discardPlayer2() {\n gm.setPlayerInfo(clientPlayer2);\n gm.setThisPlayerIndex(clientPlayer2.getPlayerIndex());\n\n dc.increaseAmount(ResourceType.ORE);\n dc.increaseAmount(ResourceType.ORE);\n dc.increaseAmount(ResourceType.WOOD);\n dc.increaseAmount(ResourceType.WOOD);\n assertEquals(2, getAmounts().getOfType(ResourceType.ORE));\n assertEquals(2, getAmounts().getOfType(ResourceType.WOOD));\n Player p = model.getPlayer(clientPlayer2.getPlayerIndex());\n ResourceSet discardSet = dc.getDiscardAmount();\n when(robberFacade.canDiscard(discardSet, p)).thenReturn(true);\n dc.discard();\n // This verifies that the robberFacade.discard is only called twice\n verify(robberFacade, atMost(2)).discard(discardSet, p);\n\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> concat(\r\n\t\t\t@Nonnull Observable<? extends T> first,\r\n\t\t\t@Nonnull Observable<? extends T> second) {\r\n\t\tList<Observable<? extends T>> list = new ArrayList<Observable<? extends T>>();\r\n\t\tlist.add(first);\r\n\t\tlist.add(second);\r\n\t\treturn concat(list);\r\n\t}", "private void handleEarlySubscribeReceived()\n {\n for(Jid from : earlySubscriptions.keySet())\n {\n handleSubscribeReceived(from, earlySubscriptions.get(from));\n }\n\n earlySubscriptions.clear();\n }", "public static void main(String[] args) throws Exception {\n\t\tFlowable<String> obs4 = Flowable.just(\"un\", \"deux\", \"trois\", \"quatre\", \"sank\", \"six\", \"sept\", \"huit\", \"neuf\", \"deese\");\n//\t\tobs4.map(mapper -> {\n//\t\t\tif (\"deux\".equals(mapper))\n//\t\t\t\tThread.sleep(2000);\n//\t\t\treturn mapper+\" -- \"+Thread.currentThread().getName();\n//\t\t})\t\n//\t\t.subscribe(System.out::println);\n\t\t\n\t\tObserver<String> observer1 = new Observer<String>() {\n\n\t\t\t@Override\n\t\t\tpublic void onComplete() {\n\t\t\t\tSystem.out.println(\"Completed...\");\n\t\t\t\t\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onError(Throwable arg0) {\n\t\t\t\targ0.printStackTrace();\n\t\t\t\t\n\t\t\t}\n\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onSubscribe(Disposable arg0) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onNext(String arg0) {\n\t\t\t\tSystem.out.println(\"on next -- \"+arg0);\n\t\t\t\t\n\t\t\t}\n\t\t};\n\t\t\n\t\tList<String> list1 = Arrays.asList(\"un\",\"deux\",\"trois\",\"quatre\",\"sank\");\n\t\t\n\t\tObservable obs5 = Observable.fromIterable(list1);\n\t\t\n\t\t//obs5.subscribe(observer1);\n\t\t\n\t\t//Flowable.range(3, 10).subscribe(System.out::println);\n\t\t\n\t\tnew Thread(\n\t\t()->{\n\t\t\tobs4\n\t\t\t.map(mapper ->{\n\t\t\t\tif (\"deux\".equals(mapper) || \"quatre\".equals(mapper))\n\t\t\t\t\tThread.sleep(2000);\n\t\t\t\treturn mapper+\" -- \"+Thread.currentThread().getName();\n\t\t\t})\n\t\t\t.subscribe(System.out::println);\n\t\t\t\n\t\t}).start();\n\t\t\n//\t\tnew Thread() {\n//\t\t\tpublic void run() {\n//\t\t\t\tobs4\n//\t\t\t\t\t.map(mapper ->{\n//\t\t\t\t\t\tif (\"deux\".equals(mapper) || \"quatre\".equals(mapper))\n//\t\t\t\t\t\t\tThread.sleep(2000);\n//\t\t\t\t\t\treturn mapper+\" -- \"+Thread.currentThread().getName();\n//\t\t\t\t\t})\n//\t\t\t\t\t.subscribe(System.out::println);\n//\t\t\t}\n//\t\t}.start();\n\t\t\n//\t\tExecutor exe = Executors.newCachedThreadPool();\n//\t\t\n//\t\texe.execute(()->{\n//\t\t\t\n//\t\t\tobs4\n//\t\t\t.map(mapper ->{\n//\t\t\t\tif (\"deux\".equals(mapper) || \"quatre\".equals(mapper))\n//\t\t\t\t\tThread.sleep(2000);\n//\t\t\t\treturn mapper+\" -- \"+Thread.currentThread().getName();\n//\t\t\t})\n//\t\t\t.subscribe(System.out::println);\n\t\t\t\n//\t\t\tobs4.subscribe();\n//\t\t\tFlowable.zip(obs4, Flowable.interval(2, TimeUnit.SECONDS),(k,v)->k)\n//\t\t\t.subscribe((data)->{\n//\t\t\t\tSystem.out.println(\" \"+data+\" -- \"+Thread.currentThread().getName());\n//\t\t\t});\n//\t\t\tFlowable.interval(1, TimeUnit.SECONDS)\n//\t\t\t.map(mapper -> {\n//\t\t\t\tif (mapper == 3)\n//\t\t\t\t\tthrow new Exception(\" Time is Over !!! \");\n//\t\t\t\treturn mapper;\n//\t\t\t})\n//\t\t\t.subscribe((data)->{\n//\t\t\t\tSystem.out.println(data +\" -- \"+Thread.currentThread().getName());\n//\t\t\t},(e)->{\n//\t\t\t\te.printStackTrace();\n//\t\t\t});\n\t\t\t\n\t\t//});\n\t\t\n//\t\t//Thread.sleep(5000);\t\n//\t\tFlowable<String> flw1 = Flowable.just(\"un\",\"deux\",\"trois\",\"quatre\",\"sank\",\"six\",\"sept\");\n//\t\tflw1\n//\t\t//.subscribeOn(Schedulers.from(Executors.newFixedThreadPool(4)))\n//\t\t.map(mapper ->{\n//\t\t\tif (\"deux\".equals(mapper))\n//\t\t\t\tThread.sleep(1000);\n//\t\t\tif (\"quatre\".equals(mapper))\n//\t\t\t\tThread.sleep(500);\n//\t\t\treturn mapper +\" -- \"+Thread.currentThread().getName();\n//\t\t})\n//\t\t.subscribe(System.out::println);\n//\t\t\n//\t\tThread.sleep(2000);\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> merge(\r\n\t\t\t@Nonnull final Iterable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\tfinal CompositeCloseable closeables = new CompositeCloseable();\r\n\t\t\t\t\r\n\t\t\t\tList<Observable<? extends T>> sourcesList = new ArrayList<Observable<? extends T>>();\r\n\t\t\t\tfor (Observable<? extends T> os : sources) {\r\n\t\t\t\t\tsourcesList.add(os);\r\n\t\t\t\t}\r\n\t\t\t\tfinal AtomicInteger wip = new AtomicInteger(sourcesList.size() + 1);\r\n\t\t\t\tfinal List<DefaultObserverEx<T>> observers = new ArrayList<DefaultObserverEx<T>>();\r\n\t\t\t\tfinal Lock lock = new ReentrantLock();\r\n\t\t\t\tfor (int i = 0; i < sourcesList.size(); i++) {\r\n\t\t\t\t\tfinal int j = i;\r\n\t\t\t\t\tDefaultObserverEx<T> obs = new DefaultObserverEx<T>(lock, true) {\r\n\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\tpublic void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t\t\tfor (int k = 0; k < observers.size(); k++) {\r\n\t\t\t\t\t\t\t\tif (k != j) {\r\n\t\t\t\t\t\t\t\t\tobservers.get(k).close();\r\n\t\t\t\t\t\t\t\t}\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\t@Override\r\n\t\t\t\t\t\tpublic void onFinish() {\r\n\t\t\t\t\t\t\tif (wip.decrementAndGet() == 0) {\r\n\t\t\t\t\t\t\t\tobserver.finish();\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\t@Override\r\n\t\t\t\t\t\tpublic void onNext(T value) {\r\n\t\t\t\t\t\t\tobserver.next(value);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t};\r\n\t\t\t\t\tobservers.add(obs);\r\n\t\t\t\t\tcloseables.add(obs);\r\n\t\t\t\t}\r\n\t\t\t\tfor (int i = 0; i < observers.size(); i++) {\r\n\t\t\t\t\tDefaultObserverEx<T> obs = observers.get(i);\r\n\t\t\t\t\tObservable<? extends T> ov = sourcesList.get(i);\r\n\t\t\t\t\tobs.registerWith(ov);\r\n\t\t\t\t}\r\n\t\t\t\tif (wip.decrementAndGet() == 0) {\r\n\t\t\t\t\tobserver.finish();\r\n\t\t\t\t}\r\n\t\t\t\treturn closeables;\r\n\t\t\t}\r\n\t\t};\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> never() {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull Observer<? super T> observer) {\r\n\t\t\t\treturn Closeables.emptyCloseable();\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public static Observable<String> getObservableDistinct() {\n return observableSrcDuplicated;//todo\n }", "public static void generateStateless() {\n Observable<String> myObservable = Observable.generate((emitter -> {\n System.out.println(\"got emitter = \" + emitter);\n try {\n emitter.onNext(\"generate - 1\");\n emitter.onNext(\"generate - 2 \");\n emitter.onComplete();\n } catch (Exception e) {\n emitter.onError(e);\n }\n }));\n myObservable.subscribe(genericObserver1);\n }", "public void testDrainToN() {\n final SynchronousQueue q = new SynchronousQueue();\n Thread t1 = new Thread(new Runnable() {\n public void run() {\n try {\n q.put(one);\n } catch (InterruptedException ie){\n threadUnexpectedException();\n }\n }\n });\n Thread t2 = new Thread(new Runnable() {\n public void run() {\n try {\n q.put(two);\n } catch (InterruptedException ie){\n threadUnexpectedException();\n }\n }\n });\n\n try {\n t1.start();\n t2.start();\n ArrayList l = new ArrayList();\n Thread.sleep(SHORT_DELAY_MS);\n q.drainTo(l, 1);\n assertTrue(l.size() == 1);\n q.drainTo(l, 1);\n assertTrue(l.size() == 2);\n assertTrue(l.contains(one));\n assertTrue(l.contains(two));\n t1.join();\n t2.join();\n } catch(Exception e){\n unexpectedException();\n }\n }", "void filterDisposed(Filter filter);", "@Nonnull\r\n\tpublic static <T> Observable<T> skip(\r\n\t\t\t@Nonnull Observable<? extends T> source,\r\n\t\t\tlong time,\r\n\t\t\t@Nonnull TimeUnit unit\r\n\t\t\t) {\r\n\t\treturn skip(source, time, unit, scheduler());\r\n\t}", "private ObservableOnSubscribe<Object> receiveLoop() {\n return emitter -> {\n Message message;\n try {\n while ( ( message = consumer.receive( jmsDelegate.receiveTimeout ) ) != null ) {\n streamStep.logDebug( message.toString() );\n emitter.onNext( message.getBody( Object.class ) );\n }\n } catch ( JMSRuntimeException jmsException ) {\n emitter.onError( jmsException );\n }\n emitter.onComplete();\n };\n }", "private void test1() {\n Observable observable = Observable.create(new ObservableOnSubscribe<QuoteBean>() {\n @Override\n public void subscribe(ObservableEmitter<QuoteBean> e) throws Exception {\n e.onNext(Request.stringRequest(url, com.android.volley.Request.Method.GET, HomeActivity.class.getSimpleName()));\n }\n }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());\n\n Observer<QuoteBean> observer = new Observer<QuoteBean>() {\n @Override\n public void onSubscribe(Disposable d) {\n Log.d(TAG, \"test1 onSubscribe\");\n }\n\n @Override\n public void onNext(QuoteBean s) {\n Log.d(TAG, \"onNext:\" + s.toString());\n }\n\n @Override\n public void onError(Throwable e) {\n Log.d(TAG, \"onError\");\n }\n\n @Override\n public void onComplete() {\n Log.d(TAG, \"onComplete\");\n }\n };\n observable.subscribe(observer);\n }", "public static void test017()\r\n {\r\n System.out.println(\"RxJavaTest04::test017\");\r\n ExecutorService poolA = Executors.newFixedThreadPool(10, newThreadFactory(\"Sched-A-%d\"));\r\n Scheduler schedulerA = Schedulers.from(poolA);\r\n RxGroceries store = new RxGroceries();\r\n\r\n Maybe<BigDecimal> totalPrice = Observable\r\n .just(\"bread\", \"butter\", \"egg\", \"milk\", \"tomato\",\r\n \"cheese\", \"tomato\", \"egg\", \"egg\")\r\n .groupBy(prod -> prod)\r\n .flatMapSingle(grouped -> grouped\r\n .count()\r\n .map(quantity -> {\r\n String productName = grouped.getKey();\r\n return Pair.of(productName, quantity);\r\n })\r\n )\r\n .flatMap(order -> store\r\n .purchase(order.getLeft(), (int)order.getRight().longValue())\r\n .subscribeOn(schedulerA)\r\n )\r\n .reduce(BigDecimal::add);\r\n\r\n totalPrice\r\n .subscribe(System.out::println);\r\n myWait(2000);\r\n poolA.shutdown();\r\n }", "public void concatMap() {\r\n\t\tList<Integer> list1 = Arrays.asList(1, 2, 3, 7, 8, 9, 10);\r\n\t\tList<Integer> list2 = Arrays.asList(4, 5, 6);\r\n\t\tObservable.just(list1, list2).concatMap(x -> Observable.from(x)).map(x -> x * 10).subscribe(integerSubscribe());\r\n\t}", "public void skip() {\t\n\t\tif(nItems < 2) {\n\t\t\treturn;\n\t\t}\n\t\tCustomer temp = new Customer(queArray[front].getName(), queArray[front].getPartySize());\n\t\tqueArray[front] = queArray[front+1];\n\t\tqueArray[front+1] = temp;\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> merge(\r\n\t\t\t@Nonnull Observable<? extends T> first,\r\n\t\t\t@Nonnull Observable<? extends T> second) {\r\n\t\tList<Observable<? extends T>> list = new ArrayList<Observable<? extends T>>();\r\n\t\tlist.add(first);\r\n\t\tlist.add(second);\r\n\t\treturn merge(list);\r\n\t}", "@Override\n public void rxUnsubscribe() {\n if (placesSubscriber != null) {\n if (!placesSubscriber.isDisposed()) {\n placesSubscriber.dispose();\n }\n }\n }", "private void clearTasks(){\n ArrayList<Item> iteratorList = new ArrayList<Item>(items);\n Iterator<Item> it = iteratorList.iterator();\n while(it.hasNext()){\n Item i = it.next();\n if (!i.isCategory()){\n Task t = (Task) i;\n if(t.finished){\n \tDirectIO.RemoveItem(t);\n adapter.remove(i);\n }\n }\n }\n }", "public void giveOutCards() {\n boolean shared = false;\n while (!shared) {\n for (Player player : this.players) {\n if (this.cards.size() == 0) {\n shared = true;\n } else {\n Card card = this.cards.get(0);\n this.cards.remove(0);\n if (!envelope.has(card)) {\n player.addCard(card);\n }\n }\n }\n }\n }" ]
[ "0.6290674", "0.62014323", "0.6032369", "0.59008205", "0.58547723", "0.5716806", "0.563486", "0.5629971", "0.5576547", "0.554626", "0.5405824", "0.5399403", "0.5393011", "0.5377472", "0.53704494", "0.5330305", "0.53146935", "0.5299518", "0.5287627", "0.52634937", "0.5243095", "0.5240368", "0.52188164", "0.52139765", "0.51653606", "0.5159819", "0.51519614", "0.51460177", "0.51412517", "0.5138408", "0.51174307", "0.5113073", "0.5101947", "0.50745106", "0.506757", "0.5042733", "0.5036648", "0.5036175", "0.5015551", "0.5005049", "0.5004669", "0.5002176", "0.5001718", "0.4973642", "0.49490413", "0.48871267", "0.48827815", "0.48794013", "0.48787946", "0.48655623", "0.48651809", "0.48390663", "0.48324472", "0.4829458", "0.48133066", "0.48112813", "0.48087302", "0.4806455", "0.4788815", "0.47863248", "0.4776746", "0.47705123", "0.47696668", "0.47694296", "0.47531137", "0.47464618", "0.47430012", "0.4735811", "0.47233966", "0.47229892", "0.47160372", "0.47133482", "0.46949735", "0.4690556", "0.46745816", "0.46736404", "0.4668554", "0.46657756", "0.46336964", "0.4624934", "0.46203282", "0.46182162", "0.46126887", "0.46093285", "0.46037814", "0.460287", "0.46027222", "0.45945257", "0.45927265", "0.45907873", "0.4586393", "0.45838702", "0.45751032", "0.45745343", "0.45606518", "0.45424715", "0.4541421", "0.45399946", "0.45314163", "0.4530644" ]
0.6599678
0
discard items emitted by an Observable until a specified condition becomes false
@Test public void skipWhile() { Observable.interval(100, TimeUnit.SECONDS, mTestScheduler) .map(num -> num + 1) .take(7) .skipWhile(aLong -> aLong != 4) .subscribe(mList::add); mTestScheduler.advanceTimeBy(1000, TimeUnit.SECONDS); assertEquals(mList, Arrays.asList(4L, 5L, 6L, 7L)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void skipWhile() {\n Observable.fromIterable(sData)\n .skipWhile((item) -> {\n System.out.println(\"item = \" + item);\n return item.equalsIgnoreCase(\"abc\");\n }).subscribe(new MyObserver<>());\n }", "@Test\n public void skipUntil() {\n\n Observable<Long> o1 = Observable.interval(100, TimeUnit.SECONDS, mTestScheduler)\n .map(num -> num + 1)\n .take(9);\n\n Observable<Integer> o2 = Observable.just(0, 0)\n .delay(550, TimeUnit.SECONDS, mTestScheduler);\n\n o1.skipUntil(o2)\n .subscribe(mList::add);\n\n mTestScheduler.advanceTimeBy(2000, TimeUnit.SECONDS);\n assertEquals(mList, Arrays.asList(6L, 7L, 8L, 9L));\n }", "@Test\n public void takeUntil() {\n Observable.just(1, 2, 3, 4)\n .takeUntil(integer -> integer > 2)\n .subscribe(mList::add);\n assertEquals(mList, Arrays.asList(1, 2, 3));\n\n mList.clear();\n Observable.just(1, 2, 3, 4)\n .takeUntil(integer -> integer < 10)\n .subscribe(mList::add);\n assertEquals(mList, Collections.singletonList(1));\n }", "public static void ignoreElements() {\n Observable.fromIterable(Utils.getData())\n .ignoreElements()\n .subscribe(new MyCompletableObserver());\n }", "@Test\n public void takeWhile() {\n Observable.interval(100, TimeUnit.SECONDS, mTestScheduler)\n .map(num -> num + 1)\n .take(7)\n .takeWhile(aLong -> aLong != 4)\n .subscribe(mList::add);\n\n mTestScheduler.advanceTimeBy(1000, TimeUnit.SECONDS);\n assertEquals(mList, Arrays.asList(1L, 2L, 3L));\n }", "public static void never() {\n Observable<String> myObservable = Observable.never();\n myObservable.subscribe(genericObserver1);\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> relayUntil(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func0<Boolean> condition) {\r\n\t\treturn relayWhile(source, Functions.not(condition));\r\n\t}", "public static Observable<String> getObservableSkipWhileElement() {\n return observableSrc;//todo\n }", "private static void createObservableUsingNever() {\n Observable<?> observable = Observable.never();\n\n observable.subscribe(x -> LOG.info(\"{}\", x),\n error -> LOG.info(\"{}\", error.getLocalizedMessage()),\n () -> LOG.info(\"Completed\"));\n\n // Pause the main thread for the hope that it will print something\n sleep(3000);\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> relayWhile(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func0<Boolean> condition) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\tDefaultObserverEx<T> obs = new DefaultObserverEx<T>(true) {\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\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 onFinish() {\r\n\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\tclose();\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 onNext(T value) {\r\n\t\t\t\t\t\tif (condition.invoke()) {\r\n\t\t\t\t\t\t\tobserver.next(value);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tfinish();\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\t\t\t\treturn obs.registerWith(source);\r\n\t\t\t}\r\n\t\t};\r\n\t}", "private static void exSwitchMapTwo() {\n\n Observable.interval(5,TimeUnit.SECONDS)\n .switchMap(call -> Observable.just(getResponse()).doOnDispose(() -> System.out.println(\"Disposed\")))\n .subscribe(System.out::println);\n\n //An Observable which performs network call.\n sleep(40000);\n\n\n /* OUTPUT :\n 6\n 10\n 13\n 17\n 26\n 32\n 35\n 42\n\n */\n }", "public static <T> Observable<T> whileDo(\r\n\t\t\t@Nonnull final Observable<? extends T> source, \r\n\t\t\t@Nonnull final Func0<Boolean> condition) {\r\n\t\treturn new Repeat.WhileDo<T>(source, condition);\r\n\t}", "@Nonnull \r\n\tpublic static <T> Observable<T> doWhile(\r\n\t\t\t@Nonnull final Observable<? extends T> source, \r\n\t\t\t@Nonnull final Func0<Boolean> condition) {\r\n\t\treturn new Repeat.DoWhile<T>(source, condition);\r\n\t}", "public static Observable<String> getObservableSkipElement() {\n return observableSrc;//todo\n }", "@BackpressureSupport(BackpressureKind.FULL)\n @SchedulerSupport(SchedulerKind.CUSTOM)\n public final Observable<T> skip(long time, TimeUnit unit, Scheduler scheduler) {\n return skipUntil(timer(time, unit, scheduler));\n }", "private static void createColdObservable() {\n var observable = Observable.just(1, 2, 3, 4, 5);\n\n observable.subscribe(item -> LOG.info(\"Observer 1: {}\", item));\n\n pause(1000);\n\n observable.subscribe(item -> LOG.info(\"Observer 2: {}\", item));\n }", "protected void discard() {\r\n discarded = true;\r\n onDiscard();\r\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> takeWhile(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func1<? super T, Boolean> predicate) {\r\n\t\treturn new Take.While<T>(source, predicate);\r\n\t}", "ObservableList<Task> getUnfilteredTaskList();", "void filterDisposed(Filter filter);", "@Nonnull\r\n\tpublic static <T, U> Observable<T> skipUntil(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Observable<U> signaller) {\r\n\t\treturn new Skip.Until<T, U>(source, signaller);\r\n\t}", "@Nonnull \r\n\tpublic static <T, U> Observable<U> prune(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func1<? super Observable<? extends T>, ? extends Observable<U>> selector\r\n\t) {\r\n\t\treturn replay(source, selector, 1);\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> never() {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull Observer<? super T> observer) {\r\n\t\t\t\treturn Closeables.emptyCloseable();\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public static Observable<Long> getObservableTakeWhile() {\n return observableIntervalSrc;//todo\n }", "@Override\n public void subscribe(ObservableEmitter<Integer> e) throws Exception {\n\n e.onNext(1);\n SystemClock.sleep(1000);\n e.onNext(2);\n SystemClock.sleep(1000);\n e.onNext(3);\n SystemClock.sleep(1000);\n e.onNext(4);\n\n //Once the Observable has emitted all items in the sequence, call onComplete//\n e.onComplete();\n //e.onError(new Throwable(\"Some Error!!\"));\n }", "ObservableList<Deliverable> getFilteredDeliverableList();", "public void emitLoop() {\n Subscriber<? super R> subscriber = this.child;\n Queue<Object> queue2 = this.queue;\n AtomicLong atomicLong = this.requested;\n long j = atomicLong.get();\n while (!checkTerminated(this.done, queue2.isEmpty(), subscriber)) {\n long j2 = 0;\n while (j2 != j) {\n boolean z = this.done;\n Object poll = queue2.poll();\n boolean z2 = poll == null;\n if (!checkTerminated(z, z2, subscriber)) {\n if (z2) {\n break;\n }\n Object value = NotificationLite.getValue(poll);\n try {\n subscriber.onNext(value);\n j2++;\n } catch (Throwable th) {\n Exceptions.throwOrReport(th, (Observer<?>) subscriber, value);\n return;\n }\n } else {\n return;\n }\n }\n if (!(j2 == 0 || j == Long.MAX_VALUE)) {\n j = BackpressureUtils.produced(atomicLong, j2);\n }\n synchronized (this) {\n if (!this.missed) {\n this.emitting = false;\n return;\n }\n this.missed = false;\n }\n }\n }", "@Nonnull \r\n\tpublic static <T> Observable<T> prune(\r\n\t\t\tfinal Observable<? extends T> source\r\n\t) {\r\n\t\treturn replay(source, 1);\r\n\t}", "public static void just() {\n Observable<List<String>> myObservable = Observable.just(Utils.getData());\n myObservable.subscribe(consumerList);\n }", "@Test\r\n\tpublic void exerciseInterruptible() {\n\t\t\r\n\t\tList<String> articlesTopicA = Arrays.asList(\"Article A-1\",\"Article A-2\",\"Article A-3\");\r\n\t\tList<String> articlesTopicB = Arrays.asList(\"Article B-1\",\"Article B-2\",\"Article B-3\");\r\n\t\tList<String> articlesTopicC = Arrays.asList(\"Article C-1\",\"Article C-2\",\"Article C-3\");\r\n\t\t\r\n\t\tList<Observable<String>> topicObservables = Arrays.asList(\r\n\t\t\t\tObservable.interval(0, 80L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicA.get(i.intValue())),\r\n\t\t\t\tObservable.interval(50, 60L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicB.get(i.intValue())),\r\n\t\t\t\tObservable.interval(0, 40L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicC.get(i.intValue())));\r\n\t\t\r\n\t\tObservable<Observable<String>> topics = Observable.interval(0, 100L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> topicObservables.get(i.intValue()));\r\n\t\t\r\n\t\t//\t\t t[ms]: 0 100 200 300\r\n\t\t//\t\ttopics: A---------B---------C---------| \r\n\t\t//\t\t A: 1-------2-|-----3---|---------|\r\n\t\t//\t\t B: |---------|----1----|2-----3--|\r\n\t\t//\t\t C: |---------|---------1---2---3-|\r\n\t\t//\t\tResult: A-1 A-2 B-1 C-1 C-2 C-3\r\n\t\t\t\t\r\n\t\t// TODO: always switch to the latest topic\r\n\t\t// HINT: http://reactivex.io/documentation/operators/switch.html\r\n\t\tObservable<String> latestInteresting = Observable.empty();\r\n\r\n\t\t// verify\r\n\t\tTestSubscriber<String> testSubscriber = new TestSubscriber<>();\r\n\t\tlatestInteresting\r\n\t\t\t.doOnNext(article -> log(String.format(\" doOnNext(): %s Time: %d\", article, testScheduler.now())))\r\n\t\t\t.subscribe(testSubscriber);\r\n\t\t\r\n\t\t// let the time elapse until completion\r\n\t\ttestScheduler.advanceTimeBy(300, TimeUnit.MILLISECONDS);\r\n\t\t\r\n\t\ttestSubscriber.assertCompleted();\r\n\t\ttestSubscriber.assertNoErrors();\r\n\t\tList<String> expectedArticles = Arrays.asList(\r\n\t\t\t\t\"Article A-1\",\"Article A-2\", \r\n\t\t\t\t\"Article B-1\", \r\n\t\t\t\t\"Article C-1\", \"Article C-2\", \"Article C-3\");\r\n\t\ttestSubscriber.assertReceivedOnNext(expectedArticles);\r\n\t\t\r\n\t}", "private static void backPressureChallenge() {\n\t\tObservable.range(1, 1000000)\n\t\t//below map will run in sequential\n\t\t//since sequential it has to complete whole task then only it can allow consumer to start\n\t\t\t.map(item -> {\n\t\t\t\tSystem.out.println(\"Produced item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t\treturn item;\n\t\t\t})\n\t\t\t.observeOn(Schedulers.io())\n\t\t\t//.subscribeOn(Schedulers.io())//with this whole pipelein runs in seprate thread paralleley\n\t\t\t//below will run in concurrent\n\t\t\t.subscribe(item ->{\n\t\t\t\t//mimcing slowness\n\t\t\t\tThreadUtil.sleep(300);\n\t\t\t\tSystem.out.println(\"Consumed item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t})\n\t\t\t\n\t\t\t;\n\t\t\n\t\t//since running in async we need to sleep\n\t\tThreadUtil.sleep(10000000);\n\t}", "@Test\r\n public void testReplayRemoveSubjectConcurrentObservations() throws InterruptedException {\r\n\r\n final ReplayRemoveSubject<Long> replay = ReplayRemoveSubject.create();\r\n\r\n final int THREAD_COUNT = 20;\r\n final int START_SOURCE_AFTER_THREADS = 3;\r\n final int THREADS_TO_RECEIVE_ALL_BEFORE_REMOVE_STARTED = 5;\r\n final int AWAITER_1_THREAD_COUNT = 10;\r\n final int AWAITER_2_THREAD_COUNT = 12;\r\n final int AWAITER_3_THREAD_COUNT = 14;\r\n\r\n final CountDownLatch sourceAwaiterMain = new CountDownLatch(THREADS_TO_RECEIVE_ALL_BEFORE_REMOVE_STARTED);\r\n\r\n final CountDownLatch threadCreationAwaiter1 = new CountDownLatch(1);\r\n final CountDownLatch sourceAwaiter1 = new CountDownLatch(3);\r\n\r\n final CountDownLatch threadCreationAwaiter2 = new CountDownLatch(1);\r\n final CountDownLatch sourceAwaiter2 = new CountDownLatch(3);\r\n\r\n final CountDownLatch threadCreationAwaiter3 = new CountDownLatch(1);\r\n\r\n final List<Long> valuesToRemove = new ArrayList<>();\r\n valuesToRemove.add(1L);\r\n valuesToRemove.add(20L);\r\n valuesToRemove.add(300L);\r\n\r\n AtomicLong fullCounter = new AtomicLong();\r\n\r\n Thread source = new Thread(() -> {\r\n try {\r\n System.out.println(\"********* Start Source Data ***********\");\r\n for (long l = 1; l <= 10000; l++) {\r\n if (l % 100 == 0)\r\n System.out.println(\"Emitting \" + l);\r\n\r\n fullCounter.addAndGet(l);\r\n replay.onNext(l);\r\n\r\n // just random value, could be any:\r\n if (l == 567) {\r\n sourceAwaiterMain.await();\r\n\r\n replay.onRemove(valuesToRemove.get(0));\r\n threadCreationAwaiter1.countDown();\r\n sourceAwaiter1.await();\r\n\r\n replay.onRemove(valuesToRemove.get(1));\r\n threadCreationAwaiter2.countDown();\r\n sourceAwaiter2.await();\r\n\r\n replay.onRemove(valuesToRemove.get(2));\r\n threadCreationAwaiter3.countDown();\r\n }\r\n\r\n }\r\n System.out.println(\"********* Finished Source Data ***********\");\r\n replay.onComplete();\r\n\r\n } catch (Exception e) {\r\n fail(e.getMessage());\r\n }\r\n });\r\n\r\n // used to collect results of each thread\r\n final List<Pair<Long, List<Long>>> listOfListsOfValues = Collections.synchronizedList(new ArrayList<>());\r\n\r\n\r\n CountDownLatch countDownLatch = new CountDownLatch(THREAD_COUNT);\r\n\r\n for (int i = 1; i <= THREAD_COUNT; i++) {\r\n\r\n final int count = i;\r\n\r\n if (count == START_SOURCE_AFTER_THREADS) {\r\n // start source data after we have some already subscribed\r\n // and while others are in process of subscribing\r\n source.start();\r\n }\r\n\r\n if (count == AWAITER_1_THREAD_COUNT)\r\n threadCreationAwaiter1.await();\r\n\r\n if (count == AWAITER_2_THREAD_COUNT)\r\n threadCreationAwaiter2.await();\r\n\r\n if (count == AWAITER_3_THREAD_COUNT)\r\n threadCreationAwaiter3.await();\r\n\r\n try {\r\n AtomicLong phase = new AtomicLong();\r\n\r\n //noinspection ResultOfMethodCallIgnored\r\n replay\r\n .observeOn(Schedulers.newThread())\r\n .doOnNext(val -> {\r\n final int indexOfRemovable =\r\n valuesToRemove.indexOf(val);\r\n\r\n if (indexOfRemovable >= 0) {\r\n phase.addAndGet(val);\r\n }\r\n\r\n if (val.equals(300L))\r\n sourceAwaiterMain.countDown();\r\n\r\n if (count >= 10)\r\n sourceAwaiter1.countDown();\r\n\r\n if (count >= 12)\r\n sourceAwaiter2.countDown();\r\n\r\n\r\n })\r\n .toList()\r\n .subscribe(values -> {\r\n listOfListsOfValues.add(Pair.of(phase.get(), values));\r\n countDownLatch.countDown();\r\n System.out.println(\"Finished thread: \" + count);\r\n });\r\n } catch (Exception e) {\r\n fail(e.getMessage());\r\n }\r\n\r\n System.out.println(\"Started thread: \" + i);\r\n }\r\n\r\n countDownLatch.await();\r\n\r\n listOfListsOfValues.stream().map(Pair::getLeft).collect(Collectors.toSet()).\r\n forEach(System.out::println);\r\n\r\n long maxRemoved = valuesToRemove.stream().reduce(0L, Long::sum);\r\n\r\n // assert all threads got the same results\r\n Map<Long, Long> sums = new HashMap<>();\r\n for (Pair<Long, List<Long>> pair : listOfListsOfValues) {\r\n long v = 0;\r\n for (long l : pair.getRight()) {\r\n v += l;\r\n }\r\n\r\n long phase = pair.getKey();\r\n assertEquals(fullCounter.get() - (maxRemoved - phase), v);\r\n\r\n sums.put(pair.getLeft(), v);\r\n }\r\n\r\n assertEquals(valuesToRemove.size() + 1, sums.size());\r\n Long phaseAcc = 0L;\r\n for (int i = valuesToRemove.size() - 1; i >= 0; i--) {\r\n assertTrue(sums.containsKey(phaseAcc));\r\n phaseAcc += valuesToRemove.get(i);\r\n assertTrue(sums.containsKey(phaseAcc));\r\n }\r\n\r\n }", "protected void removeAlarmsIf(@NonNull Predicate<K> predicate) {\n boolean removed = false;\n synchronized (mLock) {\n Pair[] alarms = mAlarmPriorityQueue.toArray(new Pair[mAlarmPriorityQueue.size()]);\n for (int i = alarms.length - 1; i >= 0; --i) {\n final K key = (K) alarms[i].first;\n if (predicate.test(key)) {\n mAlarmPriorityQueue.remove(alarms[i]);\n removed = true;\n }\n }\n if (removed) {\n setNextAlarmLocked();\n }\n }\n }", "private static void exSwitchMapThree(){\n Observable<String> intense =\n Observable.just(\"Savi\",\"Healer\",\"Three\",\"Four\",\"Wednesday\",\"Friday\",\"You\",\"Me\")\n .concatMap(result -> Observable.just(result).delay(randomSleepTime(),TimeUnit.MILLISECONDS))\n .doOnDispose(() -> System.out.println(\" * * Disposed * *\"));\n\n //Observable to execute intense task every 5 seconds\n Observable.interval(5,TimeUnit.SECONDS)\n .switchMap(r -> intense)\n .subscribe(System.out::println);\n\n //Sleep the main thread for few seconds\n Take.sleep(20000);\n\n /*\n After every 5 seconds it will dispose the ongoing intense (variable name) process and\n start the same process again.\n */\n\n //Output\n /*\n Savi\n Healer\n Three\n Four\n * * Disposed * *\n Savi\n Healer\n Three\n Four\n Wednesday\n Friday\n You\n * * Disposed * *\n Savi\n Healer\n Three\n Four\n Wednesday\n * * Disposed * *\n */\n }", "public static void empty() {\n Observable<String> myObservable = Observable.empty();\n myObservable.subscribe(genericObserver1);\n }", "public static void debounce() {\n List<String> data = Utils.getData();\n\n System.out.println(\"# 1\");\n\n /*\n An item needs to be most recent for at least 1 microseconds to be considered for\n transmission.\n */\n Observable.fromIterable(data)\n .debounce(1, TimeUnit.MICROSECONDS)\n .subscribe(new MyObserver<>());\n\n System.out.println(\"# 2\");\n\n /*\n Item \"def\" is being intentionally delayed, so it will not most recent and \"ghi\" will\n emitted before it, Hence \"def\" will not be emitted.\n */\n Observable.fromIterable(data)\n .debounce((item) -> {\n if (item.equalsIgnoreCase(\"def\")) {\n return Observable.just(item).delay(1000L, TimeUnit.MICROSECONDS);\n } else {\n return Observable.just(item);\n }\n }).subscribe(new MyObserver<>());\n }", "public static Observable<String> getObservableSkipLastElement() {\n return observableSrc;//todo\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> takeWhile(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func2<? super T, ? super Integer, Boolean> predicate) {\r\n\t\treturn new Take.WhileIndexed<T>(source, predicate);\r\n\t}", "boolean doFilter() { return false; }", "@Test\n public void all() {\n Observable.just(1, 2, 3, 4, 5)\n .doOnNext(System.out::println)\n .all(x -> x < 10)\n .subscribe(mList::add);\n assertEquals(mList, Collections.singletonList(true));\n }", "private void assertNotConsumed() {\n if (this.consumed) {\n throw new IllegalStateException(\"Response content has been already consumed\");\n }\n }", "@BackpressureSupport(BackpressureKind.ERROR)\n @SchedulerSupport(SchedulerKind.NONE)\n public final <B> Observable<List<T>> buffer(Publisher<B> boundary) {\n return buffer(boundary, new Supplier<List<T>>() {\n @Override\n public List<T> get() {\n return new ArrayList<T>();\n }\n });\n }", "public Observable<DownloadType> notSupportHead(final String url)\r\n throws IOException {\r\n\r\n return mDownloadApi\r\n .GET_withIfRange(TEST_RANGE_SUPPORT, readLastModify(url), url)\r\n .map(new Function<Response<Void>, DownloadType>() {\r\n @Override\r\n public DownloadType apply(Response<Void> response)\r\n throws Exception {\r\n if (serverFileNotChange(response)) {\r\n return getWhenServerFileNotChange(response, url);\r\n } else if (serverFileChanged(response)) {\r\n return getWhenServerFileChanged(response, url);\r\n } else {\r\n return typeFactory.unable();\r\n }\r\n }\r\n })\r\n .compose(Utils.<DownloadType>retry(MAX_RETRY_COUNT));\r\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> ifThen(\r\n\t\t\t@Nonnull final Func0<Boolean> condition,\r\n\t\t\t@Nonnull final Observable<? extends T> then) {\r\n\t\treturn ifThen(condition, then, Reactive.<T>empty());\r\n\t}", "private static void scenario() {\n\n Observable<String> stringObservable = Observable.just(\"One\",\"Two\",\"Three\",\"Four\",\"Five\",\"Six\",\"Seven\",\"Eight\",\"Nine\");\n\n Observable<String> stringProcessor = stringObservable.concatMap(data -> Observable.just(data).delay(randomSleepTime(),\n TimeUnit.MILLISECONDS));\n\n stringProcessor.subscribe(System.out::println);\n\n sleep(20000);\n\n /* OUTPUT :\n One\n Two\n Three\n Four\n Five\n Six\n Seven\n Eight\n Nine\n */\n }", "public static void main(String[] args){\n Observable myObservable = Observable.create(new Observable.OnSubscribe(){\n\n @Override\n public void call(Object subscriber) {\n Subscriber mySubscriber = (Subscriber)subscriber;\n\n for(int i = 0 ; i < 10; i++){\n //if my subscriber was subscribed\n if(!mySubscriber.isUnsubscribed()){\n mySubscriber.onNext(\"Pushed value \" + i);\n }\n }\n\n if(!mySubscriber.isUnsubscribed()){\n mySubscriber.onCompleted();\n }\n\n }\n });\n\n //subscribe to your Observable\n myObservable.subscribe(new Action1<String>() {\n @Override\n public void call(String s) {\n System.out.println(s);\n }\n },\n new Action1<Throwable>() {\n @Override\n public void call(Throwable throwable) {\n System.out.println(\"Something went wrong the observable\");\n }\n },\n new Action0() {\n @Override\n public void call() {\n System.out.println(\"No more values will be pushed.\");\n }\n });\n\n }", "@Nonnull \r\n\tpublic static <T> Observable<T> ignoreValues(\r\n\t\t\t@Nonnull final Observable<? extends T> source) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\treturn source.register(new Observer<T>() {\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\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 finish() {\r\n\t\t\t\t\t\tobserver.finish();\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 next(T value) {\r\n\t\t\t\t\t\t// ignored\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t};\r\n\t}", "@Test\n public void shouldReturnOnErrorWithRequestNotPermittedUsingObservable() {\n RateLimiterConfig rateLimiterConfig = RateLimiterConfig.custom()\n .limitRefreshPeriod(Duration.ofMillis(CYCLE_IN_MILLIS))\n .limitForPeriod(PERMISSIONS_RER_CYCLE)\n .timeoutDuration(TIMEOUT_DURATION)\n .build();\n\n // Create a RateLimiterRegistry with a custom global configuration\n RateLimiter rateLimiter = RateLimiter.of(LIMITER_NAME, rateLimiterConfig);\n\n assertThat(rateLimiter.getPermission(rateLimiter.getRateLimiterConfig().getTimeoutDuration()));\n\n Observable.fromIterable(makeEleven())\n .lift(RateLimiterOperator.of(rateLimiter))\n .test()\n .assertError(RequestNotPermitted.class)\n .assertNotComplete()\n .assertSubscribed();\n\n assertThat(!rateLimiter.getPermission(rateLimiter.getRateLimiterConfig().getTimeoutDuration()));\n\n RateLimiter.Metrics metrics = rateLimiter.getMetrics();\n\n assertThat(metrics.getAvailablePermissions()).isEqualTo(0);\n assertThat(metrics.getNumberOfWaitingThreads()).isEqualTo(0);\n }", "@Test\n public void observableGetBooleanLogicOperationAndReturnBooleanValue() {\n assertTrue(Observable.just(10)\n .map(intValue -> intValue == 10)\n .toBlocking()\n .single());\n }", "private void filterHidden() {\n final List<TreeItem<File>> filterItems = new LinkedList<>();\n\n for (TreeItem<File> item : itemList) {\n if (isCancelled()) {\n return;\n }\n\n if (!shouldHideFile.test(item.getValue())) {\n filterItems.add(item);\n\n if (shouldSchedule(filterItems)) {\n scheduleJavaFx(filterItems);\n filterItems.clear();\n }\n }\n }\n\n scheduleJavaFx(filterItems);\n Platform.runLater(latch::countDown);\n }", "public void emitLoop() {\n Subscriber<? super R> child2 = this.child;\n Queue<Object> queue2 = this.queue;\n NotificationLite<R> nl = NotificationLite.instance();\n AtomicLong requested2 = this.requested;\n long r = requested2.get();\n while (true) {\n boolean max = r == LongCompanionObject.MAX_VALUE;\n if (!checkTerminated(this.done, queue2.isEmpty(), child2)) {\n long e = 0;\n while (r != 0) {\n boolean d = this.done;\n Object o = queue2.poll();\n boolean empty = o == null;\n if (checkTerminated(d, empty, child2)) {\n return;\n }\n if (empty) {\n break;\n }\n R v = nl.getValue(o);\n try {\n child2.onNext(v);\n r--;\n e--;\n } catch (Throwable ex) {\n Exceptions.throwOrReport(ex, child2, v);\n return;\n }\n }\n if (e != 0 && !max) {\n r = requested2.addAndGet(e);\n }\n synchronized (this) {\n if (!this.missed) {\n this.emitting = false;\n return;\n }\n this.missed = false;\n }\n } else {\n return;\n }\n }\n }", "public static void test016()\r\n {\r\n System.out.println(\"RxJavaTest04::test016\");\r\n ExecutorService poolA = Executors.newFixedThreadPool(10, newThreadFactory(\"Sched-A-%d\"));\r\n Scheduler schedulerA = Schedulers.from(poolA);\r\n RxGroceries rxGroceries = new RxGroceries();\r\n\r\n Maybe<BigDecimal> totalPrice = Observable\r\n .fromIterable(Arrays.asList(\"bread\", \"butter\", \"milk\", \"tomato\", \"cheese\"))\r\n .subscribeOn(schedulerA)\r\n .flatMap(prod -> rxGroceries\r\n .purchase(prod, 1)\r\n .subscribeOn(schedulerA)\r\n )\r\n .reduce(BigDecimal::add);\r\n totalPrice\r\n .subscribe(\r\n x -> log(\"Got \" + x),\r\n Throwable::printStackTrace,\r\n () -> log(\"Completed\")\r\n );\r\n myWait(2000); // We have to wait before shutting down the pool,\r\n // otherwise it will throw exception \r\n // [java] io.reactivex.exceptions.UndeliverableException:\r\n // java.util.concurrent.RejectedExecutionException:\r\n // Task java.util.concurrent.FutureTask@38d8f9d0 rejected\r\n // from java.util.concurrent.ThreadPoolExecutor@6a724a6c\r\n // [Shutting down, pool size = 1, active threads = 1, queued\r\n // tasks = 0, completed tasks = 0]\r\n poolA.shutdown();\r\n }", "public static void test009()\r\n {\r\n System.out.println(\"RxJavaTest04::test009\");\r\n List<String> tickets = new ArrayList<String>(Arrays.asList(\"one\", \"two\", \"three\", \"four\", \"five\"));\r\n List<String> failures = Observable.fromIterable(tickets)\r\n .flatMap(ticket ->\r\n myRxSendEmail(ticket)\r\n .flatMap(response -> Observable.<String>empty())\r\n .doOnError(e -> System.out.printf(\"Failed to send %s: %s\\n\", ticket, e))\r\n .onErrorReturn(err -> ticket)\r\n .subscribeOn(Schedulers.io())\r\n )\r\n .toList()\r\n .blockingGet();\r\n for (String failure : failures) {\r\n System.out.println(failure);\r\n }\r\n }", "@Nonnull \r\n\tpublic static <T, U> Observable<U> prune(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func1<? super Observable<? extends T>, ? extends Observable<U>> selector,\r\n\t\t\t\t\t@Nonnull final Scheduler scheduler\r\n\t) {\r\n\t\treturn replay(source, selector, 1, scheduler);\r\n\t}", "public void metodoTakeWhile() {\n\n // takeWhile it stops once it has found an element that fails to match\n List<Dish> slicedMenu1\n = specialMenu.stream()\n .takeWhile(dish -> dish.getCalories() < 320)\n .collect(toList());\n }", "public void observaleJust() {\n\t\tObservable.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).subscribe(integerSubscribe());\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> repeat(\r\n\t\t\t@Nonnull Observable<? extends T> source,\r\n\t\t\tfinal int count) {\r\n\t\tif (count > 0) {\r\n\t\t\tPred0 condition = new Pred0() {\r\n\t\t\t\t/** Repeat counter. */\r\n\t\t\t\tint i = count - 1;\r\n\t\t\t\t@Override\r\n\t\t\t\tpublic Boolean invoke() {\r\n\t\t\t\t\treturn i-- > 0;\r\n\t\t\t\t}\r\n\t\t\t};\r\n\t\t\treturn doWhile(source, condition);\r\n\t\t}\r\n\t\treturn empty();\r\n\t}", "@Test\n public void discardIfCannot() {\n gm.setPlayerInfo(clientPlayer3);\n gm.setThisPlayerIndex(clientPlayer3.getPlayerIndex());\n dc.increaseAmount(ResourceType.ORE);\n dc.increaseAmount(ResourceType.ORE);\n dc.increaseAmount(ResourceType.WOOD);\n assertEquals(2, getAmounts().getOfType(ResourceType.ORE));\n assertEquals(1, getAmounts().getOfType(ResourceType.WOOD));\n Player p = model.getPlayer(clientPlayer3.getPlayerIndex());\n when(robberFacade.canDiscard(dc.getDiscardAmount(), p)).thenReturn(false);\n dc.discard();\n // This verifies that the robberFacade.discard is only called once instead of twice\n verify(robberFacade, atMost(1)).discard(dc.getDiscardAmount(), p);\n\n }", "@Override\r\n public Subscription onSubscribe(final Observer<? super String> observer) {\n final Thread t = new Thread(new Runnable() {\r\n @Override\r\n public void run() {\r\n for (int i = 0; i < 75; i++) {\r\n observer.onNext(\"anotherValue_\" + i);\r\n }\r\n // After sending all values we complete the sequence\r\n observer.onCompleted();\r\n }\r\n });\r\n t.start();\r\n \r\n return new Subscription() {\r\n @Override\r\n public void unsubscribe() {\r\n // Ask the thread to stop doing work.\r\n // For this simple example it just interrupts.\r\n t.interrupt();\r\n }\r\n };\r\n }", "public static void buffer() {\n\n List<String> data = Utils.getData();\n\n int numberOfBuffers = 11;\n\n CountDownLatch latch = new CountDownLatch(numberOfBuffers);\n\n\n Observable.fromIterable(data).buffer(3).subscribe(new MyObserver<>(latch));\n\n Observable.fromIterable(data).buffer(2, 3).subscribe(new MyObserver<>(latch));\n\n Observable.fromIterable(data).buffer(2, 3, ArrayList::new).subscribe(new MyObserver<>(latch));\n\n Observable.fromIterable(data).buffer(2, HashSet::new).subscribe(new MyObserver<>(latch));\n\n /*\n Opening and closing windows defined\n */\n Observable.fromIterable(data).buffer((observer) -> {\n System.out.println(\"opening\");\n // Starts buffer collection window\n // For every onNext a buffer window is created.\n observer.onNext(\"opening-1\");\n observer.onNext(\"opening-2\");\n }, (value) -> {\n System.out.println(\"closing, value = \" + value);\n // Closes buffer collection window\n // Gets invoked for each onNext in opening indicator\n return Observable.just(value).delay(100L, TimeUnit.MICROSECONDS);\n }, HashSet::new).subscribe(new MyObserver<>(latch));\n\n /*\n Buffer with boundary observable\n */\n Observable.fromIterable(data).buffer((Observer<? super Integer> observer) -> {\n System.out.println(\"onNext - 1\");\n observer.onNext(1);\n observer.onNext(2);\n }).subscribe(new MyObserver<>(latch));\n\n /*\n 1. Buffer with boundary observable by providing some other in built observable\n 2. Create a buffer of 100 Microseconds\n */\n Observable.fromIterable(data)\n .buffer(Observable.interval(100L, TimeUnit.MICROSECONDS))\n .subscribe(new MyObserver<>(latch));\n\n Observable.fromIterable(data)\n .buffer(Observable.interval(100L, TimeUnit.MICROSECONDS), 4)\n .subscribe(new MyObserver<>(latch));\n\n Observable.fromIterable(data)\n .buffer(Observable.interval(100L, TimeUnit.MICROSECONDS), () -> new HashSet<>())\n .subscribe(new MyObserver<>(latch));\n\n\n /*\n Boundary supplier is being passed from callable.\n */\n Observable.fromIterable(data)\n .buffer(() -> Observable.interval(100L, TimeUnit.MICROSECONDS))\n .subscribe(new MyObserver<>(latch));\n\n\n Observable.fromIterable(data)\n .buffer(() -> Observable.interval(100L, TimeUnit.MICROSECONDS), HashSet::new)\n .subscribe(new MyObserver<>(latch));\n\n try {\n latch.await();\n } catch (InterruptedException e) {\n System.out.println(e.getMessage());\n }\n }", "public static void test008()\r\n {\r\n System.out.println(\"RxJavaTest04::test008\");\r\n List<String> tickets = new ArrayList<String>(Arrays.asList(\"one\", \"two\", \"three\", \"four\", \"five\"));\r\n List<String> failures = Observable.fromIterable(tickets)\r\n .flatMap(ticket ->\r\n myRxSendEmail(ticket)\r\n .flatMap(response -> Observable.<String>empty())\r\n .doOnError(e -> System.out.printf(\"Failed to send %s: %s\\n\", ticket, e))\r\n .onErrorReturn(err -> ticket))\r\n .toList()\r\n .blockingGet();\r\n for (String failure : failures) {\r\n System.out.println(failure);\r\n }\r\n }", "public static <T> Observable<T> resumeConditionally(\r\n\t\t\t@Nonnull Observable<? extends T> source,\r\n\t\t\t@Nonnull Func1<? super Throwable, ? extends Observable<? extends T>> handler) {\r\n\t\treturn new Resume.Conditionally<T>(source, handler);\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> repeat(\r\n\t\t\t@Nonnull Observable<? extends T> source) {\r\n\t\treturn doWhile(source, Functions.TRUE);\r\n\t}", "public void performSuppression() {\n \n for (int row = 0; row < dataOutput.getNumRows(); row++) {\n if (privacyModelDefinesSubset == null || privacyModelDefinesSubset.contains(row)) {\n final int hash = dataOutput.hashCode(row);\n final int index = hash & (hashTableBuckets.length - 1);\n HashGroupifyEntry m = hashTableBuckets[index];\n while ((m != null) && ((m.hashcode != hash) || !dataOutput.equalsIgnoringOutliers(row, m.row))) {\n m = m.next;\n }\n if (m == null) {\n throw new RuntimeException(\"Invalid state! Group the data before suppressing records!\");\n }\n if (!m.isNotOutlier || this.isCompletelyGeneralized(m)) {\n dataOutput.or(row, Data.OUTLIER_MASK);\n m.isNotOutlier = false;\n }\n } else {\n dataOutput.or(row, Data.OUTLIER_MASK);\n }\n }\n }", "public boolean isSleepingIgnored ( ) {\n\t\treturn extract ( handle -> handle.isSleepingIgnored ( ) );\n\t}", "@ServiceAction\n protected void onNotificationDismissed(final ArrayList<Integer> serversRequiringNotification) {\n Observable.from(servers)\n .filter(new Func1<MinecraftServerEntity, Boolean>() {\n @Override\n public Boolean call(MinecraftServerEntity server) {\n return serversRequiringNotification.contains(server.getId());\n }\n })\n .map(new Func1<MinecraftServerEntity, MinecraftServerEntity>() {\n @Override\n public MinecraftServerEntity call(MinecraftServerEntity server) {\n server.setHasOfflineStatusBeenSeen(true);\n return server;\n }\n })\n .subscribeOn(AndroidSchedulers.mainThread())\n .observeOn(AndroidSchedulers.mainThread())\n .subscribe(new Action1<MinecraftServerEntity>() {\n @Override\n public void call(MinecraftServerEntity server) {\n if (DEBUG)\n Log.d(TAG, String.format(\"'%s' offline status has been seen by the user. Updating the database\", server.getName()));\n //We update the value in the database\n runtimeMinecraftServerDao.update(server);\n }\n });\n }", "protected void sequence_LogicalAbsentStatefulSource_NOT(ISerializationContext context, NOT semanticObject) {\n\t\tif (errorAcceptor != null) {\n\t\t\tif (transientValues.isValueTransient(semanticObject, SiddhiPackage.eINSTANCE.getNOT_Not1()) == ValueTransient.YES)\n\t\t\t\terrorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SiddhiPackage.eINSTANCE.getNOT_Not1()));\n\t\t\tif (transientValues.isValueTransient(semanticObject, SiddhiPackage.eINSTANCE.getLogicalAbsentStatefulSource_Bs()) == ValueTransient.YES)\n\t\t\t\terrorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SiddhiPackage.eINSTANCE.getLogicalAbsentStatefulSource_Bs()));\n\t\t\tif (transientValues.isValueTransient(semanticObject, SiddhiPackage.eINSTANCE.getLogicalAbsentStatefulSource_And()) == ValueTransient.YES)\n\t\t\t\terrorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SiddhiPackage.eINSTANCE.getLogicalAbsentStatefulSource_And()));\n\t\t\tif (transientValues.isValueTransient(semanticObject, SiddhiPackage.eINSTANCE.getLogicalAbsentStatefulSource_StdSource()) == ValueTransient.YES)\n\t\t\t\terrorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SiddhiPackage.eINSTANCE.getLogicalAbsentStatefulSource_StdSource()));\n\t\t}\n\t\tSequenceFeeder feeder = createSequencerFeeder(context, semanticObject);\n\t\tfeeder.accept(grammarAccess.getNOTAccess().getNot1NotKeyword_0(), semanticObject.getNot1());\n\t\tfeeder.accept(grammarAccess.getLogicalAbsentStatefulSourceAccess().getBsBasicSourceParserRuleCall_2_0_0_1_0(), semanticObject.getBs());\n\t\tfeeder.accept(grammarAccess.getLogicalAbsentStatefulSourceAccess().getAndANDParserRuleCall_2_0_0_2_0(), semanticObject.getAnd());\n\t\tfeeder.accept(grammarAccess.getLogicalAbsentStatefulSourceAccess().getStdSourceStandardStatefulSourceParserRuleCall_2_1_0(), semanticObject.getStdSource());\n\t\tfeeder.finish();\n\t}", "@BackpressureSupport(BackpressureKind.FULL)\n @SchedulerSupport(SchedulerKind.NONE)\n public final Observable<T> retry(long times, Predicate<? super Throwable> predicate) {\n if (times < 0) {\n throw new IllegalArgumentException(\"times >= 0 required but it was \" + times);\n }\n Objects.requireNonNull(predicate, \"predicate is null\");\n\n return create(new PublisherRetryPredicate<T>(this, times, predicate));\n }", "public void discard();", "public static void main(String[] args) {\n // count operator counter number of elements emmitted,\n Observable<Integer> observable = Observable.just(1,2,3,4);\n observable.count().subscribe(s->System.out.println(s));\n\n // conditional opertors\n // all() -> this operator checks condition for all values and returns false if any condition fails\n observable.all(i->i<3).subscribe(s->System.out.println(s));\n\n // any() -> this operator checks condition for all values and returns true if any condition is true\n // empty() -> checks if observable have empty value and returns true/false \n // contains() -> checks if specified item is contained/emmitted by observable\n // sequenceEqual() -> checks if two sequences are equals (sequences contains same values)\n\n observable.any(i->i<3).subscribe(s->System.out.println(s));\n observable.filter(i->i<5).isEmpty().subscribe(s->System.out.println(s));\n }", "@Nonnull\r\n\tpublic static Observable<Boolean> isEmpty(\r\n\t\t\t@Nonnull final Observable<?> source) {\r\n\t\treturn new Observable<Boolean>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super Boolean> observer) {\r\n\t\t\t\treturn source.register(new Observer<Object>() {\r\n\t\t\t\t\t/** We already determined the answer? */\r\n\t\t\t\t\tboolean done;\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tif (!done) {\r\n\t\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t\t}\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 finish() {\r\n\t\t\t\t\t\tif (!done) {\r\n\t\t\t\t\t\t\tdone = true;\r\n\t\t\t\t\t\t\tobserver.next(false);\r\n\t\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\t}\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 next(Object value) {\r\n\t\t\t\t\t\tif (!done) {\r\n\t\t\t\t\t\t\tdone = true;\r\n\t\t\t\t\t\t\tobserver.next(true);\r\n\t\t\t\t\t\t\tobserver.finish();\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\t\t\t}\r\n\t\t};\r\n\t}", "private void clearConditionalResponses() {\n conditionalResponses_ = emptyProtobufList();\n }", "public void emitLoop() {\n /*\n r14 = this;\n L_0x0000:\n monitor-enter(r14)\n long r0 = r14.missedRequested // Catch:{ all -> 0x0061 }\n long r2 = r14.missedProduced // Catch:{ all -> 0x0061 }\n rx.Producer r4 = r14.missedProducer // Catch:{ all -> 0x0061 }\n r5 = 0\n int r7 = (r0 > r5 ? 1 : (r0 == r5 ? 0 : -1))\n if (r7 != 0) goto L_0x0018\n int r8 = (r2 > r5 ? 1 : (r2 == r5 ? 0 : -1))\n if (r8 != 0) goto L_0x0018\n if (r4 != 0) goto L_0x0018\n r0 = 0\n r14.emitting = r0 // Catch:{ all -> 0x0061 }\n monitor-exit(r14) // Catch:{ all -> 0x0061 }\n return\n L_0x0018:\n r14.missedRequested = r5 // Catch:{ all -> 0x0061 }\n r14.missedProduced = r5 // Catch:{ all -> 0x0061 }\n r8 = 0\n r14.missedProducer = r8 // Catch:{ all -> 0x0061 }\n monitor-exit(r14) // Catch:{ all -> 0x0061 }\n long r9 = r14.requested\n r11 = 9223372036854775807(0x7fffffffffffffff, double:NaN)\n int r13 = (r9 > r11 ? 1 : (r9 == r11 ? 0 : -1))\n if (r13 == 0) goto L_0x0048\n long r9 = r9 + r0\n int r13 = (r9 > r5 ? 1 : (r9 == r5 ? 0 : -1))\n if (r13 < 0) goto L_0x0045\n int r13 = (r9 > r11 ? 1 : (r9 == r11 ? 0 : -1))\n if (r13 != 0) goto L_0x0035\n goto L_0x0045\n L_0x0035:\n long r9 = r9 - r2\n int r2 = (r9 > r5 ? 1 : (r9 == r5 ? 0 : -1))\n if (r2 < 0) goto L_0x003d\n r14.requested = r9\n goto L_0x0048\n L_0x003d:\n java.lang.IllegalStateException r0 = new java.lang.IllegalStateException\n java.lang.String r1 = \"more produced than requested\"\n r0.<init>(r1)\n throw r0\n L_0x0045:\n r14.requested = r11\n r9 = r11\n L_0x0048:\n if (r4 == 0) goto L_0x0057\n rx.Producer r0 = NULL_PRODUCER\n if (r4 != r0) goto L_0x0051\n r14.currentProducer = r8\n goto L_0x0000\n L_0x0051:\n r14.currentProducer = r4\n r4.request(r9)\n goto L_0x0000\n L_0x0057:\n rx.Producer r2 = r14.currentProducer\n if (r2 == 0) goto L_0x0000\n if (r7 == 0) goto L_0x0000\n r2.request(r0)\n goto L_0x0000\n L_0x0061:\n r0 = move-exception\n monitor-exit(r14) // Catch:{ all -> 0x0061 }\n throw r0\n */\n throw new UnsupportedOperationException(\"Method not decompiled: p030rx.internal.producers.ProducerArbiter.emitLoop():void\");\n }", "public static Observable<String> getObservableDistinctUntilChanges() {\n return observableSrcDuplicated;//todo\n }", "public void discard() {\n }", "public static void timeoutOperatorWithSecondObservable(Observable<Player> playerObservable) {\n playerObservable.delay(2, TimeUnit.SECONDS)\n .timeout(1000, TimeUnit.MILLISECONDS, playerObservable.filter(player -> {\n return player.getPosition().equals(\"Forward\");\n }))\n .subscribe(player -> {\n Log.d(\"output: \", player.toString());\n });\n }", "private void signalNotEmpty() {\n\t\tfinal ReentrantLock takeLock = this.takeLock;\n\t\ttakeLock.lock();\n\t\ttry {\n\t\t\tnotEmpty.signal();\n\t\t} finally {\n\t\t\ttakeLock.unlock();\n\t\t}\n\t}", "private static void createObservableUsingEmpty() {\n Observable<?> observable = Observable.empty();\n\n observable.subscribe(x -> LOG.info(\"{}\", x), error -> LOG.info(\"Error 1: {}\", error.hashCode()));\n observable.subscribe(x -> LOG.info(\"{}\", x),\n error -> LOG.info(\"{}\", error.getLocalizedMessage()),\n () -> LOG.info(\"Completed\"));\n }", "public static <T> boolean retainAll(@Nonnull Collection<T> collection, @Nonnull Condition<? super T> condition) {\n boolean modified = false;\n\n for (Iterator<T> iterator = collection.iterator(); iterator.hasNext(); ) {\n T next = iterator.next();\n if (!condition.value(next)) {\n iterator.remove();\n modified = true;\n }\n }\n\n return modified;\n }", "protected void removeHalted() {\n for (Machine machine : machines) {\n while (!machine.getEventBuffer().isEmpty()) {\n Guard targetHalted =\n machine.getEventBuffer().satisfiesPredUnderGuard(x -> x.targetHalted()).getGuardFor(true);\n if (!targetHalted.isFalse()) {\n rmBuffer(machine, targetHalted);\n continue;\n }\n break;\n }\n }\n }", "boolean hasUnReceived();", "private static void backPressureFix() {\n\t\tFlowable.range(1, 1000000)\n\t\t//below map will run in sequential\n\t\t//since sequential it has to complete whole task then only it can allow consumer to start\n\t\t\t.map(item -> {\n\t\t\t\tSystem.out.println(\"Produced item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t\treturn item;\n\t\t\t})\n\t\t\t.observeOn(Schedulers.io())\n\t\t\t//.subscribeOn(Schedulers.io())//with this whole pipelein runs in seprate thread paralleley\n\t\t\t//below will run in concurrent\n\t\t\t.subscribe(item ->{\n\t\t\t\t//mimcing slowness\n\t\t\t\tThreadUtil.sleep(300);\n\t\t\t\tSystem.out.println(\"Consumed item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t})\n\t\t\t\n\t\t\t;\n\t\t\n\t\t//since running in async we need to sleep\n\t\tThreadUtil.sleep(10000000);\n\t\t\t\n\t}", "public boolean burn(){\r\n for(ListIterator<Item> iter = listIterator();iter.hasNext();)\r\n if(iter.next().flammable) iter.remove();\r\n return isEmpty();\r\n }", "@Test\n public void testDefer() throws InterruptedException {\n Observable<LocalTime> localTimeObservable =\n Observable.defer(\n () -> Observable\n .just(LocalTime.now()))\n .repeat(3);\n localTimeObservable.subscribe(System.out::println);\n Thread.sleep(3000);\n System.out.println(\"Next Subscriber\");\n localTimeObservable.subscribe(System.out::println);\n }", "public static Observable<String> getObservableFiltered() {\n return observableSrc;//todo\n }", "ObservableList<Link> getUnfilteredLinkList();", "public static Observable<Long> getObservableSkipDuration() {\n return observableIntervalSrc;//todo\n }", "public static void switchOnNext(CountDownLatch latch) {\n\n List<Observable<Long>> collectionOfObservable = new ArrayList<>();\n\n Observable<Long> first = Observable.interval(1L, TimeUnit.SECONDS).take(5)\n .doOnNext((item) -> System.out.println(\"first doOnNext item = \" + item));\n\n Observable<Long> second = Observable.interval(1L, TimeUnit.SECONDS)\n .map(item -> item + 100).take(10);\n\n collectionOfObservable.add(first);\n collectionOfObservable.add(second);\n\n Observable.switchOnNext(Observable.fromIterable(collectionOfObservable))\n .subscribeOn(Schedulers.io()).subscribe(new MyObserver<>(latch));\n }", "public static void test015()\r\n {\r\n System.out.println(\"RxJavaTest04::test015\");\r\n ExecutorService poolA = Executors.newFixedThreadPool(10, newThreadFactory(\"Sched-A-%d\"));\r\n Scheduler schedulerA = Schedulers.from(poolA);\r\n RxGroceries rxGroceries = new RxGroceries();\r\n\r\n Maybe<BigDecimal> totalPrice = Observable\r\n .fromIterable(Arrays.asList(\"bread\", \"butter\", \"milk\", \"tomato\", \"cheese\"))\r\n .subscribeOn(schedulerA)\r\n .flatMap(prod -> rxGroceries.purchase(prod, 1))\r\n .reduce(BigDecimal::add);\r\n totalPrice\r\n .subscribe(System.out::println);\r\n poolA.shutdown();\r\n }", "public static void sample() {\n System.out.println(\"# 1\");\n Observable.fromIterable(sData)\n .timestamp()\n .sample(1000, TimeUnit.MICROSECONDS)\n .subscribe(new MyObserver<>());\n\n /*\n Emission controlled by sampler inner observable\n */\n System.out.println(\"# 2\");\n Observable.fromIterable(sData)\n .sample((observer) -> {\n System.out.println(\"emitter\");\n Observable.just(\"123\").subscribe(observer);\n }, true).subscribe(new MyObserver<>());\n }", "MapComp<K, V> removeAll(Predicate<K> p);", "private ObservableOnSubscribe<Object> receiveLoop() {\n return emitter -> {\n Message message;\n try {\n while ( ( message = consumer.receive( jmsDelegate.receiveTimeout ) ) != null ) {\n streamStep.logDebug( message.toString() );\n emitter.onNext( message.getBody( Object.class ) );\n }\n } catch ( JMSRuntimeException jmsException ) {\n emitter.onError( jmsException );\n }\n emitter.onComplete();\n };\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> skip(\r\n\t\t\t@Nonnull Observable<? extends T> source,\r\n\t\t\tlong time,\r\n\t\t\t@Nonnull TimeUnit unit\r\n\t\t\t) {\r\n\t\treturn skip(source, time, unit, scheduler());\r\n\t}", "public synchronized void filtered() {\n filteredCountStat.received();\n filteredCount++;\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}", "@Override\n public Boolean skip(final ServerWebExchange exchange) {\n return false;\n }", "public static void scan() {\n Observable.range(1, 10)\n .scan((previous, current) -> {\n System.out.println(\"previous = \" + previous);\n System.out.println(\"current = \" + current);\n return previous + current;\n }).subscribe(new MyObserver<>());\n }", "public ConditionItem not(ConditionItem constraint) {\n\t\treturn blockCondition(ConditionType.NOT, constraint);\n\t}", "@Override\n public StateContents<Boolean> isEmpty() {\n final List<StateContents<Boolean>> futures = new ArrayList<>(sources.size());\n for (CombiningValueStateInternal<InputT, AccumT, OutputT> source : sources) {\n futures.add(source.isEmpty());\n }\n\n // But defer the actual reads until later.\n return new StateContents<Boolean>() {\n @Override\n public Boolean read() {\n for (StateContents<Boolean> future : futures) {\n if (!future.read()) {\n return false;\n }\n }\n return true;\n }\n };\n }", "@Override\n\tpublic void run() {\n\t\twhile(true){\n \tlock.lock();\n \ttry{\n\t \tif(observers.isEmpty()){\n\t \t\treturn;\n\t \t}\n \t}\n \tfinally{\n \t\tlock.unlock();\n \t}\n }\n\t}" ]
[ "0.6973597", "0.6306131", "0.6217215", "0.6129408", "0.58866924", "0.58113885", "0.5677299", "0.5667031", "0.5526006", "0.5486568", "0.53770137", "0.5367651", "0.532584", "0.5288527", "0.5269547", "0.51674324", "0.51368463", "0.5083244", "0.50727755", "0.5068088", "0.50574833", "0.50522894", "0.50522214", "0.50323564", "0.5028241", "0.5027426", "0.49818513", "0.49798965", "0.4976195", "0.49438983", "0.4939687", "0.4926035", "0.4907863", "0.48971236", "0.4873025", "0.48605874", "0.48605502", "0.4856489", "0.4853704", "0.48165053", "0.48134974", "0.48107755", "0.48033646", "0.47710705", "0.47628474", "0.47592056", "0.47564274", "0.47419423", "0.47161317", "0.47054064", "0.47005534", "0.46795875", "0.46672583", "0.4656355", "0.465013", "0.46405625", "0.46377867", "0.4636609", "0.46310255", "0.4619772", "0.46091807", "0.45995018", "0.45988095", "0.459778", "0.45902073", "0.45842567", "0.45788208", "0.45763743", "0.45735812", "0.45719025", "0.45513484", "0.45319712", "0.45267177", "0.45230466", "0.45209965", "0.45067748", "0.44974965", "0.4490774", "0.4489232", "0.44889617", "0.44881034", "0.44724727", "0.44694233", "0.44547695", "0.44530085", "0.44525307", "0.4443592", "0.4443154", "0.44427863", "0.4442677", "0.44191203", "0.44034848", "0.440277", "0.44018343", "0.4394579", "0.43823498", "0.43810448", "0.43805996", "0.43782932", "0.43699682" ]
0.6285179
2
discard items emitted by an Observable after a second Observable emits an item or terminates
@Test public void takeUntil() { Observable.just(1, 2, 3, 4) .takeUntil(integer -> integer > 2) .subscribe(mList::add); assertEquals(mList, Arrays.asList(1, 2, 3)); mList.clear(); Observable.just(1, 2, 3, 4) .takeUntil(integer -> integer < 10) .subscribe(mList::add); assertEquals(mList, Collections.singletonList(1)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void ignoreElements() {\n Observable.fromIterable(Utils.getData())\n .ignoreElements()\n .subscribe(new MyCompletableObserver());\n }", "private static void exSwitchMapTwo() {\n\n Observable.interval(5,TimeUnit.SECONDS)\n .switchMap(call -> Observable.just(getResponse()).doOnDispose(() -> System.out.println(\"Disposed\")))\n .subscribe(System.out::println);\n\n //An Observable which performs network call.\n sleep(40000);\n\n\n /* OUTPUT :\n 6\n 10\n 13\n 17\n 26\n 32\n 35\n 42\n\n */\n }", "public static void never() {\n Observable<String> myObservable = Observable.never();\n myObservable.subscribe(genericObserver1);\n }", "private static void createColdObservable() {\n var observable = Observable.just(1, 2, 3, 4, 5);\n\n observable.subscribe(item -> LOG.info(\"Observer 1: {}\", item));\n\n pause(1000);\n\n observable.subscribe(item -> LOG.info(\"Observer 2: {}\", item));\n }", "@Test\n public void skipUntil() {\n\n Observable<Long> o1 = Observable.interval(100, TimeUnit.SECONDS, mTestScheduler)\n .map(num -> num + 1)\n .take(9);\n\n Observable<Integer> o2 = Observable.just(0, 0)\n .delay(550, TimeUnit.SECONDS, mTestScheduler);\n\n o1.skipUntil(o2)\n .subscribe(mList::add);\n\n mTestScheduler.advanceTimeBy(2000, TimeUnit.SECONDS);\n assertEquals(mList, Arrays.asList(6L, 7L, 8L, 9L));\n }", "public static void skipWhile() {\n Observable.fromIterable(sData)\n .skipWhile((item) -> {\n System.out.println(\"item = \" + item);\n return item.equalsIgnoreCase(\"abc\");\n }).subscribe(new MyObserver<>());\n }", "private static void exSwitchMapThree(){\n Observable<String> intense =\n Observable.just(\"Savi\",\"Healer\",\"Three\",\"Four\",\"Wednesday\",\"Friday\",\"You\",\"Me\")\n .concatMap(result -> Observable.just(result).delay(randomSleepTime(),TimeUnit.MILLISECONDS))\n .doOnDispose(() -> System.out.println(\" * * Disposed * *\"));\n\n //Observable to execute intense task every 5 seconds\n Observable.interval(5,TimeUnit.SECONDS)\n .switchMap(r -> intense)\n .subscribe(System.out::println);\n\n //Sleep the main thread for few seconds\n Take.sleep(20000);\n\n /*\n After every 5 seconds it will dispose the ongoing intense (variable name) process and\n start the same process again.\n */\n\n //Output\n /*\n Savi\n Healer\n Three\n Four\n * * Disposed * *\n Savi\n Healer\n Three\n Four\n Wednesday\n Friday\n You\n * * Disposed * *\n Savi\n Healer\n Three\n Four\n Wednesday\n * * Disposed * *\n */\n }", "protected void discard() {\r\n discarded = true;\r\n onDiscard();\r\n }", "public static void empty() {\n Observable<String> myObservable = Observable.empty();\n myObservable.subscribe(genericObserver1);\n }", "@Override\n public void subscribe(ObservableEmitter<Integer> e) throws Exception {\n\n e.onNext(1);\n SystemClock.sleep(1000);\n e.onNext(2);\n SystemClock.sleep(1000);\n e.onNext(3);\n SystemClock.sleep(1000);\n e.onNext(4);\n\n //Once the Observable has emitted all items in the sequence, call onComplete//\n e.onComplete();\n //e.onError(new Throwable(\"Some Error!!\"));\n }", "@Test\r\n\tpublic void exerciseInterruptible() {\n\t\t\r\n\t\tList<String> articlesTopicA = Arrays.asList(\"Article A-1\",\"Article A-2\",\"Article A-3\");\r\n\t\tList<String> articlesTopicB = Arrays.asList(\"Article B-1\",\"Article B-2\",\"Article B-3\");\r\n\t\tList<String> articlesTopicC = Arrays.asList(\"Article C-1\",\"Article C-2\",\"Article C-3\");\r\n\t\t\r\n\t\tList<Observable<String>> topicObservables = Arrays.asList(\r\n\t\t\t\tObservable.interval(0, 80L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicA.get(i.intValue())),\r\n\t\t\t\tObservable.interval(50, 60L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicB.get(i.intValue())),\r\n\t\t\t\tObservable.interval(0, 40L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicC.get(i.intValue())));\r\n\t\t\r\n\t\tObservable<Observable<String>> topics = Observable.interval(0, 100L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> topicObservables.get(i.intValue()));\r\n\t\t\r\n\t\t//\t\t t[ms]: 0 100 200 300\r\n\t\t//\t\ttopics: A---------B---------C---------| \r\n\t\t//\t\t A: 1-------2-|-----3---|---------|\r\n\t\t//\t\t B: |---------|----1----|2-----3--|\r\n\t\t//\t\t C: |---------|---------1---2---3-|\r\n\t\t//\t\tResult: A-1 A-2 B-1 C-1 C-2 C-3\r\n\t\t\t\t\r\n\t\t// TODO: always switch to the latest topic\r\n\t\t// HINT: http://reactivex.io/documentation/operators/switch.html\r\n\t\tObservable<String> latestInteresting = Observable.empty();\r\n\r\n\t\t// verify\r\n\t\tTestSubscriber<String> testSubscriber = new TestSubscriber<>();\r\n\t\tlatestInteresting\r\n\t\t\t.doOnNext(article -> log(String.format(\" doOnNext(): %s Time: %d\", article, testScheduler.now())))\r\n\t\t\t.subscribe(testSubscriber);\r\n\t\t\r\n\t\t// let the time elapse until completion\r\n\t\ttestScheduler.advanceTimeBy(300, TimeUnit.MILLISECONDS);\r\n\t\t\r\n\t\ttestSubscriber.assertCompleted();\r\n\t\ttestSubscriber.assertNoErrors();\r\n\t\tList<String> expectedArticles = Arrays.asList(\r\n\t\t\t\t\"Article A-1\",\"Article A-2\", \r\n\t\t\t\t\"Article B-1\", \r\n\t\t\t\t\"Article C-1\", \"Article C-2\", \"Article C-3\");\r\n\t\ttestSubscriber.assertReceivedOnNext(expectedArticles);\r\n\t\t\r\n\t}", "private void subscribeToDeleteEvents() {\n mDisposable.add(basketListAdapter.deleteItemSubject\n .observeOn(Schedulers.io())\n .flatMapCompletable(basketItemWithProduct -> mViewModel.deleteItemFromBasket(basketItemWithProduct.basketItem))\n .subscribeOn(AndroidSchedulers.mainThread())\n .subscribe(this::onItemDeleted, this::onItemDeleteFailed)\n );\n }", "public static Observable<String> getObservableSkipElement() {\n return observableSrc;//todo\n }", "private static void createObservableUsingNever() {\n Observable<?> observable = Observable.never();\n\n observable.subscribe(x -> LOG.info(\"{}\", x),\n error -> LOG.info(\"{}\", error.getLocalizedMessage()),\n () -> LOG.info(\"Completed\"));\n\n // Pause the main thread for the hope that it will print something\n sleep(3000);\n }", "@Test\r\n public void testReplayRemoveSubjectConcurrentObservations() throws InterruptedException {\r\n\r\n final ReplayRemoveSubject<Long> replay = ReplayRemoveSubject.create();\r\n\r\n final int THREAD_COUNT = 20;\r\n final int START_SOURCE_AFTER_THREADS = 3;\r\n final int THREADS_TO_RECEIVE_ALL_BEFORE_REMOVE_STARTED = 5;\r\n final int AWAITER_1_THREAD_COUNT = 10;\r\n final int AWAITER_2_THREAD_COUNT = 12;\r\n final int AWAITER_3_THREAD_COUNT = 14;\r\n\r\n final CountDownLatch sourceAwaiterMain = new CountDownLatch(THREADS_TO_RECEIVE_ALL_BEFORE_REMOVE_STARTED);\r\n\r\n final CountDownLatch threadCreationAwaiter1 = new CountDownLatch(1);\r\n final CountDownLatch sourceAwaiter1 = new CountDownLatch(3);\r\n\r\n final CountDownLatch threadCreationAwaiter2 = new CountDownLatch(1);\r\n final CountDownLatch sourceAwaiter2 = new CountDownLatch(3);\r\n\r\n final CountDownLatch threadCreationAwaiter3 = new CountDownLatch(1);\r\n\r\n final List<Long> valuesToRemove = new ArrayList<>();\r\n valuesToRemove.add(1L);\r\n valuesToRemove.add(20L);\r\n valuesToRemove.add(300L);\r\n\r\n AtomicLong fullCounter = new AtomicLong();\r\n\r\n Thread source = new Thread(() -> {\r\n try {\r\n System.out.println(\"********* Start Source Data ***********\");\r\n for (long l = 1; l <= 10000; l++) {\r\n if (l % 100 == 0)\r\n System.out.println(\"Emitting \" + l);\r\n\r\n fullCounter.addAndGet(l);\r\n replay.onNext(l);\r\n\r\n // just random value, could be any:\r\n if (l == 567) {\r\n sourceAwaiterMain.await();\r\n\r\n replay.onRemove(valuesToRemove.get(0));\r\n threadCreationAwaiter1.countDown();\r\n sourceAwaiter1.await();\r\n\r\n replay.onRemove(valuesToRemove.get(1));\r\n threadCreationAwaiter2.countDown();\r\n sourceAwaiter2.await();\r\n\r\n replay.onRemove(valuesToRemove.get(2));\r\n threadCreationAwaiter3.countDown();\r\n }\r\n\r\n }\r\n System.out.println(\"********* Finished Source Data ***********\");\r\n replay.onComplete();\r\n\r\n } catch (Exception e) {\r\n fail(e.getMessage());\r\n }\r\n });\r\n\r\n // used to collect results of each thread\r\n final List<Pair<Long, List<Long>>> listOfListsOfValues = Collections.synchronizedList(new ArrayList<>());\r\n\r\n\r\n CountDownLatch countDownLatch = new CountDownLatch(THREAD_COUNT);\r\n\r\n for (int i = 1; i <= THREAD_COUNT; i++) {\r\n\r\n final int count = i;\r\n\r\n if (count == START_SOURCE_AFTER_THREADS) {\r\n // start source data after we have some already subscribed\r\n // and while others are in process of subscribing\r\n source.start();\r\n }\r\n\r\n if (count == AWAITER_1_THREAD_COUNT)\r\n threadCreationAwaiter1.await();\r\n\r\n if (count == AWAITER_2_THREAD_COUNT)\r\n threadCreationAwaiter2.await();\r\n\r\n if (count == AWAITER_3_THREAD_COUNT)\r\n threadCreationAwaiter3.await();\r\n\r\n try {\r\n AtomicLong phase = new AtomicLong();\r\n\r\n //noinspection ResultOfMethodCallIgnored\r\n replay\r\n .observeOn(Schedulers.newThread())\r\n .doOnNext(val -> {\r\n final int indexOfRemovable =\r\n valuesToRemove.indexOf(val);\r\n\r\n if (indexOfRemovable >= 0) {\r\n phase.addAndGet(val);\r\n }\r\n\r\n if (val.equals(300L))\r\n sourceAwaiterMain.countDown();\r\n\r\n if (count >= 10)\r\n sourceAwaiter1.countDown();\r\n\r\n if (count >= 12)\r\n sourceAwaiter2.countDown();\r\n\r\n\r\n })\r\n .toList()\r\n .subscribe(values -> {\r\n listOfListsOfValues.add(Pair.of(phase.get(), values));\r\n countDownLatch.countDown();\r\n System.out.println(\"Finished thread: \" + count);\r\n });\r\n } catch (Exception e) {\r\n fail(e.getMessage());\r\n }\r\n\r\n System.out.println(\"Started thread: \" + i);\r\n }\r\n\r\n countDownLatch.await();\r\n\r\n listOfListsOfValues.stream().map(Pair::getLeft).collect(Collectors.toSet()).\r\n forEach(System.out::println);\r\n\r\n long maxRemoved = valuesToRemove.stream().reduce(0L, Long::sum);\r\n\r\n // assert all threads got the same results\r\n Map<Long, Long> sums = new HashMap<>();\r\n for (Pair<Long, List<Long>> pair : listOfListsOfValues) {\r\n long v = 0;\r\n for (long l : pair.getRight()) {\r\n v += l;\r\n }\r\n\r\n long phase = pair.getKey();\r\n assertEquals(fullCounter.get() - (maxRemoved - phase), v);\r\n\r\n sums.put(pair.getLeft(), v);\r\n }\r\n\r\n assertEquals(valuesToRemove.size() + 1, sums.size());\r\n Long phaseAcc = 0L;\r\n for (int i = valuesToRemove.size() - 1; i >= 0; i--) {\r\n assertTrue(sums.containsKey(phaseAcc));\r\n phaseAcc += valuesToRemove.get(i);\r\n assertTrue(sums.containsKey(phaseAcc));\r\n }\r\n\r\n }", "public static void timeoutOperatorWithSecondObservable(Observable<Player> playerObservable) {\n playerObservable.delay(2, TimeUnit.SECONDS)\n .timeout(1000, TimeUnit.MILLISECONDS, playerObservable.filter(player -> {\n return player.getPosition().equals(\"Forward\");\n }))\n .subscribe(player -> {\n Log.d(\"output: \", player.toString());\n });\n }", "public static Observable<String> getObservableSkipLastElement() {\n return observableSrc;//todo\n }", "public static void just() {\n Observable<List<String>> myObservable = Observable.just(Utils.getData());\n myObservable.subscribe(consumerList);\n }", "public void discard();", "private void assertNotConsumed() {\n if (this.consumed) {\n throw new IllegalStateException(\"Response content has been already consumed\");\n }\n }", "public static void debounce() {\n List<String> data = Utils.getData();\n\n System.out.println(\"# 1\");\n\n /*\n An item needs to be most recent for at least 1 microseconds to be considered for\n transmission.\n */\n Observable.fromIterable(data)\n .debounce(1, TimeUnit.MICROSECONDS)\n .subscribe(new MyObserver<>());\n\n System.out.println(\"# 2\");\n\n /*\n Item \"def\" is being intentionally delayed, so it will not most recent and \"ghi\" will\n emitted before it, Hence \"def\" will not be emitted.\n */\n Observable.fromIterable(data)\n .debounce((item) -> {\n if (item.equalsIgnoreCase(\"def\")) {\n return Observable.just(item).delay(1000L, TimeUnit.MICROSECONDS);\n } else {\n return Observable.just(item);\n }\n }).subscribe(new MyObserver<>());\n }", "public static Observable<String> getObservableSkipWhileElement() {\n return observableSrc;//todo\n }", "@Test\n public void amb() {\n Observable<Integer> o1 = Observable.just(20, 40, 60)\n .delay(500, TimeUnit.SECONDS, mTestScheduler);\n\n Observable<Integer> o2 = Observable.just(1, 2, 3)\n .delay(200, TimeUnit.SECONDS, mTestScheduler);\n\n Observable<Integer> o3 = Observable.just(0, 0, 0)\n .delay(1000, TimeUnit.SECONDS, mTestScheduler);\n\n Observable.amb(o1, o2, o3)\n .subscribe(mList::add);\n\n mTestScheduler.advanceTimeBy(1000, TimeUnit.SECONDS);\n assertEquals(mList, Arrays.asList(1, 2, 3));\n }", "private static void exKeepingAppAliveTwo() {\n\n Observable.interval(1, TimeUnit.SECONDS)\n .take(3)\n .blockingSubscribe(System.out::println);\n\n\n\n /* OUTPUT :\n 0\n 1\n 2\n */\n }", "private static void createObservableUsingEmpty() {\n Observable<?> observable = Observable.empty();\n\n observable.subscribe(x -> LOG.info(\"{}\", x), error -> LOG.info(\"Error 1: {}\", error.hashCode()));\n observable.subscribe(x -> LOG.info(\"{}\", x),\n error -> LOG.info(\"{}\", error.getLocalizedMessage()),\n () -> LOG.info(\"Completed\"));\n }", "@Nonnull \r\n\tpublic static <T> Observable<T> prune(\r\n\t\t\tfinal Observable<? extends T> source\r\n\t) {\r\n\t\treturn replay(source, 1);\r\n\t}", "@Override\n\t\t\t\t\tpublic void onSubscribe(Disposable p1) {\n\t\t\t\t\t}", "public void discard() {\n }", "public static void zipObservables(CountDownLatch latch) {\n\n Observable<Observable<String>> source = Observable.create(observableEmitter -> {\n System.out.println(\"create\");\n observableEmitter.onNext(Observable.just(\"abc\", \"def\"));\n observableEmitter.onNext(Observable.just(\"123\", \"456\"));\n observableEmitter.onNext(Observable.just(\"alpha\", \"beta\", \"gama\"));\n observableEmitter.onComplete();\n });\n\n source.doOnSubscribe(d -> System.out.println(\"source doOnSubscribe\"));\n source.doOnNext(i -> System.out.println(\"source doOnNext = \" + i.toString()));\n source.doOnComplete(() -> System.out.println(\"source doOnComplete\"));\n\n\n Observable.zip(source, items -> items[0] + \"-\" + items[1] + \"-\" + items[2])\n .doOnSubscribe(d -> System.out.println(\"zip doOnSubscribe\"))\n .doOnNext(i -> System.out.println(\"zip doOnNext\"))\n .subscribe(new MyObserver<>(latch));\n }", "public static void test009()\r\n {\r\n System.out.println(\"RxJavaTest04::test009\");\r\n List<String> tickets = new ArrayList<String>(Arrays.asList(\"one\", \"two\", \"three\", \"four\", \"five\"));\r\n List<String> failures = Observable.fromIterable(tickets)\r\n .flatMap(ticket ->\r\n myRxSendEmail(ticket)\r\n .flatMap(response -> Observable.<String>empty())\r\n .doOnError(e -> System.out.printf(\"Failed to send %s: %s\\n\", ticket, e))\r\n .onErrorReturn(err -> ticket)\r\n .subscribeOn(Schedulers.io())\r\n )\r\n .toList()\r\n .blockingGet();\r\n for (String failure : failures) {\r\n System.out.println(failure);\r\n }\r\n }", "void disposeObservable();", "@Test\n public void example() {\n Func1<Integer, Observable<Integer>> db1 = param -> Observable.range(1, param);\n\n // ws-kald som funktion der returner en Observable\n Func1<Integer, Observable<Integer>> ws1 = param -> Observable.just(param);\n\n // ws-kald som funktion der returner en Observable\n Func1<Integer, Observable<Integer>> ws2 = param -> Observable.just(param);\n\n // ws-kald som funktion der returner en Observable\n Func1<List<Integer>, Observable<Object>> ws3 = param -> Observable.empty();\n\n db1.call(5)\n .flatMap(row -> {\n if (row % 2 == 0) {\n // ws2 kaldes kun, hvis ws1 ikke var tom\n return Observable.concat(ws1.call(row), ws2.call(row)).first();\n } else {\n // ws1 og ws2 udføres parallelt\n return Observable.zip(ws1.call(10), ws2.call(20), (e1, e2) -> e1 + e2);\n }\n })\n .onErrorResumeNext(err -> {\n log.error(\"error - resume next \", err);\n return Observable.empty();\n })\n .doOnNext(n -> log.info(\"element {}\", n))\n // samle/batche 2 elementer i en liste (men højst vente 1 sekund)\n .buffer(2, 1, TimeUnit.SECONDS)\n // output sendes til en ws3\n .flatMap(ws3)\n // subscribe starter kæden\n .subscribe();\n }", "@Override\n public void rxUnsubscribe() {\n if (placesSubscriber != null) {\n if (!placesSubscriber.isDisposed()) {\n placesSubscriber.dispose();\n }\n }\n }", "private static void backPressureChallenge() {\n\t\tObservable.range(1, 1000000)\n\t\t//below map will run in sequential\n\t\t//since sequential it has to complete whole task then only it can allow consumer to start\n\t\t\t.map(item -> {\n\t\t\t\tSystem.out.println(\"Produced item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t\treturn item;\n\t\t\t})\n\t\t\t.observeOn(Schedulers.io())\n\t\t\t//.subscribeOn(Schedulers.io())//with this whole pipelein runs in seprate thread paralleley\n\t\t\t//below will run in concurrent\n\t\t\t.subscribe(item ->{\n\t\t\t\t//mimcing slowness\n\t\t\t\tThreadUtil.sleep(300);\n\t\t\t\tSystem.out.println(\"Consumed item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t})\n\t\t\t\n\t\t\t;\n\t\t\n\t\t//since running in async we need to sleep\n\t\tThreadUtil.sleep(10000000);\n\t}", "@Override\n\tpublic void discardUnget() {\n\t\t\n\t}", "public static void switchOnNext(CountDownLatch latch) {\n\n List<Observable<Long>> collectionOfObservable = new ArrayList<>();\n\n Observable<Long> first = Observable.interval(1L, TimeUnit.SECONDS).take(5)\n .doOnNext((item) -> System.out.println(\"first doOnNext item = \" + item));\n\n Observable<Long> second = Observable.interval(1L, TimeUnit.SECONDS)\n .map(item -> item + 100).take(10);\n\n collectionOfObservable.add(first);\n collectionOfObservable.add(second);\n\n Observable.switchOnNext(Observable.fromIterable(collectionOfObservable))\n .subscribeOn(Schedulers.io()).subscribe(new MyObserver<>(latch));\n }", "public static void flatMap() {\n List<String> data = Utils.getData();\n Observable.fromIterable(data)\n .flatMap((item) -> Observable.just(item + \" flat mapped\").repeat(2)\n ).subscribe(new MyObserver<>());\n }", "@Test\n public void discardPlayer2() {\n gm.setPlayerInfo(clientPlayer2);\n gm.setThisPlayerIndex(clientPlayer2.getPlayerIndex());\n\n dc.increaseAmount(ResourceType.ORE);\n dc.increaseAmount(ResourceType.ORE);\n dc.increaseAmount(ResourceType.WOOD);\n dc.increaseAmount(ResourceType.WOOD);\n assertEquals(2, getAmounts().getOfType(ResourceType.ORE));\n assertEquals(2, getAmounts().getOfType(ResourceType.WOOD));\n Player p = model.getPlayer(clientPlayer2.getPlayerIndex());\n ResourceSet discardSet = dc.getDiscardAmount();\n when(robberFacade.canDiscard(discardSet, p)).thenReturn(true);\n dc.discard();\n // This verifies that the robberFacade.discard is only called twice\n verify(robberFacade, atMost(2)).discard(discardSet, p);\n\n }", "public static void test016()\r\n {\r\n System.out.println(\"RxJavaTest04::test016\");\r\n ExecutorService poolA = Executors.newFixedThreadPool(10, newThreadFactory(\"Sched-A-%d\"));\r\n Scheduler schedulerA = Schedulers.from(poolA);\r\n RxGroceries rxGroceries = new RxGroceries();\r\n\r\n Maybe<BigDecimal> totalPrice = Observable\r\n .fromIterable(Arrays.asList(\"bread\", \"butter\", \"milk\", \"tomato\", \"cheese\"))\r\n .subscribeOn(schedulerA)\r\n .flatMap(prod -> rxGroceries\r\n .purchase(prod, 1)\r\n .subscribeOn(schedulerA)\r\n )\r\n .reduce(BigDecimal::add);\r\n totalPrice\r\n .subscribe(\r\n x -> log(\"Got \" + x),\r\n Throwable::printStackTrace,\r\n () -> log(\"Completed\")\r\n );\r\n myWait(2000); // We have to wait before shutting down the pool,\r\n // otherwise it will throw exception \r\n // [java] io.reactivex.exceptions.UndeliverableException:\r\n // java.util.concurrent.RejectedExecutionException:\r\n // Task java.util.concurrent.FutureTask@38d8f9d0 rejected\r\n // from java.util.concurrent.ThreadPoolExecutor@6a724a6c\r\n // [Shutting down, pool size = 1, active threads = 1, queued\r\n // tasks = 0, completed tasks = 0]\r\n poolA.shutdown();\r\n }", "private static void fluxConnectToSecondSubscriberWithoutUseCache() throws InterruptedException {\n Flux<Long> startTheExecutionFlux = Flux.interval(Duration.ofSeconds(1)).share();\n\n Flux FluxOne = Flux.from(startTheExecutionFlux);\n //a cada cinco segundos é gerado um novo numero\n Disposable disposable = FluxOne.subscribe(out -> System.out.println(\"FluxOne value: \" + out));\n new CountDownLatch(1).await(5, TimeUnit.SECONDS);\n\n Flux fluxTwo = Flux.from(startTheExecutionFlux);\n Disposable secondDisposable = fluxTwo.subscribe(out -> System.out.println(\"fluxTwo value: \" + out));\n new CountDownLatch(1).await(5, TimeUnit.SECONDS);\n\n disposable.dispose();\n secondDisposable.dispose();\n //imprime ambos os valores sem uso de cache\n }", "void onDiscardChangesSelected();", "void unpublish() {\n pendingOps.decrementAndGet();\n }", "public static void test008()\r\n {\r\n System.out.println(\"RxJavaTest04::test008\");\r\n List<String> tickets = new ArrayList<String>(Arrays.asList(\"one\", \"two\", \"three\", \"four\", \"five\"));\r\n List<String> failures = Observable.fromIterable(tickets)\r\n .flatMap(ticket ->\r\n myRxSendEmail(ticket)\r\n .flatMap(response -> Observable.<String>empty())\r\n .doOnError(e -> System.out.printf(\"Failed to send %s: %s\\n\", ticket, e))\r\n .onErrorReturn(err -> ticket))\r\n .toList()\r\n .blockingGet();\r\n for (String failure : failures) {\r\n System.out.println(failure);\r\n }\r\n }", "private static void createHotAndConnectableObservable() {\n var observable = Observable.just(1, 2, 3, 4, 5).publish();\n\n observable.subscribe(item -> LOG.info(\"Connectable Observer 1: {}\", item));\n observable.subscribe(item -> LOG.info(\"Connectable Observer 2: {}\", item));\n\n pause(1000);\n // calling connect starts emitting immediately - any order\n observable.connect();\n\n // if we subscribe now it'll now be emitted - hot observable\n observable.subscribe(item -> LOG.info(\"Connectable Observer 3: {}\", item));\n }", "public static void buffer() {\n\n List<String> data = Utils.getData();\n\n int numberOfBuffers = 11;\n\n CountDownLatch latch = new CountDownLatch(numberOfBuffers);\n\n\n Observable.fromIterable(data).buffer(3).subscribe(new MyObserver<>(latch));\n\n Observable.fromIterable(data).buffer(2, 3).subscribe(new MyObserver<>(latch));\n\n Observable.fromIterable(data).buffer(2, 3, ArrayList::new).subscribe(new MyObserver<>(latch));\n\n Observable.fromIterable(data).buffer(2, HashSet::new).subscribe(new MyObserver<>(latch));\n\n /*\n Opening and closing windows defined\n */\n Observable.fromIterable(data).buffer((observer) -> {\n System.out.println(\"opening\");\n // Starts buffer collection window\n // For every onNext a buffer window is created.\n observer.onNext(\"opening-1\");\n observer.onNext(\"opening-2\");\n }, (value) -> {\n System.out.println(\"closing, value = \" + value);\n // Closes buffer collection window\n // Gets invoked for each onNext in opening indicator\n return Observable.just(value).delay(100L, TimeUnit.MICROSECONDS);\n }, HashSet::new).subscribe(new MyObserver<>(latch));\n\n /*\n Buffer with boundary observable\n */\n Observable.fromIterable(data).buffer((Observer<? super Integer> observer) -> {\n System.out.println(\"onNext - 1\");\n observer.onNext(1);\n observer.onNext(2);\n }).subscribe(new MyObserver<>(latch));\n\n /*\n 1. Buffer with boundary observable by providing some other in built observable\n 2. Create a buffer of 100 Microseconds\n */\n Observable.fromIterable(data)\n .buffer(Observable.interval(100L, TimeUnit.MICROSECONDS))\n .subscribe(new MyObserver<>(latch));\n\n Observable.fromIterable(data)\n .buffer(Observable.interval(100L, TimeUnit.MICROSECONDS), 4)\n .subscribe(new MyObserver<>(latch));\n\n Observable.fromIterable(data)\n .buffer(Observable.interval(100L, TimeUnit.MICROSECONDS), () -> new HashSet<>())\n .subscribe(new MyObserver<>(latch));\n\n\n /*\n Boundary supplier is being passed from callable.\n */\n Observable.fromIterable(data)\n .buffer(() -> Observable.interval(100L, TimeUnit.MICROSECONDS))\n .subscribe(new MyObserver<>(latch));\n\n\n Observable.fromIterable(data)\n .buffer(() -> Observable.interval(100L, TimeUnit.MICROSECONDS), HashSet::new)\n .subscribe(new MyObserver<>(latch));\n\n try {\n latch.await();\n } catch (InterruptedException e) {\n System.out.println(e.getMessage());\n }\n }", "@Test\n public void sequenceEqual() {\n\n Observable<Long> o1 = Observable.just(1L, 2L, 3L, 4L, 5L)\n .delay(1000, TimeUnit.SECONDS, mTestScheduler);\n Observable<Long> o2 = Observable.interval(20, TimeUnit.SECONDS, mTestScheduler)\n .skip(1)\n .take(5);\n\n Observable.sequenceEqual(o1, o2)\n .subscribe(mList::add);\n\n mTestScheduler.advanceTimeBy(1200, TimeUnit.SECONDS);\n\n assertEquals(mList, Collections.singletonList(true));\n }", "public static void combineLatest() {\n\n System.out.println(\"# 1\");\n\n /*\n Emits item every second\n */\n Observable sourceInterval = Observable.interval(1L, TimeUnit.MILLISECONDS).take(10);\n\n /*\n Emits string items\n */\n Observable sourceString = Observable.fromIterable(sData);\n\n Observable<?> combined = Observable.combineLatest((objects) -> {\n StringBuilder stringBuilder = new StringBuilder();\n Stream.of(objects).forEach(stringBuilder::append);\n return stringBuilder.toString();\n }, 1, sourceInterval, sourceString);\n\n combined.subscribe(new MyObserver<>());\n\n System.out.println(\"# 2\");\n\n /*\n Because empty observable immediately terminates hence whole sequence terminates.\n */\n combined = Observable.combineLatest((objects) -> {\n StringBuilder stringBuilder = new StringBuilder();\n Stream.of(objects).forEach(stringBuilder::append);\n return stringBuilder.toString();\n }, 1, sourceInterval, sourceString, Observable.empty());\n combined.subscribe(new MyObserver<>());\n\n System.out.println(\"# 3\");\n /*\n Same as above but instead collection of sources are used.\n */\n List<Observable<?>> collection = new ArrayList<>();\n collection.add(sourceInterval);\n collection.add(sourceString.repeat(1));\n combined = Observable.combineLatest(collection, (objects) -> {\n StringBuilder stringBuilder = new StringBuilder();\n Stream.of(objects).forEach(stringBuilder::append);\n return stringBuilder.toString();\n });\n combined.subscribe(new MyObserver<>());\n\n System.out.println(\"# 4\");\n /*\n Explicitly combine 2 sources, similarly it can be done up to 10 sources\n */\n combined = Observable.combineLatest(sourceInterval, sourceString.repeat(1),\n (first, second) -> first + \"-\" + second);\n combined.subscribe(new MyObserver<>());\n }", "@Nonnull \r\n\tpublic static <T, U> Observable<U> prune(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func1<? super Observable<? extends T>, ? extends Observable<U>> selector\r\n\t) {\r\n\t\treturn replay(source, selector, 1);\r\n\t}", "public void observaleJust() {\n\t\tObservable.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).subscribe(integerSubscribe());\r\n\t}", "void drainFused() {\n int n;\n int n2 = 1;\n Subscriber<T> subscriber = this.actual;\n SimpleQueueWithConsumerIndex<Object> simpleQueueWithConsumerIndex = this.queue;\n do {\n if (this.cancelled) {\n simpleQueueWithConsumerIndex.clear();\n return;\n }\n Throwable throwable = (Throwable)this.error.get();\n if (throwable != null) {\n simpleQueueWithConsumerIndex.clear();\n subscriber.onError(throwable);\n return;\n }\n n = simpleQueueWithConsumerIndex.producerIndex() == this.sourceCount ? 1 : 0;\n if (!simpleQueueWithConsumerIndex.isEmpty()) {\n subscriber.onNext(null);\n }\n if (n != 0) {\n subscriber.onComplete();\n return;\n }\n n2 = n = this.addAndGet(-n2);\n } while (n != 0);\n }", "@Test\n public void discardIfCannot() {\n gm.setPlayerInfo(clientPlayer3);\n gm.setThisPlayerIndex(clientPlayer3.getPlayerIndex());\n dc.increaseAmount(ResourceType.ORE);\n dc.increaseAmount(ResourceType.ORE);\n dc.increaseAmount(ResourceType.WOOD);\n assertEquals(2, getAmounts().getOfType(ResourceType.ORE));\n assertEquals(1, getAmounts().getOfType(ResourceType.WOOD));\n Player p = model.getPlayer(clientPlayer3.getPlayerIndex());\n when(robberFacade.canDiscard(dc.getDiscardAmount(), p)).thenReturn(false);\n dc.discard();\n // This verifies that the robberFacade.discard is only called once instead of twice\n verify(robberFacade, atMost(1)).discard(dc.getDiscardAmount(), p);\n\n }", "@Test\n public void onlyWithMap(){\n Observable<Observable<PhoneNumber>> usersPhonesNumbers = costService\n .findUserInDepartment(DEPARTMENT_ID)\n .map(costService::findPhoneNumber);//<-- returns observable\n\n //Strange type here :o\n Observable<Observable<BigDecimal>> priceStream = usersPhonesNumbers\n .map(phones -> phones.map(costService::getPricePerSmsForNumber));\n\n Observable<BigDecimal> costPerPerson = priceStream.map(userPhones -> userPhones.reduce(ZERO, BigDecimal::add).blockingGet());//blockingGet<---only one difference in comparison to streams\n\n BigDecimal totalCost = costPerPerson.reduce(ZERO, BigDecimal::add).blockingGet(); //blockingGet<---only one difference in comparison to streams\n log.info(\"Total cost of sending SMSes to all users all phones {}\", totalCost);\n }", "public static void sample() {\n System.out.println(\"# 1\");\n Observable.fromIterable(sData)\n .timestamp()\n .sample(1000, TimeUnit.MICROSECONDS)\n .subscribe(new MyObserver<>());\n\n /*\n Emission controlled by sampler inner observable\n */\n System.out.println(\"# 2\");\n Observable.fromIterable(sData)\n .sample((observer) -> {\n System.out.println(\"emitter\");\n Observable.just(\"123\").subscribe(observer);\n }, true).subscribe(new MyObserver<>());\n }", "public static void main(String[] args){\n Observable myObservable = Observable.create(new Observable.OnSubscribe(){\n\n @Override\n public void call(Object subscriber) {\n Subscriber mySubscriber = (Subscriber)subscriber;\n\n for(int i = 0 ; i < 10; i++){\n //if my subscriber was subscribed\n if(!mySubscriber.isUnsubscribed()){\n mySubscriber.onNext(\"Pushed value \" + i);\n }\n }\n\n if(!mySubscriber.isUnsubscribed()){\n mySubscriber.onCompleted();\n }\n\n }\n });\n\n //subscribe to your Observable\n myObservable.subscribe(new Action1<String>() {\n @Override\n public void call(String s) {\n System.out.println(s);\n }\n },\n new Action1<Throwable>() {\n @Override\n public void call(Throwable throwable) {\n System.out.println(\"Something went wrong the observable\");\n }\n },\n new Action0() {\n @Override\n public void call() {\n System.out.println(\"No more values will be pushed.\");\n }\n });\n\n }", "private void getItemsInBasket(){\n Disposable disposable = mViewModel.getItemsInBasket()\n .subscribeOn(Schedulers.io())\n .observeOn(AndroidSchedulers.mainThread())\n .doOnError(throwable -> Log.e(\"BasketFragment\",throwable.getMessage()))\n .subscribe(basketItems -> basketListAdapter.submitList(basketItems));\n mDisposable.add(disposable);\n }", "void filterDisposed(Filter filter);", "private static void scenario() {\n\n Observable<String> stringObservable = Observable.just(\"One\",\"Two\",\"Three\",\"Four\",\"Five\",\"Six\",\"Seven\",\"Eight\",\"Nine\");\n\n Observable<String> stringProcessor = stringObservable.concatMap(data -> Observable.just(data).delay(randomSleepTime(),\n TimeUnit.MILLISECONDS));\n\n stringProcessor.subscribe(System.out::println);\n\n sleep(20000);\n\n /* OUTPUT :\n One\n Two\n Three\n Four\n Five\n Six\n Seven\n Eight\n Nine\n */\n }", "protected void discard()\n {\n if (!isDiscarded())\n {\n OldOldCache map = OldOldCache.this;\n synchronized (map)\n {\n int cUnits = m_cUnits;\n if (cUnits == -1)\n {\n // entry is discarded; avoid repetitive events\n return;\n }\n\n if (cUnits > 0)\n {\n map.adjustUnits(-cUnits);\n }\n\n m_cUnits = -1;\n }\n\n // issue remove notification\n if (map.hasListeners())\n {\n map.dispatchEvent(map.instantiateMapEvent(\n MapEvent.ENTRY_DELETED, getKey(), getValue(), null));\n }\n }\n }", "@Nonnull \r\n\tpublic static <T> Observable<T> ignoreValues(\r\n\t\t\t@Nonnull final Observable<? extends T> source) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\treturn source.register(new Observer<T>() {\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\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 finish() {\r\n\t\t\t\t\t\tobserver.finish();\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 next(T value) {\r\n\t\t\t\t\t\t// ignored\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t};\r\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> never() {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull Observer<? super T> observer) {\r\n\t\t\t\treturn Closeables.emptyCloseable();\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public static Observable<String> getObservableDistinctUntilChanges() {\n return observableSrcDuplicated;//todo\n }", "void discard();", "void discard();", "@BackpressureSupport(BackpressureKind.FULL)\n @SchedulerSupport(SchedulerKind.CUSTOM)\n public final Observable<T> skip(long time, TimeUnit unit, Scheduler scheduler) {\n return skipUntil(timer(time, unit, scheduler));\n }", "@Test\n public void skipWhile() {\n Observable.interval(100, TimeUnit.SECONDS, mTestScheduler)\n .map(num -> num + 1)\n .take(7)\n .skipWhile(aLong -> aLong != 4)\n .subscribe(mList::add);\n\n mTestScheduler.advanceTimeBy(1000, TimeUnit.SECONDS);\n assertEquals(mList, Arrays.asList(4L, 5L, 6L, 7L));\n }", "@ServiceAction\n protected void onNotificationDismissed(final ArrayList<Integer> serversRequiringNotification) {\n Observable.from(servers)\n .filter(new Func1<MinecraftServerEntity, Boolean>() {\n @Override\n public Boolean call(MinecraftServerEntity server) {\n return serversRequiringNotification.contains(server.getId());\n }\n })\n .map(new Func1<MinecraftServerEntity, MinecraftServerEntity>() {\n @Override\n public MinecraftServerEntity call(MinecraftServerEntity server) {\n server.setHasOfflineStatusBeenSeen(true);\n return server;\n }\n })\n .subscribeOn(AndroidSchedulers.mainThread())\n .observeOn(AndroidSchedulers.mainThread())\n .subscribe(new Action1<MinecraftServerEntity>() {\n @Override\n public void call(MinecraftServerEntity server) {\n if (DEBUG)\n Log.d(TAG, String.format(\"'%s' offline status has been seen by the user. Updating the database\", server.getName()));\n //We update the value in the database\n runtimeMinecraftServerDao.update(server);\n }\n });\n }", "public static void error() {\n Observable<String> myObservable = Observable.error(\n () -> new Exception(\"Exception from error observable\"));\n myObservable.subscribe(genericObserver1);\n }", "private static void backPressureFix() {\n\t\tFlowable.range(1, 1000000)\n\t\t//below map will run in sequential\n\t\t//since sequential it has to complete whole task then only it can allow consumer to start\n\t\t\t.map(item -> {\n\t\t\t\tSystem.out.println(\"Produced item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t\treturn item;\n\t\t\t})\n\t\t\t.observeOn(Schedulers.io())\n\t\t\t//.subscribeOn(Schedulers.io())//with this whole pipelein runs in seprate thread paralleley\n\t\t\t//below will run in concurrent\n\t\t\t.subscribe(item ->{\n\t\t\t\t//mimcing slowness\n\t\t\t\tThreadUtil.sleep(300);\n\t\t\t\tSystem.out.println(\"Consumed item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t})\n\t\t\t\n\t\t\t;\n\t\t\n\t\t//since running in async we need to sleep\n\t\tThreadUtil.sleep(10000000);\n\t\t\t\n\t}", "private void test1() {\n Observable observable = Observable.create(new ObservableOnSubscribe<QuoteBean>() {\n @Override\n public void subscribe(ObservableEmitter<QuoteBean> e) throws Exception {\n e.onNext(Request.stringRequest(url, com.android.volley.Request.Method.GET, HomeActivity.class.getSimpleName()));\n }\n }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());\n\n Observer<QuoteBean> observer = new Observer<QuoteBean>() {\n @Override\n public void onSubscribe(Disposable d) {\n Log.d(TAG, \"test1 onSubscribe\");\n }\n\n @Override\n public void onNext(QuoteBean s) {\n Log.d(TAG, \"onNext:\" + s.toString());\n }\n\n @Override\n public void onError(Throwable e) {\n Log.d(TAG, \"onError\");\n }\n\n @Override\n public void onComplete() {\n Log.d(TAG, \"onComplete\");\n }\n };\n observable.subscribe(observer);\n }", "public void flatMap() {\r\n\t\tList<Integer> list = Arrays.asList(1, 2, 3, 7, 8, 9, 10);\r\n\t\tList<Integer> list2 = Arrays.asList(4, 5, 6);\r\n\t\tObservable.just(list, list2).flatMap(x -> Observable.from(x)).map(x -> x * 10).subscribe(integerSubscribe());\r\n\t}", "private List<Intent> handleSubscribeFailure (ContentResolver contentResolver, ArrayList<String> requestIds,\n MediatorTuple mediatorTuple) {\n List<Intent> intentsToBroadcast = new ArrayList<Intent>();\n String consumer = mediatorTuple.getConsumer();\n\n if (requestIds.size() > 1) {\n //Other subscribe requests are pending. Only remove this entry.\n mediatorTuple.removeSubscribeRequestId(mResponseId);\n MediatorHelper.updateTuple(contentResolver, mediatorTuple);\n } else {\n //Subscribe failed. Remove entry from the database\n MediatorHelper.deleteFromMediatorDatabase(contentResolver, consumer, mPublisher, mConfig);\n }\n intentsToBroadcast.add(MediatorHelper.createCommandResponseIntent(consumer, mConfig,\n mResponseId, SUBSCRIBE_RESPONSE_EVENT, mPublisher, mStatus, mState, null));\n return intentsToBroadcast;\n }", "public void stopAll(ContentItem contentItem)\n {\n if (log.isInfoEnabled())\n {\n log.info(\"stopAll: \" + contentItem);\n }\n //release all streams associated with the connection id for a streaming content item \n //map of connection ids to set of streams to release\n Map streamsToRelease = new HashMap(); \n synchronized (lock)\n {\n for (Iterator activeStreamSetsIter = activeStreams.entrySet().iterator(); activeStreamSetsIter.hasNext();)\n {\n Map.Entry entry = (Map.Entry)activeStreamSetsIter.next();\n Integer connectionId = (Integer) entry.getKey();\n Set streams = (Set) entry.getValue();\n for (Iterator streamSetForConnectionId = streams.iterator(); streamSetForConnectionId.hasNext();)\n {\n Stream stream = (Stream)streamSetForConnectionId.next();\n //release all streams associated with any connection id streaming the contentitem \n if (stream.isTransmitting(contentItem))\n {\n Set currentEntries = (Set) streamsToRelease.get(connectionId);\n if (currentEntries == null)\n {\n currentEntries = new HashSet();\n }\n currentEntries.addAll(streams);\n //release all streams associated with this connection id\n streamsToRelease.put(connectionId, currentEntries);\n //there may or may not be an active stream, remove from authorized connections regardless\n cachedAuthorizations.remove(connectionId);\n break;\n }\n }\n }\n }\n \n for (Iterator iter = streamsToRelease.entrySet().iterator(); iter.hasNext();)\n {\n Map.Entry entry = (Map.Entry)iter.next();\n Integer connectionId = (Integer) entry.getKey();\n for (Iterator streams = ((Set)(entry.getValue())).iterator(); streams.hasNext(); )\n {\n doRelease((Stream)streams.next(), true);\n }\n // Notify the NAH that activity is ended for this connection\n ((NetSecurityManagerImpl) NetSecurityManager.getInstance()).notifyActivityEnd(connectionId.intValue(), HttpURLConnection.HTTP_OK);\n }\n }", "public void emitLoop() {\n Subscriber<? super R> subscriber = this.child;\n Queue<Object> queue2 = this.queue;\n AtomicLong atomicLong = this.requested;\n long j = atomicLong.get();\n while (!checkTerminated(this.done, queue2.isEmpty(), subscriber)) {\n long j2 = 0;\n while (j2 != j) {\n boolean z = this.done;\n Object poll = queue2.poll();\n boolean z2 = poll == null;\n if (!checkTerminated(z, z2, subscriber)) {\n if (z2) {\n break;\n }\n Object value = NotificationLite.getValue(poll);\n try {\n subscriber.onNext(value);\n j2++;\n } catch (Throwable th) {\n Exceptions.throwOrReport(th, (Observer<?>) subscriber, value);\n return;\n }\n } else {\n return;\n }\n }\n if (!(j2 == 0 || j == Long.MAX_VALUE)) {\n j = BackpressureUtils.produced(atomicLong, j2);\n }\n synchronized (this) {\n if (!this.missed) {\n this.emitting = false;\n return;\n }\n this.missed = false;\n }\n }\n }", "public static void concatMap() {\n List<String> data = Utils.getData();\n Observable.fromIterable(data)\n .concatMap((item) -> Observable.just(item + \" concat mapped\").repeat(2)\n ).subscribe(new MyObserver<>());\n }", "@Override\r\n\tpublic void discard(Resources toDiscard) {\n\t\t\r\n\t}", "public static void test015()\r\n {\r\n System.out.println(\"RxJavaTest04::test015\");\r\n ExecutorService poolA = Executors.newFixedThreadPool(10, newThreadFactory(\"Sched-A-%d\"));\r\n Scheduler schedulerA = Schedulers.from(poolA);\r\n RxGroceries rxGroceries = new RxGroceries();\r\n\r\n Maybe<BigDecimal> totalPrice = Observable\r\n .fromIterable(Arrays.asList(\"bread\", \"butter\", \"milk\", \"tomato\", \"cheese\"))\r\n .subscribeOn(schedulerA)\r\n .flatMap(prod -> rxGroceries.purchase(prod, 1))\r\n .reduce(BigDecimal::add);\r\n totalPrice\r\n .subscribe(System.out::println);\r\n poolA.shutdown();\r\n }", "private void clearTasks(){\n ArrayList<Item> iteratorList = new ArrayList<Item>(items);\n Iterator<Item> it = iteratorList.iterator();\n while(it.hasNext()){\n Item i = it.next();\n if (!i.isCategory()){\n Task t = (Task) i;\n if(t.finished){\n \tDirectIO.RemoveItem(t);\n adapter.remove(i);\n }\n }\n }\n }", "@Test\n public void testDefer() throws InterruptedException {\n Observable<LocalTime> localTimeObservable =\n Observable.defer(\n () -> Observable\n .just(LocalTime.now()))\n .repeat(3);\n localTimeObservable.subscribe(System.out::println);\n Thread.sleep(3000);\n System.out.println(\"Next Subscriber\");\n localTimeObservable.subscribe(System.out::println);\n }", "void unsetCombine();", "public static void main(String[] args) throws Exception {\n\t\tFlowable<String> obs4 = Flowable.just(\"un\", \"deux\", \"trois\", \"quatre\", \"sank\", \"six\", \"sept\", \"huit\", \"neuf\", \"deese\");\n//\t\tobs4.map(mapper -> {\n//\t\t\tif (\"deux\".equals(mapper))\n//\t\t\t\tThread.sleep(2000);\n//\t\t\treturn mapper+\" -- \"+Thread.currentThread().getName();\n//\t\t})\t\n//\t\t.subscribe(System.out::println);\n\t\t\n\t\tObserver<String> observer1 = new Observer<String>() {\n\n\t\t\t@Override\n\t\t\tpublic void onComplete() {\n\t\t\t\tSystem.out.println(\"Completed...\");\n\t\t\t\t\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onError(Throwable arg0) {\n\t\t\t\targ0.printStackTrace();\n\t\t\t\t\n\t\t\t}\n\n\t\t\t\n\t\t\t@Override\n\t\t\tpublic void onSubscribe(Disposable arg0) {\n\t\t\t\t// TODO Auto-generated method stub\n\t\t\t\t\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic void onNext(String arg0) {\n\t\t\t\tSystem.out.println(\"on next -- \"+arg0);\n\t\t\t\t\n\t\t\t}\n\t\t};\n\t\t\n\t\tList<String> list1 = Arrays.asList(\"un\",\"deux\",\"trois\",\"quatre\",\"sank\");\n\t\t\n\t\tObservable obs5 = Observable.fromIterable(list1);\n\t\t\n\t\t//obs5.subscribe(observer1);\n\t\t\n\t\t//Flowable.range(3, 10).subscribe(System.out::println);\n\t\t\n\t\tnew Thread(\n\t\t()->{\n\t\t\tobs4\n\t\t\t.map(mapper ->{\n\t\t\t\tif (\"deux\".equals(mapper) || \"quatre\".equals(mapper))\n\t\t\t\t\tThread.sleep(2000);\n\t\t\t\treturn mapper+\" -- \"+Thread.currentThread().getName();\n\t\t\t})\n\t\t\t.subscribe(System.out::println);\n\t\t\t\n\t\t}).start();\n\t\t\n//\t\tnew Thread() {\n//\t\t\tpublic void run() {\n//\t\t\t\tobs4\n//\t\t\t\t\t.map(mapper ->{\n//\t\t\t\t\t\tif (\"deux\".equals(mapper) || \"quatre\".equals(mapper))\n//\t\t\t\t\t\t\tThread.sleep(2000);\n//\t\t\t\t\t\treturn mapper+\" -- \"+Thread.currentThread().getName();\n//\t\t\t\t\t})\n//\t\t\t\t\t.subscribe(System.out::println);\n//\t\t\t}\n//\t\t}.start();\n\t\t\n//\t\tExecutor exe = Executors.newCachedThreadPool();\n//\t\t\n//\t\texe.execute(()->{\n//\t\t\t\n//\t\t\tobs4\n//\t\t\t.map(mapper ->{\n//\t\t\t\tif (\"deux\".equals(mapper) || \"quatre\".equals(mapper))\n//\t\t\t\t\tThread.sleep(2000);\n//\t\t\t\treturn mapper+\" -- \"+Thread.currentThread().getName();\n//\t\t\t})\n//\t\t\t.subscribe(System.out::println);\n\t\t\t\n//\t\t\tobs4.subscribe();\n//\t\t\tFlowable.zip(obs4, Flowable.interval(2, TimeUnit.SECONDS),(k,v)->k)\n//\t\t\t.subscribe((data)->{\n//\t\t\t\tSystem.out.println(\" \"+data+\" -- \"+Thread.currentThread().getName());\n//\t\t\t});\n//\t\t\tFlowable.interval(1, TimeUnit.SECONDS)\n//\t\t\t.map(mapper -> {\n//\t\t\t\tif (mapper == 3)\n//\t\t\t\t\tthrow new Exception(\" Time is Over !!! \");\n//\t\t\t\treturn mapper;\n//\t\t\t})\n//\t\t\t.subscribe((data)->{\n//\t\t\t\tSystem.out.println(data +\" -- \"+Thread.currentThread().getName());\n//\t\t\t},(e)->{\n//\t\t\t\te.printStackTrace();\n//\t\t\t});\n\t\t\t\n\t\t//});\n\t\t\n//\t\t//Thread.sleep(5000);\t\n//\t\tFlowable<String> flw1 = Flowable.just(\"un\",\"deux\",\"trois\",\"quatre\",\"sank\",\"six\",\"sept\");\n//\t\tflw1\n//\t\t//.subscribeOn(Schedulers.from(Executors.newFixedThreadPool(4)))\n//\t\t.map(mapper ->{\n//\t\t\tif (\"deux\".equals(mapper))\n//\t\t\t\tThread.sleep(1000);\n//\t\t\tif (\"quatre\".equals(mapper))\n//\t\t\t\tThread.sleep(500);\n//\t\t\treturn mapper +\" -- \"+Thread.currentThread().getName();\n//\t\t})\n//\t\t.subscribe(System.out::println);\n//\t\t\n//\t\tThread.sleep(2000);\n\t}", "@Test\n public void shouldDownloadAllUrls() throws Exception {\n //given\n Flowable<URL> urls = Urls.all();\n\n\n/* final Flowable<String> htmls2 = urls\n .flatMap(url -> UrlDownloader.download(url)\n .subscribeOn(Schedulers.io())); //ojo al subscribeon\n\n\n Flowable<Pair<String, String>> gel = urls.map(s -> {\n final String[] html = {\"\"};\n final String[] gelote = new String[1];\n\n UrlDownloader.download(s).subscribe(value -> {\n gelote[0] = value;\n });\n String result = gelote[0];\n return Pair.of(s.toURI().toString(), gelote[0]);\n });\n\n //\n Flowable<String> htmls =\n urls.flatMap(url -> UrlDownloader.download(url).subscribeOn(Schedulers.io()));\n\n Flowable<Pair<URL, Flowable<String>>> broken = urls.map(url -> Pair.of(url, UrlDownloader.download(url)));\n\n urls.flatMap(url -> {\n final Flowable<String> html = UrlDownloader.download(url);\n Flowable<Pair<URL,String>> var =html.map(htmlstr->Pair.of(url,htmlstr));\n return var;\n });\n\n */\n Flowable<Pair<URI, String>> pairs = urls.flatMap(url -> UrlDownloader.download(url)\n .subscribeOn(Schedulers.io())\n .map(htmlstr -> Pair.of(toUri(url), htmlstr)));\n\n\n //no confundir toMap con map\n //Maybe: 0..1 values\n //Single 1 value\n //Completable 0 values\n //Flowable 0...infinity\n //single es un stream que solo tiene un valor\n Single<Map<URI, String>> var = pairs.toMap((Pair<URI, String> pair) -> pair.getLeft(), (Pair<URI, String> pair) -> pair.getRight());\n Map<URI, String> bodies2 = var.blockingGet();\n Map<URI, String> bodies = pairs.toMap(Pair::getLeft, Pair::getRight).blockingGet();\n TimeUnit.SECONDS.sleep(20);\n\n //when\n //WARNING: URL key in HashMap is a bad idea here\n\n //No mutar el mapa del suscribe , en vez de eso, use toMap()\n //con confundir con el operador map()\n //blocking*\n\n\n /*Map<URI, String> bodies = new HashMap<>();*/\n\n/*\n gel.toMap(s.getLeft());\n gel.subscribe(System.out::println);\n*/\n\n //then\n assertThat(bodies).hasSize(996);\n assertThat(bodies).containsEntry(new URI(\"http://www.twitter.com\"), \"<html>www.twitter.com</html>\");\n assertThat(bodies).containsEntry(new URI(\"http://www.aol.com\"), \"<html>www.aol.com</html>\");\n assertThat(bodies).containsEntry(new URI(\"http://www.mozilla.org\"), \"<html>www.mozilla.org</html>\");\n }", "public void drain() {\r\n if (getAndIncrement() == 0) {\r\n SimpleQueue<T> simpleQueue = this.queue;\r\n int i = this.consumed;\r\n int i2 = this.bufferSize;\r\n int i3 = i2 - (i2 >> 2);\r\n boolean z = this.sourceMode != 1;\r\n int i4 = 1;\r\n int i5 = i;\r\n SimpleQueue<T> simpleQueue2 = simpleQueue;\r\n int i6 = i5;\r\n while (true) {\r\n if (simpleQueue2 != null) {\r\n long j = LongCompanionObject.MAX_VALUE;\r\n InnerSubscription[] innerSubscriptionArr = (InnerSubscription[]) this.subscribers.get();\r\n boolean z2 = false;\r\n for (InnerSubscription innerSubscription : innerSubscriptionArr) {\r\n long j2 = innerSubscription.get();\r\n if (j2 != Long.MIN_VALUE) {\r\n j = Math.min(j2 - innerSubscription.emitted, j);\r\n z2 = true;\r\n }\r\n }\r\n long j3 = 0;\r\n if (!z2) {\r\n j = 0;\r\n }\r\n while (true) {\r\n if (j == j3) {\r\n break;\r\n }\r\n boolean z3 = this.done;\r\n try {\r\n Object poll = simpleQueue2.poll();\r\n boolean z4 = poll == null;\r\n if (!checkTerminated(z3, z4)) {\r\n if (z4) {\r\n break;\r\n }\r\n int length = innerSubscriptionArr.length;\r\n for (int i7 = 0; i7 < length; i7++) {\r\n InnerSubscription innerSubscription2 = innerSubscriptionArr[i7];\r\n if (!innerSubscription2.isCancelled()) {\r\n innerSubscription2.downstream.onNext(poll);\r\n innerSubscription2.emitted++;\r\n }\r\n }\r\n if (z) {\r\n i6++;\r\n if (i6 == i3) {\r\n ((Subscription) this.upstream.get()).request((long) i3);\r\n i6 = 0;\r\n }\r\n }\r\n j--;\r\n if (innerSubscriptionArr != this.subscribers.get()) {\r\n break;\r\n }\r\n j3 = 0;\r\n } else {\r\n return;\r\n }\r\n } catch (Throwable th) {\r\n Throwable th2 = th;\r\n Exceptions.throwIfFatal(th2);\r\n ((Subscription) this.upstream.get()).cancel();\r\n simpleQueue2.clear();\r\n this.done = true;\r\n signalError(th2);\r\n return;\r\n }\r\n }\r\n if (checkTerminated(this.done, simpleQueue2.isEmpty())) {\r\n return;\r\n }\r\n }\r\n this.consumed = i6;\r\n i4 = addAndGet(-i4);\r\n if (i4 != 0) {\r\n if (simpleQueue2 == null) {\r\n simpleQueue2 = this.queue;\r\n }\r\n } else {\r\n return;\r\n }\r\n }\r\n }\r\n }", "@Override\r\n public Subscription onSubscribe(final Observer<? super String> observer) {\n final Thread t = new Thread(new Runnable() {\r\n @Override\r\n public void run() {\r\n for (int i = 0; i < 75; i++) {\r\n observer.onNext(\"anotherValue_\" + i);\r\n }\r\n // After sending all values we complete the sequence\r\n observer.onCompleted();\r\n }\r\n });\r\n t.start();\r\n \r\n return new Subscription() {\r\n @Override\r\n public void unsubscribe() {\r\n // Ask the thread to stop doing work.\r\n // For this simple example it just interrupts.\r\n t.interrupt();\r\n }\r\n };\r\n }", "@Test\n public void downloadThrottled() throws Exception {\n //given\n Flowable<URL> urls = Urls.all().take(20);\n //ojo al parametro del flatmap que indica el maximo de concurrencia\n Flowable<Pair<URI, String>> pairs = urls.flatMap(url -> UrlDownloader.downloadThrottled(url)\n .subscribeOn(Schedulers.io())\n .map(htmlstr -> Pair.of(toUri(url), htmlstr)), 10);\n Single<Map<URI, String>> var = pairs.toMap((Pair<URI, String> pair) -> pair.getLeft(), (Pair<URI, String> pair) -> pair.getRight());\n Map<URI, String> bodies2 = var.blockingGet();\n Map<URI, String> bodies = pairs.toMap(Pair::getLeft, Pair::getRight).blockingGet();\n\n\n Map<URI, String> bodies3 = urls.flatMap(url -> UrlDownloader.downloadThrottled(url)\n .subscribeOn(Schedulers.io())\n .map(htmlstr -> Pair.of(toUri(url), htmlstr)), 10).toMap(Pair::getLeft, Pair::getRight).blockingGet();\n\n //when\n //Use UrlDownloader.downloadThrottled()\n\n\n //then\n assertThat(bodies).containsEntry(new URI(\"http://www.twitter.com\"), \"<html>www.twitter.com</html>\");\n assertThat(bodies).containsEntry(new URI(\"http://www.adobe.com\"), \"<html>www.adobe.com</html>\");\n assertThat(bodies).containsEntry(new URI(\"http://www.bing.com\"), \"<html>www.bing.com</html>\");\n }", "public static Observable<String> getObservableDistinct() {\n return observableSrcDuplicated;//todo\n }", "protected void ignoreDuplicatedAddRemoveItemRequests()\n \t{\n \t\tif (this.getItems() != null)\n \t\t{\n \t\t\tfinal List<T> removeChildren = new ArrayList<T>();\n \t\t\n \t\t\t/* on the second loop, remove any items that are marked for both add and remove is separate items */\n \t\t\tfor (int i = 0; i < this.getItems().size(); ++i)\n \t\t\t{\n \t\t\t\tfinal T child1 = this.getItems().get(i);\n \t\t\t\t\n \t\t\t\t/* at this point we know that either add1 or remove1 will be true, but not both */\n \t\t\t\tfinal boolean add1 = child1.getAddItem();\n \t\t\t\tfinal boolean remove1 = child1.getRemoveItem();\n \t\t\t\t\n \t\t\t\t/* Loop a second time, looking for duplicates */\n \t\t\t\tfor (int j = i + 1; j < this.getItems().size(); ++j)\n \t\t\t\t{\n \t\t\t\t\tfinal T child2 = this.getItems().get(j);\n \t\t\t\t\t\n \t\t\t\t\tif (child1.getId().equals(child2.getId()))\n \t\t\t\t\t{\n \t\t\t\t\t\tfinal boolean add2 = child2.getAddItem();\n \t\t\t\t\t\tfinal boolean remove2 = child2.getRemoveItem();\n \t\t\t\t\t\t\n \t\t\t\t\t\t/* check for double add, double remove, add and remove, remove and add */\n \t\t\t\t\t\tif ((add1 && add2) || (remove1 && remove2) || (add1 && remove2) || (remove1 && add2))\t\t\t\t\t\t\n \t\t\t\t\t\t\tif (!removeChildren.contains(child1))\n \t\t\t\t\t\t\t\tremoveChildren.add(child1);\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n\t\t\t\n\t\t\tfor (final T removeChild : removeChildren)\n\t\t\t\tthis.getItems().remove(removeChild);\n \t\t}\n \t}", "ObservableList<Task> getUnfilteredTaskList();", "public void drain() {\n int missed;\n if (getAndIncrement() == 0) {\n SpscLinkedArrayQueue<Object> q = this.queue;\n Subscriber<? super R> a = this.actual;\n int missed2 = 1;\n while (this.cancelled == 0) {\n if (this.error.get() != null) {\n q.clear();\n cancelAll();\n errorAll(a);\n return;\n }\n boolean d = this.active.get() == 0;\n Integer mode = (Integer) q.poll();\n boolean empty = mode == null;\n if (d && empty) {\n this.lefts.clear();\n this.rights.clear();\n this.disposables.dispose();\n a.onComplete();\n return;\n } else if (empty) {\n missed2 = addAndGet(-missed2);\n if (missed2 == 0) {\n return;\n }\n } else {\n TRight val = q.poll();\n if (mode == LEFT_VALUE) {\n TRight tright = val;\n int i = this.leftIndex;\n this.leftIndex = i + 1;\n int idx = i;\n this.lefts.put(Integer.valueOf(idx), tright);\n try {\n Publisher publisher = (Publisher) ObjectHelper.requireNonNull(this.leftEnd.apply(tright), \"The leftEnd returned a null Publisher\");\n TRight right = new FlowableGroupJoin.LeftRightEndSubscriber(this, true, idx);\n this.disposables.add(right);\n publisher.subscribe(right);\n Throwable ex = this.error.get();\n if (ex != null) {\n q.clear();\n cancelAll();\n errorAll(a);\n return;\n }\n long r = this.requested.get();\n Iterator<TRight> it = this.rights.values().iterator();\n missed = missed2;\n Throwable th = ex;\n long e = 0;\n while (it.hasNext()) {\n TRight end = right;\n Iterator<TRight> it2 = it;\n try {\n R w = ObjectHelper.requireNonNull(this.resultSelector.apply(tright, it.next()), \"The resultSelector returned a null value\");\n if (e != r) {\n a.onNext(w);\n e++;\n right = end;\n it = it2;\n } else {\n R r2 = w;\n ExceptionHelper.addThrowable(this.error, new MissingBackpressureException(\"Could not emit value due to lack of requests\"));\n q.clear();\n cancelAll();\n errorAll(a);\n return;\n }\n } catch (Throwable exc) {\n fail(exc, a, q);\n return;\n }\n }\n TRight end2 = right;\n if (e != 0) {\n BackpressureHelper.produced(this.requested, e);\n }\n } catch (Throwable exc2) {\n int i2 = missed2;\n fail(exc2, a, q);\n return;\n }\n } else {\n missed = missed2;\n if (mode == RIGHT_VALUE) {\n TRight right2 = val;\n int i3 = this.rightIndex;\n this.rightIndex = i3 + 1;\n int idx2 = i3;\n this.rights.put(Integer.valueOf(idx2), right2);\n try {\n Publisher publisher2 = (Publisher) ObjectHelper.requireNonNull(this.rightEnd.apply(right2), \"The rightEnd returned a null Publisher\");\n FlowableGroupJoin.LeftRightEndSubscriber end3 = new FlowableGroupJoin.LeftRightEndSubscriber(this, false, idx2);\n this.disposables.add(end3);\n publisher2.subscribe(end3);\n Throwable ex2 = this.error.get();\n if (ex2 != null) {\n q.clear();\n cancelAll();\n errorAll(a);\n return;\n }\n long r3 = this.requested.get();\n Iterator<TLeft> it3 = this.lefts.values().iterator();\n Throwable th2 = ex2;\n FlowableGroupJoin.LeftRightEndSubscriber leftRightEndSubscriber = end3;\n long e2 = 0;\n while (it3.hasNext()) {\n int idx3 = idx2;\n Iterator<TLeft> it4 = it3;\n try {\n R w2 = ObjectHelper.requireNonNull(this.resultSelector.apply(it3.next(), right2), \"The resultSelector returned a null value\");\n if (e2 != r3) {\n a.onNext(w2);\n e2++;\n idx2 = idx3;\n it3 = it4;\n } else {\n R r4 = w2;\n ExceptionHelper.addThrowable(this.error, new MissingBackpressureException(\"Could not emit value due to lack of requests\"));\n q.clear();\n cancelAll();\n errorAll(a);\n return;\n }\n } catch (Throwable exc3) {\n fail(exc3, a, q);\n return;\n }\n }\n if (e2 != 0) {\n BackpressureHelper.produced(this.requested, e2);\n }\n } catch (Throwable exc4) {\n int i4 = idx2;\n fail(exc4, a, q);\n return;\n }\n } else if (mode == LEFT_CLOSE) {\n FlowableGroupJoin.LeftRightEndSubscriber end4 = (FlowableGroupJoin.LeftRightEndSubscriber) val;\n this.lefts.remove(Integer.valueOf(end4.index));\n this.disposables.remove(end4);\n } else if (mode == RIGHT_CLOSE) {\n FlowableGroupJoin.LeftRightEndSubscriber end5 = (FlowableGroupJoin.LeftRightEndSubscriber) val;\n this.rights.remove(Integer.valueOf(end5.index));\n this.disposables.remove(end5);\n }\n }\n missed2 = missed;\n }\n }\n q.clear();\n }\n }", "private static void createObservableUsingDefer() {\n LOG.info(LINE);\n // it prints from start up to (start + count - 1)\n final int start = 5;\n\n var observable = Observable.range(start, count);\n observable.subscribe(item -> LOG.info(\"Observer 1: {}\", item)); // only 5 6\n count = 3;\n observable.subscribe(item -> LOG.info(\"Observer 2: {}\", item)); // only 5 6 - count change is not reffered\n\n LOG.info(LINE);\n\n count = 2;\n observable = Observable.defer(() -> {\n System.out.println(\"New Observable is created with start = \" + start + \" and count = \" + count);\n return Observable.range(start, count);\n });\n\n observable.subscribe(item -> LOG.info(\"Observer 1: {}\", item)); // only 5 6\n count = 3;\n observable.subscribe(item -> LOG.info(\"Observer 2: {}\", item)); // 5 6 7 - count change used by new range object\n }", "private void handleEarlySubscribeReceived()\n {\n for(Jid from : earlySubscriptions.keySet())\n {\n handleSubscribeReceived(from, earlySubscriptions.get(from));\n }\n\n earlySubscriptions.clear();\n }", "@BackpressureSupport(BackpressureKind.ERROR)\n @SchedulerSupport(SchedulerKind.NONE)\n public final <B> Observable<List<T>> buffer(Publisher<B> boundary) {\n return buffer(boundary, new Supplier<List<T>>() {\n @Override\n public List<T> get() {\n return new ArrayList<T>();\n }\n });\n }", "@Nonnull\r\n\tpublic static <T> Observable<List<T>> forkJoin(\r\n\t\t\t@Nonnull final Iterable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Observable<List<T>>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super List<T>> observer) {\r\n\t\t\t\tfinal CompositeCloseable closeables = new CompositeCloseable();\r\n\t\t\t\tfinal List<AtomicReference<T>> lastValues = new ArrayList<AtomicReference<T>>();\r\n\t\t\t\tfinal List<Observable<? extends T>> observableList = new ArrayList<Observable<? extends T>>();\r\n\t\t\t\tfinal List<Observer<T>> observers = new ArrayList<Observer<T>>();\r\n\t\t\t\tfinal AtomicInteger wip = new AtomicInteger(observableList.size() + 1);\r\n\r\n\t\t\t\tint i = 0;\r\n\t\t\t\tfor (Observable<? extends T> o : sources) {\r\n\t\t\t\t\tfinal int j = i;\r\n\t\t\t\t\tobservableList.add(o);\r\n\t\t\t\t\tlastValues.add(new AtomicReference<T>());\r\n\t\t\t\t\tobservers.add(new Observer<T>() {\r\n\t\t\t\t\t\t/** The last value. */\r\n\t\t\t\t\t\tT last;\r\n\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t\t\tcloseables.closeSilently();\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 finish() {\r\n\t\t\t\t\t\t\tlastValues.get(j).set(last);\r\n\t\t\t\t\t\t\trunIfComplete(observer, lastValues, wip);\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 next(T value) {\r\n\t\t\t\t\t\t\tlast = value;\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\ti = 0;\r\n\t\t\t\tfor (Observable<? extends T> o : observableList) {\r\n\t\t\t\t\tcloseables.add(Observers.registerSafe(o, observers.get(i)));\r\n\t\t\t\t\ti++;\r\n\t\t\t\t}\r\n\t\t\t\trunIfComplete(observer, lastValues, wip);\r\n\t\t\t\treturn closeables;\r\n\t\t\t}\r\n\t\t\t/**\r\n\t\t\t * Runs the completion sequence once the WIP drops to zero.\r\n\t\t\t * @param observer the observer who will receive the values\r\n\t\t\t * @param lastValues the array of last values\r\n\t\t\t * @param wip the work in progress counter\r\n\t\t\t */\r\n\t\t\tpublic void runIfComplete(\r\n\t\t\t\t\tfinal Observer<? super List<T>> observer,\r\n\t\t\t\t\tfinal List<AtomicReference<T>> lastValues,\r\n\t\t\t\t\tfinal AtomicInteger wip) {\r\n\t\t\t\tif (wip.decrementAndGet() == 0) {\r\n\t\t\t\t\tList<T> values = new ArrayList<T>();\r\n\t\t\t\t\tfor (AtomicReference<T> r : lastValues) {\r\n\t\t\t\t\t\tvalues.add(r.get());\r\n\t\t\t\t\t}\r\n\t\t\t\t\tobserver.next(values);\r\n\t\t\t\t\tobserver.finish();\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public void emitLoop() {\n Subscriber<? super R> child2 = this.child;\n Queue<Object> queue2 = this.queue;\n NotificationLite<R> nl = NotificationLite.instance();\n AtomicLong requested2 = this.requested;\n long r = requested2.get();\n while (true) {\n boolean max = r == LongCompanionObject.MAX_VALUE;\n if (!checkTerminated(this.done, queue2.isEmpty(), child2)) {\n long e = 0;\n while (r != 0) {\n boolean d = this.done;\n Object o = queue2.poll();\n boolean empty = o == null;\n if (checkTerminated(d, empty, child2)) {\n return;\n }\n if (empty) {\n break;\n }\n R v = nl.getValue(o);\n try {\n child2.onNext(v);\n r--;\n e--;\n } catch (Throwable ex) {\n Exceptions.throwOrReport(ex, child2, v);\n return;\n }\n }\n if (e != 0 && !max) {\n r = requested2.addAndGet(e);\n }\n synchronized (this) {\n if (!this.missed) {\n this.emitting = false;\n return;\n }\n this.missed = false;\n }\n } else {\n return;\n }\n }\n }", "@Override\n protected void onSubscribe() {\n Subscription s = subscription;\n Disposable d = Disposable.from(s);\n \n if (!TerminalAtomics.set(this, DISCONNECT, d)) {\n done = true;\n return;\n }\n \n connected = true;\n s.request(Flow.defaultBufferSize());\n }", "public static void test001()\r\n {\r\n System.out.println(\"RxJavaTest04::test001\");\r\n Observable<String> peopleStream = myListPeople();\r\n Single<List<String>> peopleList = peopleStream.toList();\r\n List<String> people = peopleList.blockingGet();\r\n for (String person : people) {\r\n System.out.println(person);\r\n }\r\n }", "public static void test005()\r\n {\r\n System.out.println(\"RxJavaTest04::test005\");\r\n Observable<String> flight = myRxLookupFlight(\"Amsterdam\");\r\n Observable<String> passenger = myRxFindPassenger(1001);\r\n Observable<String> ticket =\r\n flight.zipWith(passenger, (f, p) -> myBookTicket(f, p));\r\n ticket.subscribe(RxJavaTest04::mySendEmail);\r\n }", "private void test() {\n Observable<String> observable = Observable.create(new ObservableOnSubscribe<String>() {\n\n @Override\n public void subscribe(ObservableEmitter<String> e) throws Exception {\n e.onNext(\"hello\");\n e.onNext(\"RXJAVA\");\n e.onComplete();\n }\n }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread());\n\n Observer<String> observer = new Observer<String>() {\n @Override\n public void onSubscribe(Disposable d) {\n Log.d(TAG, \"onSubscribe\");\n }\n\n @Override\n public void onNext(String s) {\n Log.d(TAG, \"onNext:\" + s);\n }\n\n @Override\n public void onError(Throwable e) {\n Log.d(TAG, \"onError\");\n }\n\n @Override\n public void onComplete() {\n Log.d(TAG, \"onComplete\");\n }\n };\n observable.subscribe(observer);\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> merge(\r\n\t\t\t@Nonnull final Iterable<? extends Observable<? extends T>> sources) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\tfinal CompositeCloseable closeables = new CompositeCloseable();\r\n\t\t\t\t\r\n\t\t\t\tList<Observable<? extends T>> sourcesList = new ArrayList<Observable<? extends T>>();\r\n\t\t\t\tfor (Observable<? extends T> os : sources) {\r\n\t\t\t\t\tsourcesList.add(os);\r\n\t\t\t\t}\r\n\t\t\t\tfinal AtomicInteger wip = new AtomicInteger(sourcesList.size() + 1);\r\n\t\t\t\tfinal List<DefaultObserverEx<T>> observers = new ArrayList<DefaultObserverEx<T>>();\r\n\t\t\t\tfinal Lock lock = new ReentrantLock();\r\n\t\t\t\tfor (int i = 0; i < sourcesList.size(); i++) {\r\n\t\t\t\t\tfinal int j = i;\r\n\t\t\t\t\tDefaultObserverEx<T> obs = new DefaultObserverEx<T>(lock, true) {\r\n\t\t\t\t\t\t@Override\r\n\t\t\t\t\t\tpublic void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t\t\tfor (int k = 0; k < observers.size(); k++) {\r\n\t\t\t\t\t\t\t\tif (k != j) {\r\n\t\t\t\t\t\t\t\t\tobservers.get(k).close();\r\n\t\t\t\t\t\t\t\t}\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\t@Override\r\n\t\t\t\t\t\tpublic void onFinish() {\r\n\t\t\t\t\t\t\tif (wip.decrementAndGet() == 0) {\r\n\t\t\t\t\t\t\t\tobserver.finish();\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\t@Override\r\n\t\t\t\t\t\tpublic void onNext(T value) {\r\n\t\t\t\t\t\t\tobserver.next(value);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t};\r\n\t\t\t\t\tobservers.add(obs);\r\n\t\t\t\t\tcloseables.add(obs);\r\n\t\t\t\t}\r\n\t\t\t\tfor (int i = 0; i < observers.size(); i++) {\r\n\t\t\t\t\tDefaultObserverEx<T> obs = observers.get(i);\r\n\t\t\t\t\tObservable<? extends T> ov = sourcesList.get(i);\r\n\t\t\t\t\tobs.registerWith(ov);\r\n\t\t\t\t}\r\n\t\t\t\tif (wip.decrementAndGet() == 0) {\r\n\t\t\t\t\tobserver.finish();\r\n\t\t\t\t}\r\n\t\t\t\treturn closeables;\r\n\t\t\t}\r\n\t\t};\r\n\t}", "ObservableList<Deliverable> getFilteredDeliverableList();", "ObservableList<Link> getUnfilteredLinkList();" ]
[ "0.60827214", "0.6078709", "0.60710627", "0.5975292", "0.5929827", "0.5683883", "0.5563117", "0.54974735", "0.5456722", "0.5456454", "0.53902227", "0.5383282", "0.5350695", "0.5304079", "0.5238655", "0.5233044", "0.51832956", "0.51791036", "0.5164402", "0.51333797", "0.5130455", "0.51178515", "0.51043916", "0.50734097", "0.50580895", "0.5055863", "0.5036487", "0.5035679", "0.50160825", "0.50152445", "0.49984318", "0.49820435", "0.49738124", "0.49649036", "0.49557492", "0.49523214", "0.494849", "0.49478656", "0.49474463", "0.4932669", "0.4930657", "0.49303776", "0.4926897", "0.4915816", "0.49018687", "0.4883235", "0.48721272", "0.48655447", "0.48626053", "0.48491427", "0.4848909", "0.48453254", "0.4844051", "0.48347193", "0.48335966", "0.48300377", "0.4821741", "0.48185766", "0.4807012", "0.4804855", "0.47899565", "0.4789423", "0.4789423", "0.4786301", "0.47809708", "0.4779304", "0.47448537", "0.47258383", "0.47161385", "0.4715264", "0.47131547", "0.47019473", "0.47000283", "0.4690568", "0.46874264", "0.46689108", "0.46610436", "0.46474332", "0.46464106", "0.46448752", "0.46281797", "0.46249333", "0.4613647", "0.46119815", "0.46116865", "0.46013287", "0.45857677", "0.4584272", "0.45839378", "0.4561816", "0.45551458", "0.4548947", "0.4540807", "0.45358148", "0.45349377", "0.45297837", "0.4524045", "0.45070642", "0.4504686", "0.44971764" ]
0.5381867
12
discard items emitted by an Observable after a specified condition becomes false
@Test public void takeWhile() { Observable.interval(100, TimeUnit.SECONDS, mTestScheduler) .map(num -> num + 1) .take(7) .takeWhile(aLong -> aLong != 4) .subscribe(mList::add); mTestScheduler.advanceTimeBy(1000, TimeUnit.SECONDS); assertEquals(mList, Arrays.asList(1L, 2L, 3L)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public static void skipWhile() {\n Observable.fromIterable(sData)\n .skipWhile((item) -> {\n System.out.println(\"item = \" + item);\n return item.equalsIgnoreCase(\"abc\");\n }).subscribe(new MyObserver<>());\n }", "public static void ignoreElements() {\n Observable.fromIterable(Utils.getData())\n .ignoreElements()\n .subscribe(new MyCompletableObserver());\n }", "public static void never() {\n Observable<String> myObservable = Observable.never();\n myObservable.subscribe(genericObserver1);\n }", "@Test\n public void skipUntil() {\n\n Observable<Long> o1 = Observable.interval(100, TimeUnit.SECONDS, mTestScheduler)\n .map(num -> num + 1)\n .take(9);\n\n Observable<Integer> o2 = Observable.just(0, 0)\n .delay(550, TimeUnit.SECONDS, mTestScheduler);\n\n o1.skipUntil(o2)\n .subscribe(mList::add);\n\n mTestScheduler.advanceTimeBy(2000, TimeUnit.SECONDS);\n assertEquals(mList, Arrays.asList(6L, 7L, 8L, 9L));\n }", "@Test\n public void skipWhile() {\n Observable.interval(100, TimeUnit.SECONDS, mTestScheduler)\n .map(num -> num + 1)\n .take(7)\n .skipWhile(aLong -> aLong != 4)\n .subscribe(mList::add);\n\n mTestScheduler.advanceTimeBy(1000, TimeUnit.SECONDS);\n assertEquals(mList, Arrays.asList(4L, 5L, 6L, 7L));\n }", "protected void discard() {\r\n discarded = true;\r\n onDiscard();\r\n }", "private static void createObservableUsingNever() {\n Observable<?> observable = Observable.never();\n\n observable.subscribe(x -> LOG.info(\"{}\", x),\n error -> LOG.info(\"{}\", error.getLocalizedMessage()),\n () -> LOG.info(\"Completed\"));\n\n // Pause the main thread for the hope that it will print something\n sleep(3000);\n }", "@Test\n public void takeUntil() {\n Observable.just(1, 2, 3, 4)\n .takeUntil(integer -> integer > 2)\n .subscribe(mList::add);\n assertEquals(mList, Arrays.asList(1, 2, 3));\n\n mList.clear();\n Observable.just(1, 2, 3, 4)\n .takeUntil(integer -> integer < 10)\n .subscribe(mList::add);\n assertEquals(mList, Collections.singletonList(1));\n }", "public static Observable<String> getObservableSkipWhileElement() {\n return observableSrc;//todo\n }", "public static Observable<String> getObservableSkipElement() {\n return observableSrc;//todo\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> never() {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull Observer<? super T> observer) {\r\n\t\t\t\treturn Closeables.emptyCloseable();\r\n\t\t\t}\r\n\t\t};\r\n\t}", "private static void exSwitchMapTwo() {\n\n Observable.interval(5,TimeUnit.SECONDS)\n .switchMap(call -> Observable.just(getResponse()).doOnDispose(() -> System.out.println(\"Disposed\")))\n .subscribe(System.out::println);\n\n //An Observable which performs network call.\n sleep(40000);\n\n\n /* OUTPUT :\n 6\n 10\n 13\n 17\n 26\n 32\n 35\n 42\n\n */\n }", "@Nonnull \r\n\tpublic static <T, U> Observable<U> prune(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func1<? super Observable<? extends T>, ? extends Observable<U>> selector\r\n\t) {\r\n\t\treturn replay(source, selector, 1);\r\n\t}", "@BackpressureSupport(BackpressureKind.FULL)\n @SchedulerSupport(SchedulerKind.CUSTOM)\n public final Observable<T> skip(long time, TimeUnit unit, Scheduler scheduler) {\n return skipUntil(timer(time, unit, scheduler));\n }", "public void discard() {\n }", "@Nonnull \r\n\tpublic static <T> Observable<T> prune(\r\n\t\t\tfinal Observable<? extends T> source\r\n\t) {\r\n\t\treturn replay(source, 1);\r\n\t}", "public void discard();", "void filterDisposed(Filter filter);", "private static void createColdObservable() {\n var observable = Observable.just(1, 2, 3, 4, 5);\n\n observable.subscribe(item -> LOG.info(\"Observer 1: {}\", item));\n\n pause(1000);\n\n observable.subscribe(item -> LOG.info(\"Observer 2: {}\", item));\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> relayUntil(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func0<Boolean> condition) {\r\n\t\treturn relayWhile(source, Functions.not(condition));\r\n\t}", "private void assertNotConsumed() {\n if (this.consumed) {\n throw new IllegalStateException(\"Response content has been already consumed\");\n }\n }", "boolean doFilter() { return false; }", "ObservableList<Deliverable> getFilteredDeliverableList();", "ObservableList<Task> getUnfilteredTaskList();", "@Nonnull \r\n\tpublic static <T> Observable<T> ignoreValues(\r\n\t\t\t@Nonnull final Observable<? extends T> source) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\treturn source.register(new Observer<T>() {\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\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 finish() {\r\n\t\t\t\t\t\tobserver.finish();\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 next(T value) {\r\n\t\t\t\t\t\t// ignored\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public static void empty() {\n Observable<String> myObservable = Observable.empty();\n myObservable.subscribe(genericObserver1);\n }", "@Test\n public void discardIfCannot() {\n gm.setPlayerInfo(clientPlayer3);\n gm.setThisPlayerIndex(clientPlayer3.getPlayerIndex());\n dc.increaseAmount(ResourceType.ORE);\n dc.increaseAmount(ResourceType.ORE);\n dc.increaseAmount(ResourceType.WOOD);\n assertEquals(2, getAmounts().getOfType(ResourceType.ORE));\n assertEquals(1, getAmounts().getOfType(ResourceType.WOOD));\n Player p = model.getPlayer(clientPlayer3.getPlayerIndex());\n when(robberFacade.canDiscard(dc.getDiscardAmount(), p)).thenReturn(false);\n dc.discard();\n // This verifies that the robberFacade.discard is only called once instead of twice\n verify(robberFacade, atMost(1)).discard(dc.getDiscardAmount(), p);\n\n }", "public void performSuppression() {\n \n for (int row = 0; row < dataOutput.getNumRows(); row++) {\n if (privacyModelDefinesSubset == null || privacyModelDefinesSubset.contains(row)) {\n final int hash = dataOutput.hashCode(row);\n final int index = hash & (hashTableBuckets.length - 1);\n HashGroupifyEntry m = hashTableBuckets[index];\n while ((m != null) && ((m.hashcode != hash) || !dataOutput.equalsIgnoringOutliers(row, m.row))) {\n m = m.next;\n }\n if (m == null) {\n throw new RuntimeException(\"Invalid state! Group the data before suppressing records!\");\n }\n if (!m.isNotOutlier || this.isCompletelyGeneralized(m)) {\n dataOutput.or(row, Data.OUTLIER_MASK);\n m.isNotOutlier = false;\n }\n } else {\n dataOutput.or(row, Data.OUTLIER_MASK);\n }\n }\n }", "protected void removeAlarmsIf(@NonNull Predicate<K> predicate) {\n boolean removed = false;\n synchronized (mLock) {\n Pair[] alarms = mAlarmPriorityQueue.toArray(new Pair[mAlarmPriorityQueue.size()]);\n for (int i = alarms.length - 1; i >= 0; --i) {\n final K key = (K) alarms[i].first;\n if (predicate.test(key)) {\n mAlarmPriorityQueue.remove(alarms[i]);\n removed = true;\n }\n }\n if (removed) {\n setNextAlarmLocked();\n }\n }\n }", "public static void just() {\n Observable<List<String>> myObservable = Observable.just(Utils.getData());\n myObservable.subscribe(consumerList);\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> relayWhile(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func0<Boolean> condition) {\r\n\t\treturn new Observable<T>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super T> observer) {\r\n\t\t\t\tDefaultObserverEx<T> obs = new DefaultObserverEx<T>(true) {\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic void onError(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tobserver.error(ex);\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 onFinish() {\r\n\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\tclose();\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 onNext(T value) {\r\n\t\t\t\t\t\tif (condition.invoke()) {\r\n\t\t\t\t\t\t\tobserver.next(value);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tfinish();\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\t\t\t\treturn obs.registerWith(source);\r\n\t\t\t}\r\n\t\t};\r\n\t}", "public static Observable<String> getObservableSkipLastElement() {\n return observableSrc;//todo\n }", "protected void sequence_LogicalAbsentStatefulSource_NOT(ISerializationContext context, NOT semanticObject) {\n\t\tif (errorAcceptor != null) {\n\t\t\tif (transientValues.isValueTransient(semanticObject, SiddhiPackage.eINSTANCE.getNOT_Not1()) == ValueTransient.YES)\n\t\t\t\terrorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SiddhiPackage.eINSTANCE.getNOT_Not1()));\n\t\t\tif (transientValues.isValueTransient(semanticObject, SiddhiPackage.eINSTANCE.getLogicalAbsentStatefulSource_Bs()) == ValueTransient.YES)\n\t\t\t\terrorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SiddhiPackage.eINSTANCE.getLogicalAbsentStatefulSource_Bs()));\n\t\t\tif (transientValues.isValueTransient(semanticObject, SiddhiPackage.eINSTANCE.getLogicalAbsentStatefulSource_And()) == ValueTransient.YES)\n\t\t\t\terrorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SiddhiPackage.eINSTANCE.getLogicalAbsentStatefulSource_And()));\n\t\t\tif (transientValues.isValueTransient(semanticObject, SiddhiPackage.eINSTANCE.getLogicalAbsentStatefulSource_StdSource()) == ValueTransient.YES)\n\t\t\t\terrorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SiddhiPackage.eINSTANCE.getLogicalAbsentStatefulSource_StdSource()));\n\t\t}\n\t\tSequenceFeeder feeder = createSequencerFeeder(context, semanticObject);\n\t\tfeeder.accept(grammarAccess.getNOTAccess().getNot1NotKeyword_0(), semanticObject.getNot1());\n\t\tfeeder.accept(grammarAccess.getLogicalAbsentStatefulSourceAccess().getBsBasicSourceParserRuleCall_2_0_0_1_0(), semanticObject.getBs());\n\t\tfeeder.accept(grammarAccess.getLogicalAbsentStatefulSourceAccess().getAndANDParserRuleCall_2_0_0_2_0(), semanticObject.getAnd());\n\t\tfeeder.accept(grammarAccess.getLogicalAbsentStatefulSourceAccess().getStdSourceStandardStatefulSourceParserRuleCall_2_1_0(), semanticObject.getStdSource());\n\t\tfeeder.finish();\n\t}", "@Nonnull \r\n\tpublic static <T, U> Observable<U> prune(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Func1<? super Observable<? extends T>, ? extends Observable<U>> selector,\r\n\t\t\t\t\t@Nonnull final Scheduler scheduler\r\n\t) {\r\n\t\treturn replay(source, selector, 1, scheduler);\r\n\t}", "void discardIrrelevantResponse(CruiseControlParameters parameters);", "@Override\n public void subscribe(ObservableEmitter<Integer> e) throws Exception {\n\n e.onNext(1);\n SystemClock.sleep(1000);\n e.onNext(2);\n SystemClock.sleep(1000);\n e.onNext(3);\n SystemClock.sleep(1000);\n e.onNext(4);\n\n //Once the Observable has emitted all items in the sequence, call onComplete//\n e.onComplete();\n //e.onError(new Throwable(\"Some Error!!\"));\n }", "public ConditionItem not(ConditionItem constraint) {\n\t\treturn blockCondition(ConditionType.NOT, constraint);\n\t}", "private void filterHidden() {\n final List<TreeItem<File>> filterItems = new LinkedList<>();\n\n for (TreeItem<File> item : itemList) {\n if (isCancelled()) {\n return;\n }\n\n if (!shouldHideFile.test(item.getValue())) {\n filterItems.add(item);\n\n if (shouldSchedule(filterItems)) {\n scheduleJavaFx(filterItems);\n filterItems.clear();\n }\n }\n }\n\n scheduleJavaFx(filterItems);\n Platform.runLater(latch::countDown);\n }", "private void clearConditionalResponses() {\n conditionalResponses_ = emptyProtobufList();\n }", "@Override\r\n\tpublic void discard(Resources toDiscard) {\n\t\t\r\n\t}", "private static void exSwitchMapThree(){\n Observable<String> intense =\n Observable.just(\"Savi\",\"Healer\",\"Three\",\"Four\",\"Wednesday\",\"Friday\",\"You\",\"Me\")\n .concatMap(result -> Observable.just(result).delay(randomSleepTime(),TimeUnit.MILLISECONDS))\n .doOnDispose(() -> System.out.println(\" * * Disposed * *\"));\n\n //Observable to execute intense task every 5 seconds\n Observable.interval(5,TimeUnit.SECONDS)\n .switchMap(r -> intense)\n .subscribe(System.out::println);\n\n //Sleep the main thread for few seconds\n Take.sleep(20000);\n\n /*\n After every 5 seconds it will dispose the ongoing intense (variable name) process and\n start the same process again.\n */\n\n //Output\n /*\n Savi\n Healer\n Three\n Four\n * * Disposed * *\n Savi\n Healer\n Three\n Four\n Wednesday\n Friday\n You\n * * Disposed * *\n Savi\n Healer\n Three\n Four\n Wednesday\n * * Disposed * *\n */\n }", "@Nonnull\r\n\tpublic static <T, U> Observable<T> skipUntil(\r\n\t\t\t@Nonnull final Observable<? extends T> source,\r\n\t\t\t@Nonnull final Observable<U> signaller) {\r\n\t\treturn new Skip.Until<T, U>(source, signaller);\r\n\t}", "public Observable<DownloadType> notSupportHead(final String url)\r\n throws IOException {\r\n\r\n return mDownloadApi\r\n .GET_withIfRange(TEST_RANGE_SUPPORT, readLastModify(url), url)\r\n .map(new Function<Response<Void>, DownloadType>() {\r\n @Override\r\n public DownloadType apply(Response<Void> response)\r\n throws Exception {\r\n if (serverFileNotChange(response)) {\r\n return getWhenServerFileNotChange(response, url);\r\n } else if (serverFileChanged(response)) {\r\n return getWhenServerFileChanged(response, url);\r\n } else {\r\n return typeFactory.unable();\r\n }\r\n }\r\n })\r\n .compose(Utils.<DownloadType>retry(MAX_RETRY_COUNT));\r\n }", "@ServiceAction\n protected void onNotificationDismissed(final ArrayList<Integer> serversRequiringNotification) {\n Observable.from(servers)\n .filter(new Func1<MinecraftServerEntity, Boolean>() {\n @Override\n public Boolean call(MinecraftServerEntity server) {\n return serversRequiringNotification.contains(server.getId());\n }\n })\n .map(new Func1<MinecraftServerEntity, MinecraftServerEntity>() {\n @Override\n public MinecraftServerEntity call(MinecraftServerEntity server) {\n server.setHasOfflineStatusBeenSeen(true);\n return server;\n }\n })\n .subscribeOn(AndroidSchedulers.mainThread())\n .observeOn(AndroidSchedulers.mainThread())\n .subscribe(new Action1<MinecraftServerEntity>() {\n @Override\n public void call(MinecraftServerEntity server) {\n if (DEBUG)\n Log.d(TAG, String.format(\"'%s' offline status has been seen by the user. Updating the database\", server.getName()));\n //We update the value in the database\n runtimeMinecraftServerDao.update(server);\n }\n });\n }", "@Test\n public void shouldReturnOnErrorWithRequestNotPermittedUsingObservable() {\n RateLimiterConfig rateLimiterConfig = RateLimiterConfig.custom()\n .limitRefreshPeriod(Duration.ofMillis(CYCLE_IN_MILLIS))\n .limitForPeriod(PERMISSIONS_RER_CYCLE)\n .timeoutDuration(TIMEOUT_DURATION)\n .build();\n\n // Create a RateLimiterRegistry with a custom global configuration\n RateLimiter rateLimiter = RateLimiter.of(LIMITER_NAME, rateLimiterConfig);\n\n assertThat(rateLimiter.getPermission(rateLimiter.getRateLimiterConfig().getTimeoutDuration()));\n\n Observable.fromIterable(makeEleven())\n .lift(RateLimiterOperator.of(rateLimiter))\n .test()\n .assertError(RequestNotPermitted.class)\n .assertNotComplete()\n .assertSubscribed();\n\n assertThat(!rateLimiter.getPermission(rateLimiter.getRateLimiterConfig().getTimeoutDuration()));\n\n RateLimiter.Metrics metrics = rateLimiter.getMetrics();\n\n assertThat(metrics.getAvailablePermissions()).isEqualTo(0);\n assertThat(metrics.getNumberOfWaitingThreads()).isEqualTo(0);\n }", "void onDiscardChangesSelected();", "void discard();", "void discard();", "protected void discard()\n {\n if (!isDiscarded())\n {\n OldOldCache map = OldOldCache.this;\n synchronized (map)\n {\n int cUnits = m_cUnits;\n if (cUnits == -1)\n {\n // entry is discarded; avoid repetitive events\n return;\n }\n\n if (cUnits > 0)\n {\n map.adjustUnits(-cUnits);\n }\n\n m_cUnits = -1;\n }\n\n // issue remove notification\n if (map.hasListeners())\n {\n map.dispatchEvent(map.instantiateMapEvent(\n MapEvent.ENTRY_DELETED, getKey(), getValue(), null));\n }\n }\n }", "@Override\n\tpublic void discardUnget() {\n\t\t\n\t}", "MapComp<K, V> removeAll(Predicate<K> p);", "@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}", "private static void backPressureChallenge() {\n\t\tObservable.range(1, 1000000)\n\t\t//below map will run in sequential\n\t\t//since sequential it has to complete whole task then only it can allow consumer to start\n\t\t\t.map(item -> {\n\t\t\t\tSystem.out.println(\"Produced item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t\treturn item;\n\t\t\t})\n\t\t\t.observeOn(Schedulers.io())\n\t\t\t//.subscribeOn(Schedulers.io())//with this whole pipelein runs in seprate thread paralleley\n\t\t\t//below will run in concurrent\n\t\t\t.subscribe(item ->{\n\t\t\t\t//mimcing slowness\n\t\t\t\tThreadUtil.sleep(300);\n\t\t\t\tSystem.out.println(\"Consumed item \"+item +\" using thread \"+Thread.currentThread().getName());\n\t\t\t})\n\t\t\t\n\t\t\t;\n\t\t\n\t\t//since running in async we need to sleep\n\t\tThreadUtil.sleep(10000000);\n\t}", "public void suppress() {\n\t\tstop = true;\n\t}", "protected void onDiscard() {\r\n this.setActive(false);\r\n }", "public void executeNot() {\n\t\tBitString destBS = mIR.substring(4, 3);\n\t\tBitString sourceBS = mIR.substring(7, 3);\n\t\tmRegisters[destBS.getValue()] = mRegisters[sourceBS.getValue()].copy();\n\t\tmRegisters[destBS.getValue()].invert();\n\n\t\tBitString notVal = mRegisters[destBS.getValue()];\n\t\tsetConditionalCode(notVal);\n\t}", "@Test\r\n public void testReplayRemoveSubjectConcurrentObservations() throws InterruptedException {\r\n\r\n final ReplayRemoveSubject<Long> replay = ReplayRemoveSubject.create();\r\n\r\n final int THREAD_COUNT = 20;\r\n final int START_SOURCE_AFTER_THREADS = 3;\r\n final int THREADS_TO_RECEIVE_ALL_BEFORE_REMOVE_STARTED = 5;\r\n final int AWAITER_1_THREAD_COUNT = 10;\r\n final int AWAITER_2_THREAD_COUNT = 12;\r\n final int AWAITER_3_THREAD_COUNT = 14;\r\n\r\n final CountDownLatch sourceAwaiterMain = new CountDownLatch(THREADS_TO_RECEIVE_ALL_BEFORE_REMOVE_STARTED);\r\n\r\n final CountDownLatch threadCreationAwaiter1 = new CountDownLatch(1);\r\n final CountDownLatch sourceAwaiter1 = new CountDownLatch(3);\r\n\r\n final CountDownLatch threadCreationAwaiter2 = new CountDownLatch(1);\r\n final CountDownLatch sourceAwaiter2 = new CountDownLatch(3);\r\n\r\n final CountDownLatch threadCreationAwaiter3 = new CountDownLatch(1);\r\n\r\n final List<Long> valuesToRemove = new ArrayList<>();\r\n valuesToRemove.add(1L);\r\n valuesToRemove.add(20L);\r\n valuesToRemove.add(300L);\r\n\r\n AtomicLong fullCounter = new AtomicLong();\r\n\r\n Thread source = new Thread(() -> {\r\n try {\r\n System.out.println(\"********* Start Source Data ***********\");\r\n for (long l = 1; l <= 10000; l++) {\r\n if (l % 100 == 0)\r\n System.out.println(\"Emitting \" + l);\r\n\r\n fullCounter.addAndGet(l);\r\n replay.onNext(l);\r\n\r\n // just random value, could be any:\r\n if (l == 567) {\r\n sourceAwaiterMain.await();\r\n\r\n replay.onRemove(valuesToRemove.get(0));\r\n threadCreationAwaiter1.countDown();\r\n sourceAwaiter1.await();\r\n\r\n replay.onRemove(valuesToRemove.get(1));\r\n threadCreationAwaiter2.countDown();\r\n sourceAwaiter2.await();\r\n\r\n replay.onRemove(valuesToRemove.get(2));\r\n threadCreationAwaiter3.countDown();\r\n }\r\n\r\n }\r\n System.out.println(\"********* Finished Source Data ***********\");\r\n replay.onComplete();\r\n\r\n } catch (Exception e) {\r\n fail(e.getMessage());\r\n }\r\n });\r\n\r\n // used to collect results of each thread\r\n final List<Pair<Long, List<Long>>> listOfListsOfValues = Collections.synchronizedList(new ArrayList<>());\r\n\r\n\r\n CountDownLatch countDownLatch = new CountDownLatch(THREAD_COUNT);\r\n\r\n for (int i = 1; i <= THREAD_COUNT; i++) {\r\n\r\n final int count = i;\r\n\r\n if (count == START_SOURCE_AFTER_THREADS) {\r\n // start source data after we have some already subscribed\r\n // and while others are in process of subscribing\r\n source.start();\r\n }\r\n\r\n if (count == AWAITER_1_THREAD_COUNT)\r\n threadCreationAwaiter1.await();\r\n\r\n if (count == AWAITER_2_THREAD_COUNT)\r\n threadCreationAwaiter2.await();\r\n\r\n if (count == AWAITER_3_THREAD_COUNT)\r\n threadCreationAwaiter3.await();\r\n\r\n try {\r\n AtomicLong phase = new AtomicLong();\r\n\r\n //noinspection ResultOfMethodCallIgnored\r\n replay\r\n .observeOn(Schedulers.newThread())\r\n .doOnNext(val -> {\r\n final int indexOfRemovable =\r\n valuesToRemove.indexOf(val);\r\n\r\n if (indexOfRemovable >= 0) {\r\n phase.addAndGet(val);\r\n }\r\n\r\n if (val.equals(300L))\r\n sourceAwaiterMain.countDown();\r\n\r\n if (count >= 10)\r\n sourceAwaiter1.countDown();\r\n\r\n if (count >= 12)\r\n sourceAwaiter2.countDown();\r\n\r\n\r\n })\r\n .toList()\r\n .subscribe(values -> {\r\n listOfListsOfValues.add(Pair.of(phase.get(), values));\r\n countDownLatch.countDown();\r\n System.out.println(\"Finished thread: \" + count);\r\n });\r\n } catch (Exception e) {\r\n fail(e.getMessage());\r\n }\r\n\r\n System.out.println(\"Started thread: \" + i);\r\n }\r\n\r\n countDownLatch.await();\r\n\r\n listOfListsOfValues.stream().map(Pair::getLeft).collect(Collectors.toSet()).\r\n forEach(System.out::println);\r\n\r\n long maxRemoved = valuesToRemove.stream().reduce(0L, Long::sum);\r\n\r\n // assert all threads got the same results\r\n Map<Long, Long> sums = new HashMap<>();\r\n for (Pair<Long, List<Long>> pair : listOfListsOfValues) {\r\n long v = 0;\r\n for (long l : pair.getRight()) {\r\n v += l;\r\n }\r\n\r\n long phase = pair.getKey();\r\n assertEquals(fullCounter.get() - (maxRemoved - phase), v);\r\n\r\n sums.put(pair.getLeft(), v);\r\n }\r\n\r\n assertEquals(valuesToRemove.size() + 1, sums.size());\r\n Long phaseAcc = 0L;\r\n for (int i = valuesToRemove.size() - 1; i >= 0; i--) {\r\n assertTrue(sums.containsKey(phaseAcc));\r\n phaseAcc += valuesToRemove.get(i);\r\n assertTrue(sums.containsKey(phaseAcc));\r\n }\r\n\r\n }", "@Test\n public void all() {\n Observable.just(1, 2, 3, 4, 5)\n .doOnNext(System.out::println)\n .all(x -> x < 10)\n .subscribe(mList::add);\n assertEquals(mList, Collections.singletonList(true));\n }", "protected void sequence_BasicAbsentPatternSource_NOT(ISerializationContext context, NOT semanticObject) {\n\t\tif (errorAcceptor != null) {\n\t\t\tif (transientValues.isValueTransient(semanticObject, SiddhiPackage.eINSTANCE.getNOT_Not1()) == ValueTransient.YES)\n\t\t\t\terrorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SiddhiPackage.eINSTANCE.getNOT_Not1()));\n\t\t\tif (transientValues.isValueTransient(semanticObject, SiddhiPackage.eINSTANCE.getNOT_BasicSrc()) == ValueTransient.YES)\n\t\t\t\terrorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SiddhiPackage.eINSTANCE.getNOT_BasicSrc()));\n\t\t\tif (transientValues.isValueTransient(semanticObject, SiddhiPackage.eINSTANCE.getNOT_Ft()) == ValueTransient.YES)\n\t\t\t\terrorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SiddhiPackage.eINSTANCE.getNOT_Ft()));\n\t\t}\n\t\tSequenceFeeder feeder = createSequencerFeeder(context, semanticObject);\n\t\tfeeder.accept(grammarAccess.getNOTAccess().getNot1NotKeyword_0(), semanticObject.getNot1());\n\t\tfeeder.accept(grammarAccess.getBasicAbsentPatternSourceAccess().getBasicSrcBasicSourceParserRuleCall_0_1_0(), semanticObject.getBasicSrc());\n\t\tfeeder.accept(grammarAccess.getBasicAbsentPatternSourceAccess().getFtForTimeParserRuleCall_0_2_0(), semanticObject.getFt());\n\t\tfeeder.finish();\n\t}", "private static void createObservableUsingEmpty() {\n Observable<?> observable = Observable.empty();\n\n observable.subscribe(x -> LOG.info(\"{}\", x), error -> LOG.info(\"Error 1: {}\", error.hashCode()));\n observable.subscribe(x -> LOG.info(\"{}\", x),\n error -> LOG.info(\"{}\", error.getLocalizedMessage()),\n () -> LOG.info(\"Completed\"));\n }", "public static void debounce() {\n List<String> data = Utils.getData();\n\n System.out.println(\"# 1\");\n\n /*\n An item needs to be most recent for at least 1 microseconds to be considered for\n transmission.\n */\n Observable.fromIterable(data)\n .debounce(1, TimeUnit.MICROSECONDS)\n .subscribe(new MyObserver<>());\n\n System.out.println(\"# 2\");\n\n /*\n Item \"def\" is being intentionally delayed, so it will not most recent and \"ghi\" will\n emitted before it, Hence \"def\" will not be emitted.\n */\n Observable.fromIterable(data)\n .debounce((item) -> {\n if (item.equalsIgnoreCase(\"def\")) {\n return Observable.just(item).delay(1000L, TimeUnit.MICROSECONDS);\n } else {\n return Observable.just(item);\n }\n }).subscribe(new MyObserver<>());\n }", "private boolean NOT(boolean b) {\r\n in = saves[--save];\r\n return !b;\r\n }", "@BackpressureSupport(BackpressureKind.ERROR)\n @SchedulerSupport(SchedulerKind.NONE)\n public final <B> Observable<List<T>> buffer(Publisher<B> boundary) {\n return buffer(boundary, new Supplier<List<T>>() {\n @Override\n public List<T> get() {\n return new ArrayList<T>();\n }\n });\n }", "public void observaleJust() {\n\t\tObservable.just(1, 2, 3, 4, 5, 6, 7, 8, 9, 10).subscribe(integerSubscribe());\r\n\t}", "@Test\r\n\tpublic void exerciseInterruptible() {\n\t\t\r\n\t\tList<String> articlesTopicA = Arrays.asList(\"Article A-1\",\"Article A-2\",\"Article A-3\");\r\n\t\tList<String> articlesTopicB = Arrays.asList(\"Article B-1\",\"Article B-2\",\"Article B-3\");\r\n\t\tList<String> articlesTopicC = Arrays.asList(\"Article C-1\",\"Article C-2\",\"Article C-3\");\r\n\t\t\r\n\t\tList<Observable<String>> topicObservables = Arrays.asList(\r\n\t\t\t\tObservable.interval(0, 80L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicA.get(i.intValue())),\r\n\t\t\t\tObservable.interval(50, 60L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicB.get(i.intValue())),\r\n\t\t\t\tObservable.interval(0, 40L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> articlesTopicC.get(i.intValue())));\r\n\t\t\r\n\t\tObservable<Observable<String>> topics = Observable.interval(0, 100L, TimeUnit.MILLISECONDS, testScheduler)\r\n\t\t\t\t.take(3)\r\n\t\t\t\t.map(i -> topicObservables.get(i.intValue()));\r\n\t\t\r\n\t\t//\t\t t[ms]: 0 100 200 300\r\n\t\t//\t\ttopics: A---------B---------C---------| \r\n\t\t//\t\t A: 1-------2-|-----3---|---------|\r\n\t\t//\t\t B: |---------|----1----|2-----3--|\r\n\t\t//\t\t C: |---------|---------1---2---3-|\r\n\t\t//\t\tResult: A-1 A-2 B-1 C-1 C-2 C-3\r\n\t\t\t\t\r\n\t\t// TODO: always switch to the latest topic\r\n\t\t// HINT: http://reactivex.io/documentation/operators/switch.html\r\n\t\tObservable<String> latestInteresting = Observable.empty();\r\n\r\n\t\t// verify\r\n\t\tTestSubscriber<String> testSubscriber = new TestSubscriber<>();\r\n\t\tlatestInteresting\r\n\t\t\t.doOnNext(article -> log(String.format(\" doOnNext(): %s Time: %d\", article, testScheduler.now())))\r\n\t\t\t.subscribe(testSubscriber);\r\n\t\t\r\n\t\t// let the time elapse until completion\r\n\t\ttestScheduler.advanceTimeBy(300, TimeUnit.MILLISECONDS);\r\n\t\t\r\n\t\ttestSubscriber.assertCompleted();\r\n\t\ttestSubscriber.assertNoErrors();\r\n\t\tList<String> expectedArticles = Arrays.asList(\r\n\t\t\t\t\"Article A-1\",\"Article A-2\", \r\n\t\t\t\t\"Article B-1\", \r\n\t\t\t\t\"Article C-1\", \"Article C-2\", \"Article C-3\");\r\n\t\ttestSubscriber.assertReceivedOnNext(expectedArticles);\r\n\t\t\r\n\t}", "public static Observable<String> getObservableFiltered() {\n return observableSrc;//todo\n }", "@Override\n public Boolean skip(final ServerWebExchange exchange) {\n return false;\n }", "@Test\n public void observableGetBooleanLogicOperationAndReturnBooleanValue() {\n assertTrue(Observable.just(10)\n .map(intValue -> intValue == 10)\n .toBlocking()\n .single());\n }", "public Units whereNot(UnitSelector.BooleanSelector selector)\n\t{\n\t\tUnits result = new Units();\n\t\tfor (Unit unit : this)\n\t\t{\n\t\t\tif (!selector.isTrueFor(unit))\n\t\t\t{\n\t\t\t\tresult.add(unit);\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t}", "void discard(T1XTemplateTag tag) {\n final int listLength = methodStatusList.size();\n MethodStatus ms = methodStatusList.get(listLength - 1);\n // ok to destroy ms.asSet\n ms.atSet.retainAll(generating);\n // throw it away if we generated advice type that was not wanted.\n if (ms.atSet.isEmpty()) {\n ms.output = false;\n // Checkstyle: resume Indentation check\n int index = listLength - 2;\n while (index >= 0) {\n ms = methodStatusList.get(index);\n if (ms.tag == null) {\n ms.output = false;\n } else if (ms.tag != tag) {\n return;\n }\n index--;\n }\n }\n }", "@Nonnull\r\n\tpublic static Observable<Boolean> isEmpty(\r\n\t\t\t@Nonnull final Observable<?> source) {\r\n\t\treturn new Observable<Boolean>() {\r\n\t\t\t@Override\r\n\t\t\t@Nonnull \r\n\t\t\tpublic Closeable register(@Nonnull final Observer<? super Boolean> observer) {\r\n\t\t\t\treturn source.register(new Observer<Object>() {\r\n\t\t\t\t\t/** We already determined the answer? */\r\n\t\t\t\t\tboolean done;\r\n\t\t\t\t\t@Override\r\n\t\t\t\t\tpublic void error(@Nonnull Throwable ex) {\r\n\t\t\t\t\t\tif (!done) {\r\n\t\t\t\t\t\t\tobserver.error(ex);\r\n\t\t\t\t\t\t}\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 finish() {\r\n\t\t\t\t\t\tif (!done) {\r\n\t\t\t\t\t\t\tdone = true;\r\n\t\t\t\t\t\t\tobserver.next(false);\r\n\t\t\t\t\t\t\tobserver.finish();\r\n\t\t\t\t\t\t}\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 next(Object value) {\r\n\t\t\t\t\t\tif (!done) {\r\n\t\t\t\t\t\t\tdone = true;\r\n\t\t\t\t\t\t\tobserver.next(true);\r\n\t\t\t\t\t\t\tobserver.finish();\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\t\t\t}\r\n\t\t};\r\n\t}", "public boolean isSleepingIgnored ( ) {\n\t\treturn extract ( handle -> handle.isSleepingIgnored ( ) );\n\t}", "ObservableList<Link> getUnfilteredLinkList();", "public static void main(String[] args){\n Observable myObservable = Observable.create(new Observable.OnSubscribe(){\n\n @Override\n public void call(Object subscriber) {\n Subscriber mySubscriber = (Subscriber)subscriber;\n\n for(int i = 0 ; i < 10; i++){\n //if my subscriber was subscribed\n if(!mySubscriber.isUnsubscribed()){\n mySubscriber.onNext(\"Pushed value \" + i);\n }\n }\n\n if(!mySubscriber.isUnsubscribed()){\n mySubscriber.onCompleted();\n }\n\n }\n });\n\n //subscribe to your Observable\n myObservable.subscribe(new Action1<String>() {\n @Override\n public void call(String s) {\n System.out.println(s);\n }\n },\n new Action1<Throwable>() {\n @Override\n public void call(Throwable throwable) {\n System.out.println(\"Something went wrong the observable\");\n }\n },\n new Action0() {\n @Override\n public void call() {\n System.out.println(\"No more values will be pushed.\");\n }\n });\n\n }", "public static <T> Observable<T> whileDo(\r\n\t\t\t@Nonnull final Observable<? extends T> source, \r\n\t\t\t@Nonnull final Func0<Boolean> condition) {\r\n\t\treturn new Repeat.WhileDo<T>(source, condition);\r\n\t}", "public static void main(String[] args) {\n // count operator counter number of elements emmitted,\n Observable<Integer> observable = Observable.just(1,2,3,4);\n observable.count().subscribe(s->System.out.println(s));\n\n // conditional opertors\n // all() -> this operator checks condition for all values and returns false if any condition fails\n observable.all(i->i<3).subscribe(s->System.out.println(s));\n\n // any() -> this operator checks condition for all values and returns true if any condition is true\n // empty() -> checks if observable have empty value and returns true/false \n // contains() -> checks if specified item is contained/emmitted by observable\n // sequenceEqual() -> checks if two sequences are equals (sequences contains same values)\n\n observable.any(i->i<3).subscribe(s->System.out.println(s));\n observable.filter(i->i<5).isEmpty().subscribe(s->System.out.println(s));\n }", "public static void test009()\r\n {\r\n System.out.println(\"RxJavaTest04::test009\");\r\n List<String> tickets = new ArrayList<String>(Arrays.asList(\"one\", \"two\", \"three\", \"four\", \"five\"));\r\n List<String> failures = Observable.fromIterable(tickets)\r\n .flatMap(ticket ->\r\n myRxSendEmail(ticket)\r\n .flatMap(response -> Observable.<String>empty())\r\n .doOnError(e -> System.out.printf(\"Failed to send %s: %s\\n\", ticket, e))\r\n .onErrorReturn(err -> ticket)\r\n .subscribeOn(Schedulers.io())\r\n )\r\n .toList()\r\n .blockingGet();\r\n for (String failure : failures) {\r\n System.out.println(failure);\r\n }\r\n }", "@Nonnull \r\n\tpublic static <T> Observable<T> doWhile(\r\n\t\t\t@Nonnull final Observable<? extends T> source, \r\n\t\t\t@Nonnull final Func0<Boolean> condition) {\r\n\t\treturn new Repeat.DoWhile<T>(source, condition);\r\n\t}", "public static Observable<Long> getObservableTakeWhile() {\n return observableIntervalSrc;//todo\n }", "protected void sequence_NOT(ISerializationContext context, NOT semanticObject) {\n\t\tif (errorAcceptor != null) {\n\t\t\tif (transientValues.isValueTransient(semanticObject, SiddhiPackage.eINSTANCE.getNOT_Not1()) == ValueTransient.YES)\n\t\t\t\terrorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, SiddhiPackage.eINSTANCE.getNOT_Not1()));\n\t\t}\n\t\tSequenceFeeder feeder = createSequencerFeeder(context, semanticObject);\n\t\tfeeder.accept(grammarAccess.getNOTAccess().getNot1NotKeyword_0(), semanticObject.getNot1());\n\t\tfeeder.finish();\n\t}", "public static Observable<String> getObservableDistinctUntilChanges() {\n return observableSrcDuplicated;//todo\n }", "public void suppress() {\r\n\t\tsuppressed = true;\r\n\t}", "public void suppress() {\r\n\t\tsuppressed = true;\r\n\t}", "public boolean burn(){\r\n for(ListIterator<Item> iter = listIterator();iter.hasNext();)\r\n if(iter.next().flammable) iter.remove();\r\n return isEmpty();\r\n }", "@Nonnull\r\n\tpublic static <T> Observable<T> skip(\r\n\t\t\t@Nonnull Observable<? extends T> source,\r\n\t\t\tlong time,\r\n\t\t\t@Nonnull TimeUnit unit\r\n\t\t\t) {\r\n\t\treturn skip(source, time, unit, scheduler());\r\n\t}", "protected boolean processStoppedObserving(int gameNumber){return false;}", "@Override\n\tpublic void suppress() {\n\t\tsuppressed = true;\n\t}", "@Override\n\tpublic void suppress() {\n\t\tsuppressed = true;\n\t}", "@Override\n\tpublic void suppress() {\n\t\tsuppressed = true;\n\t}", "@Nonnull\r\n\tpublic static <T> Observable<T> ifThen(\r\n\t\t\t@Nonnull final Func0<Boolean> condition,\r\n\t\t\t@Nonnull final Observable<? extends T> then) {\r\n\t\treturn ifThen(condition, then, Reactive.<T>empty());\r\n\t}", "public SamFilterParamsBuilder excludeUnmated(final boolean val) {\n mExcludeUnmated = val;\n return this;\n }", "protected void removeHalted() {\n for (Machine machine : machines) {\n while (!machine.getEventBuffer().isEmpty()) {\n Guard targetHalted =\n machine.getEventBuffer().satisfiesPredUnderGuard(x -> x.targetHalted()).getGuardFor(true);\n if (!targetHalted.isFalse()) {\n rmBuffer(machine, targetHalted);\n continue;\n }\n break;\n }\n }\n }", "public static void test008()\r\n {\r\n System.out.println(\"RxJavaTest04::test008\");\r\n List<String> tickets = new ArrayList<String>(Arrays.asList(\"one\", \"two\", \"three\", \"four\", \"five\"));\r\n List<String> failures = Observable.fromIterable(tickets)\r\n .flatMap(ticket ->\r\n myRxSendEmail(ticket)\r\n .flatMap(response -> Observable.<String>empty())\r\n .doOnError(e -> System.out.printf(\"Failed to send %s: %s\\n\", ticket, e))\r\n .onErrorReturn(err -> ticket))\r\n .toList()\r\n .blockingGet();\r\n for (String failure : failures) {\r\n System.out.println(failure);\r\n }\r\n }", "public static void test016()\r\n {\r\n System.out.println(\"RxJavaTest04::test016\");\r\n ExecutorService poolA = Executors.newFixedThreadPool(10, newThreadFactory(\"Sched-A-%d\"));\r\n Scheduler schedulerA = Schedulers.from(poolA);\r\n RxGroceries rxGroceries = new RxGroceries();\r\n\r\n Maybe<BigDecimal> totalPrice = Observable\r\n .fromIterable(Arrays.asList(\"bread\", \"butter\", \"milk\", \"tomato\", \"cheese\"))\r\n .subscribeOn(schedulerA)\r\n .flatMap(prod -> rxGroceries\r\n .purchase(prod, 1)\r\n .subscribeOn(schedulerA)\r\n )\r\n .reduce(BigDecimal::add);\r\n totalPrice\r\n .subscribe(\r\n x -> log(\"Got \" + x),\r\n Throwable::printStackTrace,\r\n () -> log(\"Completed\")\r\n );\r\n myWait(2000); // We have to wait before shutting down the pool,\r\n // otherwise it will throw exception \r\n // [java] io.reactivex.exceptions.UndeliverableException:\r\n // java.util.concurrent.RejectedExecutionException:\r\n // Task java.util.concurrent.FutureTask@38d8f9d0 rejected\r\n // from java.util.concurrent.ThreadPoolExecutor@6a724a6c\r\n // [Shutting down, pool size = 1, active threads = 1, queued\r\n // tasks = 0, completed tasks = 0]\r\n poolA.shutdown();\r\n }", "public static <T> boolean retainAll(@Nonnull Collection<T> collection, @Nonnull Condition<? super T> condition) {\n boolean modified = false;\n\n for (Iterator<T> iterator = collection.iterator(); iterator.hasNext(); ) {\n T next = iterator.next();\n if (!condition.value(next)) {\n iterator.remove();\n modified = true;\n }\n }\n\n return modified;\n }", "public void removeIf(Predicate<NoteBuilder> filter) {\n\t\tthis.noteBuilders.removeIf(filter);\n\t}", "public static void timeoutOperatorWithSecondObservable(Observable<Player> playerObservable) {\n playerObservable.delay(2, TimeUnit.SECONDS)\n .timeout(1000, TimeUnit.MILLISECONDS, playerObservable.filter(player -> {\n return player.getPosition().equals(\"Forward\");\n }))\n .subscribe(player -> {\n Log.d(\"output: \", player.toString());\n });\n }", "@Test\n public void discardLessThan4() {\n gm.setPlayerInfo(clientPlayer4);\n gm.setThisPlayerIndex(clientPlayer4.getPlayerIndex());\n Player p = model.getPlayer(clientPlayer4.getPlayerIndex());\n ResourceSet discardSet = dc.getDiscardAmount();\n verify(robberFacade, atMost(3)).canDiscard(discardSet, p);\n verify(robberFacade, atMost(2)).discard(discardSet, p);\n }", "private static void scenario() {\n\n Observable<String> stringObservable = Observable.just(\"One\",\"Two\",\"Three\",\"Four\",\"Five\",\"Six\",\"Seven\",\"Eight\",\"Nine\");\n\n Observable<String> stringProcessor = stringObservable.concatMap(data -> Observable.just(data).delay(randomSleepTime(),\n TimeUnit.MILLISECONDS));\n\n stringProcessor.subscribe(System.out::println);\n\n sleep(20000);\n\n /* OUTPUT :\n One\n Two\n Three\n Four\n Five\n Six\n Seven\n Eight\n Nine\n */\n }", "ObservableList<Task> getFilteredTaskList();" ]
[ "0.6544702", "0.6435292", "0.6112887", "0.5933153", "0.5747507", "0.5715463", "0.5617889", "0.5563855", "0.54449296", "0.5441216", "0.5368078", "0.5350539", "0.52228236", "0.52090657", "0.5200563", "0.5182953", "0.51809883", "0.51795566", "0.5174905", "0.51722205", "0.5164731", "0.51578456", "0.5131021", "0.5120346", "0.51132905", "0.5055914", "0.50544775", "0.5045039", "0.49814504", "0.4978001", "0.49529654", "0.492412", "0.48540947", "0.48496738", "0.4841486", "0.48211837", "0.48018172", "0.48003158", "0.47867388", "0.47740564", "0.4770049", "0.47594756", "0.47574905", "0.47497633", "0.47483394", "0.4723753", "0.47199062", "0.47199062", "0.47181427", "0.46948367", "0.46795934", "0.46673262", "0.4663223", "0.46585745", "0.4655134", "0.46526095", "0.4650815", "0.46434218", "0.46338147", "0.46330515", "0.46227497", "0.46226016", "0.4614137", "0.46002707", "0.45982748", "0.45953584", "0.4592", "0.45897827", "0.4589492", "0.45893484", "0.45803994", "0.4575252", "0.45744655", "0.45685804", "0.4562428", "0.45566332", "0.45310816", "0.4525458", "0.45178807", "0.4517101", "0.45081967", "0.4505062", "0.4505062", "0.44951788", "0.44919652", "0.44902992", "0.44897705", "0.44897705", "0.44897705", "0.4486838", "0.4485629", "0.4483483", "0.44793642", "0.44778082", "0.44604284", "0.44600663", "0.44543868", "0.44525507", "0.44422463", "0.44395962" ]
0.5101564
25
Make the LiveData LeagueEntity observable
public LiveData<LeagueEntity> getLeague() { return observableLeague; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public LeagueTableBase getEntity() {\n LeagueTableBase leagueTable = new LeagueTableBase();\n\n leagueTable.setId(new LeagueTableBasePK(getId().getLeagueSeasonId(), getId().getTeamNo(), getId().getPredicted(), getId().getWeekNo()));\n leagueTable.setGameDate(this.gameDate);\n leagueTable.setPlayed(this.played);\n leagueTable.setWon(this.won);\n leagueTable.setDrawn(this.drawn);\n leagueTable.setLost(this.lost);\n leagueTable.setGoalsFor(this.goalsFor);\n leagueTable.setGoalsAgainst(this.goalsAgainst);\n leagueTable.setPoints(this.points);\n leagueTable.setForm(this.form);\n leagueTable.setHomeWon(this.homeWon);\n leagueTable.setHomeDrawn(this.homeDrawn);\n leagueTable.setHomeLost(this.homeLost);\n leagueTable.setHomeGoalsFor(this.homeGoalsFor);\n leagueTable.setHomeGoalsAgainst(this.homeGoalsAgainst);\n leagueTable.setHomePoints(this.homePoints);\n leagueTable.setHomeForm(this.homeForm);\n leagueTable.setAwayWon(this.awayWon);\n leagueTable.setAwayDrawn(this.awayDrawn);\n leagueTable.setAwayLost(this.awayLost);\n leagueTable.setAwayGoalsFor(this.awayGoalsFor);\n leagueTable.setAwayGoalsAgainst(this.awayGoalsAgainst);\n leagueTable.setAwayPoints(this.awayPoints);\n leagueTable.setAwayForm(this.awayForm);\n leagueTable.setUpdatedDate(this.updatedDate);\n\n return leagueTable;\n }", "public List<Hero> getTeam() {\r\n return team;\r\n }", "public interface League {\n String getIdLeague();\n String getNameLeague();\n String getLogoLeague();\n}", "ReadOnlyObjectProperty<TeamId> winningTeamProperty() {\n return winningTeam;\n }", "Team getMyTeam();", "public Team getTeam1 () {\n return team1;\n }", "@Override\r\n public ViviendaEntity toEntity() {\r\n ViviendaEntity viviendaEntity = super.toEntity();\r\n if (contratos != null) {\r\n List<ContratoEntity> contratosEntity = new ArrayList<>();\r\n for (ContratoDTO dtoContrato : contratos) {\r\n contratosEntity.add(dtoContrato.toEntity());\r\n }\r\n viviendaEntity.setContratos(contratosEntity);\r\n }\r\n\r\n if (cuartos != null) {\r\n List<CuartoEntity> cuartoEntities = new ArrayList<>();\r\n for (CuartoDTO dto : cuartos) {\r\n cuartoEntities.add(dto.toEntity());\r\n }\r\n viviendaEntity.setCuartos(cuartoEntities);\r\n }\r\n\r\n if (sitiosDeInteres != null) {\r\n List<SitioInteresEntity> entities = new ArrayList<>();\r\n for (SitioInteresDTO dto : sitiosDeInteres) {\r\n entities.add(dto.toEntity());\r\n }\r\n viviendaEntity.setSitiosDeInteres(entities);\r\n }\r\n\r\n if (calificaciones != null) {\r\n List<CalificacionEntity> entities = new ArrayList<>();\r\n for (CalificacionDTO dto : calificaciones) {\r\n entities.add(dto.toEntity());\r\n }\r\n viviendaEntity.setCalificaciones(entities);\r\n }\r\n\r\n if (serviciosOfrecidos != null) {\r\n viviendaEntity.setServiciosIncluidos(serviciosOfrecidos);\r\n }\r\n\r\n if (serviciosAdicionales != null) {\r\n List<ServicioAdicionalEntity> entities = new ArrayList<>();\r\n for (ServicioAdicionalDTO dto : serviciosAdicionales) {\r\n entities.add(dto.toEntity());\r\n }\r\n viviendaEntity.setServiciosAdicionales(entities);\r\n }\r\n\r\n return viviendaEntity;\r\n }", "public Team getTeam() {\n return team;\n }", "Observable<List<CountryEntity>> fetchAllCountries();", "public List<PlayerWon> findByLeagueId(int leagueId);", "public interface RechargeListExRepo {\n Observable<RechargeListExEntity> getRechargeListEx();\n}", "public League getLeague()\n\t{\n\t\treturn league;\n\t}", "@Override\n public Observable<UserLoggedEntity> get() {\n return Observable.create(subscriber -> {\n\n Realm realm = Realm.getInstance(realmConfiguration);\n RealmResults<UserLoggedEntity> result = realm.where(UserLoggedEntity.class).findAll();\n result.load();\n\n for (UserLoggedEntity userLoggedEntity : result) {\n if (userLoggedEntity != null) {\n subscriber.onNext(userLoggedEntity);\n subscriber.onComplete();\n } else {\n subscriber.onError(new UserLoggedNotFoundException());\n }\n }\n realm.close();\n });\n }", "@Override\n public void addToModel() {\n for (final Person person : team.observableTeamMembers()) {\n person.setTeam(team);\n }\n\n // Add team to project\n organisation.getTeams().add(team);\n }", "public Player getPlayer(){\r\n return player;\r\n }", "public int getLeagueId() {\n return leagueId;\n }", "@Override\n public Tournament newTournament() {\n String newId = Tournament.randomId();\n while(tournamentCache.containsKey(newId) || tournamentRepository.findById(newId).isPresent()){\n newId = Tournament.randomId();\n }\n Tournament newTournament = new Tournament(newId, fighterService);\n tournamentCache.put(newId, newTournament);\n return newTournament;\n }", "public MutableLiveData<List<NicePlace>> getNicePlaces(){\n setNicePlaces();\n MutableLiveData<List<NicePlace>> data = new MutableLiveData<>();\n data.setValue(dataSet);\n return data;\n }", "public interface DataRepository {\n\n LiveData<List<TvProgramEntity>> findAll();\n\n void update(TvProgramEntity entity);\n\n void updateProgram(TvProgramEntity entity);\n\n void deleteAll();\n\n int delete(TvProgramEntity entity);\n\n}", "public ObservableList<EmployeeEntity> select(){\n return EmployeeDB.getInstance().select();\n }", "public ArrayList<Player> getPlayers() {\n return players;\n}", "public Observable<NearByPlaces> fetchNearByPlaceFromRealm() {\n return Observable.empty();\n }", "public League getLeagueName() {\n return leagueName;\n }", "public Player getPlayer() { return player;}", "@Override // java.util.concurrent.Callable\n public final Result<List<? extends Entity>> call() {\n DataManager instance = DataManager.getInstance();\n Intrinsics.checkNotNullExpressionValue(instance, \"DataManager.getInstance()\");\n return EntityConvertUtils.convertEntityList(instance.getGson(), FakeDanmakuData.access$createJson(this.this$0));\n }", "@Override\n public ArrayList<League> select(String id) {\n return null;\n }", "public void toEntity(){\n\n }", "Team createTeam();", "TimelineEntity(){}", "public interface TeamBLS {\n\n /**\n * 获取TeamListActivity显示内容\n *\n * @param context\n * @return\n */\n public List<TeamConferenceVo> getTeamConference(Context context);\n\n /**\n * 获取TeamActivity的顶层显示内容\n *\n * @param context\n * @param abbr\n * @return\n */\n public TeamInfoVo getTeamInfo(Context context,String abbr);\n\n public List<TeamSeasonInfoVo> getTeamSeasonTotal(Context context,String abbr);\n}", "@Dao\npublic interface MentorDAO {\n @Insert\n void insertMentor(Mentor mentor);\n\n @Update\n void updateMentor(Mentor mentor);\n\n @Delete\n void deleteMentor(Mentor mentor);\n\n @Query(\"SELECT * FROM Mentors\")\n LiveData<List<Mentor>> getAllMentors();\n\n\n @Query(\"SELECT * FROM Mentors WHERE MentorId = :mentorId\")\n Mentor getMentorById(int mentorId);\n\n @Query(\"SELECT * FROM Mentors WHERE CourseId = :courseId\")\n LiveData<List<Mentor>> getMentorsByCourseId(int courseId);\n}", "public Player getPlayer() { return player; }", "@Dao\npublic interface WeekDao {\n\n @Query(\"SELECT * FROM week_table\")\n LiveData<List<Week>> getAllWeeks();\n\n @Insert(onConflict = IGNORE)\n void insertWeek(Week week);\n\n @Update\n void updateWeek(Week week);\n\n @Query(\"DELETE FROM week_table\")\n void deleteAllWeeks();\n}", "@Override\r\n\tpublic ArrayList<TeamPO> getAllTeams() {\n\t\treturn teams.getAllTeams() ;\r\n\t}", "public CuentaEntity toEntity() {\r\n CuentaEntity cuentaE = super.toEntity();\r\n if (this.tarjeta != null) {\r\n if (!this.tarjeta.isEmpty()) {\r\n List<TarjetaEntity> tarjetasEntity = new ArrayList<>();\r\n for (TarjetaDTO dtoTarjeta : tarjeta) {\r\n tarjetasEntity.add(dtoTarjeta.toEntity());\r\n }\r\n cuentaE.setTarjeta(tarjetasEntity);\r\n }\r\n }\r\n if (this.ordenPagos != null) {\r\n if (!this.ordenPagos.isEmpty()) {\r\n List<OrdenPagoEntity> ordenesEntity = new ArrayList<>();\r\n for (OrdenPagoDTO dtoOrdenPago : ordenPagos) {\r\n ordenesEntity.add(dtoOrdenPago.toEntity());\r\n }\r\n cuentaE.setOrdenPagos(ordenesEntity);\r\n }\r\n }\r\n \r\n if (this.estudiante != null) {\r\n System.out.println(\"---------------------------------------------------343434343\");\r\n EstudianteEntity es = estudiante.toEntity();\r\n cuentaE.setEstudiante(es);\r\n System.out.println(es.getDocumento());\r\n System.out.println(cuentaE.getEstudiante());\r\n System.out.println(cuentaE.getEstudiante().getDocumento());\r\n }\r\n\r\n return cuentaE;\r\n }", "public TwoplayertournamentDTO getTwoplayertournamentDTO() {\r\n\t\treturn twoplayertournamentDTO;\r\n\t}", "@Repository\npublic interface PlayersWonDao extends CrudRepository<PlayerWon, Integer>{\n\n /**\n * Get the players that have been won by a given team.\n * \n * @param teamId The team to get players won for.\n * @return The players won by the team.\n */\n public List<PlayerWon> findByTeamId(int teamId);\n \n /**\n * Get the full list of players won in a league.\n * \n * @param leagueId The league to get the players won for.\n * @return The players that have been won in the league.\n */\n public List<PlayerWon> findByLeagueId(int leagueId);\n \n /**\n * Get a player that has already been won.\n * \n * @param leagueId The league to get the player for.\n * @param playerId The player to get.\n * @return The player that has been won, or null if the player has not been won.\n */\n public PlayerWon findByLeagueIdAndPlayerId(int leagueId, int playerId);\n}", "public LiveData<ShipWithContainer> getShip() {\n return mObservableShip;\n }", "public ViviendaEntity toEntity() {\r\n ViviendaEntity entity = new ViviendaEntity();\r\n entity.setIdVivienda(this.getIdVivienda());\r\n entity.setCiudad(this.getCiudad());\r\n entity.setDescripcion(this.getDescripcion());\r\n entity.setDireccion(this.getDireccion());\r\n entity.setCapacidad(this.getCapacidad());\r\n \r\n entity.setValorDiario(this.getValorDiario());\r\n entity.setImagen(this.getImagen());\r\n entity.setNumeroHabitaciones (this.getNumeroHabitaciones());\r\n return entity;\r\n }", "public Team(String name) {\r\n this.name = name;\r\n team = new ArrayList<Hero>();\r\n }", "public List<Team> getAllByLeague(League leagueID) {\n TeamDB tdb = new TeamDB();\n List<Team> teams = tdb.getAllByLeague(leagueID);\n for (Team t : teams) {\n String teamName = t.getTeamName();\n teamName = teamName.replace(\"'\", \"\\\\\\'\");\n t.setTeamName(teamName);\n System.out.println(t.getTeamName());\n }\n return teams;\n }", "public ArrayList<Team> getTeamList(){\n\t\treturn this.teamList;\n\t}", "@Dao\npublic interface FSalesmanDao {\n /**\n * @param fSalesman\n * Harus Menggunakan\n * .allowMainThreadQueries() pada Configurasi database utama agar tidak perlu menggunakan AsynT\n */\n @Insert\n void insert(FSalesman fSalesman);\n @Update\n void update(FSalesman fSalesman);\n @Delete\n void delete(FSalesman fSalesman);\n\n\n @Query(\"DELETE FROM fSalesman\")\n void deleteAllFSalesman();\n\n @Query(\"SELECT * FROM fSalesman \")\n LiveData<List<FSalesman>> getAllFSalesmanLive();\n\n @Query(\"SELECT * FROM fSalesman \")\n List<FSalesman> getAllFSalesman();\n\n\n @Query(\"SELECT * FROM fSalesman WHERE id = :id \")\n List<FSalesman> getAllById(int id);\n\n @Query(\"SELECT * FROM fSalesman WHERE fdivisionBean = :id \")\n List<FSalesman> getAllByDivision(int id);\n\n}", "@Query(\"Select * from Asignatura\")\n LiveData<List<Asignatura>> obtenerAsignaturas();", "@Mapper(componentModel = \"spring\", uses = { CustomUserMapper.class, IconMapper.class })\npublic interface TeamMapper extends EntityMapper<TeamDTO, Team> {\n\n /* (non-Javadoc)\n * @see com.ttth.teamcaring.service.mapper.EntityMapper#toDto(java.lang.Object)\n */\n @Mapping(source = \"owner.id\", target = \"ownerId\")\n @Mapping(source = \"icon.id\", target = \"iconId\")\n TeamDTO toDto(Team team);\n\n /* (non-Javadoc)\n * @see com.ttth.teamcaring.service.mapper.EntityMapper#toEntity(java.lang.Object)\n */\n @Mapping(target = \"groups\", ignore = true)\n @Mapping(target = \"appointments\", ignore = true)\n @Mapping(source = \"ownerId\", target = \"owner\")\n @Mapping(source = \"iconId\", target = \"icon\")\n Team toEntity(TeamDTO teamDTO);\n\n /**\n * From id.\n *\n * @param id the id\n * @return the team\n */\n default Team fromId(Long id) {\n if (id == null) {\n return null;\n }\n Team team = new Team();\n team.setId(id);\n return team;\n }\n}", "public interface TeamService {\n Teams getAllTeams();\n Team getTeamById(int id);\n Teams getSelectedTeams(int[] teamList);\n}", "List<Team> findAll();", "public ArrayList<CollegeFootballTeam> getTeamList();", "@Repository\npublic interface UserLeagueRepo extends JpaRepository<UserLeague, UserLeagueKey> {\n}", "public ArrayList<Team> getList(){\n\t\treturn this.teams;\n\t}", "public SongEntity getSong()\r\n {\r\n return song;\r\n }", "Team findById(Long id);", "public Team get(Long id);", "E toEntity(V dto);", "public static ArrayList<Player> getWinners(){return winners;}", "@Dao\npublic interface MovieDao {\n @Query(\"select * from movies\")\n LiveData<List<MovieEntity>> load();\n\n @Insert(onConflict = OnConflictStrategy.REPLACE)\n void insertAll(List<MovieEntity> movies);\n\n @Query(\"select * from movies where rating >= :min and rating <= :max\")\n LiveData<List<MovieEntity>> getWithRatingsFilter(int min, int max);\n\n @Query(\"select * from movies where releaseYear >= :min and releaseYear <= :max\")\n LiveData<List<MovieEntity>> getWithYearFilter(int min, int max);\n\n @Query(\"select releaseYear from movies order by releaseYear asc limit 1\")\n int getMinReleaseYear();\n\n @Query(\"select releaseYear from movies order by releaseYear desc limit 1\")\n int getMaxReleaseYear();\n\n @Query(\"select rating from movies order by rating asc limit 1\")\n double getMinRating();\n\n @Query(\"select rating from movies order by rating desc limit 1\")\n double getMaxRating();\n\n @Query(\"select genre from movies\")\n List<String> getGenres();\n\n @Query(\"select * from movies where genre like :genre\")\n LiveData<List<MovieEntity>> getWithGenreFilter(String genre);\n\n @Query(\"delete from movies\")\n void deleteAll();\n}", "@Override\n public Entity getEntity() {\n return super.getEntity();\n }", "public Room getTheObject(){\n return this;\n }", "@Override\n public String getTeam(){\n return this.team;\n }", "public ObservableList<twinsTable> getData(){\r\n\t\t\r\n\t\tConnection conn1;\r\n \r\n try{\r\n \tClass.forName(\"com.mysql.cj.jdbc.Driver\");\r\n \tconn1 = DriverManager.getConnection(\"jdbc:mysql://www.db4free.net:3306/project4\", \"mikerolfe\", \"#OnTrack1!\");\r\n \tSystem.out.println(\"Connected\");\r\n String SQL = \"Select * from twinsmn\"; \r\n ResultSet rs = conn1.createStatement().executeQuery(SQL);\r\n System.out.println(\"Query Ran\");\r\n while(rs.next()){ \r\n playerInfo.add( new twinsTable(rs.getInt(1), rs.getInt(2), rs.getString(3), rs.getString(4), rs.getString(5), rs.getString(6), rs.getString(7)));\r\n System.out.println(\"inserted row\");\r\n System.out.println(\"The player id: \" + rs.getInt(1) + \" The Jersey Number: \" +rs.getInt(2) + \" The Player: \" + rs.getString(3) + \" The BT: \"+ rs.getString(4) + \" The Height: \"+ rs.getString(5));\r\n }\r\n filteredData.addAll(playerInfo);\r\n }\r\n catch(Exception e){\r\n e.printStackTrace();\r\n System.out.println(\"Error on Building Data\"); \r\n }\r\n return playerInfo;\r\n }", "public MoverEntity getConvoyLeader();", "public LiveData<List<ComicEntity>> getComics() {\n return mObservableComics;\n }", "public abstract V getEntity();", "public EventoEntity toEntity() {\n EventoEntity entity = new EventoEntity();\n entity.setId(this.id);\n entity.setCapacidad(this.capacidad);\n entity.setDistanciaVivienda(this.distanciaVivienda);\n entity.setFechaEvento(this.fechaEvento);\n entity.setNombreEvento(this.nombreEvento);\n entity.setPrivado(this.privado);\n entity.setTipoEvento(this.tipoEvento);\n entity.setUbicacionLat(this.ubicacionLat);\n entity.setUbicacionLon(this.ubicacionLon);\n return entity;\n }", "@Override\n protected Entity[] getObservedEntities() {\n return entities;\n }", "public LiveObject getLiveObject();", "public List<PlayerWon> findByTeamId(int teamId);", "public void newTeam(Team team);", "public LiveData<List<Spot>> getAllSpots() { return mAllSpots; }", "public List<Entity> getPassengers() {\n/* 667 */ return Lists.newArrayList(Lists.transform((getHandle()).passengers, new Function<Entity, Entity>()\n/* */ {\n/* */ public Entity apply(Entity input) {\n/* 670 */ return input.getBukkitEntity();\n/* */ }\n/* */ }));\n/* */ }", "public interface DbHelper {\n\n Observable<Long> insertTranslation(Translation translation);\n\n Observable<List<Translation>> getAllTranslations();\n\n}", "public List<Player> getPlayerList(){\n return this.players;\n }", "public interface UsersRepo {\n Observable<List<User>> getAllUsers();\n\n}", "EntityData<?> getEntityData();", "interface NewsDataStore {\n\n /**\n * Get an {@link Observable} which will emit a List of {@link NewsEntity}.\n */\n Single<List<NewsEntity>> news();\n\n}", "public Player getPlayer1(){\n return jugador1;\n }", "@Override\n public ArrayList<Player> getPlayers() {return steadyPlayers;}", "public ObservableList<Movie> getFilmData() {\r\n return ser.movieData;\r\n }", "@Query(\"SELECT * FROM Round WHERE round_id= :roundId\")\n LiveData<Round> getByRoundId(long roundId);", "Match getTeam2LooserOfMatch();", "@Dao\npublic interface ProductDao {\n\n @Query(\"SELECT * FROM products\")\n LiveData<List<ProductEntity>> loadAllProducts();\n}", "@Override\r\n public AseoEntity toEntity() {\r\n AseoEntity entity = new AseoEntity();\r\n entity.setBanho(this.banho);\r\n entity.setDientes(this.dientes);\r\n entity.setPeluqueria(this.peluqueria);\r\n entity.setCosto(this.getCosto());\r\n entity.setDuracion(this.getDuracion());\r\n entity.setEstado(this.isEstado());\r\n entity.setFecha(this.getFecha());\r\n entity.setRango(this.getRango());\r\n entity.setId(this.id);\r\n if (this.cliente != null) {\r\n entity.setCliente(cliente.toEntity());\r\n }\r\n if (this.mascota != null) {\r\n entity.setMascota(mascota.toEntity());\r\n }\r\n if (this.empleado != null) {\r\n entity.setEmpleado(empleado.toEntity());\r\n }\r\n if (this.factura != null) {\r\n entity.setFactura(factura.toEntity());\r\n }\r\n if (this.calificacion != null) {\r\n entity.setCalificacion(calificacion.toEntity());\r\n }\r\n if (this.getVeterinaria() != null) {\r\n entity.setVeterinaria(this.getVeterinaria().toEntity());\r\n }\r\n return entity;\r\n }", "public Model() {\r\n\t\t\tsuper();\r\n\t\t\tdao=new SerieADAO();\r\n\t\t\tthis.mapSeason=new HashMap<>();\r\n\t\t\tthis.mapTeam=new HashMap<>();\r\n\t\t\tthis.mapTeamBySeason=new HashMap<>();\r\n\t\t\tthis.mapMatch=new HashMap<>();\r\n\t\t\tthis.mapMatchBySeason=new HashMap<>();\r\n\r\n\t\r\n\t\t}", "public Long getLeagueId() {\n return (this.leagueId);\n }", "@Override\n public Participant mapToModel(ParticipantEntity entity) {\n Participant participant = new Participant();\n\n participant.setId(entity.getId());\n participant.setUsername(entity.getUsername());\n\n return participant;\n }", "public interface OrdersDataSource {\n\n /**\n * Query the orders of the product range from beginTime to endTime.\n *\n * @param productId product id\n * @param productType product type\n * @param beginTime begin time\n * @param endTime end time\n * @return The the orders of the product range from beginTime to endTime if exist.\n */\n Observable<List<Order>> queryOrders(@NonNull String productId, @NonNull String productType,\n @NonNull String beginTime, @NonNull String endTime);\n\n /**\n * Get valid orders of the product.\n *\n * @param productId product id\n * @param productType product type\n * @return The valid order of the product or <code>null<code/>.\n */\n Observable<List<Order>> getValidOrders(@NonNull String productId, @NonNull String productType);\n\n /**\n * Get order by order serial.\n *\n * @param orderSerial order serial.\n * @return The order detail or <code>null<code/>.\n */\n Observable<Order> getOrder(@NonNull String orderSerial);\n\n /**\n * Create the order of the product.\n *\n * @return The order(not paid yet) created by Server.\n */\n Observable<Order> createOrder(@NonNull String productId, @Nullable String mediaId,\n @Nullable String encryptionType, @NonNull String productType, @NonNull String quantity);\n\n /**\n * Pay the order.\n *\n * @param orderSerial order number\n * @return Pay status.\n */\n Observable<PayOrderResult> payOrder(@NonNull String orderSerial);\n\n /**\n * Pay the credit order.\n *\n * @param orderSerial order number\n * @return Pay status.\n */\n Observable<PayOrderResult> payCreditOrder(@NonNull String orderSerial);\n\n Observable<Ticket> getPlayTicket(@NonNull String filmId, @Nullable String mediaName,\n @NonNull String orderSerial, @NonNull String licenseId);\n\n Observable<Ticket> getPlayToken(@NonNull String ticket, @NonNull String licenseId,\n @Nullable String checkcode, @Nullable String kdmId);\n\n /**\n * Report the ticket status\n */\n Observable<Response> reportTicketStatus(@NonNull String orderSerial, @NonNull String ticket,\n @NonNull String status, @Nullable String progressrate);\n\n /**\n * refresh order by order serial\n *\n * @param orderSerial order serial\n */\n Observable<Boolean> refreshOrder(@NonNull String orderSerial);\n}", "@Override\n public List<Player> getPlayers() {\n return players;\n }", "public void populatePalicoWeaponList()\r\n\t{\r\n\t\tpalicoWeapons = FXCollections.observableArrayList();\r\n\t\tselect(\"SELECT * FROM Palico_Weapon\");\r\n\t}", "public static ResponseDataObject<MatchEntity> getListLiveMatches()\n {\n ResponseDataObject responseDataObject = new ResponseDataObject();\n List<MatchEntity> listLiveMatches = new ArrayList<>();\n\n // Load Document\n Document document = null;\n try\n {\n document = HTMLRequestManager.getData(REQUEST_URL);\n\n // Set Response Code\n if(document != null && document.hasText())\n {\n // Response OK\n responseDataObject.setResponseCode(ResponseDataObject.RESPONSE_CODE_OK);\n } else\n {\n // Response Failed\n responseDataObject.setResponseCode(ResponseDataObject.RESPONSE_CODE_FAILED_GETTING_DOCUMENT);\n }\n\n }\n catch (IOException e)\n {\n LogUtil.e(TAG, e.getMessage(), e);\n\n // Response Falied\n responseDataObject.setResponseCode(ResponseDataObject.RESPONSE_CODE_FAILED_GETTING_DOCUMENT);\n }\n\n\n // Parse Data\n if(responseDataObject.isOk())\n {\n responseDataObject.setListObjectsResponse(parseLiveMatchDocumentToListMatches(document));\n }\n\n return responseDataObject;\n }", "@Query(\"SELECT * FROM Motivator WHERE activity = :name\")\n LiveData<List<Motivator>> getMotivators(String name);", "Match getTeam1LooserOfMatch();", "public GoalsViewModel(DataManager dataManager, SchedulerProvider schedulerProvider) {\n super(dataManager, schedulerProvider);\n// goalsData = new MutableLiveData<>();\n\n loadGoals();\n }", "SysTeam selectByPrimaryKey(Integer teamId);", "public ArrayList<Entity> getPlayers() {\n ArrayList<Entity> players = new ArrayList<>();\n students.forEach(student -> players.add(student.getPlayer()));\n return players;\n }", "public interface StudentDataSource {\n\n Observable<Student> getStudent(@NonNull String name);\n\n Single<List<Student>> getStudents();\n\n void saveStudent(@NonNull Student student);\n\n}", "PlayerInRoomModel createPlayerInRoomModel(PlayerInRoomModel playerInRoomModel);", "public FightTeam team();", "public LeaguePrimaryKey() {\n }", "@Query(\"SELECT * FROM Motivator WHERE motivator_id = :id\")\n LiveData<Motivator> selectMotivator(long id);", "public interface RemoteRouteRepository {\n Observable<List<LatLng>> getRoute(LatLng currentLocation, LatLng toiletLocation);\n}" ]
[ "0.5898374", "0.55082905", "0.54966277", "0.5489158", "0.5346952", "0.5340667", "0.5275813", "0.5250629", "0.5222563", "0.52117556", "0.51654214", "0.51088494", "0.5107464", "0.5106105", "0.51026964", "0.5098615", "0.50943017", "0.50819653", "0.5070841", "0.5062602", "0.5038145", "0.5032382", "0.50309664", "0.50263035", "0.50226176", "0.500713", "0.5006915", "0.4999783", "0.49940157", "0.49711052", "0.49512222", "0.4923594", "0.48968664", "0.4896569", "0.48907465", "0.48905736", "0.48836496", "0.48797938", "0.4873801", "0.486508", "0.48622486", "0.48568955", "0.4850932", "0.48473954", "0.48469314", "0.48388997", "0.48375544", "0.4835027", "0.4824994", "0.4824379", "0.48008853", "0.47912917", "0.4785915", "0.4784331", "0.478173", "0.47738385", "0.47719312", "0.4771494", "0.47704217", "0.4768228", "0.47665453", "0.47649837", "0.47636312", "0.4762647", "0.47621882", "0.47609168", "0.47602198", "0.47591788", "0.4758247", "0.4756585", "0.47492954", "0.47465342", "0.47396448", "0.4735164", "0.4732478", "0.4728549", "0.47252873", "0.47207025", "0.47202745", "0.47170615", "0.47124234", "0.47119826", "0.47112432", "0.470854", "0.4708394", "0.47051063", "0.47007704", "0.47006178", "0.47003388", "0.46990585", "0.4696553", "0.46942797", "0.469256", "0.46911633", "0.46900046", "0.46895805", "0.46894634", "0.46871108", "0.46867925", "0.46789363" ]
0.7993114
0
Use the rule to implement the given query. This will instantiate the rule against the query, run the new query against the whole reasoner+rawdata again and then rewrite the results from that query according the rule.
public ExtendedIterator execute(TriplePattern query, InfGraph infGraph, Finder data, HashSet firedRules) { RDFSInfGraph bRr = (RDFSInfGraph)infGraph; if (query.getSubject().isVariable()) { // Find all things of type resource return new ResourceRewriteIterator(bRr.findRawWithContinuation(body, data)); } else { // Just check for a specific resource Node subj = query.getSubject(); TriplePattern pattern = new TriplePattern(subj, null, null); String var = "s"; ExtendedIterator it = bRr.findRawWithContinuation(pattern, data); if (!it.hasNext()) { pattern = new TriplePattern(null, null, subj); var = "o"; it = bRr.findRawWithContinuation(pattern, data); if (!it.hasNext()) { pattern = new TriplePattern(null, subj, null); var = "p"; it = bRr.findRawWithContinuation(pattern, data); } } BRWRule rwrule = new BRWRule(new TriplePattern(Node.createVariable(var), TYPE, RESOURCE), body); return new RewriteIterator(it, rwrule); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract void applyToQuery(DatabaseQuery theQuery, GenerationContext context);", "public Query queryRule(String rule, Object... args) throws Exceptions.OsoException {\n Host new_host = host.clone();\n String pred = new_host.toPolarTerm(new Predicate(rule, Arrays.asList(args))).toString();\n return new Query(ffiPolar.newQueryFromTerm(pred), new_host);\n }", "public NrtAlertRule withQuery(String query) {\n if (this.innerProperties() == null) {\n this.innerProperties = new NrtAlertRuleProperties();\n }\n this.innerProperties().withQuery(query);\n return this;\n }", "void rewrite(MySqlSelectQueryBlock query);", "public void queryRecommended(Query query, float score, String original);", "public void newQuery(String query){\n\t\tparser = new Parser(query);\n\t\tQueryClass parsedQuery = parser.createQueryClass();\n\t\tqueryList.add(parsedQuery);\n\t\t\n\t\tparsedQuery.matchFpcRegister((TreeRegistry)ps.getRegistry());\n\t\tparsedQuery.matchAggregatorRegister();\n\t\t\n\t\t\n\t}", "@Test\n public void testFromFollowedByQuery() throws Exception {\n final String text = \"rule X when Cheese() from $cheesery ?person( \\\"Mark\\\", 42; ) then end\";\n RuleDescr rule = ((RuleDescr) (parse(\"rule\", text)));\n TestCase.assertFalse(parser.getErrors().toString(), parser.hasErrors());\n PatternDescr pattern = ((PatternDescr) (getDescrs().get(0)));\n TestCase.assertEquals(\"Cheese\", pattern.getObjectType());\n TestCase.assertEquals(\"from $cheesery\", pattern.getSource().getText());\n TestCase.assertFalse(pattern.isQuery());\n pattern = ((PatternDescr) (getDescrs().get(1)));\n TestCase.assertEquals(\"person\", pattern.getObjectType());\n TestCase.assertTrue(pattern.isQuery());\n }", "public abstract Query<T> setQuery(String oql);", "@Override\n\tprotected void runData(Query query) throws SQLException {\n\t\tStringBuilder q = new StringBuilder();\n\t\tArrayList<Integer> destinationList = new ArrayList<Integer>();\n\t\tquery.inc(2);\n\t\twhile (!isData(query.part()) || !isComment(query.part()) || !isCode(query.part())) {\n\t\t\tq.append(query.part());\n\t\t\tq.append(\" \");\n\t\t\tquery.inc();\n\t\t}\n\t\tArrayList<Integer> originList = getLinesFromData(q.toString());\n\t\tparseSecondCondition(query, originList, destinationList);\n\t}", "public QueryExecution createQueryExecution(Query qry);", "public Query query(Predicate query) throws Exceptions.OsoException {\n Host new_host = host.clone();\n String pred = new_host.toPolarTerm(query).toString();\n return new Query(ffiPolar.newQueryFromTerm(pred), new_host);\n }", "void updateFrom(RuleDetail ruleDetail);", "public T caseQueryRule(QueryRule object)\n {\n return null;\n }", "private void applyTheRule() throws Exception {\n System.out.println();\n System.out.println();\n System.out.println();\n System.out.println(\"IM APPLYING RULE \" + this.parameter.rule + \" ON MODEL: \" + this.resultingModel.path);\n System.out.println();\n if (parameter.rule.equals(\"1\")) {\n Rule1.apply(resultingModel);\n System.out.println();\n }\n\n if (parameter.rule.equals(\"2\")) {\n Rule2.apply(resultingModel);\n System.out.println();\n }\n\n if (parameter.rule.equals(\"3\")) {\n Rule3.all(resultingModel);\n System.out.println();\n }\n\n if (parameter.rule.equals(\"3a\")) {\n Rule3.a(resultingModel);\n\n }\n\n if (parameter.rule.equals(\"3b\")) {\n Rule3.b(resultingModel);\n }\n\n if (parameter.rule.equals(\"3c\")) {\n Rule3.c(resultingModel);\n }\n\n if (parameter.rule.equals(\"4\")) {\n Rule4.all(resultingModel);\n }\n\n if (parameter.rule.equals(\"4a\")) {\n Rule4.a(resultingModel);\n }\n\n if (parameter.rule.equals(\"4b\")) {\n Rule4.b(resultingModel);\n }\n\n if (parameter.rule.equals(\"4c\")) {\n Rule4.c(resultingModel);\n }\n\n if (parameter.rule.equals(\"r1\")) {\n Reverse1.apply(resultingModel, parameter.aggregateBy);\n }\n\n if (parameter.rule.equals(\"r2\")) {\n Reverse2.apply(resultingModel, parameter.aggregateBy);\n }\n\n if (parameter.rule.equals(\"r3\")) {\n Reverse3.apply(resultingModel, parameter.aggregateBy);\n }\n\n if (parameter.rule.equals(\"r3a\")) {\n Reverse3.a(resultingModel);\n }\n\n if (parameter.rule.equals(\"r3b\")) {\n Reverse3.b(resultingModel);\n }\n\n if (parameter.rule.equals(\"r3c\")) {\n Reverse3.c(resultingModel);\n }\n\n if (parameter.rule.equals(\"r4\")) {\n Reverse4.all(resultingModel);\n }\n\n if (parameter.rule.equals(\"r4a\")) {\n Reverse4.a(resultingModel);\n }\n\n if (parameter.rule.equals(\"r4b\")) {\n Reverse4.b(resultingModel);\n }\n\n if (parameter.rule.equals(\"r4c\")) {\n Reverse4.c(resultingModel);\n }\n\n if (parameter.rule.equals(\"5\")){\n Rule5.apply(resultingModel);\n }\n\n System.out.println(\"IM DONE APPLYING RULE \" + this.parameter.rule + \" ON MODEL: \" + this.resultingModel.path);\n\n this.resultingModel.addRule(parameter);\n //System.out.println(this.resultingModel.name);\n this.resultingModel.addOutputInPath();\n }", "@Override\n\tprotected void runComment(Query query) {\n\t\tquery.inc();\n\t\tArrayList<Integer> originList = getListOnComment(query.next());\n\t\tArrayList<Integer> destinationList = new ArrayList<Integer>();\n\t\tparseSecondCondition(query, originList, destinationList);\n\t}", "void setRule(Rule rule);", "public StatementQueryMechanism(DatabaseQuery query) {\n super(query);\n }", "private Query applySynonymQueries(Query query, List<Query> synonymQueries, float originalBoost, float synonymBoost) {\n if (query instanceof BoostedQuery) {\n return applySynonymQueries(((BoostedQuery) query).getQuery(), synonymQueries, originalBoost, synonymBoost);\n } else if (query instanceof BooleanQuery) {\n BooleanQuery.Builder booleanQueryBuilder = new BooleanQuery.Builder();\n for (BooleanClause booleanClause : ((BooleanQuery) query).clauses()) {\n if (Occur.MUST == booleanClause.getOccur()) {\n BooleanQuery.Builder combinedQueryBuilder = new BooleanQuery.Builder();\n combinedQueryBuilder.add(new BoostQuery(booleanClause.getQuery(), originalBoost), Occur.SHOULD);\n // standard 'must occur' clause - i.e. the main user query\n \n for (Query synonymQuery : synonymQueries) {\n BooleanQuery.Builder booleanSynonymQueryBuilder = new BooleanQuery.Builder();\n booleanSynonymQueryBuilder.add(new BoostQuery(synonymQuery, synonymBoost), Occur.SHOULD);\n combinedQueryBuilder.add(booleanSynonymQueryBuilder.build(), Occur.SHOULD);\n }\n booleanQueryBuilder.add(combinedQueryBuilder.build(), Occur.MUST);\n } else {\n booleanQueryBuilder.add(booleanClause);\n }\n }\n query = booleanQueryBuilder.build();\n queryToHighlight = query;\n }\n return query;\n }", "protected String compileQuery(final String query, String result) throws IllegalArgumentException {\n\t\t\n\t\tif (query != null && ! query.isEmpty()) {\n\t\t\tfinal SelektQLErrorListener selektQLErrorListener = new SelektQLErrorListener();\n\t\t\tSelektQLLexer lexer = new SelektQLLexer(CharStreams.fromString(query));\n\t\t\tSelektQLParser parser = new SelektQLParser(new CommonTokenStream(lexer));\n\t\t\tparser.removeErrorListeners();\n\t\t\tparser.addErrorListener(selektQLErrorListener);\n\t\t\tresult = selektQL2Solr.visit(parser.anfrage());\n\t\t\tif (selektQLErrorListener.error) {\n\t\t\t\tthrow new IllegalArgumentException(\"Fehler beim Kompilieren der Anfrage \" + query);\n\t\t\t}\n\t\t} \n\t\treturn result;\n\t}", "private void performRule(DataNormalizationRule rule, GraphModification modifications) throws DataNormalizationException, DatabaseException, SQLException {\n\t\tif (inputGraph.getGraphName().length() == 0) {\n\t\t\tthrow new DataNormalizationException(\"Empty Graph Name is not allowed.\");\n\t\t}\n\n\t\tif (modifications == null) {\n\t\t\t/**\n\t\t\t * In case there is no interest in what was changed just perform all the components in the correct order\n\t\t\t */\n\t\t\tperformComponents(rule, inputGraph.getGraphName());\n\t\t} else {\n\t\t\ttry {\n\t\t\t\tgetDirtyConnection().execute(markTemporaryGraph, original);\n\t\t\t\tgetDirtyConnection().execute(String.format(Locale.ROOT, backupQueryFormat, original, inputGraph.getGraphName()));\n\n\t\t\t\tperformComponents(rule, inputGraph.getGraphName());\n\n\t\t\t\tgetDirtyConnection().execute(markTemporaryGraph, modified);\n\t\t\t\tgetDirtyConnection().execute(String.format(Locale.ROOT, backupQueryFormat, modified, inputGraph.getGraphName()));\n\n\t\t\t\t/**\n\t\t\t\t * Unfortunatelly \"SELECT ?s ?p ?o WHERE {{GRAPH <%s> {?s ?p ?o}} MINUS {GRAPH <%s> {?s ?p ?o}}}\"\n\t\t\t\t * throws \"Internal error: 'output:valmode' declaration conflicts with 'output:format'\"\n\t\t\t\t *\n\t\t\t\t * Therefore it is necessary to first create graphs with differences.\n\t\t\t\t */\n\t\t\t\tgetDirtyConnection().execute(String.format(Locale.ROOT, diffQueryFormat, modified, original));\n\t\t\t\tgetDirtyConnection().execute(String.format(Locale.ROOT, diffQueryFormat, original, inputGraph.getGraphName()));\n\n\t\t\t\tWrappedResultSet inserted = getDirtyConnection().executeSelect(String.format(Locale.ROOT, selectQueryFormat, modified));\n\n\t\t\t\t/**\n\t\t\t\t * All that is new to the transformed graph are insertions done by this rule (one of its components)\n\t\t\t\t */\n\t\t\t\twhile (inserted.next()) {\n\t\t\t\t\tmodifications.addInsertion(rule,\n\t\t\t\t\t\t\tinserted.getString(\"s\"),\n\t\t\t\t\t\t\tinserted.getString(\"p\"),\n\t\t\t\t\t\t\tinserted.getString(\"o\"));\n\t\t\t\t}\n\n\t\t\t\tWrappedResultSet deleted = getDirtyConnection().executeSelect(String.format(Locale.ROOT, selectQueryFormat, original));\n\n\t\t\t\t/**\n\t\t\t\t * All that is missing from the transformed graph are deletions done by this rule (one of its components)\n\t\t\t\t */\n\t\t\t\twhile (deleted.next()) {\n\t\t\t\t\tmodifications.addDeletion(rule,\n\t\t\t\t\t\t\tdeleted.getString(\"s\"),\n\t\t\t\t\t\t\tdeleted.getString(\"p\"),\n\t\t\t\t\t\t\tdeleted.getString(\"o\"));\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\ttry {\n\t\t\t\t\tgetDirtyConnection().execute(String.format(Locale.ROOT, dropBackupQueryFormat, original));\n\t\t\t\t} finally {}\n\t\t\t\ttry {\n\t\t\t\t\tgetDirtyConnection().execute(String.format(Locale.ROOT, dropBackupQueryFormat, modified));\n\t\t\t\t} finally {}\n\t\t\t\tgetDirtyConnection().execute(unmarkTemporaryGraph, original);\n\t\t\t\tgetDirtyConnection().execute(unmarkTemporaryGraph, modified);\n\t\t\t}\n\t\t}\n\t\tLOG.info(String.format(Locale.ROOT, \"Data Normalization rule %d applied: %s\", rule.getId(), rule.getLabel() != null ? rule.getLabel() : \"\"));\n\t}", "public abstract void resetQuery();", "public void updateQuery(String query) {\n\t\tUpdateAction.parseExecute(query, model);\n\t}", "@Override\n\tprotected void runLine(Query query) {\n\t\tquery.inc();\n\t\tint i = Integer.parseInt(query.next());\n\t\tArrayList<Integer> originList = new ArrayList<Integer>();\n\t\toriginList.add(i - 1);\n\t\tArrayList<Integer> destinationList = new ArrayList<Integer>();\n\t\tparseSecondCondition(query, originList, destinationList);\n\t}", "public void setQuery(DatabaseQuery query) {\n this.query = query;\n }", "public CQLQueryResults processQuery(CQLQuery cqlQuery) throws MalformedQueryException, \n\t QueryProcessingException {\n\t\tthrow new RuntimeException(\"not impl yet. port from ncia-core-grid-transfer\");\n\t}", "public CQLQueryResults processQuery(CQLQuery cqlQuery) throws MalformedQueryException, \r\n\t QueryProcessingException {\r\n\t\tthrow new RuntimeException(\"not impl yet. port from ncia-core-grid-transfer\");\r\n\t}", "Query createQuery(final String query);", "public void callQuery(String query) throws SQLException {\n for(int i = 0; i < queryHistory.size(); i++) {\n if(queryHistory.get(i).equalsIgnoreCase(query))\n data.get(i).OUPUTQUERY(data.get(i).getConversionArray(), data.get(i).getResultSet());\n }\n }", "public void Query() {\n }", "abstract protected void passHitQueryContextToClauses(HitQueryContext context);", "public static void main(String args[]){\n String sql = \"select * from TBLS limit 2\";\n String sqlComplex = \"select testpartition.filename,format_.o,title.s,identifier.o,id.o,date_.o \" +\n \"from testpartition join format_ on (testpartition.filename=format_.s) \" +\n \"join title on (testpartition.filename=title.s) \" +\n \"join identifier on (testpartition.filename=identifier.s) \" +\n \"join id on (testpartition.filename=id.s) \" +\n \"join date_ on (testpartition.filename=date_.s) \" +\n \"where testpartition.gid0=1 and testpartition.sid=2 and testpartition.fid<100000 and testpartition.pfid=0\";\n String sqlOriginal = \"select idTable.filename,format_.o,title.s,identifier.o,id.o,date_.o \" +\n \"from idTable join format_ on (idTable.filename=format_.s) \" +\n \"join title on (idTable.filename=title.s) \" +\n \"join identifier on (idTable.filename=identifier.s) \" +\n \"join id on (idTable.filename=id.s) \" +\n \"join date_ on (idTable.filename=date_.s) \" +\n \"where idTable.gid0=1 and idTable.sid=2 and idTable.fid<100000\";\n\n QueryRewrite my = new QueryRewrite(sqlOriginal);\n String sqlRewrite = my.rewrite();\n System.out.println(sqlRewrite);\n\n\n }", "public void runQuery(String query) throws SQLException {\n runQuery(query, \"default\");\n }", "public void rewriteDLR(){\n\t\t\n\t\tlong startTime = System.currentTimeMillis();\n\t\t\n\t\t//Rewriting for global context.\n\t\tDLRGlobal2DatalogRewriter globalrewriter = new DLRGlobal2DatalogRewriter();\n\t\tdatalogGlobal = globalrewriter.rewrite(inputCKR.getGlobalOntology());\n\t\t\n\t\tlong endTime = System.currentTimeMillis();\n\t\trewritingTime = endTime - startTime;\n\t\t\n\t\t//Compute DKB Program.\n\t\tdatalogCKR = new DLProgram();\n\t\n\t\tdatalogCKR.addAll(datalogGlobal.getStatements());\n\n\t\t//Add local propagation rules.\n\t\tdatalogCKR.addAll(DLRDeductionRuleset.getPd());\n\t}", "private void performNewQuery(){\n\n // update the label of the Activity\n setLabelForActivity();\n // reset the page number that is being used in queries\n pageNumberBeingQueried = 1;\n // clear the ArrayList of Movie objects\n cachedMovieData.clear();\n // notify our MovieAdapter about this\n movieAdapter.notifyDataSetChanged();\n // reset endless scroll listener when performing a new search\n recyclerViewScrollListener.resetState();\n\n /*\n * Loader call - case 3 of 3\n * We call loader methods as we have just performed reset of the data set\n * */\n // initiate a new query\n manageLoaders();\n\n }", "public PostingsList phrase_query(Query query){\n\n LinkedList<PostingsList> listQueriedPostings = new LinkedList<PostingsList>();\n // List with postings corresponding to the queries\n for (int i = 0; i<query.size(); i++){\n // If any query has zero matches, return 0 results\n //if(!(new File(\"postings/t\"+hash(query.terms.get(i))+\".json\")).exists()){\n if (!this.index.containsKey(query.terms.get(i))){\n return null;\n }\n // Otherwise store postings in the list\n listQueriedPostings.add(this.getPostings(query.terms.get(i)));\n }\n\n PostingsList result = new PostingsList();\n result = listQueriedPostings.get(0);\n\n // In case only one word is queried\n if (listQueriedPostings.size() == 1){\n return result;\n }\n\n // Apply algorithm as many times as words in the query\n for(int i = 1; i < listQueriedPostings.size(); i++){\n result = phrase_query(result, listQueriedPostings.get(i));\n if (result.isEmpty()){\n return null;\n }\n }\n return result;\n }", "Query query();", "@Override\n\tprotected void runCode(Query query) {\n\t\tquery.inc();\n\t\tArrayList<Integer> originList = getListOnCode(query.next());\n\t\tArrayList<Integer> destinationList = new ArrayList<Integer>();\n\t\tparseSecondCondition(query, originList, destinationList);\n\t}", "public void constructQuery(String query) {\n\t\tQuery q = QueryFactory.create(query);\n\t\tQueryExecution qe = QueryExecutionFactory.create(q, model);\n\t\tModel result = qe.execConstruct();\n\t\tprintModel(result);\n\t\tmodel.add(result);\n\t\tqe.close();\n\t}", "void checkRewrite(\n SqlValidator validator,\n String query,\n String expectedRewrite);", "public PostingsList ranked_query(Query query, double w, double idf_threshold){\n long startTime = System.nanoTime();\n PostingsList result = new PostingsList();\n\n // Obtain union of terms above idf threshold if indexElimination is true\n // (Set idf_threshold to zero to disable this feature)\n Set<String> termsToConsider = this.queryTermsConsidered(query, idf_threshold);\n result = this.union_query(query, termsToConsider);\n //System.err.println(\"Size of result is \" + result.size());\n\n long estimatedTime = (System.nanoTime() - startTime)/1000000;\n System.err.println(\"* Union took: \" + estimatedTime);\n\n\n /*\n * 2) Iterate over PostingsEntries and build the solution\n */\n startTime = System.nanoTime();\n // Required when iterating over a PostingsList\n PostingsEntry postEnt = new PostingsEntry();\n // Number of documents in the collection\n double nDocs = this.docIDs.size();\n // Weight of a query vector coefficient\n double w_query_term;\n // Document tf-idf variables\n double termFrequency_doc, documentFrequency_doc, w_doc_term;\n\n for(String term : termsToConsider){\n // Obtain idf of the term\n documentFrequency_doc = Math.log(nDocs/new Double(this.idfMap.get(term)));\n\n // Obtain weight of the term\n w_query_term = query.weights.get(term);\n // Iterate over all documents containing the term and update the score(q,d)\n Iterator<PostingsEntry> it_d = result.iterator();\n while(it_d.hasNext()){\n postEnt = it_d.next();\n if (this.tfMap.get(postEnt.docID).containsKey(term)){\n termFrequency_doc = this.tfMap.get(postEnt.docID).get(term);\n w_doc_term = documentFrequency_doc*termFrequency_doc;\n postEnt.score += w_query_term*w_doc_term;\n }\n }\n }\n estimatedTime = (System.nanoTime() - startTime)/1000000;\n System.err.println(\"* Building solution took: \" + estimatedTime);\n\n /*\n * 3) Normalize the scores\n */\n startTime = System.nanoTime();\n Iterator<PostingsEntry> it = result.iterator();\n while(it.hasNext()){\n postEnt = it.next();\n postEnt.score /= (new Double(this.docLengths.get(\"\"+postEnt.docID)));//(Math.sqrt(postEnt.norm2));\n postEnt.score = w * postEnt.score + (1-w) * quality(postEnt.docID);\n }\n estimatedTime = (System.nanoTime() - startTime)/1000000;\n System.err.println(\"* Normalizing took: \" + estimatedTime);\n\n /*\n * 4) Sort the resulting solution\n */\n startTime = System.nanoTime();\n result.sort();\n estimatedTime = (System.nanoTime() - startTime)/1000000;\n System.err.println(\"* Sorting took: \" + estimatedTime);\n\n return result;\n }", "protected void initQueryFromNamedDefinition(Query query, NamedQueryDefinition nqd) {\n\t\tquery.setCacheable( nqd.isCacheable() );\n\t\tquery.setCacheRegion( nqd.getCacheRegion() );\n\t\tquery.setReadOnly( nqd.isReadOnly() );\n\n\t\tif ( nqd.getTimeout() != null ) {\n\t\t\tquery.setTimeout( nqd.getTimeout() );\n\t\t}\n\t\tif ( nqd.getFetchSize() != null ) {\n\t\t\tquery.setFetchSize( nqd.getFetchSize() );\n\t\t}\n\t\tif ( nqd.getCacheMode() != null ) {\n\t\t\tquery.setCacheMode( nqd.getCacheMode() );\n\t\t}\n\t\tif ( nqd.getComment() != null ) {\n\t\t\tquery.setComment( nqd.getComment() );\n\t\t}\n\t\tif ( nqd.getFirstResult() != null ) {\n\t\t\tquery.setFirstResult( nqd.getFirstResult() );\n\t\t}\n\t\tif ( nqd.getMaxResults() != null ) {\n\t\t\tquery.setMaxResults( nqd.getMaxResults() );\n\t\t}\n\t\tif ( nqd.getFlushMode() != null ) {\n\t\t\tquery.setHibernateFlushMode( nqd.getFlushMode() );\n\t\t}\n\t}", "public void newQuery(String query){\n for(RecyclerViewWrapper wrapper : mRecyclerViews){\n wrapper.data.clear();\n wrapper.adapter.notifyDataSetChanged();\n Log.d(TAG, \"Test: \" + wrapper.data.size());\n }\n\n mQueryManager.searchAll(query);\n }", "public Object reWriteQuery(ZQuery query, DataNode currNode) {\n if (!currNode.isLeafNode())\r\n return query;\r\n\r\n /*\r\n * note this should be called after mapping of column names has been\r\n * done so that you don't have to worry that the data descriptor is\r\n * the real one associated with the leaf node\r\n */\r\n ZQuery res = new ZQuery();\r\n // rewriting only applicable for where clause so keep the select and from clause\r\n res.addSelect(query.getSelect());\r\n res.addFrom(query.getFrom());\r\n if (query.getWhere() != null) {\r\n ZExpression where = reWriteQuery((ZExpression) query.getWhere(),\r\n currNode);\r\n res.addWhere(where);\r\n }\r\n\r\n return res;\r\n }", "public static void analyzeRuleComponentsQueries() throws SQLException\r\n\t{\r\n\t\tStatement stat = conn.createStatement();\r\n \r\n ResultSet result = stat.executeQuery(\"SELECT * FROM fraud.afm_fraudscorerecord_afm_rulecomponentrecord\");\r\n \r\n while (result.next())\r\n {\r\n \tString queryId = result.getString(\"afm_fraudscorerecord_recordId\");\r\n \tString ruleId = result.getString(\"ruleComponentRecords_componentId\");\r\n \t\r\n \t\r\n \t\tStatement stat2 = conn.createStatement();\r\n \t\r\n \t\tResultSet s = stat2.executeQuery(\"SELECT * FROM fraud.afm_fraudscorerecord where recordId='\"+queryId+\"';\");\r\n \t \t\t\r\n \t\t\r\n \t\twhile (s.next())\r\n \t\t{\r\n \t\t\t\tSystem.out.print(new Date(s.getInt(\"timestamp\")));\r\n \t\t\t\tSystem.out.print(\" UserID: \" +s.getString(\"userId\"));\r\n \t\t\tSystem.out.print(\" Query Type: \" + s.getString(\"queryType\"));\r\n \t\t\t//System.out.print(\" Amount: \" + s.getDouble(\"transactionAmount\"));\r\n \t\t}\r\n \t\t\r\n \t\t\r\n \t\tResultSet t = stat2.executeQuery(\"SELECT * FROM fraud.afm_rulecomponentrecord where componentId='\"+ruleId+\"';\");\r\n \t\r\n \t\t\r\n \t\twhile (t.next())\r\n \t\t{\r\n \t\t\tSystem.out.print(\" >>>>> Rule Name: \" + t.getString(\"ruleLongName\"));\r\n \t\t\t//System.out.print(\" Amount: \" + s.getDouble(\"transactionAmount\"));\r\n \t\t}\r\n \t\r\n \t\r\n \tSystem.out.println();\r\n \t}\r\n \t\r\n stat.close();\r\n \r\n\t}", "@Override\n\t\tpublic void executeQuery(String query) {\n\t\t\t\n\t\t}", "@Test\n public void testFromWithTernaryFollowedByQuery() throws Exception {\n final String text = \"rule X when Cheese() from (isFull ? $cheesery : $market) ?person( \\\"Mark\\\", 42; ) then end\";\n RuleDescr rule = ((RuleDescr) (parse(\"rule\", text)));\n TestCase.assertFalse(parser.getErrors().toString(), parser.hasErrors());\n PatternDescr pattern = ((PatternDescr) (getDescrs().get(0)));\n TestCase.assertEquals(\"Cheese\", pattern.getObjectType());\n TestCase.assertEquals(\"from (isFull ? $cheesery : $market)\", pattern.getSource().getText());\n TestCase.assertFalse(pattern.isQuery());\n pattern = ((PatternDescr) (getDescrs().get(1)));\n TestCase.assertEquals(\"person\", pattern.getObjectType());\n TestCase.assertTrue(pattern.isQuery());\n }", "public void setQuery(java.lang.String query) {\r\n this.query = query;\r\n }", "public Builder query(final String query) {\n this.query = query;\n return this;\n }", "public QueryCore(String query)\n {\n this.query = query;\n }", "public void setRule(RuleDefinition.Builder rule) {\r\n\t\t\tthis.rule = rule;\r\n\t\t}", "public interface Query {\n\n\t/**\n\t * @return ID of the given query\n\t */\n\tint queryID();\n\t\n\t/**\n\t * @return given query\n\t */\n\tString query();\n\t\n\t/**\n\t * @return list of relevant documents to the corresponding query\n\t */\n\tList<RelevanceInfo> listOfRelevantDocuments();\n\t\n\t/**\n\t * @return list of results to the corresponding query after running one of the retrieval models\n\t */\n\tList<Result> resultList();\n\t\n\t/**\n\t * @param resultList\n\t * @Effects adds results to the result list of the corresponding query\n\t */\n\tvoid putResultList(List<Result> resultList);\n}", "@Test\n public void testUpdateQuery() {\n LayersViewController instance = LayersViewController.getDefault().init(null);\n String queryString1 = \"Type == 'Word'\";\n int index1 = 2;\n Query query1 = new Query(GraphElementType.VERTEX, \"Type == 'Event'\");\n instance.getVxQueryCollection().getQuery(index1).setQuery(query1);\n instance.getTxQueryCollection().getQuery(index1).setQuery(null);\n assertEquals(instance.getVxQueryCollection().getQuery(index1).getQueryString(), \"Type == 'Event'\");\n\n instance.updateQuery(queryString1, index1, \"Vertex Query: \");\n assertEquals(instance.getVxQueryCollection().getQuery(index1).getQueryString(), queryString1);\n\n String queryString2 = \"Type == 'Unknown'\";\n int index2 = 3;\n Query query2 = new Query(GraphElementType.TRANSACTION, \"Type == 'Network'\");\n instance.getTxQueryCollection().getQuery(index2).setQuery(query2);\n instance.getVxQueryCollection().getQuery(index2).setQuery(null);\n assertEquals(instance.getTxQueryCollection().getQuery(index2).getQueryString(), \"Type == 'Network'\");\n \n instance.updateQuery(queryString2, index2, \"Transaction Query: \");\n assertEquals(instance.getTxQueryCollection().getQuery(index2).getQueryString(), queryString2);\n\n }", "private void applyRules () throws DataNormalizationException {\n\t\tapplyRules(null);\n\t}", "@Override\n public void apply(AsgQuery query, AsgStrategyContext context) {\n Stream.ofAll(this.elementSelector.apply(query))\n .forEach(selectedElement -> {\n Stream.ofAll(routings)\n .filter(routing -> routing.predicate.test(selectedElement))\n .toJavaOptional()\n .ifPresent(routing -> routing.getStrategy().apply(query, selectedElement, context));\n\n });\n }", "public final void setQuery(final String newQuery) {\n this.query = newQuery;\n }", "public void setQuery (String q)\n\t throws QueryParseException\n {\n\n\tthis.q = new Query ();\n\tthis.q.parse (q);\n\n\tthis.badQuery = false;\n\tthis.exp = null;\n\n\tthis.checkFrom ();\n\n }", "private void compile() throws QueryException, MappingException {\n \t\tLOG.trace( \"Compiling query\" );\n \t\ttry {\n \t\t\tParserHelper.parse( new PreprocessingParser( tokenReplacements ),\n \t\t\t\t\tqueryString,\n \t\t\t\t\tParserHelper.HQL_SEPARATORS,\n \t\t\t\t\tthis );\n \t\t\trenderSQL();\n \t\t}\n \t\tcatch ( QueryException qe ) {\n \t\t\tqe.setQueryString( queryString );\n \t\t\tthrow qe;\n \t\t}\n \t\tcatch ( MappingException me ) {\n \t\t\tthrow me;\n \t\t}\n \t\tcatch ( Exception e ) {\n \t\t\tLOG.debug( \"Unexpected query compilation problem\", e );\n \t\t\te.printStackTrace();\n \t\t\tQueryException qe = new QueryException( \"Incorrect query syntax\", e );\n \t\t\tqe.setQueryString( queryString );\n \t\t\tthrow qe;\n \t\t}\n \n \t\tpostInstantiate();\n \n \t\tcompiled = true;\n \n \t}", "@Override\n public List<String> applyRule(final String sqlSelectQuery) {\n //pre istotu cistim, v testoch mam viac stringov po sebe\n sqlBlocks.clear();\n joinTypeBlocks.clear();\n List<String> parts = new ArrayList<String>();\n //vycistenie od riadkov, trim, a 1+medizer za jednu medzeru\n String workingSQL = RuleUtils.clearSqlStatement(sqlSelectQuery);\n\n //check ci obsahuje JOIN\n while (workingSQL.toUpperCase().contains(RULE_KEY)) {\n int indexOfJoin = workingSQL.indexOf(RULE_KEY);\n //najdem index JOIN a poslem do metody na najdenie jeho celeho tvaru\n String foundJOIN = whatFormOfJoin(workingSQL, indexOfJoin);\n //najdeny cely tvar odseknem a pridam part\n String part = workingSQL.substring(0, workingSQL.indexOf(foundJOIN));\n //skratim working string pre cyklus while\n workingSQL = workingSQL.substring(indexOfJoin + 4);\n //pridam part\n sqlBlocks.add(part);\n }\n\n lastPart = workingSQL;\n //mam stavebne bloky a zapnam magicku funkciu\n List<String> variations = makeVariations(sqlBlocks, joinTypeBlocks, lastPart);\n //nabucham variacie ak su do vysledku\n for (String s : variations) {\n parts.add(s);\n }\n return parts;\n }", "public void update(Graph graph, Rule rule) {\n Term[] terms = rule.terms();\n Entry[][] matrix = graph.matrix();\n final double q = rule.getQuality().raw();\n\n for (int i = 0; i < terms.length; i++) {\n double value = matrix[terms[i].index()][0].value(0);\n matrix[terms[i].index()][0].set(0, value + (value * q));\n }\n\n // normilises the pheromone values (it has the effect of\n // evaporation for vertices that have not being updated)\n\n double total = 0.0;\n\n for (int i = 1; i < matrix.length; i++) {\n total += matrix[i][0].value(0);\n }\n\n for (int i = 1; i < matrix.length; i++) {\n double value = matrix[i][0].value(0);\n matrix[i][0].set(0, value / total);\n }\n }", "public Query query(String query) throws Exceptions.OsoException {\n return new Query(ffiPolar.newQueryFromStr(query), host.clone());\n }", "public abstract List createQuery(String query);", "public void setQuery (Query q)\n\t throws IllegalStateException,\n\t QueryParseException\n {\n\n\tif (!q.parsed ())\n\t{\n\n\t throw new IllegalStateException (\"Query has not yet been parsed.\");\n\n\t}\n\n\tthis.q = q;\n\n\tthis.checkFrom ();\n\n\tthis.badQuery = false;\n\tthis.exp = null;\n\n }", "private static Map<String, QuickResource> setupAliases(Query query,\n PhemaElmToOmopTranslatorContext context)\n throws CorrelationException, PhemaTranslationException {\n Map<String, QuickResource> aliases = new HashMap<>();\n\n AliasedQuerySource outerAliasedExpression = query.getSource().get(0);\n Retrieve outerRetrieve = (Retrieve) outerAliasedExpression.getExpression();\n String outerResourceType = outerRetrieve.getDataType().getLocalPart();\n String outerValuesetFilter = context.getVocabularyReferenceForRetrieve(outerRetrieve);\n\n RelationshipClause innerAliasedExpression = query.getRelationship().get(0);\n Retrieve innerRetrieve = (Retrieve) innerAliasedExpression.getExpression();\n String innerResourceType = innerRetrieve.getDataType().getLocalPart();\n String innerValuesetFilter = context.getVocabularyReferenceForRetrieve(innerRetrieve);\n\n aliases.put(outerAliasedExpression.getAlias(),\n QuickResource.from(outerResourceType, outerValuesetFilter));\n aliases.put(innerAliasedExpression.getAlias(),\n QuickResource.from(innerResourceType, innerValuesetFilter));\n\n return aliases;\n }", "public <T extends Collection<? super Statement>> T toRDF(final T output) {\n\n final ValueFactory vf = Statements.VALUE_FACTORY;\n output.add(vf.createStatement(this.id, RDF.TYPE, RR.RULE));\n output.add(vf.createStatement(this.id, RDF.TYPE, this.fixpoint ? RR.FIXPOINT_RULE\n : RR.NON_FIXPOINT_RULE));\n if (this.phase != 0) {\n output.add(vf.createStatement(this.id, RR.PHASE, vf.createLiteral(this.phase)));\n }\n try {\n if (this.deleteExpr != null) {\n output.add(vf.createStatement(this.id, RR.DELETE,\n vf.createLiteral(Algebra.renderExpr(this.deleteExpr, null))));\n }\n if (this.insertExpr != null) {\n output.add(vf.createStatement(this.id, RR.INSERT,\n vf.createLiteral(Algebra.renderExpr(this.insertExpr, null))));\n }\n if (this.whereExpr != null) {\n output.add(vf.createStatement(this.id, RR.WHERE,\n vf.createLiteral(Algebra.renderExpr(this.whereExpr, null))));\n }\n } catch (final Exception ex) {\n throw new RuntimeException(ex);\n }\n return output;\n }", "RewrittenStatement rewrite(String sql, Binding params);", "public ReplaceAllRewritingRule(String queryPattern, String rewrite,\n boolean caseSensitive, boolean stopOnMatch)\n {\n super(queryPattern, rewrite, caseSensitive, stopOnMatch);\n }", "public interface FwRules {\r\n \r\n\tboolean generateQuery();\r\n\t\r\n IntrospectedTable getIntrospectedTable();\r\n}", "void addRuleDefinition(RuleDefinition rd) throws ResultException, DmcValueException, DmcNameClashException {\n \t// Again, some trickiness, we have to resolve the rule so that we can access and use the must/may\n \t// attributes that are defined for it and add them to the class definition we create\n try {\n\t\t\trd.resolveReferences(this,currentResolver);\n\t\t} catch (DmcValueExceptionSet e) {\t\t\t\n\t\t\tResultException ex = new ResultException();\n\t\t\tex.addError(\"Unresolved references in RuleDefinition: \" + rd.getName());\n\t\t\t\n\t\t\tfor(DmcValueException dve : e.getExceptions()){\n\t\t\t\tex.moreMessages(dve.getMessage());\n\t\t\t}\n\t\t\tthrow(ex);\n\t\t}\n \t\n \tDefinitionName ruleClassName = new DefinitionName(rd.getName().getNameString() + \"Data\");\n \t\n if (checkAndAdd(rd.getObjectName(),rd,ruleDefs) == false){\n \tResultException ex = new ResultException();\n \tex.addError(clashMsg(rd.getObjectName(),rd,ruleDefs,\"rule definitions\"));\n \tthrow(ex);\n }\n \n // dot name is current schema.ruledef.RuleDefinition. We want just schema.ruledef\n ruleDefsByDot.put((DotName) rd.getDotName().getParentName(), rd);\n \n if (checkAndAddDOT(rd.getDotName(),rd,globallyUniqueMAP,null) == false){\n \tResultException ex = new ResultException();\n \tex.addError(clashMsgDOT(rd.getObjectName(),rd,globallyUniqueMAP,\"definition names\"));\n throw(ex);\n }\n\n // We hold on to this because we'll reuse it for the class we craete\n int originalRefDefID = rd.getDmdID();\n \n if (performIDChecks){\n\t // Bump up the DMD ID by the amount of schemaBaseID\n\t int base = rd.getDefinedIn().getSchemaBaseID();\n\t int range = rd.getDefinedIn().getSchemaIDRange();\n\t int current = base + rd.getDmdID();\n\t \n\t if (current > (base+range)){\n\t \tResultException ex = new ResultException(\"Number of rules exceeds schema ID range: \" + rd.getName());\n\t \tex.moreMessages(\"The dmdID must be less than \" + range);\n\t \tex.setLocationInfo(rd.getFile(), rd.getLineNumber());\n\t \tthrow(ex); \t\n\t }\t \t\n\t \n\t rd.setDmdID(base + current);\n }\n \n// ClassDefinition existing = classDefs.get(ruleClassName);\n ClassDefinition existing = classDefinitions.getDefinition(ruleClassName.getNameString());\n if (existing != null){\n \t// We have the class for this rule, just check that it's auto generated\n \tif (existing.getInternallyGenerated()){\n \t\treturn;\n \t}\n \telse{\n \t\t// We have some kind of clash\n \t}\n }\n \n // We check that the ID of the rule doesn't clash with the class definitions, since we're\n // going to create a class for this rule with the rule's ID.\n if (classesByID.get(rd.getDmdID()) != null){\n \tResultException ex = new ResultException();\n \tex.addError(clashingIDsMsg(rd.getDmdID(),rd,classesByID,\"dmdID\"));\n \tthrow(ex);\n }\n \n ///////////////////////////////////////////////////////////////////////\n \n ClassDefinition cd = new ClassDefinition();\n cd.setName(ruleClassName);\n if (rd.getIsExtensible())\n \tcd.setClassType(ClassTypeEnum.EXTENSIBLE);\n else\n \tcd.setClassType(ClassTypeEnum.STRUCTURAL);\n // Note: we don't use the dmdID in the rule definition because it has already been bumped\n cd.setDmdID(originalRefDefID);\n cd.setDerivedFrom(MetaSchemaAG._RuleData);\n cd.setInternallyGenerated(true);\n cd.setRuleDefinition(rd);\n cd.setIsNamedBy(MetaSchemaAG._ruleName);\n \n // The name of a rule definition is schema.ruledef.RuleDefinition\n // For the associated class, it will be schema.ruledefData.ClassDefinition\n DotName className = new DotName(((DotName) rd.getDotName().getParentName()).getNameString() + \"Data.ClassDefinition\");\n// DotName nameAndTypeName = new DotName(cd.getName() + \"Data.ClassDefinition\");\n cd.setDotName(className);\n// cd.setNameAndTypeName(nameAndTypeName);\n\n cd.addMust(MetaSchemaAG._ruleName);\n cd.addMust(MetaSchemaAG._ruleTitle);\n cd.addMay(MetaSchemaAG._description);\n \n\t\tif (rd.getRuleType() == RuleTypeEnum.ATTRIBUTE)\n\t\t\tcd.addMust(MetaSchemaAG._applyToAttribute);\n\n cd.setFile(rd.getFile());\n cd.setLineNumber(rd.getLineNumber());\n cd.setDefinedIn(rd.getDefinedIn());\n \n if (rd.getDescription() != null){\n \tIterator<String> it = rd.getDescription();\n \twhile(it.hasNext()){\n \t\tcd.addDescription(it.next());\n \t}\n }\n \n for(AttributeDefinition ad: rd.getMay()){\n \tcd.addMay(ad);\n }\n \n for(AttributeDefinition ad: rd.getMust()){\n \tcd.addMust(ad);\n }\n \n addClass(cd);\n \n // We add the new class to the schema's list of classes\n rd.getDefinedIn().addClassDefList(cd);\n }", "protected AQLQuery buildQuery(AQLQuery query, String field, String pattern, SearchTermQuery searchTermQuery) {\n\r\n\r\n String queryText = Fmt.S(\"SELECT Manufacturer, Manufacturer.Name \"\r\n +\"FROM cat.core.Manufacturer AS Manufacturer\");\r\n\r\n query = AQLQuery.parseQuery(queryText);\r\n Log.customer.debug(\"%s *** in buildquery query returned=%s\",classname, query.toString());\r\n\r\n query = super.buildQuery(query, field, pattern, searchTermQuery);\r\n Log.customer.debug(\"%s *** in buildquery after super returned=%s\",classname, query.toString());\r\n\r\n return query;\r\n\r\n }", "public void setSpellQuery(String query) {\n\t\tspellQuery.setText(query);\n\t}", "public void setInto(Query query) {\n if (_candidate != null)\n query.setCandidateType(_candidate, true);\n if (!StringUtil.isEmpty(_query))\n query.setQuery(_query);\n if (_res != null)\n query.setResultType(_res);\n if (_readOnly != null)\n query.setReadOnly(_readOnly);\n if (_resultSetMappingName != null)\n query.setResultMapping(null, _resultSetMappingName);\n }", "public CachingKoRule(RuleSet rule) {\n\t\tthis.rule = rule;\n\t}", "private void montaQuery(Publicacao object, Query q) {\t\t\n\t}", "public void rewrite(LogicalPlan input) throws QueryCompilationException\n {\n // Stack the logical operators for a bottom-up and right-to-left traversal\n Stack<Operator> stack_logical = new Stack<Operator>();\n LogicalPlanUtil.stackBottomUpRightToLeft(input.getRootOperator(), stack_logical);\n \n // Remove the duplicate Navigate bottom-up\n while (!stack_logical.isEmpty())\n {\n Operator current_op = stack_logical.pop();\n if (current_op instanceof Navigate)\n {\n Navigate current_nav = (Navigate) current_op;\n RelativeVariable duplicate = getDuplicate(current_nav);\n if (duplicate != null)\n {\n // Remove the current Navigate operator and update the variable references above\n Operator child = current_nav.getChild();\n LogicalPlanUtil.remove(current_op);\n m_substitutions.clear();\n m_substitutions.put(current_nav.getAliasVariable(), duplicate);\n VariableReferencesUpdater var_ref_updater = new VariableReferencesUpdater();\n Operator op = child;\n do\n {\n op = op.getParent();\n if (op == null) break;\n op.accept(var_ref_updater);\n op.updateOutputInfo();\n } while (!(op instanceof Project || op instanceof GroupBy));\n }\n else\n {\n m_navigate_vars.put(current_nav.getAliasVariable(), current_nav);\n }\n }\n }\n }", "public void setRule(java.lang.String rule) {\n this.rule = rule;\n }", "@Override\n\tpublic QanaryMessage process(QanaryMessage myQanaryMessage) throws SparqlQueryFailed, Exception {\n\t\tlogger.info(\"cacheFile location: {}\", cacheFile);\n//\t\tlong startTime = System.currentTimeMillis();\n\t\torg.apache.log4j.Logger.getRootLogger().setLevel(org.apache.log4j.Level.OFF);\n\t\tMap<String, Map<String, Double>> allProperties = new HashMap<String, Map<String, Double>>();\n\t\tlogger.info(\"process: {}\", myQanaryMessage);\n\t\t// TODO: implement processing of question\n\n\t\tQanaryUtils myQanaryUtils = this.getUtils(myQanaryMessage);\n\t\tQanaryQuestion<String> myQanaryQuestion = new QanaryQuestion(myQanaryMessage);\n\t\tString question = myQanaryQuestion.getTextualRepresentation();\n\n\t\tboolean hasCacheResult = false;\n\n\t\tif (cacheEnabled) {\n\t\t\tFileCacheResult cacheResult = readFromCache(question);\n\t\t\tlogger.info(\"cached Result: {}\", cacheResult.links);\n\t\t\thasCacheResult = cacheResult.hasCacheResult;\n\t\t\tallProperties.putAll(cacheResult.links);\n\t\t\tlogger.info(\"allProperties MAP after adding results: {}\\n\", allProperties);\n\t\t}\n\n\t\t\n\t\t// STEP1: Retrieve the named graph and the endpoint\n\t\tString endpoint = myQanaryMessage.getEndpoint().toASCIIString();\n\t\tString namedGraph = myQanaryMessage.getInGraph().toASCIIString();\n\t\tlogger.info(\"Graph: {}\", namedGraph);\n\t\tlogger.info(\"Endpoint: {}\", endpoint);\n\t\tlogger.info(\"InGraph: {}\", namedGraph);\n\n\t\tif (!hasCacheResult) {\n\n\t\t\t// STEP2: Retrieve information that are needed for the computations\n\t\t\t// Here, we need two parameters as input to be fetched from triplestore-\n\t\t\t// question and language of the question.\n\t\t\t// So first, Retrieve the uri where the question is exposed\n//\t\tString sparql = \"PREFIX qa:<http://www.wdaqua.eu/qa#> \" + \"SELECT ?questionuri \" + \"FROM <\" + namedGraph + \"> \"\n//\t\t\t\t+ \"WHERE {?questionuri a qa:Question}\";\n\n//\t\tResultSet result = myQanaryUtils.selectFromTripleStore(sparql, endpoint);\n//\t\tString uriQuestion = result.next().getResource(\"questionuri\").toString();\n//\t\tlogger.info(\"Uri of the question: {}\", uriQuestion);\n\t\t\t// Retrieve the question itself\n//\t\tRestTemplate restTemplate = new RestTemplate();\n\t\t\t// TODO: pay attention to \"/raw\" maybe change that\n//\t\tResponseEntity<String> responseEntity = restTemplate.getForEntity(uriQuestion + \"/raw\", String.class);\n//\t\tString question = responseEntity.getBody();\n//\t\tlogger.info(\"Question: {}\", question);\n\n\t\t\t// the below mentioned SPARQL query to fetch annotation of language from\n\t\t\t// triplestore\n\t\t/*\n\t\tString questionlang = \"PREFIX qa: <http://www.wdaqua.eu/qa#> \" //\n\t\t\t\t+ \"SELECT ?lang \" + \"FROM <\" + namedGraph + \"> \" //\n\t\t\t\t+ \"WHERE {?q a qa:Question .\" //\n\t\t\t\t+ \" ?anno <http://www.w3.org/ns/openannotation/core/hasTarget> ?q .\" //\n\t\t\t\t+ \" ?anno <http://www.w3.org/ns/openannotation/core/hasBody> ?lang .\" //\n\t\t\t\t+ \" ?anno a qa:AnnotationOfQuestionLanguage }\";\n\t\t// Now fetch the language, in our case it is \"en\".\n\t\tResultSet result1 = myQanaryUtils.selectFromTripleStore(questionlang, endpoint);\n\t\t */\n\t\t\tString language1 = \"en\";\n//\t\tlogger.info(\"Language of the Question: {}\", language1);\n\n\t\t\tString url = \"\";\n\t\t\tString data = \"\";\n\t\t\tString contentType = \"application/json\";\n\n\t\t\t// http://repository.okbqa.org/components/21 is the template generator URL\n\t\t\t// Sample input for this is mentioned below.\n\t\t\t/*\n\t\t\t * { \"string\": \"Which river flows through Seoul?\", \"language\": \"en\" }\n\t\t\t * http://ws.okbqa.org:1515/templategeneration/rocknrole\n\t\t\t */\n\n\t\t\t// now arrange the Web service and input parameters in the way, which is needed\n\t\t\t// for CURL command\n\t\t\turl = \"http://ws.okbqa.org:1515/templategeneration/rocknrole\"; // @TODO: move to application.properties\n\t\t\tdata = \"{ \\\"string\\\":\\\"\" + question + \"\\\",\\\"language\\\":\\\"\" + language1 + \"\\\"}\";// \"{ \\\"string\\\": \\\"Which river\n\t\t\t// flows through Seoul?\\\",\n\t\t\t// \\\"language\\\": \\\"en\\\"}\";\n\t\t\tlogger.info(\"Component: 21; data: {}\", data);\n\t\t\tString output1 = \"\";\n\t\t\t// pass the input in CURL command and call the function.\n\n\t\t\ttry {\n\t\t\t\toutput1 = DiambiguationProperty.runCurlPOSTWithParam(url, data, contentType);\n\t\t\t} catch (Exception e) {\n\t\t\t}\n\t\t\tlogger.info(\"The output template is: {}\", output1);\n\n\t\t\t/*\n\t\t\t * once output is received, now the task is to parse the generated template, and\n\t\t\t * store the needed information which is Resource, Property, Resource Literal,\n\t\t\t * and Class. Then push this information back to triplestore. The below code\n\t\t\t * before step 4 does parse the template. For parsing PropertyRetrival.java file\n\t\t\t * is used, which is in the same package.\n\t\t\t *\n\t\t\t * for this, we create a new object property of Property class.\n\t\t\t *\n\t\t\t */\n\n\t\t\turl = \"http://ws.okbqa.org:2357/agdistis/run?\"; // @TODO: move to application.properties\n\t\t\tdata = output1.substring(1, output1.length() - 1);\n\t\t\tcontentType = \"application/json\";\n\n\t\t\tlogger.info(\"Component: 7; data: {}\", data);\n\t\t\toutput1 = \"\";\n\t\t\ttry {\n\t\t\t\toutput1 = DiambiguationProperty.runCurlGetWithParam(url, data, contentType);\n\t\t\t} catch (Exception e) {\n\t\t\t}\n\t\t\tlogger.info(\"The output template is: {}\", output1);\n\n\t\t\tJSONParser parser = new JSONParser();\n\n\t\t\ttry {\n\n\t\t\t\tJSONObject json = (JSONObject) parser.parse(output1);\n\n\t\t\t\tJSONArray characters = (JSONArray) json.get(\"ned\");\n\t\t\t\tIterator i = characters.iterator();\n\n\t\t\t\twhile (i.hasNext()) {\n\t\t\t\t\tJSONObject mainObject = (JSONObject) i.next();\n\t\t\t\t\tJSONArray types = (JSONArray) mainObject.get(\"properties\");\n\t\t\t\t\tIterator iTypes = types.iterator();\n\t\t\t\t\tString var = \"\";\n\n\t\t\t\t\twhile (iTypes.hasNext()) {\n\t\t\t\t\t\tMap<String, Double> urlsAndScore = new HashMap<String, Double>();\n\t\t\t\t\t\tJSONObject tempObject = (JSONObject) iTypes.next();\n\t\t\t\t\t\tString urls = (String) tempObject.get(\"value\");\n\t\t\t\t\t\tdouble score = (double) tempObject.get(\"score\");\n\t\t\t\t\t\tvar = (String) tempObject.get(\"var\");\n\t\t\t\t\t\tif (allProperties.size() > 0 && allProperties.containsKey(var)) {\n\n\t\t\t\t\t\t\tdouble tScore = (double) allProperties.get(var).entrySet().iterator().next().getValue();\n\t\t\t\t\t\t\tif (tScore < score) {\n\n\t\t\t\t\t\t\t\tallProperties.get(var).remove(allProperties.get(var).entrySet().iterator().next().getKey());\n\t\t\t\t\t\t\t\tallProperties.get(var).put(urls, score);\n\t\t\t\t\t\t\t\tlogger.info(\"var: {}, urls: {}, score: {}\", var, urls, score);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\turlsAndScore.put(urls, score);\n\t\t\t\t\t\t\tlogger.info(\"var: {}, urls: {}, score: {}\", var, urls, score);\n\t\t\t\t\t\t\t// allUrls.put(\"classes\", urlsAndScore);\n\t\t\t\t\t\t\tallProperties.put(var, urlsAndScore);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (cacheEnabled) {\n\t\t\t\t\tthis.writeToCache(question, allProperties);\n\t\t\t\t}\n\n\t\t\t} catch (Exception e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\n\t\tfor (String vars : allProperties.keySet()) {\n\t\t\tMap<String, Double> allUrls = allProperties.get(vars);\n\t\t\tint count = 0;\n\t\t\tfor (String urls : allUrls.keySet()) {\n\t\t\t\tlogger.info(\"Inside : Literal: {}\", urls);\n\t\t\t\tString sparql = \"PREFIX qa: <http://www.wdaqua.eu/qa#> \" //\n\t\t\t\t\t\t+ \"PREFIX oa: <http://www.w3.org/ns/openannotation/core/> \" //\n\t\t\t\t\t\t+ \"PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> \" //\n\t\t\t\t\t\t+ \"INSERT { \" + \"GRAPH <\" + namedGraph+ \"> { \" //\n\t\t\t\t\t\t+ \" ?a a qa:AnnotationOfRelation . \" + \" ?a oa:hasTarget [ \" + \" a oa:SpecificResource; \" // \n\t\t\t\t\t\t+ \" oa:hasSource <\" + myQanaryQuestion.getUri() + \">; \" + \" ] . \" //\n\t\t\t\t\t\t+ \" ?a oa:hasBody <\" + urls + \"> ;\" // \n\t\t\t\t\t\t+ \" oa:annotatedBy <urn:qanary:\"+this.applicationName+\"> ; \" //\n\t\t\t\t\t\t+ \" oa:annotatedAt ?time \"\n\t\t\t\t\t\t+ \"}} \" //\n\t\t\t\t\t\t+ \"WHERE { \" //\n\t\t\t\t\t\t+ \"BIND (IRI(str(RAND())) AS ?a) .\" //\n\t\t\t\t\t\t+ \"BIND (now() as ?time) \" //\n\t\t\t\t\t\t+ \"}\";\n\t\t\t\tlogger.info(\"Sparql query: {}\", sparql);\n\t\t\t\tmyQanaryUtils.updateTripleStore(sparql, endpoint);\n\t\t\t\tcount++;\n\t\t\t}\n\t\t\tlogger.info(\"Count is: {}\",count);\n\t\t}\n\n\t\treturn myQanaryMessage;\n\t}", "public int replaceRule(String key, Map ph, XQueue in) {\n int id = ruleList.getID(key);\n if (id == 0) // can not replace the default rule\n return -1;\n else if (id > 0) { // for a normal rule\n if (ph == null || ph.size() <= 0)\n throw(new IllegalArgumentException(\"Empty property for rule\"));\n if (!key.equals((String) ph.get(\"Name\"))) {\n new Event(Event.ERR, name + \": name not match for rule \" + key +\n \": \" + (String) ph.get(\"Name\")).send();\n return -1;\n }\n if (getStatus() == NODE_RUNNING)\n throw(new IllegalStateException(name + \" is in running state\"));\n long tm = System.currentTimeMillis();\n long[] meta = new long[RULE_TIME+1];\n long[] ruleInfo = ruleList.getMetaData(id);\n Map rule = initRuleset(tm, ph, meta);\n if (rule != null && rule.containsKey(\"Name\")) {\n StringBuffer strBuf = ((debug & DEBUG_DIFF) <= 0) ? null :\n new StringBuffer();\n Map h = (Map) ruleList.set(id, rule);\n if (h != null) {\n MessageFilter filter = (MessageFilter) h.remove(\"Filter\");\n if (filter != null)\n filter.clear();\n AssetList list = (AssetList) h.remove(\"TaskList\");\n if (list != null)\n cleanupTasks(list);\n h.clear();\n }\n tm = ruleInfo[RULE_PID];\n for (int i=0; i<RULE_TIME; i++) { // update metadata\n switch (i) {\n case RULE_SIZE:\n break;\n case RULE_COUNT:\n if (tm == meta[RULE_PID]) // same rule type\n break;\n default:\n ruleInfo[i] = meta[i];\n }\n if ((debug & DEBUG_DIFF) > 0)\n strBuf.append(\" \" + ruleInfo[i]);\n }\n if ((debug & DEBUG_DIFF) > 0)\n new Event(Event.DEBUG, name + \"/\" + key + \" ruleInfo:\" +\n strBuf).send();\n return id;\n }\n else\n new Event(Event.ERR, name + \" failed to init rule \"+key).send();\n }\n else if (cfgList != null && cfgList.containsKey(key)) {\n return super.replaceRule(key, ph, in);\n }\n return -1;\n }", "public void setQuery(String query) {\n this.query = query;\n }", "public void setRule(final String rule) {\r\n this.rule = rule;\r\n }", "StatementRule createStatementRule();", "private void applyRules(boolean install, FlowRule rule) {\n FlowRuleOperations.Builder ops = FlowRuleOperations.builder();\n\n ops = install ? ops.add(rule) : ops.remove(rule);\n flowRuleService.apply(ops.build(new FlowRuleOperationsContext() {\n @Override\n public void onSuccess(FlowRuleOperations ops) {\n log.trace(\"HP Driver: - applyRules onSuccess rule {}\", rule);\n }\n\n @Override\n public void onError(FlowRuleOperations ops) {\n log.trace(\"HP Driver: applyRules onError rule: \" + rule);\n }\n }));\n }", "public void process(final Query query) {\n logger.trace(\"Processing query {}\", query);\n for (Module module : modules) {\n module.process(query);\n }\n }", "public abstract ResultList executeQuery(DatabaseQuery query);", "public void setQuery(String query) {\n this.query = query;\n }", "private static void statsForQuery(String query) {\n\t\tHashMap<String,Integer> oldTerms=newTerms; // record the terms to analyze modified queries\n\t\tnewTerms=new HashMap<String,Integer>();\n\t\t\t\t\n\t\tString terms[]=query.split(\"\\\\s\");\t\t\t\t\n\t\tint matchingTerms=0;\n\t\tint matchingTermsStopwords=0;\n\t\tint matchingTermsOrder=0;\n\t\tfor (int j=0;j<terms.length;j++) {\n\t\t\tif (!terms[j].equals(\"\")) {\n\t\t\t \tif (oldTerms.containsKey(terms[j])) {\n\t\t\t \t\tmatchingTerms++;\t\t\t\t\t \n\t\t\t \t\tif (stopwordsMap.containsKey(terms[j])) { // match if it is stopword\n\t\t\t \t\t\tmatchingTermsStopwords++;\n\t\t\t \t\t}\n\t\t\t \t\tif (oldTerms.get(terms[j])==j) { // match if it has the same order\n\t\t\t \t\t\tmatchingTermsOrder++;\n\t\t\t \t\t}\n\t\t\t \t}\n\t\t\t \tnewTerms.put(terms[j],j);\n\t\t\t}\n\t\t}\t\n\n\t\tif (newTerms.size()==oldTerms.size() && matchingTerms==oldTerms.size() && matchingTerms>0) { // the queries have the same terms\n\t\t totalEqualTermsQueries++;\n\t\t\t\t \t\t\t\t \t\t\t\t\t\t \t\t\t\t \t\t\t\t \n\t\t if (matchingTermsStopwords==oldTerms.size()) {\n\t\t \ttotalEqualTermsStopwordsQueries++;\n\t\t }\n\t\t if (matchingTermsOrder==oldTerms.size()) {\n\t\t \ttotalEqualTermsOrderQueries++;\n\t\t }\n\t\t if (query.equals(oldQuery)) {\n\t\t \ttotalIdenticalQueries++;\n\t\t }\n\t\t if (sessionQueries.contains(query)) {\n\t\t \ttotalIdenticalSessionQueries++;\n\t\t }\n\t\t}\n\t\telse if (matchingTerms-matchingTermsStopwords>0) { // the queries have at least one term equal and diferent from a stopword\n\t\t totalModifiedQueries++;\n\t\t int index=newTerms.size()-oldTerms.size()+N_MODIFIED_TERMS_RANGE/2;\n\t\t if (index<0) {\n\t\t \tindex=0;\n\t\t }\n\t\t else if (index>N_MODIFIED_TERMS_RANGE-1) {\n\t\t \tindex=N_MODIFIED_TERMS_RANGE-1;\n\t\t }\n\t\t nModifiedTerms[index]++;\n\t\t}\n\t\toldQuery=query; \n\t\t\t\t\t\t\n\t\t// store session query\n\t\tsessionQueries.add(query);\n\t}", "public abstract String createQuery();", "public MethodBuilder rule(String rule) {\n\t\tthis.rule = rule;\n\t\treturn this;\n\t}", "public com.example.DNSLog.Builder setQuery(java.lang.CharSequence value) {\n validate(fields()[8], value);\n this.query = value;\n fieldSetFlags()[8] = true;\n return this;\n }", "public void setRule(IRule rule)\n\t{\n\t\tthis.rule = rule;\n\t}", "public interface AsgStrategy {\n void apply(AsgQuery query, AsgStrategyContext context);\n}", "public Query getEffectsQuery(\r\n final IRNode flowUnit, final BindingContextAnalysis.Query query) {\r\n return new Query(flowUnit, query);\r\n }", "public List<QueryHit> processQuery(String query) {\n // Do something!\n System.err.println(\"Processing query '\" + query + \"'\");\n return new ArrayList<QueryHit>();\n }", "public abstract int execUpdate(String query) ;", "public Query() {\n\n// oriToRwt = new HashMap();\n// oriToRwt.put(); // TODO\n }", "public CriteriaQueryTable(CriteriaQuery q) {\n myCriteriaQuery = q;\n myOriginalRestriction = q.getRestriction();\n \n if (myOriginalRestriction == null) {\n myOriginalRestriction = JPA.em().getCriteriaBuilder().conjunction();\n }\n }", "public void check(\n String query,\n TypeChecker typeChecker,\n ResultChecker resultChecker)\n {\n RelDataType actualType = getColumnType(query);\n\n // Check result type.\n typeChecker.checkType(actualType);\n }", "public ExplanationPipeline<I, F>\n addRuleOptimizer(Optimizer<RuleExplanation, RuleExplanationFactory, ?, ?> toAdd) {\n return addRuleOptimizer(toAdd, false);\n }", "public ORM executeQuery(String query) {\n ResultSet rs = null;\n this.query =query;\n System.out.println(\"run: \" + this.query);\n //this.curId = 0;\n Statement statement;\n try {\n statement = this.conn.createStatement();\n rs = statement.executeQuery(this.query);\n //this.saveLog(0,\"\",query);\n } catch (SQLException e) {\n System.out.println( ColorCodes.ANSI_RED +\"ERROR in SQL: \" + this.query);\n // e.printStackTrace();\n }\n lastResultSet=rs;\n this.fields_values = \"\";\n return this;\n\n }", "public DydraQueryEngine(@NotNull final Repository repository,\n @NotNull final Query query) {\n this(repository.name, query.toString());\n }", "public abstract QueryResultIterable executeGroundingQuery(Formula formula);" ]
[ "0.6380523", "0.6047777", "0.5560555", "0.5560522", "0.5548836", "0.5406992", "0.53491896", "0.5288504", "0.52862334", "0.5241047", "0.523306", "0.51956743", "0.518545", "0.51222074", "0.5108073", "0.5088834", "0.5088207", "0.5087702", "0.50729245", "0.5057489", "0.50429916", "0.5016564", "0.49960512", "0.49883524", "0.4988221", "0.4981139", "0.49773026", "0.496258", "0.49464175", "0.49416494", "0.49354315", "0.4934771", "0.49333632", "0.4925237", "0.49226028", "0.4922194", "0.49178645", "0.49056366", "0.49017414", "0.48985383", "0.4893974", "0.48725837", "0.48590994", "0.48475644", "0.4837751", "0.4824032", "0.48223323", "0.47958726", "0.47828153", "0.47820118", "0.47575694", "0.47550708", "0.4749976", "0.4743865", "0.47413906", "0.47390553", "0.47264788", "0.47252375", "0.4720662", "0.47090375", "0.47089368", "0.46975312", "0.46893916", "0.46802643", "0.46798757", "0.4677311", "0.46743315", "0.46682465", "0.4665833", "0.46650976", "0.4661915", "0.46589637", "0.46576446", "0.46487403", "0.46470264", "0.46321237", "0.4630545", "0.4628474", "0.46195745", "0.46130157", "0.4611652", "0.46095774", "0.46095446", "0.46052146", "0.46023017", "0.46014002", "0.46009463", "0.45963603", "0.45926458", "0.45879108", "0.45857534", "0.45807323", "0.45761755", "0.45681825", "0.45644456", "0.4562818", "0.45584714", "0.45572788", "0.45506608", "0.45393592" ]
0.591743
2
Return true if this rule is a a complete solution to the given query and the router need look no further
public boolean completeFor(TriplePattern query) { return head.subsumes(query); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public boolean matchResult() {\n return !pathMatchDependencies.isEmpty();\n }", "boolean hasQuery();", "@Override\n\tpublic boolean CheckFacts(){\n\t\tqueries.add( query );\n\t\t\n\t\t// while there are still queries to be proven\n\t\twhile ( queries.size() > 0 )\n\t\t{\n\t\t\t// take the first query off of queries to be checked \n\t\t\tString currentQuery = queries.remove(0);\n\n\t\t\t// add it to the list of queries that will be used to output (if true)\n\t\t\toutputFacts.add( currentQuery );\n\n\t\t\t// Compare currentQuery with every fact in Facts:\n\t\t\t// if it matches a fact then the current loop can end\n\t\t\tif( ! CompareToFacts( currentQuery ) )\n\t\t\t{\n\t\t\t\t// if not, compare currentQuery with every entailed literal\n\t\t\t\t// if it matches, add the literal(s) from the left\n\t\t\t\t// of the entailment onto queries\n\t\t\t\tif( ! CompareToClauses( currentQuery ) )\n\t\t\t\t{\n\t\t\t\t\t// if currentQuery still didn’t find a match then \n\t\t\t\t\t// the search has failed \n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// when queries is empty, it means there are no more queries to prove,\n\t\t// so the search was a success\n\t\treturn true;\n\t}", "public boolean isSetQuery() {\n return this.query != null;\n }", "public boolean isSetQuery() {\n return this.query != null;\n }", "public boolean isSetQuery() {\n return this.query != null;\n }", "boolean hasQueryAddress();", "public boolean hasFinished() {\n\n if(!matching) {\n boolean first = true;\n for(S left : slp.getAxioms()) {\n if(slp.length(left, first) == 1) {\n return true;\n }\n first = false;\n }\n }\n\n if(matching) {\n long patternLen = slp.length(patter, true);\n if(patternLen == 1) {\n return true;\n }\n }\n\n return false;\n }", "boolean hasRoute();", "public boolean isSolvable() {\n\t\tif (goal == null)\n\t\t\treturn false;\n\t\telse\n\t\t\treturn true;\n\t}", "protected boolean isQueryAvailable() {\n return query != null;\n }", "boolean isIsQuery();", "boolean checkGoal(Node solution);", "public boolean isSolvable() {\n Board twin = initial.twin();\n MinPQ<Node> mainQueue = new MinPQ<>(getComparator());\n MinPQ<Node> twinQueue = new MinPQ<>(getComparator());\n mainQueue.insert(new Node(initial, 0, null));\n twinQueue.insert(new Node(twin, 0, null));\n while (this.solution == null) {\n Node temp = mainQueue.delMin();\n if (temp.board.isGoal()) {\n this.solution = temp;\n return true;\n }\n Iterable<Board> nebrs = temp.board.neighbors();\n for (Board x : nebrs) {\n if (!x.equals(temp.previousNode.board)) {\n mainQueue.insert(new Node(x, temp.movesToBoard + 1, temp));\n }\n }\n Node temp2 = twinQueue.delMin();\n if (temp2.board.isGoal()) {\n this.solution = null;\n return false;\n }\n Iterable<Board> nebrs2 = temp2.board.neighbors();\n for (Board x : nebrs2) {\n if (!x.equals(temp2.previousNode.board)) {\n twinQueue.insert(new Node(x, temp2.movesToBoard + 1, temp2));\n }\n }\n }\n return false;\n }", "@Override\n public final void solve() {\n this.flag1 = this.neo.getPosition().equals(this.goal);\n \n }", "public boolean isSolvable() {\n return goal != null;\n }", "public final boolean synpred7_QL() {\n state.backtracking++;\n int start = input.mark();\n try {\n synpred7_QL_fragment(); // can never throw exception\n } catch (RecognitionException re) {\n System.err.println(\"impossible: \"+re);\n }\n boolean success = !state.failed;\n input.rewind(start);\n state.backtracking--;\n state.failed=false;\n return success;\n }", "protected boolean query() {\r\n\t\tqueryStr = new String(processQueryTitle(queryBk.getTitle()) + processQueryAuthor(queryBk.getCreator())\r\n\t\t\t\t+ processQueryPublisher(queryBk.getPublisher()));\r\n\t\tSystem.out.println(queryStr);\r\n\t\t// if edition is 'lastest' (coded '0'), no query is performed; and\r\n\t\t// return false.\r\n\t\tif (queryBk.parseEdition() == 0) {\r\n\t\t\treturn false;\r\n\t\t} // end if\r\n\r\n\t\t/*\r\n\t\t * The following section adds edition info to the query string if edition no. is\r\n\t\t * greater than one. By cataloging practice, for the first edition, probably\r\n\t\t * there is NO input on the associated MARC field. Considering this, edition\r\n\t\t * query string to Primo is NOT added if querying for the first edition or no\r\n\t\t * edition is specified.\r\n\t\t */\r\n\t\tif (queryBk.parseEdition() > 1) {\r\n\t\t\tqueryStr += processQueryEdition(queryBk.parseEdition());\r\n\t\t} // end if\r\n\r\n\t\t/*\r\n\t\t * Querying the Primo X-service; and invoking the matching processes (all done\r\n\t\t * by remoteQuery()).\r\n\t\t */\r\n\t\tif (strHandle.hasSomething(queryBk.getPublisher())) {\r\n\t\t\tif (remoteQuery(queryStr)) {\r\n\t\t\t\tmatch = true;\r\n\t\t\t\tsetBookInfo();\r\n\t\t\t\tcheckAVA(queryBk.parseVolume());\r\n\t\t\t\treturn true;\r\n\t\t\t} else {\r\n\t\t\t\tmatch = false;\r\n\t\t\t} // end if\r\n\t\t} // end if\r\n\r\n\t\t/*\r\n\t\t * For various reasons, there are possibilities that the first query fails while\r\n\t\t * a match should be found. The follow work as remedy queries to ensure the\r\n\t\t * accuracy.\r\n\t\t */\r\n\r\n\t\tif (!match && strHandle.hasSomething(queryBk.getPublisher())) {\r\n\t\t\tqueryStr = new String(\r\n\t\t\t\t\tprocessQueryPublisher(queryBk.getPublisher()) + processQueryAuthor(queryBk.getCreator()));\r\n\t\t\tif (remoteQuery(queryStr)) {\r\n\t\t\t\tmatch = true;\r\n\t\t\t\tsetBookInfo();\r\n\t\t\t\tcheckAVA(queryBk.parseVolume());\r\n\t\t\t\treturn true;\r\n\t\t\t} else {\r\n\t\t\t\tmatch = false;\r\n\t\t\t} // end if\r\n\t\t} // end if\r\n\r\n\t\tif (!match) {\r\n\t\t\tqueryStr = new String(processQueryTitle(queryBk.getTitle()) + processQueryAuthor(queryBk.getCreator()));\r\n\t\t\tif (remoteQuery(queryStr)) {\r\n\t\t\t\tmatch = true;\r\n\t\t\t\tsetBookInfo();\r\n\t\t\t\tcheckAVA(queryBk.parseVolume());\r\n\t\t\t\treturn true;\r\n\t\t\t} else {\r\n\t\t\t\tmatch = false;\r\n\t\t\t} // end if\r\n\t\t} // end if\r\n\r\n\t\tif (!match) {\r\n\t\t\tqueryStr = new String(processQueryTitle(queryBk.getTitle()));\r\n\t\t\tif (remoteQuery(queryStr)) {\r\n\t\t\t\tmatch = true;\r\n\t\t\t\tsetBookInfo();\r\n\t\t\t\tcheckAVA(queryBk.parseVolume());\r\n\t\t\t\treturn true;\r\n\t\t\t} else {\r\n\t\t\t\tmatch = false;\r\n\t\t\t} // end if\r\n\t\t} // end if\r\n\r\n\t\tif (!match && strHandle.hasSomething(queryBk.getPublishYear())) {\r\n\t\t\tqueryStr = new String(\r\n\t\t\t\t\tprocessQueryAuthor(queryBk.getCreator()) + processQueryYear(queryBk.getPublishYear()));\r\n\r\n\t\t\tif (remoteQuery(queryStr)) {\r\n\t\t\t\tmatch = true;\r\n\t\t\t\tsetBookInfo();\r\n\t\t\t\tcheckAVA(queryBk.parseVolume());\r\n\t\t\t\treturn true;\r\n\t\t\t} else {\r\n\t\t\t\tmatch = false;\r\n\t\t\t} // end if\r\n\t\t} // end if\r\n\r\n\t\tif (!match) {\r\n\t\t\tqueryStr = new String(\r\n\t\t\t\t\tprocessQueryAuthor(queryBk.getCreator()) + processQueryTitleShort(queryBk.getTitle()));\r\n\t\t\tif (remoteQuery(queryStr)) {\r\n\t\t\t\tmatch = true;\r\n\t\t\t\tsetBookInfo();\r\n\t\t\t\tcheckAVA(queryBk.parseVolume());\r\n\t\t\t\treturn true;\r\n\t\t\t} else {\r\n\t\t\t\tmatch = false;\r\n\t\t\t} // end if\r\n\t\t} // end if\r\n\r\n\t\t// Additional query for Chinese titles\r\n\r\n\t\tif (!match && (CJKStringHandling.isCJKString(queryBk.getTitle())\r\n\t\t\t\t|| CJKStringHandling.isCJKString(queryBk.getCreator())\r\n\t\t\t\t|| CJKStringHandling.isCJKString(queryBk.getPublisher()))) {\r\n\r\n\t\t\tqueryStr = new String(processQueryTitle(queryBk.getTitle()));\r\n\t\t\tif (remoteQuery(queryStr)) {\r\n\t\t\t\tmatch = true;\r\n\t\t\t\tsetBookInfo();\r\n\t\t\t\tcheckAVA(queryBk.parseVolume());\r\n\t\t\t\treturn true;\r\n\t\t\t} else {\r\n\t\t\t\tmatch = false;\r\n\t\t\t} // end if\r\n\r\n\t\t\tif (!match && queryBk.parseEdition() != -1) {\r\n\t\t\t\tqueryStr = new String(\r\n\t\t\t\t\t\tprocessQueryTitle(queryBk.getTitle()) + processQueryEdition2(queryBk.parseEdition()));\r\n\t\t\t\tif (remoteQuery(queryStr)) {\r\n\t\t\t\t\tmatch = true;\r\n\t\t\t\t\tsetBookInfo();\r\n\t\t\t\t\tcheckAVA(queryBk.parseVolume());\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t} else {\r\n\t\t\t\t\tmatch = false;\r\n\t\t\t\t} // end if\r\n\r\n\t\t\t\tif (!match && queryBk.parseEdition() != -1) {\r\n\t\t\t\t\tqueryStr = new String(\r\n\t\t\t\t\t\t\tprocessQueryTitle(queryBk.getTitle()) + processQueryEdition3(queryBk.parseEdition()));\r\n\t\t\t\t\tif (remoteQuery(queryStr)) {\r\n\t\t\t\t\t\tmatch = true;\r\n\t\t\t\t\t\tsetBookInfo();\r\n\t\t\t\t\t\tcheckAVA(queryBk.parseVolume());\r\n\t\t\t\t\t\treturn true;\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tmatch = false;\r\n\t\t\t\t\t} // end if\r\n\t\t\t\t} // end if\r\n\t\t\t} // end if\r\n\t\t} // end if\r\n\r\n\t\t// Additional check for ISO Document number in <search> <genernal> PNX\r\n\t\t// tag\r\n\t\tif (!match && !CJKStringHandling.isCJKString(queryBk.getTitle())) {\r\n\t\t\tqueryStr = new String(processQueryTitleISODoc(queryBk.getTitle()));\r\n\t\t\tif (remoteQuery(queryStr)) {\r\n\t\t\t\tmatch = true;\r\n\t\t\t\tsetBookInfo();\r\n\t\t\t\tcheckAVA(queryBk.parseVolume());\r\n\t\t\t\treturn true;\r\n\t\t\t} else {\r\n\t\t\t\tmatch = false;\r\n\t\t\t\terrMsg += \"Query: No record found on Primo.\" + Config.QUERY_SETTING;\r\n\t\t\t} // end if\r\n\t\t} // end if\r\n\t\treturn false;\r\n\t}", "public boolean solve()\n\t{\n Position[] pos=path.getLastStep().neighbors();\n if (grid.isOnBoundary(path.getLastStep())&&grid.isOpen(path.getLastStep()))\n\t\treturn true;\n if (path.getLastStep()==start)\n return false;\n for (int i=0;i<4;i++)\n {\n if (pos[i]!=path.getLastStep() && grid.isOpen(pos[i]))\n path.extend(pos[i]);\n }\n if (grid.isBlocked(path.getLastStep())||grid.isRejected(path.getLastStep()))\n {\n path.backUp();\n solve();\n }\n return false;\n \n\t}", "private Boolean nonEmptyQuery(String query){\n\t\tBoolean isCorrect = false;\n\t\tString [] queryElements = query.split(\"--\");\n\t\tif(queryElements.length==2 && !queryElements[0].isEmpty() && !queryElements[1].isEmpty())\n\t\t\tisCorrect = true;\n\t\treturn isCorrect;\n\t}", "protected boolean isApplicable(SPRequest req) {\n\n Log.debug(\"isApplicable ? \" + req.getPath() + \" vs \" + getRoute());\n\n if (!req.getMethod().equals(getHttpMethod()))\n return false;\n\n String[] uri = req.getSplitUri();\n String[] tok = splitPath;\n if (uri.length != tok.length && splatIndex == -1)\n return false;\n\n if (uri.length <= splatIndex)\n return false;\n\n for (int i = 0; i < tok.length; i++) {\n if (tok[i].charAt(0) != ':' && tok[i].charAt(0) != '*' && !tok[i].equals(uri[i]))\n return false;\n }\n\n return true;\n }", "public boolean isGoal() {\n return hamming() == 0; // Board is solved if hamming distance is 0\n }", "public final boolean synpred4_QL() {\r\n state.backtracking++;\r\n int start = input.mark();\r\n try {\r\n synpred4_QL_fragment(); // can never throw exception\r\n } catch (RecognitionException re) {\r\n System.err.println(\"impossible: \"+re);\r\n }\r\n boolean success = !state.failed;\r\n input.rewind(start);\r\n state.backtracking--;\r\n state.failed=false;\r\n return success;\r\n }", "public boolean isSolvable() {\n\t\treturn result != null;\n\t}", "boolean exactMatch(FlowRule rule);", "public boolean isSolvable()\n {\n if (goalNode!=null && goalNode.board.isGoal()){\n return true;\n }\n return false;\n\n }", "public boolean hasValidRoute() \n {\n return validRoute;\n }", "public boolean isSolvable() {\n return solution != null || initialNode.board.isGoal();\n }", "boolean hasRoute(Node to);", "@Override\n\t\tpublic boolean isValidSolution() {\n\t\t\treturn super.isValidSolution();\n\t\t}", "boolean isSetSearchRecurrenceRule();", "boolean hasRouteDest();", "public boolean isComplete() {\r\n for (GoalInterface g: goals) {\r\n if (type == GoalType.AND && !g.isComplete()) {\r\n return false;\r\n } else if (type == GoalType.OR && g.isComplete()) {\r\n return true;\r\n }\r\n }\r\n\r\n if (type == GoalType.AND) {\r\n return true;\r\n } else if (type == GoalType.OR) {\r\n return false;\r\n }\r\n return false;\r\n }", "public boolean solve(){\n\t\treturn solve(0,0);\n\t}", "public boolean solve(){\n\t\t//Solve the puzzle using backtrack method\n\t\treturn solve(0,0);\n\t}", "public boolean foundGoal() \r\n\t{\r\n\t\t// Write the method that determines if the walker has found a way out of the maze.\r\n\t\treturn ( currentCol < 0 || currentRow < 0 || \r\n\t\t\t\t currentCol >= size || currentRow >= size );\r\n\t}", "boolean hasQueryMessage();", "private boolean isQueryNew() throws PipelineNodeException {\n\t\tthis.getCanonicalFormForParameters();\n\n\t\t// get the Id of an evenual existing query identical to the one which is\n\t\t// submitted\n\t\ttry {\n\n\t\t\tthis.queryId = QueryDao.getInstance().getIdentifierExistingQuery(\n\t\t\t\t\tnotification);\n\t\t} catch (Exception e) {\n\t\t\tnew ErrorHandler(notification, queryId, e.getMessage(), this\n\t\t\t\t\t.getClass().getName());\n\t\t\tthrow new PipelineNodeException(e.getMessage());\n\t\t}\n\t\treturn (null == queryId);\n\t}", "public static boolean isValidinput(String query){\r\n\t\tPattern regex = Pattern.compile(\"[$&+,:;=@#|]\");\r\n\t\tMatcher matcher = regex.matcher(query);\r\n\t\tif (matcher.find()){\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\telse{\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t}", "protected boolean isFinished() {\n \treturn (Robot.sonar.getDistance() <= distance);\n }", "public boolean isGoal() {\n for (int i = 0; i < L; i++)\n if (arr1d[i] != goalEntry1d(i)) { return false; }\n return true;\n }", "public boolean queryRepository() {\n return !pathQueryDependencies.isEmpty() && repositoryUrl != null;\n }", "public boolean compute() {\n\t\tif(this.startNode.equals(goalNode)) {\r\n\t\t\tSystem.out.println(\"Goal Node Found :)\");\r\n\t\t\tSystem.out.println(startNode);\r\n\t\t}\r\n\t\r\n\t\tQueue<Node> queue = new LinkedList<>();\r\n\t\tArrayList<Node> explored = new ArrayList<>();\r\n\t\tqueue.add(this.startNode);\r\n\t\texplored.add(startNode);\r\n\t\t\r\n\t\t//while queue is not empty\r\n\t\twhile(!queue.isEmpty()) {\r\n\t\t\t//remove and return the first node in the queue\r\n\t\t\tNode current = queue.remove();\r\n\t\t\tif(current.equals(this.goalNode)) {\r\n\t\t\t\tSystem.out.println(\"Explored: \" + explored + \"\\nQueue: \" + queue);\r\n\t\t\t\treturn true;\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\t//dead end\r\n\t\t\t\tif(current.getChildren().isEmpty()){\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\t//add to queue the children of the current node\r\n\t\t\t\telse {\r\n\t\t\t\t\tqueue.addAll(current.getChildren());\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\texplored.add(current);\r\n\t\t}\r\n\t\treturn false;\r\n\t}", "boolean isNilSearchRecurrenceRule();", "public boolean isSolution() {\n\t\t\n\t\tboolean foundSolution = false;\n\t\t\n\t\tif (inconsistencyCount == 0) {\n\t\t\tfoundSolution = true;\n\t\t\tSet<PlanGraphLiteral> lastLevelFacts = facts.get(maxLevel);\n\t\t\tPlanGraphStep endStep = steps.get(maxLevel + 1).iterator().next();\n\t\t\tfor (PlanGraphLiteral goalCondition : endStep.getParentNodes()) {\n\t\t\t\tif (!lastLevelFacts.contains(goalCondition)) {\n\t\t\t\t\tinconsistencies.get(maxLevel).add(new UnsupportedPrecondition(goalCondition, maxLevel));\n\t\t\t\t\tinconsistencyCount++;\n\t\t\t\t\tfoundSolution = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn foundSolution;\n\t}", "public boolean isComplete()\n {\n return (getCount() >= getGoal());\n }", "public boolean isGoal() \n {\n return this.manhattan() == 0;\n // return this.manhattan() == 0 || this.checkTwinSolution();\n }", "boolean hasDestination();", "boolean hasDestination();", "private boolean isResolvable() {\n\t\tfinal int sourceParity = board.calculateParity() % 2;\n\t\tfinal int targetParity = goal.calculateParity() % 2;\n\t\treturn (((sourceParity != 0) && (targetParity != 0)) || ((sourceParity == 0) && (targetParity == 0)));\n\t}", "public final boolean IsSatisfy() {\r\n List<State> states = this.SAT(this._expression);\r\n for(State state : states)\r\n \t{\r\n \t\tif (state.StateName.equals(this._state.StateName)) {\r\n \t\t\treturn true;\r\n \t} \r\n \r\n }\r\n return false;\r\n }", "public abstract boolean isSatisfied();", "public boolean finished() {\r\n\t\tboolean allOccupied = true;\r\n\t\tfor (Node n : allNodes.values()) {\r\n\t\t\tif (n.path == 0) {\r\n\t\t\t\tallOccupied = false;\r\n\t\t\t}\r\n\t\t}\r\n\t\tif (allOccupied) {\r\n\r\n\t\t\tfor (Integer path : paths.keySet()) {\r\n\t\t\t\tStack<Node> sn=paths.get(path);\r\n\t\t\t\tNode n = sn.peek();\r\n\t\t\t\tif (!EndPoint.containsValue(n)) {\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\tif (sn.size() > 1) {\r\n\t\t\t\t\tStack<Node> snBK = (Stack<Node>) sn.clone();\r\n\t\t\t\t\t\r\n\t\t\t\t\tNode n1 = snBK.pop();\r\n\t\t\t\t\twhile (!snBK.isEmpty()) {\r\n\t\t\t\t\t\tif(n1.path!=path)\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\tNode n2= snBK.pop();\r\n\t\t\t\t\t\tif(adjaMatrix[n1.index][n2.index]==0)\r\n\t\t\t\t\t\t\treturn false;\r\n\t\t\t\t\t\telse {\r\n\t\t\t\t\t\t\tn1=n2;\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\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\treturn true;\r\n\t\t} else\r\n\t\t\treturn false;\r\n\t}", "public boolean isGoal();", "public boolean isSolvable() {\r\n return solution() != null;\r\n }", "public boolean isWinnable() {\n Solver<ArrayList<Integer>> mySolver =\n new Solver<ArrayList<Integer>>();\n ArrayList<ArrayList<Integer>> Solution =\n mySolver.SolveBFS(this);\n\n //Reset 'tried' to none\n tried = new HashSet<ArrayList<Integer>>();\n\n if(Solution.size() == 0) {\n //No Solution\n return false;\n }\n return true;\n }", "@Override\n public boolean hasNext() {\n return !query.isEmpty();\n }", "boolean hasQueryZone();", "boolean hasResolve();", "public boolean isFullResult();", "public boolean isSatisfied() {\n for (IntegerVariable v : integerVariables) {\n if (!v.isSatisfied()) {\n // Logger.fine(v.toString() + \" is not satisfied\");\n return false;\n }\n }\n for (Clause clause : clauses) {\n if (!clause.isSatisfied()) {\n // Logger.fine(clause.toString() + \" is not satisfied\");\n return false;\n }\n }\n return true;\n }", "public boolean runSolver()\n {\n Variable current = getUnassignedVar();\n\n if (current == null)\n {\n return true;\n }\n\n for (int i = 0; i < current.getDomain().size(); i++)\n {\n List<Integer> oldDomain = current.getDomain();\n int newval = oldDomain.get(i);\n current.setValue(newval);\n current.setDomain(i);\n\n if (constraintsSatisfied(constraintsWithAnyVals()))\n {\n if (runSolver())\n {\n return true;\n }\n }\n\n current.setDomain(oldDomain);\n current.setValue(current.getPrevious()); \n }\n return false;\n }", "public boolean isMatched() {\n return ruleCount == matches;\n }", "boolean search(int count, GraphDatabaseService databaseService, boolean isProtein) {\n boolean completed = false;\n int id = searchOrderSeq.get(count);\n String x = null;\n if(isProtein)\n x = queryGraphNodes.get(id).label;\n else\n x = String.valueOf(queryGraphNodes.get(id).labels.get(0));\n for(Long nodeID: searchSpaceProtein.get(x)) {\n boolean alreadyEncountered = false;\n for(int id1: solution.keySet()) {\n if(solution.get(id1) == nodeID)\n alreadyEncountered = true;\n }\n\n if(!check(nodeID, id, databaseService) || alreadyEncountered)\n continue;\n\n\n solution.put(id, nodeID);\n\n if(solution.size() == searchOrderSeq.size()) {\n listOfSolutions.put(++numSubgraphs, new HashMap<>(solution));\n solution.remove(id);\n }\n if(listOfSolutions.size()>999)\n return true;\n if(count<searchOrderSeq.size() - 1)\n search(count + 1, databaseService, isProtein);\n\n }\n if(listOfSolutions.size()>999)\n return true;\n if(solution.size()>0)\n solution.remove(searchOrderSeq.get(count - 1));\n return completed;\n }", "public boolean isSolvable() {\n Node preNode = minNode;\n while (preNode.getPrevious() != null) {\n preNode = preNode.getPrevious();\n }\n\n if (preNode.getBoard().equals(inNode.getBoard())) {\n return true;\n } else {\n return false;\n }\n }", "public boolean isGoal() {\n if (posX != N-1 || posY != N-1) return false;\n for (int i = 0; i < N; i++) {\n for (int j = 0; j < N; j++) {\n if (matrix[i][j] == 0) continue;\n if (i*N+j+1 != matrix[i][j]) return false;\n }\n }\n return true;\n }", "private boolean isSolvable() {\n\t\tshort permutations = 0; // the number of incorrect orderings of tiles\n\t\tshort currentTileViewLocationScore;\n\t\tshort subsequentTileViewLocationScore;\n\n\t\t// Start at the first tile\n\t\tfor (int i = 0; i < tiles.size() - 2; i++) {\n\t\t\tTile tile = tiles.get(i);\n\n\t\t\t// Determine the tile's location value\n\t\t\tcurrentTileViewLocationScore = computeLocationValue(tile\n\t\t\t\t\t.getCorrectLocation());\n\n\t\t\t// Compare the tile's location score to all of the tiles that\n\t\t\t// follow it\n\t\t\tfor (int j = i + 1; j < tiles.size() - 1; j++) {\n\t\t\t\tTile tSub = tiles.get(j);\n\n\t\t\t\tsubsequentTileViewLocationScore = computeLocationValue(tSub\n\t\t\t\t\t\t.getCorrectLocation());\n\n\t\t\t\t// If a tile is found to be out of order, increment the number\n\t\t\t\t// of permutations.\n\t\t\t\tif (currentTileViewLocationScore > subsequentTileViewLocationScore) {\n\t\t\t\t\tpermutations++;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// return whether number of permutations is even\n\t\treturn permutations % 2 == 0;\n\t}", "private boolean isAdvancedQuery(String enteredQuery){\n try{\n Character firstChar = enteredQuery.charAt(0);\n Character secondChar = enteredQuery.charAt(1);\n\n return isSignOperator(firstChar.toString()) && secondChar.equals(' ');\n }catch (StringIndexOutOfBoundsException ex){\n return false;\n }\n }", "public boolean hasQuery() {\n return ((bitField0_ & 0x00000010) == 0x00000010);\n }", "public abstract boolean isAppropriateRequest(Request request);", "public boolean hasQuery() {\n return ((bitField0_ & 0x00000010) == 0x00000010);\n }", "private static boolean hasSolution(AlgoFunction algo, GridGraph gridGraph, StartGoalPoints p) {\n int[][] path = Utility.generatePath(algo, gridGraph, p.sx, p.sy, p.ex, p.ey);\n return path.length > 1;\n }", "public boolean hasDestination() {\n return result.hasDestination();\n }", "private boolean checkFinalPuzzle() throws Exception {\n for(int i = 0; i < puzzle.getColumns(); ++i) {\n var clues = puzzle.getColumnClue(i);\n var solver_col = searchBoard.getFilledGroups(i, TraversalType.COLUMN);\n if(clues.size() != solver_col.size()) {\n return false;\n }\n for(int j = 0; j < clues.size(); ++j) {\n if(!clues.get(j).equals(solver_col.get(j))) {\n return false;\n }\n }\n }\n for(int i = 0; i < puzzle.getRows(); ++i) {\n var clues = puzzle.getRowClue(i);\n var solver_row = searchBoard.getFilledGroups(i, TraversalType.ROW);\n if(clues.size() != solver_row.size()) {\n return false;\n }\n for(int j = 0; j < clues.size(); ++j) {\n if(!clues.get(j).equals(solver_row.get(j))) {\n return false;\n }\n }\n }\n return true;\n }", "public abstract boolean hasMapped(Edge queryEdge);", "protected boolean isFinished() {\n \t//finish if distance >= requried distance\n return (Robot.drive.leftEncoder.getDistance() >= distance || Robot.drive.rightEncoder.getDistance() >= distance);\n }", "boolean hasResidues();", "boolean isValid()\n {\n return isRequest() && isResponse();\n }", "public boolean hasQuery() {\n return fieldSetFlags()[8];\n }", "public boolean isGoal() {\n boolean result = false; \n for (int i = 0; i < this.N; i++) {\n for (int j = 0; j < this.N; j++) {\n int idx = (i * this.N) + (j + 1);\n if (idx != N * N - 1 && tiles[i][j] != idx) {\n return false;\n } \n if (idx == N * N - 1) {\n if (tiles[N - 1][N - 1] == 0) return true;\n return false;\n }\n }\n }\n return result;\n }", "public abstract boolean isGoal(CCState state);", "private boolean roadCheck(Road road) {\n\t\t\n\t\treturn false;\n\t}", "private boolean isRelevantClause(CNFElement clause) {\n return clause.size() == 1 && !isMinMax(clause.getPredicates().get(0)) &&\n !isDuration(clause.getPredicates().get(0));\n }", "boolean distinct(Node qNode) {\n switch (type()) {\n\n case UNION:\n //case OPTION:\n boolean success = false;\n for (Exp ee : this) {\n success = ee.distinct(qNode) || success;\n }\n if (success) {\n return true;\n }\n break;\n\n case AND:\n case BGP:\n case GRAPH:\n\n for (int i = 0; i < size(); i++) {\n Exp exp = get(i);\n switch (exp.type()) {\n case EDGE:\n case PATH:\n case XPATH:\n case EVAL:\n //Edge edge = exp.getEdge();\n if (exp.contains(qNode)) {\n add(i + 1, Exp.create(ACCEPT, qNode));\n return true;\n }\n break;\n\n case AND:\n case GRAPH:\n case UNION:\n //case OPTION:\n if (exp.distinct(qNode)) {\n return true;\n }\n\n break;\n\n }\n }\n }\n\n return false;\n }", "public boolean isHasSolution() {\n return hasSolution;\n }", "public boolean contains(String query) {\n query = query.toLowerCase();\n for (PersonInfo personInfo : info) {\n if (personInfo.getRight().toLowerCase().contains(query)) {\n return true;\n }\n }\n return name.toLowerCase().contains(query)\n || (title != null && title.toLowerCase().contains(query))\n || pictureUrl.toLowerCase().contains(query)\n || id.toLowerCase().contains(query);\n }", "private boolean findMatchProtocol(BooleanExpr expr, \n\t RoutingProtocol protocol, String indent) {\n\t //System.out.println(indent + \"BoolExpr: \" + expr);\n\t if (expr instanceof MatchProtocol) {\n MatchProtocol matchProto = (MatchProtocol)expr;\n if (matchProto.getProtocol().equals(protocol)) {\n return true;\n }\n\t } else if (expr instanceof Conjunction) {\n Conjunction conditions = (Conjunction)expr;\n for (BooleanExpr condition : conditions.getConjuncts()) {\n if (findMatchProtocol(condition, protocol, indent + \" \")) {\n return true;\n }\n }\n } else if (expr instanceof Disjunction) {\n Disjunction conditions = (Disjunction)expr;\n for (BooleanExpr condition : conditions.getDisjuncts()) {\n if (findMatchProtocol(condition, protocol, indent + \" \")) {\n return true;\n }\n }\n }\n\t return false;\n\t}", "@Override\n\tpublic boolean solved() {\n\n\t\treturn solved;\n\t}", "public boolean isValid() {\n\t\t//for every city\n\t\tfor(int i = 0; i < numKingdoms; i++) {\n\t\t\t//check its adjacency list\n\t\t\tfor(int j = 0; j < numKingdoms; j++) {\n\n\t\t\t\t//if reachable from i and if j has been conquered\n\t\t\t\tif(cost[i][j] > 0 && conquered.contains(j)) {\n\t\t\t\t\t//yes, this city has been conquered\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}", "public boolean isGoal() {\n return hamming() == 0;\n }", "public boolean isGoal() {\n return hamming() == 0;\n }", "public boolean isGoal() {\n return hamming() == 0;\n }", "public boolean isGoal() {\n return hamming() == 0;\n }", "public boolean isGoal() {\n return hamming() == 0;\n }", "public boolean isGoal() {\n return hamming() == 0;\n }", "public boolean isSolvable() {\n return finalMove != null;\n }", "boolean hasSearchRequest();", "boolean complete() {\n\t\tint sizes = 1;\n\n\t\tfor (int i = 0; i <= matrix.length - 1; i++) {\n\t\t\tfor (int j = 4; j >= sizes; j--) {\n\t\t\t\tint cost = getCost(i,j);\n\t\t\t\tif (cost == 0) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tsizes = sizes + 1;\n\t\t}\n\t\treturn true;\n\t}", "private boolean isFullyMatched() {\n\t\treturn subBeatMatches > 0 && beatMatches > 0;\n\t}", "public boolean checkRules() {\n for (Rule rule: rules) {\n if (! rule.checkRegel(board)) { //problem with a rule\n return false;\n }\n }\n return true;\n }" ]
[ "0.6158143", "0.6067928", "0.5800235", "0.5691826", "0.5659112", "0.5659112", "0.5585804", "0.5585208", "0.5580247", "0.5508721", "0.5495961", "0.547901", "0.5472578", "0.5452428", "0.5450443", "0.54491454", "0.53979164", "0.53941286", "0.5379722", "0.53637415", "0.5341885", "0.53249395", "0.53126794", "0.53116786", "0.5285283", "0.5284384", "0.5275658", "0.5271323", "0.5268454", "0.52644306", "0.52243876", "0.5221082", "0.52203894", "0.52194583", "0.52163106", "0.5198026", "0.51789784", "0.514678", "0.51465964", "0.5142518", "0.51420385", "0.5138252", "0.5132195", "0.5129865", "0.51285905", "0.51202774", "0.5115328", "0.5095151", "0.5095151", "0.508865", "0.5063639", "0.5059346", "0.50585246", "0.5055142", "0.5054287", "0.5053423", "0.5053303", "0.50392807", "0.50269765", "0.50196004", "0.50137687", "0.50101274", "0.5001448", "0.49991566", "0.4997802", "0.49873832", "0.4979498", "0.49780244", "0.49771005", "0.49729648", "0.4968248", "0.4967709", "0.49392843", "0.49338877", "0.49326822", "0.4930862", "0.49271512", "0.491861", "0.4914228", "0.49109146", "0.49050117", "0.49030927", "0.48967952", "0.48897532", "0.48852602", "0.48852286", "0.48748952", "0.48732975", "0.48730576", "0.48689637", "0.48689637", "0.48689637", "0.48689637", "0.48689637", "0.48689637", "0.48674765", "0.48673496", "0.48640153", "0.48638734", "0.48611802" ]
0.6662964
0
Record a new instance of Resource so long as it has not been seen before
private void push(Node resource) { if (seen.add(resource)) { lookahead[nAvailable++] = new Triple(resource, TYPE, RESOURCE); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "void handleNewResource() {\n System.out.println(\"Here at VMLeaseProcessor#handleNewResource\");\n callForBackup();\n resourceManager.createRedundant();\n }", "public Resource storeResource( Resource r );", "public synchronized Resource createUniqueResource() throws ModelException {\n\n ensureCanCreateUnique();\n\n int id = getUnusedNodeID();\n BlankResourceImpl r = new BlankResourceImpl(this, id);\n return r;\n }", "public synchronized Resource createResource(QName str) throws ModelException {\n\n // check whether we have it in the registry\n Resource r = (Resource)rmap.get(str);\n // System.err.println(\"Creating resource: \" + str + \", in rmap=\" + r);\n\n if(r == null) {\n r = new ResourceImpl(/*getUnusedNodeID(),*/ str);\n rmap.put(str, r);\n }\n return r;\n }", "Resource createResource();", "private Resource() {}", "@Override\n\tpublic Resource insert(Resource resource) {\n\t\treturn null;\n\t}", "public void resourceCreated(Resource resource)\n {\n event(\"ResourceCreation\",\n resource.getId(),\n -1,\n -1,\n false);\n }", "public ModifiableResource(Resource resource) {\n super(resource);\n }", "E create(Resource data);", "public abstract T getCreatedResource();", "Resource() {\r\n this.parent = null;\r\n this.name = \"\";\r\n this.displayName = \"\";\r\n this.createdDate = null;\r\n this.modifiedDate = null;\r\n count++;\r\n }", "public MyResource() {\n System.out.println(\"creating Resource\");\n }", "private MyResource() {\n System.out.printf(\"[%s] has been created \\n\", MyResource.class.getSimpleName());\n }", "public Closeable add(final Resource resource) {\n final ResourceWrapper resourceWrapper = new ResourceWrapper(resource);\n \n synchronized (m_reservableListMutex) {\n m_reservables.add(resourceWrapper);\n }\n \n m_listeners.apply(\n new ListenerSupport.Informer() {\n public void inform(Object listener) {\n ((Listener)listener).resourceAdded(resource);\n }\n });\n \n return resourceWrapper;\n }", "@Override\n public boolean registerNewResource(API api, Map resourceAttributes) throws APIManagementException {\n\n return true;\n }", "@Override\n public void addResource(String resourceKey, Object resource)\n {\n synchronized(InProcessCache.class) {\n if(!hasResource(resourceKey)) {\n WeakReference weak = new WeakReference(resource);\n _cache.put(resourceKey, weak);\n }\n }\n }", "public void addResource(PSResource res) {\n/* 72 */ prepareResourceSet();\n/* 73 */ this.resources.add(res);\n/* */ }", "Resource create(Session session, IRI identifier, IRI type);", "public AddResource() {\n }", "public Resource() {\n }", "public Resource() {\n }", "org.hl7.fhir.ResourceReference addNewPerformer();", "public void addResource(Resource resource) {\n this.resources.clear();\n this.resources.add(resource);\n }", "public void addResource(TIdentifiable resource) {\r\n // make sure that the resource doesn't exists already\r\n\t if (resourceExists(resource)) return;\t \r\n\t \r\n // check to see if we need to expand the array:\r\n\t if (m_current_resources_count == m_current_max_resources) expandTable(1, 2);\t \t \r\n\t m_resources.addID(resource);\r\n\t m_current_resources_count++;\r\n }", "public org.hl7.fhir.ResourceReference addNewPatient()\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.hl7.fhir.ResourceReference target = null;\n target = (org.hl7.fhir.ResourceReference)get_store().add_element_user(PATIENT$2);\n return target;\n }\n }", "public void addResource(ResourceInterface resource) {\n if (resource != null && !this.resources.contains(resource)) {\n this.resources.add(resource);\n forceUpdate();\n }\n }", "@Test\n\tpublic void testAddResource()\n\t{\n\t\tLocalDate resDate = null;\n\t\t\n\t\tCategory cat = new Category();\n\t\tcat.setCatId(10);\n\t\tcat.setCatName(\"Clothing\");\n\t\t\n\t\tResource res = new Resource();\n\t\tres.setResId(10);\n\t\tres.setResDate(resDate);\n\t\tres.setCategory(cat);\n\t\tres.setResDescription(\"100% Cotton\");\n\t\tres.setResTitle(\"Shirt\");\n\t\tres.setResPrice(1000);\n\t\t\n\t\tMockito.when(resourceRepository.save(res)).thenReturn(res);\n\t\tassertEquals(res, resourceService.addResource(res)); //check the expected result with actual result.\n\t}", "public void giveResourcesToPlayer(Resource resource){\n resources.addResource(resource);\n }", "InformationResource createInformationResource();", "public void create(Singer newRecord);", "public org.hl7.fhir.ResourceReference addNewMedication()\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.hl7.fhir.ResourceReference target = null;\n target = (org.hl7.fhir.ResourceReference)get_store().add_element_user(MEDICATION$10);\n return target;\n }\n }", "public static void addResource(ArrayList<Resource> resource){\n String id;\n String type;\n String name;\n String genre;\n String author;\n String year;\n String userID = \"0\";\n Boolean checkedOut = false;\n\n int nextID = Resource.getLastID() + 1;\n id = \"\" + nextID;\n type = stringInput(\"What type is the resource\");\n name = stringInput(\"What is the name of the resource\");\n genre = stringInput(\"What genre is the resource\");\n author = stringInput(\"Who is the author\");\n year = stringInput(\"What year is it published\");\n\n resource.add(new Resource(id, type, name, genre, author, year, userID, checkedOut));\n }", "protected void recordResourceMacro(ResourceMacro macro) {\n super.recordResourceMacro(macro);\n }", "public Object makeResource();", "public ResourceDowntimeRecord() {}", "public void setResource(ResourceVO newResource) {\n\tresource = newResource;\n}", "@Override\n\tprotected boolean addResourceToDataStore(ExampleResource resource) {\n\t\tHALLink selfLink = resource.getSelf();\n\t\tif (selfLink == null){\n\t\t\tUUID resourceID = UUID.randomUUID();\n\t\t\tselfLink = createSelfLinkWithUUID(resourceID, resource.getProfile());\n\t\t\tresource.setSelf(selfLink);\n\t\t\tresourceMapping.put(selfLink.getHref(), resourceID);\n\t\t}\n\t\tString resourceURI = selfLink.getHref();\n\t\tUUID dataID = resourceMapping.get(resourceURI);\n\t\tif (dataID == null){\n\t\t\tdataID = UUID.randomUUID();\n\t\t\tresourceMapping.put(resourceURI, dataID);\n\t\t}\n\t\treturn dataStore.getData().add(convert(resource));\n\t}", "int insert(ResourcePojo record);", "public void addResource(Resource r,int max){\n t.put(r.getName(),new SupplyNode(r,max));\n }", "On_Device_Resource createOn_Device_Resource();", "ObjectResource createObjectResource();", "protected ValidatableResponse createResource(String path, JSONObject newResource) throws JSONException {\n return given()\n .header(HEADER_AUTHORIZATION, authenticated())\n .contentType(ContentType.JSON)\n .body(newResource.toString())\n .when()\n .post(path)\n .then()\n .contentType(ContentType.JSON)\n .statusCode(201);\n }", "public void addResource(Resource resource) {\n\t\tresources.add(resource);\n\t}", "ResourceAPI createResourceAPI();", "public UserHasHistoryResource() {\n }", "@PostMapping(\"/course-resources\")\n @Timed\n public ResponseEntity<CourseResource> createCourseResource(@RequestBody CourseResource courseResource) throws URISyntaxException {\n log.debug(\"REST request to save CourseResource : {}\", courseResource);\n if (courseResource.getId() != null) {\n return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert(ENTITY_NAME, \"idexists\", \"A new courseResource cannot already have an ID\")).body(null);\n }\n CourseResource result = courseResourceService.save(courseResource);\n return ResponseEntity.created(new URI(\"/api/course-resources/\" + result.getId()))\n .headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))\n .body(result);\n }", "public ModelResource() {\n }", "public static void createInstance(Model model, Resource instanceResource) {\r\n\t\tBase.createInstance(model, RDFS_CLASS, instanceResource);\r\n\t}", "public org.hl7.fhir.ResourceReference addNewDevice()\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.hl7.fhir.ResourceReference target = null;\n target = (org.hl7.fhir.ResourceReference)get_store().add_element_user(DEVICE$12);\n return target;\n }\n }", "public CarResource() {\n }", "Device_Resource createDevice_Resource();", "public void add(BindResource resource) {\n \tif(resource==null)\n \t\tthrow new IllegalArgumentException(\"resourceProperties cannot be null\");\n \tif(resources==null)\n \t\tresources = new ArrayList<BindResource>();\n \t\n \tresources.add(resource);\n }", "public CarroResource() {\r\n }", "public NotificationResource() {\r\n }", "public Resource save(Object bean) {\r\n\t\treturn write(bean, false);\r\n\t}", "public RandomResource(int instances_) {\n super(instances_);\n stream = new UniformStream(0.0, 1.0);\n waitingList = new Vector();\n }", "public void setRWResource(RWResource theResource) {\n resource = theResource;\n }", "public BookResource() {\n }", "public ProductResource() {\n }", "public StudentResource() {\n }", "protected abstract T createTestResource();", "@Override\n \tpublic Representation postResource(Representation representation)\n \t\t\tthrows Exception {\n \t\treturn null;\n \t}", "public GenericResource() {\r\n }", "public GenericResource() {\n }", "Network_Resource createNetwork_Resource();", "public void onResourceAdded(final ResourceEvent resourceEvent);", "public void addResource(Resource resource) {\n\t\tif (resource != null) {\n\t\t\tthis.getResources().add(resource);\n\t\t\tresource.setSystem(this);\n\t\t}\n\t}", "@Test\n public void testSave() {\n System.out.println(\"save\");\n Resource instance = new ResourceImpl();\n instance.save();\n // TODO review the generated test code and remove the default call to fail.\n fail(\"The test case is a prototype.\");\n }", "int insertSelective(ResourcePojo record);", "@Override\n public void addedResource( ResourceEvent event )\n {\n }", "@Test(dependsOnMethods = {\"modifyResource\"})\n public void modifyNotExistingResource() throws Exception {\n showTitle(\"modifyNotExistingResource\");\n\n try {\n UmaResource resource = new UmaResource();\n resource.setName(\"Photo Album 3\");\n resource.setIconUri(\"http://www.example.com/icons/flower.png\");\n resource.setScopes(Arrays.asList(\"http://photoz.example.com/dev/scopes/view\", \"http://photoz.example.com/dev/scopes/all\"));\n\n getResourceService().updateResource(\"Bearer \" + pat.getAccessToken(), \"fake_resource_id\", resource);\n } catch (ClientErrorException ex) {\n System.err.println(ex.getResponse().readEntity(String.class));\n int status = ex.getResponse().getStatus();\n assertTrue(status != Response.Status.OK.getStatusCode(), \"Unexpected response status\");\n }\n }", "public interface ResourceStamper<R extends Resource> extends Serializable {\n ResourceStamp<R> stamp(R resource) throws IOException;\n}", "public void createNewObject(Representation entity) throws ResourceException {\r\n\t\tT entry = createObjectFromHeaders(null, entity);\r\n\t\texecuteUpdate(entity, entry, createUpdateObject(entry));\r\n\r\n\t}", "public org.hl7.fhir.ResourceReference addNewMember()\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.hl7.fhir.ResourceReference target = null;\n target = (org.hl7.fhir.ResourceReference)get_store().add_element_user(MEMBER$14);\n return target;\n }\n }", "public File addResource(String id, File f) {\n\t\trks.add(id);\n\t\trvs.add(f);\n\t\treturn f;\n\t}", "public <T extends Closeable> T addResource(String id, T c) {\n\t\trks.add(id);\n\t\trvs.add(c);\n\t\treturn c;\n\t}", "public GenericResource()\r\n {\r\n }", "public AbstractResource(T id) {\n\t\tthis.id = id;\n\t}", "public GenericResource()\n {\n }", "int insert(RoleResource record);", "public org.hl7.fhir.ResourceReference addNewObservation()\n {\n synchronized (monitor())\n {\n check_orphaned();\n org.hl7.fhir.ResourceReference target = null;\n target = (org.hl7.fhir.ResourceReference)get_store().add_element_user(OBSERVATION$0);\n return target;\n }\n }", "Service_Resource createService_Resource();", "public DeleteResource() {\n }", "public void createResident(Resident resident);", "public synchronized void registerResource(KbResource resource) {\r\n \t\tregisterResource(resource, false);\r\n \t}", "public Diaryresource() {\r\n\t}", "void callForBackup() {\n List<Resource> redundantList = resourceRepository.findAllByIsRedundantIsTrue();\n System.out.println(\"Invoking redundant instance from list: \" + redundantList);\n if (redundantList != null && redundantList.size() > 0) {\n Resource redundantResource = redundantList.get(0);\n redundantResource.setRedundant(false);\n resourceRepository.save(redundantResource);\n }\n }", "public void setResource(int newResource) throws java.rmi.RemoteException;", "public ProfileResource() {\n }", "public void create(){}", "private void add(EResource resource) {\n switch (resource) {\n case BRICK:\n brick++;\n break;\n case GRAIN:\n grain++;\n break;\n case LUMBER:\n lumber++;\n break;\n case ORE:\n ore++;\n break;\n case WOOL:\n wool++;\n break;\n }\n }", "public ResourceFactory(){}", "@Override\r\n\tpublic void updateResourceInformation() {\n\t}", "@Test\n public void testSetResource() {\n System.out.println(\"setResource\");\n String resource = \"\";\n Resource instance = new ResourceImpl();\n instance.setResource(resource);\n // TODO review the generated test code and remove the default call to fail.\n fail(\"The test case is a prototype.\");\n }", "public FlightsResource() {\r\n }", "public StorageResource() {\n }", "public Produces( AbstractResource resource, String tag ) \r\n {\r\n\t super.resource_state = resource;\r\n\t super.tag = tag;\r\n }", "public void setResource(ResourceInfo resource) {\n\t\tif (this.resource != null) {\n\t\t\tthrow new IllegalStateException(\"The resource pointer can only be set once for Resource [\" + name + \"]\");\n\t\t}\n\t\tthis.resource = resource;\n\t}", "@Override\n\tpublic void updateResourceInformation() {\n\t}" ]
[ "0.6620876", "0.6457194", "0.63378215", "0.62145853", "0.61882585", "0.6116511", "0.60979986", "0.6089751", "0.6047087", "0.60297716", "0.60211396", "0.60092527", "0.59873927", "0.59863997", "0.5984354", "0.596567", "0.59055835", "0.58875585", "0.58445174", "0.5831039", "0.5815792", "0.5815792", "0.5813292", "0.5797228", "0.57776886", "0.57166266", "0.56912565", "0.5686931", "0.5666579", "0.5649437", "0.5647864", "0.5631306", "0.5618386", "0.5612777", "0.5598536", "0.5595833", "0.55826926", "0.557554", "0.5562757", "0.55567133", "0.5552993", "0.555005", "0.55429906", "0.5539129", "0.5519473", "0.55017775", "0.5495271", "0.5480981", "0.5464997", "0.54646647", "0.5457302", "0.5442522", "0.54397625", "0.5399472", "0.53931063", "0.5388403", "0.53861284", "0.53772855", "0.5375745", "0.5351509", "0.5339258", "0.5336324", "0.5330885", "0.53280526", "0.53177345", "0.53165776", "0.5316341", "0.5308924", "0.530058", "0.52967453", "0.52954733", "0.5295461", "0.52659374", "0.5261937", "0.5253937", "0.5252539", "0.52512145", "0.5246169", "0.5233484", "0.5232708", "0.52320737", "0.52276367", "0.52259237", "0.5221768", "0.5189755", "0.51823986", "0.51818836", "0.5177922", "0.5169734", "0.5163603", "0.5155706", "0.515478", "0.5141432", "0.51387644", "0.51299804", "0.5121595", "0.5119336", "0.5116014", "0.5097514", "0.5094603" ]
0.56592774
29
Creates new form Registration
public Registration() { initComponents(); handler = new ClientSocketHandler(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "UserRegistrationResponse registrationPost(RegistrationForm registrationForm);", "@RequestMapping(\"/register\")\r\n\tpublic ModelAndView register(@ModelAttribute(\"registerForm\") final UserRegisterForm form) {\r\n\t\treturn new ModelAndView(\"users/register\");\r\n\t}", "@GetMapping(\"/registration\")\n\t public String registration(Model model) {\n\t model.addAttribute(\"userForm\", new User());\n\t return \"registration\";\n\t }", "public void register(String form /* should be a Form from GUI */){\n String email = \"email\";\n String nome_completo = \"full_name\";\n Date data_nascimento = new Date(1996-10-21);\n String password = getMd5(\"password\");\n String nif = \"nif\";\n String morada = \"morada\";\n String telemovel = \"telemovel\";\n User user = new User(email);\n if (!user.exists()){\n user.setNome_completo(nome_completo);\n user.setData_nascimento(data_nascimento);\n user.setPassword(password);\n user.setNif(nif);\n user.setMorada(morada);\n user.setTelemovel(telemovel);\n user.setAdmin(FALSE);\n //System registers person\n //db.register(user)\n }\n }", "public String createRegisterForm(Register reg)\n {\n DBConnect db = new DBConnect();\n Connection con;\n \n try\n {\n con = (Connection) db.establishConnection();\n String q = \"insert into registerUser (register_name, register_email, register_phone, register_pass)\"\n + \"values (?, ?, ?, ?)\";\n \n PreparedStatement prepareState = con.prepareStatement(q);\n \n prepareState.setString(1, reg.getRegisterName());\n prepareState.setString(2, reg.getRegisterEmail());\n prepareState.setString(3, reg.getRegisterPhone());\n prepareState.setString(4, reg.getRegisterPassword());\n \n prepareState.execute();\n con.close();\n \n return \"Successfully Registered..!!\";\n }\n \n catch(Exception ex)\n {\n System.err.println(\"Exception..!!\");\n System.err.println(\"Message: \" + ex.getMessage());\n \n return \"Data Not Registered..!!\";\n }\n \n }", "public void registerUser(RegisterForm form) throws DAOException;", "@GetMapping(\"/registration\")\n public String registration(Model model) {\n \t\n model.addAttribute(\"userForm\", new User());\n\n return \"registration\";\n }", "void register() {\n if (registerView.getFirstName().length() == 0 || registerView.getLastName().length() == 0 || registerView.getUsername().length() == 0 || registerView.getPassword().length() == 0) {\n IDialog invalidRegistrationDialog\n = dialogFactory.createDialog(DialogFactoryOptions.dialogNames.MESSAGE, new HashMap<String, Object>() {\n {\n put(\"message\", \"Unable to register: Fields must be non-empty!\");\n put(\"title\", \"Authentication Error\");\n put(\"messageType\", DialogFactoryOptions.dialogType.ERROR);\n }\n });\n\n invalidRegistrationDialog.run();\n } else {\n if (userController.registerUser(registerView.getFirstName(), registerView.getLastName(), registerView.getUsername(), registerView.getPassword()) != null) {\n mainFrame.setPanel(panelFactory.createPanel(PanelFactoryOptions.panelNames.MAIN_MENU));\n } else {\n IDialog invalidRegistrationDialog = dialogFactory.createDialog(DialogFactoryOptions.dialogNames.MESSAGE, new HashMap<String, Object>() {\n {\n put(\"message\", \"Unable to register: Username is already taken\");\n put(\"title\", \"Authentication Error\");\n put(\"messageType\", DialogFactoryOptions.dialogType.ERROR);\n }\n });\n\n invalidRegistrationDialog.run();\n }\n }\n }", "private void register() {\r\n if (mName.getText().length() == 0) {\r\n mName.setError(\"please fill this field\");\r\n return;\r\n }\r\n if (mEmail.getText().length() == 0) {\r\n mEmail.setError(\"please fill this field\");\r\n return;\r\n }\r\n if (mPassword.getText().length() == 0) {\r\n mPassword.setError(\"please fill this field\");\r\n return;\r\n }\r\n if (mPassword.getText().length() < 6) {\r\n mPassword.setError(\"password must have at least 6 characters\");\r\n return;\r\n }\r\n\r\n\r\n final String email = mEmail.getText().toString();\r\n final String password = mPassword.getText().toString();\r\n final String name = mName.getText().toString();\r\n\r\n FirebaseAuth.getInstance().createUserWithEmailAndPassword(email, password).addOnCompleteListener(getActivity(), new OnCompleteListener<AuthResult>() {\r\n @Override\r\n public void onComplete(@NonNull Task<AuthResult> task) {\r\n if (!task.isSuccessful()) {\r\n Snackbar.make(view.findViewById(R.id.layout), \"sign up error\", Snackbar.LENGTH_SHORT).show();\r\n } else {\r\n String uid = FirebaseAuth.getInstance().getCurrentUser().getUid();\r\n\r\n //Saves the user's info in the database\r\n Map<String, Object> mNewUserMap = new HashMap<>();\r\n mNewUserMap.put(\"email\", email);\r\n mNewUserMap.put(\"name\", name);\r\n\r\n FirebaseDatabase.getInstance().getReference().child(\"users\").child(uid).updateChildren(mNewUserMap);\r\n }\r\n }\r\n });\r\n\r\n }", "private void registration() {\n\t\tif (ur_name.getText().length() > 0 && email.getText().length() > 0\r\n\t\t\t\t&& pass.getText().length() > 0\r\n\t\t\t\t&& re_pass.getText().length() > 0) {\r\n\t\t\tif (pass.getText().toString()\r\n\t\t\t\t\t.equalsIgnoreCase(re_pass.getText().toString())) {\r\n\t\t\t\tString postEntity = \"user_name=\" + ur_name.getText().toString()\r\n\t\t\t\t\t\t+ \"&email=\" + email.getText().toString() + \"&password=\"\r\n\t\t\t\t\t\t+ pass.getText().toString() + \"&gcm_id=\"\r\n\t\t\t\t\t\t+ GlobalDeclares.getGcmId();\r\n\t\t\t\tnew ServerUtilities(getApplicationContext(),\r\n\t\t\t\t\t\tGlobalDeclares.NEW_REGISTRATION, postEntity, delegate);\r\n\r\n\t\t\t} else {\r\n\t\t\t\tToast.makeText(getApplicationContext(),\r\n\t\t\t\t\t\t\"Password does not match!\", Toast.LENGTH_LONG).show();\r\n\t\t\t}\r\n\r\n\t\t} else {\r\n\t\t\tToast.makeText(getApplicationContext(),\r\n\t\t\t\t\t\"You need to fill all the fields!\", Toast.LENGTH_LONG)\r\n\t\t\t\t\t.show();\r\n\t\t}\r\n\r\n\t}", "public Successful_Registration() {\n initComponents();\n }", "@GetMapping(\"/register\")\r\n\tpublic String showRegistrationForm(Model theModel) {\r\n\t\ttheModel.addAttribute(\"user\", new UserCrm());\r\n\t\treturn \"registration\";\r\n\t}", "public RegisterForm() {\n initComponents();\n }", "public RegisterForm() {\n initComponents();\n }", "public RegisterForm() {\n initComponents();\n }", "@RequestMapping(\"/newuser\")\r\n\tpublic ModelAndView newUser() {\t\t\r\n\t\tRegister reg = new Register();\r\n\t\treg.setUser_type(\"ROLE_INDIVIDUAL\");\r\n\t\treg.setEmail_id(\"[email protected]\");\r\n\t\treg.setFirst_name(\"First Name\");\r\n\t\treg.setCity(\"pune\");\r\n\t\treg.setMb_no(new BigInteger(\"9876543210\"));\r\n\t\treturn new ModelAndView(\"register\", \"rg\", reg);\r\n\t}", "public LandingPage registerNewAccount(){\n\t\taction.WaitForWebElement(linkRegisterNewAccount)\n\t\t\t .Click(linkRegisterNewAccount);\n\t\treturn this;\n\t}", "@PostMapping(\"/registration\")\n\t public String registration(@ModelAttribute(\"userForm\") User userForm, BindingResult bindingResult,Model model) {if (bindingResult.hasErrors()) {\n\t return \"registration\";\n\t }\n\t userService.save(userForm);\n\t localUsername=userForm.getUsername();\n\t boolean flag=userService.autoLogin(userForm.getUsername(), userForm.getPasswordConfirm());\n\t model.addAttribute(\"expense\", expenseService.getMonthAndYearAndAmount());\n\t model.addAttribute(\"username\",userForm.getUsername());\n\t return \"redirect:/dashboard\";\n\t }", "@GetMapping(\"register\")\n public String registerForm(RegisterForm registerForm) {\n return \"register\";\n }", "@PostMapping(\"/registration\")\n public String registration(@ModelAttribute(\"userForm\") User userForm, BindingResult bindingResult) {\n \n \tuserValidator.validate(userForm, bindingResult); // Validates the user registration form inputs and binds the errors.\n\n if (bindingResult.hasErrors()) {\n return \"registration\";\n }\n\n userService.save(userForm);\n\n return \"redirect:/welcome\";\n }", "@GetMapping(\"/register-particular\")\n\tpublic ModelAndView goToRegisterPartForm() {\n\t\t\n\t\tModelAndView mav = new ModelAndView(\"register-particular\");\n\t\tUser user = new User();\n\t\tmav.addObject(\"user\", user);\n\n\t\treturn mav;\n\t}", "@RequestMapping(value = \"/user/registrationForm\", method = RequestMethod.GET)\n\tpublic ModelAndView registrationForm(HttpServletRequest request) {\n\t\tlog.debug(\"User registration\");\n\t\tString communityId = \"-1\";\n\t\tModelAndView model=new ModelAndView(\"form/registration\",\"command\",new User()); \n\t\tmodel.addObject(\"selectedCommunity\", communityId);\n\t\treturn model; \n\t}", "@RequestMapping(\"/processForm\")\n\tpublic String processForm( @Valid @ModelAttribute(\"register\") Register theRegister, BindingResult theBindingResult) {\n\t\tSystem.out.println(\"Register new: \" + theRegister.getFirstName() \n\t\t\t\t\t\t+ \" \" + theRegister.getLastName());\n\t\t\n\t\tif(theBindingResult.hasErrors()) {\n\t\t\t\n\t\t\treturn \"register-form\";\n\t\t}else {\n\t\t\treturn \"register-confirmation\";\n\t\t}\n\t\t\n\t\t\n\t\t\n\t}", "@GetMapping(\"/register-pro\")\n\tpublic ModelAndView goToRegisterProForm() {\n\t\t\n\t\tModelAndView mav = new ModelAndView(\"register-pro\");\n\t\tUser user = new User();\n\t\tmav.addObject(\"user\", user);\n\n\t\treturn mav;\n\t}", "public String registration() {\n if (name != null) {\n int createdUsers = DBUtils.addUser(name, password, email);\n if (createdUsers > 0) {\n try {\n HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();\n request.login(name, password);\n initUser();\n request.getSession().setAttribute(\"current_user\", this);\n } catch (ServletException e) {\n FacesContext context = FacesContext.getCurrentInstance();\n FacesMessage message = new FacesMessage(\"Wrong login or password\");\n message.setSeverity(FacesMessage.SEVERITY_ERROR);\n context.addMessage(\"login\", message);\n }\n return \"/index?faces-redirect=true\";\n }\n }\n return \"/pages/register.xhtml?faces-redirect=true\";\n }", "private FormLayout initRegisterForm() {\r\n final FormLayout formLayout = new FormLayout();\r\n formLayout.getElement().getThemeList().removeAll(formLayout.getElement().getThemeList());\r\n formLayout.setClassName(StyleConstants.REGISTER_CONTENT.getName());\r\n\r\n nameField = new VTextField(getTranslation(\"name.label\"));\r\n\r\n lastNameField = new VTextField(getTranslation(\"lastName.label\"));\r\n\r\n birthDate = new VDatePicker(getTranslation(\"birthDate.label\"));\r\n birthDate.setMax(LocalDate.now().minusYears(5));\r\n birthDate.setMin(LocalDate.now().minusYears(100));\r\n final DatePickerI18n calendarLocalization = new DatePickerI18n();\r\n birthDate.setI18n(calendarLocalization);\r\n\r\n identificationNumberField = new VTextField(getTranslation(\"identificationNumber.label\"));\r\n identificationNumberField.addValueChangeListener(e -> {\r\n if (setErrorIfRequired(e.getSource().getElement(), !e.getValue().matches(\"^[0-9]*$\"), \"field.onlyNumbers\")) {\r\n return;\r\n }\r\n setErrorIfRequired(e.getSource().getElement(), e.getValue().length() < e.getSource().getMinLength(), \"field.minLength\", 4);\r\n });\r\n identificationNumberField.setMinLength(4);\r\n identificationNumberField.setMaxLength(8);\r\n identificationNumberField.setValueChangeMode(ValueChangeMode.EAGER);\r\n\r\n emailField = new VEmailField(getTranslation(\"email.label\"));\r\n emailField.setValueChangeMode(ValueChangeMode.EAGER);\r\n emailField.addValueChangeListener(e -> {\r\n setErrorIfRequired(e.getSource().getElement(), !e.getValue().matches(\"^\\\\w+@[a-zA-Z_]+?\\\\.[a-zA-Z]{2,3}$\"), \"field.notEmail\");\r\n });\r\n usernameField = new VTextField(getTranslation(\"username.label\"));\r\n\r\n passwordField = new VPasswordField(getTranslation(\"password.label\"));\r\n repeatPasswordField = new VPasswordField(getTranslation(\"repeatPassword.label\"));\r\n passwordField.setValueChangeMode(ValueChangeMode.EAGER);\r\n passwordField.setMinLength(5);\r\n passwordField.addValueChangeListener(e -> {\r\n setErrorIfRequired(e.getSource().getElement(), e.getValue().length() < e.getSource().getMinLength(), \"field.minLength\", 5);\r\n });\r\n\r\n repeatPasswordField.setValueChangeMode(ValueChangeMode.EAGER);\r\n repeatPasswordField.addValueChangeListener(e -> {\r\n setErrorIfRequired(e.getSource().getElement(),\r\n !e.getValue().equals(passwordField.getValue()) && StringUtils.isNotBlank(passwordField.getValue()), \"field.passwordNotMatch\");\r\n });\r\n\r\n professionSelect = new VSelect<>(getTranslation(\"profession.label\"));\r\n professionSelect.setItemLabelGenerator(item -> getTranslation(item.getProfessionTranslationKey()));\r\n professionSelect.setItems(Arrays.asList(Professions.values()));\r\n\r\n organizationSelect = new VSelect<>(getTranslation(\"organization.label\"));\r\n organizationSelect.setItemLabelGenerator(item -> item.getName());\r\n\r\n final VButton requestAccessButton = new VButton(getTranslation(\"requestAccess.label\"));\r\n requestAccessButton.addClassName(StyleConstants.BUTTON_BLUE.getName());\r\n requestAccessButton.addClickListener(e -> requestAccess());\r\n\r\n final RouterLink signInButton = new RouterLink(getTranslation(\"signIn.label\"), LoginView.class);\r\n\r\n formLayout.add(nameField, lastNameField, birthDate, identificationNumberField, emailField, usernameField, passwordField, repeatPasswordField,\r\n professionSelect, organizationSelect);\r\n formLayout.setColspan(requestAccessButton, 2);\r\n\r\n formLayout.add(requestAccessButton, signInButton);\r\n requestAccessButton.addClickListener(e -> {\r\n\r\n });\r\n return formLayout;\r\n }", "@RequestMapping(value = \"/create\", method = RequestMethod.POST)\n public final String submit(\n @ModelAttribute(REGISTER) @Valid final Register register,\n final BindingResult binding, final HttpServletRequest request) {\n final Locale locale = localeResolver.resolveLocale(request);\n\n if (binding.hasErrors()) {\n return \"create\";\n }\n\n final UserAccount user = new UserAccount(register.getUsername());\n user.setDisplayName(register.getDisplayName());\n user.setEmail(register.getEmail());\n user.setPassword(passwordEncoder.encodePassword(\n register.getPassword(), user.getSalt()));\n\n try {\n userDetailsService.addUser(user, locale);\n } catch (DuplicateUserException e) {\n binding.addError(new FieldError(REGISTER, \"username\",\n messageSource.getMessage(\"create.error.username\", null,\n locale)));\n return \"create\";\n }\n\n return \"redirect:/register/success\";\n }", "@RequestMapping(value = \"/registreren\", method = RequestMethod.POST)\n\tpublic String register(HttpServletRequest req, @ModelAttribute(\"form\") RegisterForm form,\n Errors errors, HttpSession session) {\n synchronized(AccountController.class) { // hopefully registrations don't occur too much\n User user = userSessionService.getCurrentUser(session);\n if (user == null || user.isAnonymous()) {\n validator.validate(form, errors);\n if (!errors.hasErrors()) {\n try {\n user = new User();\n form.applyTo(user);\n userRepo.store(user);\n userSessionService.login(session, user);\n int userId = user.getId();\n\t\t\t\t\t\t\n String userName = \"anonymous\";\n userName = Integer.toString(userId);\n\t\t\t\t\t\tString userIP = ipUtil.getClientIp(req);\n\t\t\t\t\t\tString action = \"register\";\n\t\t\t\t\t\tString userAgent = req.getHeader(\"user-agent\");\n\t\t\t\t\t\tString referer = req.getHeader(\"Referer\");\n\t\t\t\t\t\tif (referer == null){\n\t\t\t\t\t\t\treferer = \"register\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\tLog4jPrefix.initialise(userName, userIP, action, userAgent, referer);\n log.info(String.format(\"Registered %s!\", user.getShortDescription()));\n } catch(Exception e) {\n // this exception may have been caused by duplicate user\n // so we'll simply validate again. If validation fails\n // we'll return this page, otherwise we'll rethrow,\n // resulting in the error page\n validator.validate(form, errors);\n if (!errors.hasErrors()) {\n if (e instanceof RuntimeException) {\n throw (RuntimeException) e;\n }\n throw new RuntimeException(e);\n }\n // show form again\n return \"register\";\n }\n } else {\n // show form again\n return \"register\";\n }\n }\n }\n return \"redirect:/\";\n\t}", "@RequestMapping(\"/createnewuser\")\r\n\tpublic ModelAndView userCreated(@ModelAttribute(\"rg\") Register reg) {\r\n\t\t\r\n\t\tBigInteger num = reg.getMb_no();\r\n\t\tSystem.out.println(\"mbno=\"+num.toString());\r\n\t\t//Doing the entry of New User in Spring_Users table\r\n\t\t\r\n\t\tString username = reg.getEmail_id();\r\n\t\tString password = reg.getPassword();\r\n\t\tSpringUsers su = new SpringUsers();\r\n\t\tsu.setUsername(username);\r\n\t\tsu.setPassword(password);\r\n\t\tsu.setEnabled(1);\r\n\t\tSystem.out.println(\"username=\"+username);\r\n\t\tSystem.out.println(\"password=\"+password);\r\n\t\t\r\n\t\t\r\n\t\t\r\n\t\tString r = reg.getUser_type();\r\n\t\t\r\n\t\t//if(r.equals(\"ROLE_INDIVIDUAL\"))\r\n\t\t\t//return new ModelAndView(\"individualhomepage\");\r\n\t\t//if(r.equals(\"ROLE_BROKER\"))\r\n\t//\t\treturn new ModelAndView(\"brokerhomepage\");\r\n\t\t//if(r.equals(\"ROLE_BUILDER\"))\r\n\t\t//\treturn new ModelAndView(\"builderhomepage\");\r\n\t\t\r\n\t//\tint i = susvc.entryOfNewUser(su);\r\n\t\t\r\n\t\tint j = regsvc.registerNewUser(reg);\r\n\t\t \r\n\t\treturn new ModelAndView(\"usercreated\");\r\n\r\n\t}", "protected void createRegistrationInfo() {\n registrationInfo.put(\"email\", email.getText().toString());\n registrationInfo.put(\"password\", password.getText().toString());\n }", "public signup() {\n initComponents();\n }", "@GetMapping(\"register\")\n public String registerForm(Model model){\n model.addAttribute(\"user\", new User());\n return \"register_form\";\n }", "@RequestMapping(value = \"register\", method = RequestMethod.POST)\n public String register(@ModelAttribute @Valid RegisterForm registerForm, Errors errors, HttpServletRequest request, Model model) {\n\n if (errors.hasErrors()) {\n model.addAttribute(\"title\", \"Register to RandNums\");\n model.addAttribute(\"sessionActive\", isSessionActive(request.getSession()));\n return \"login/register\";\n }\n\n User existingUser = userDao.findByUsername(registerForm.getUsername());\n\n if (existingUser != null) {\n errors.rejectValue(\"username\", \"username.alreadyexists\", \"A user with that username already exists\");\n model.addAttribute(\"title\", \"Register\");\n model.addAttribute(\"sessionActive\", isSessionActive(request.getSession()));\n return \"login/register\";\n }\n\n User newUser = new User(registerForm.getUsername(), registerForm.getEmail(), registerForm.getPassword());\n\n userDao.save(newUser);\n setUserInSession(request.getSession(), newUser);\n\n return \"redirect:/home\";\n }", "@GetMapping(value=\"/\")\n\tpublic String showRegistrationForm(WebRequest request, Model model) {\n\t\tUserDTO userDTO = new UserDTO();\n\t\tmodel.addAttribute(\"user\", userDTO);\n\t\treturn \"security/register\";\n\t}", "private void submitForm() {\n Toast.makeText(this, \"Registering...\", Toast.LENGTH_LONG).show();\n }", "@GetMapping(\"/registration\")\n public String getRegistration(Model model)\n {\n model.addAttribute(\"newAccount\", new Account());\n \n return \"registration\";\n }", "@RequestMapping(value = \"/register\",method = RequestMethod.GET)\r\n\tpublic String viewRegistration(Model model) { \r\n\t\tmodel.addAttribute(\"userForm\", uservalue);\r\n\t\t//UserForm Name of the model attribute under which the form object is exposed. Defaults to 'command'.\r\n\t\treturn \"Registration\";\r\n\t}", "public void RegisterUser() {\n try {\n reg = new Registration();\n reg.setFirstName(FName);\n reg.setLastName(LName);\n reg.setCompanyName(CompanyName);\n reg.setEmail(Email);\n reg.setMobile(mobile);\n ValidateRegistration validator = new ValidateRegistration();\n boolean legitmail = validator.validateEmail(reg);\n if ( legitmail == false ) {\n System.out.println(\"Not a legitimate Email\");\n FacesContext c = FacesContext.getCurrentInstance();\n FacesMessage m = new FacesMessage(\"Invalid Email\", \"The email provided is not correct\");\n c.addMessage(null, m);\n } else {\n FacesContext c = FacesContext.getCurrentInstance();\n c.getApplication().getNavigationHandler().handleNavigation(c, null, \"mainpage.xhtml\");\n }\n } catch (Exception ex) {\n System.out.println(ex.getMessage());\n }\n }", "public Signup() {\n initComponents();\n }", "@RequestMapping(value = \"/create\", method = RequestMethod.GET)\n public final String create(final ModelMap model) {\n model.addAttribute(REGISTER, new Register());\n return \"create\";\n }", "public void register()\n {\n String n = nameProperty.getValue();\n if (n == null || n.isEmpty())\n {\n throw new IllegalArgumentException(\"Field cannot be empty\");\n }\n String p = passwordProperty.getValue();\n if (p == null || p.isEmpty())\n {\n throw new IllegalArgumentException(\"Field cannot be empty\");\n }\n String e = emailProperty.getValue();\n if (e == null || e.isEmpty())\n {\n throw new IllegalArgumentException(\"Field cannot be empty\");\n }\n String ph = phoneProperty.getValue();\n if (ph == null || ph.isEmpty())\n {\n throw new IllegalArgumentException(\"Field cannot be empty\");\n }\n if (ph.length() != 8)\n {\n throw new IllegalArgumentException(\"Invalid phone number\");\n }\n try\n {\n Integer.parseInt(ph);\n }\n catch (NumberFormatException ex)\n {\n throw new IllegalArgumentException(\"Invalid phone number\", ex);\n }\n String t = titleProperty.getValue();\n if (t == null || t.isEmpty())\n {\n throw new IllegalArgumentException(\"Field cannot be empty\");\n }\n String a = authorProperty.getValue();\n if (a == null || a.isEmpty())\n {\n throw new IllegalArgumentException(\"Field cannot be empty\");\n }\n String y = yearProperty.getValue();\n if (y == null || y.isEmpty())\n {\n throw new IllegalArgumentException(\"Field cannot be empty\");\n }\n if (y.length() != 4)\n {\n throw new IllegalArgumentException(\"Invalid year\");\n }\n try\n {\n Integer.parseInt(y);\n }\n catch (NumberFormatException ex)\n {\n throw new IllegalArgumentException(\"Invalid year\", ex);\n }\n\n try\n {\n\n model.registerUser(n, p, e, ph, t, a, y);\n\n }\n catch (Exception e1)\n {\n\n e1.printStackTrace();\n }\n\n }", "public void processRegistration() {\n try {\n System.out.println(\"Processing Registration\");\n FacesContext c = FacesContext.getCurrentInstance();\n c.getApplication().getNavigationHandler().handleNavigation(c, null, \"register.xhtml\");\n } catch (Exception ex) {\n System.out.println(ex.getMessage());\n }\n }", "@RequestMapping(\"/showForm\")\n\tpublic String showForm(Model theModel) {\n\t\tRegister theRegister = new Register();\n\t\t\n\t // add register object to the model\n\t\ttheModel.addAttribute(\"register\", theRegister);\n\t\t\n\t\treturn \"register-form\";\n\t}", "@GetMapping(\"/register\")\n\tpublic String provideRegistrationForm(Model map)\n\t{\n\t\tSystem.out.println(\"inside vendor reg form\" + getClass().getName());\n\t\tmap.addAttribute(\"vendor_details\", new Vendor());\n\t\tmap.addAttribute(\"payment_modes\", PaymentMode.values());\n\t\tSystem.out.println(map);\n\t\treturn \"/admin/register\";\n\t}", "private void registrationView() {\n String login;\n String email;\n String password;\n\n try {\n while (true) {\n printLine();\n print(\"\\tВведите логин\\n\");\n print(\"\\t>>>>> \");\n login = readStringFromConsole();\n\n print(\"\\tВведите email\\n\");\n print(\"\\t>>>>> \");\n try {\n email = valid.emailValidation(readStringFromConsole());\n } catch (NotValidDataException e) {\n printErr(\"\\tнекорректный email\");\n continue;\n }\n\n print(\"\\tВведите пароль\\n\");\n print(\"\\t>>>>> \");\n try {\n password = valid.passwordValidation(readStringFromConsole());\n } catch (NotValidDataException e) {\n printErr(\"\\tнекорректный password\");\n continue;\n }\n break;\n }\n\n try {\n\n serviceAuthorizationService.registration(new UserDto()\n .withUsername(login)\n .withEmail(email)\n .withPassword(password));\n setStatus(REGISTERED);\n printLine();\n print(\"\\tВы успешно зарегистрировались\");\n } catch (AlreadyExistsException e) {\n e.showMessage();\n registrationView();\n }\n } catch (IOException e) {\n registrationView();\n }\n }", "@GetMapping(\"/userAddForm\")\n\tpublic String userAddForm(Model theModel) {\n\t\tUser theUser = new User();\n\t\ttheModel.addAttribute(\"user\", theUser);\n\t\treturn \"registration-form\";\n\t}", "@RequestMapping(method = RequestMethod.GET)\n \tpublic String createForm(Model model, ForgotLoginForm form) {\n \t\tmodel.addAttribute(\"form\", form);\n \t\treturn \"forgotlogin/index\";\n \t}", "@RequestMapping(value = \"/registration\", method = RequestMethod.POST)\n public String createNewUser(@Valid User user, BindingResult bindingResult) {\n User userExists = userService.findByEmail(user.getEmail());\n if (userExists != null) {\n bindingResult\n .rejectValue(\"email\", \"error.user\",\n \"Пользователь с таким адресом электронной почты уже существует\");\n }\n if (bindingResult.hasErrors()) {\n return \"user/registration\";\n } else {\n userService.create(user);\n return \"redirect:/\";\n }\n }", "public Sign_up() {\n initComponents();\n }", "public SignUp() {\n initComponents();\n }", "public SignUp() {\n initComponents();\n }", "private void registerUser()\n {\n /*AuthService.createAccount takes a Consumer<Boolean> where the result will be true if the user successfully logged in, or false otherwise*/\n authService.createAccount(entryService.extractText(namedFields), result -> {\n if (result.isEmpty()) {\n startActivity(new Intent(this, DashboardActivity.class));\n } else {\n makeToast(result);\n formContainer.setAlpha(1f);\n progressContainer.setVisibility(View.GONE);\n progressContainer.setOnClickListener(null);\n }\n });\n }", "@RequestMapping(value = {\"/register\"}, method = RequestMethod.GET)\n public String newUser(ModelMap model) {\n User user = new User();\n Customer customer = new Customer();\n List<UserProfile> userProfileList = new ArrayList();\n user.setCustomer(customer);\n user.setUserProfileList(userProfileList);\n model.addAttribute(\"user\", user);\n model.addAttribute(\"edit\", false);\n model.addAttribute(\"action\", \"newuser\");\n model.addAttribute(\"loggedinuser\", appService.getPrincipal());\n return \"registration\";\n }", "@RequestMapping(value = \"/registration\")\n public String registration(Model model) {\n User user = new User();\n model.addAttribute(\"user\", user);\n return \"user/registration\";\n }", "public Registration() {\n initComponents();\n managerpassword_label.setVisible(false);\n managerpassword_passfield.setVisible(false);\n \n }", "public static void create(Formulario form){\n daoFormulario.create(form);\n }", "public void displayRegisterForm(View v) {\n\n Intent intent = new Intent(getApplicationContext(), RegistrationScreenActivity.class);\n startActivityForResult(intent, NEW_USER_REGISTER);\n }", "private void register_user() {\n\n\t\tHttpRegister post = new HttpRegister();\n\t\tpost.execute(Config.URL + \"/api/newuser\");\n\n\t}", "public void registerNewUser(View v) {\n Intent intent = new Intent(this, com.mms.memorizationgame.RegisterActivity.class);\n\n finish();\n startActivity(intent);\n }", "@GetMapping(\"/createRegistro\")\n\tpublic String crearValidacion(Model model) {\n\t\tList<Barrio> localidades = barrioService.obtenerBarrios();\n\t\tmodel.addAttribute(\"localidades\",localidades);\n\t\tmodel.addAttribute(\"persona\",persona);\n\t\tmodel.addAttribute(\"validacion\",validacion);\n\t\tmodel.addAttribute(\"registro\",registro);\n\t\tmodel.addAttribute(\"barrio\",barrio);\n\t\treturn \"RegistroForm\";\n\t}", "public void registrarMateria() {\n materia.setIdDepartamento(departamento);\n ejbFacade.create(materia);\n RequestContext requestContext = RequestContext.getCurrentInstance();\n requestContext.execute(\"PF('MateriaCreateDialog').hide()\");\n items = ejbFacade.findAll();\n departamento = new Departamento();\n materia = new Materia();\n\n FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_INFO, \"Información\", \"La materia se registró con éxito\");\n FacesContext.getCurrentInstance().addMessage(null, msg);\n requestContext.update(\"msg\");//Actualiza la etiqueta growl para que el mensaje pueda ser mostrado\n\n requestContext.update(\"MateriaListForm\");\n requestContext.update(\"MateriaCreateForm\");\n }", "public void register(View v)\n {\n\n Intent loginPage = new Intent(RegisterPage.this, Login.class);\n loginPage.putExtra(\"username\",username.getText().toString());\n loginPage.putExtra(\"password\",password.getText().toString());\n loginPage.putExtra(\"firstname\",firstName.getText().toString());\n loginPage.putExtra(\"lastname\",lastName.getText().toString());\n startActivity(loginPage);\n }", "@Test(priority=1, dataProvider=\"User Details\")\n\t\tpublic void registration(String firstname,String lastname,String emailAddress,\n\t\t\t\tString telephoneNum,String address1,String cityName,String postcodeNum,\n\t\t\t\tString country,String zone,String pwd,String confirm_pwd) throws Exception{\n\t\t\t\n\t\t\thomePage = new HomePage(driver);\n//'**********************************************************\t\t\t\n//Calling method to click on 'Create Account' link\n\t\t\tregistraionPageOC = homePage.clickCreateAccount();\n//'**********************************************************\t\t\t\n//Calling method to fill user details in Registration page and verify account is created\n\t\t\tregistraionPageOC.inputDetails(firstname,lastname,emailAddress,telephoneNum,address1,cityName,postcodeNum,country,zone,pwd,confirm_pwd);\n\t\t\ttry{\n\t\t\tAssert.assertEquals(\"Your Account Has Been Created!\", driver.getTitle(),\"Titles Not Matched: New Account Not Created\");\n\t\t\textentTest.log(LogStatus.PASS, \"Registration: New User Account is created\");\n\t\t\t}catch(Exception e){\n\t\t\t\textentTest.log(LogStatus.FAIL, \"Registration is not successful\");\n\t\t\t}\n\t\t}", "@RequestMapping(value = \"/register\", method = RequestMethod.GET)\n public ModelAndView displayRegisterForm() {\n return new ModelAndView(\"registerForm\", \"customer\", new Customer());\n }", "@GetMapping(\"/register\")\n public String showRegister(Model model){\n model.addAttribute(\"user\", new User());\n return \"registerForm\";\n }", "public String create() {\n\n if (log.isDebugEnabled()) {\n log.debug(\"create()\");\n }\n FacesContext context = FacesContext.getCurrentInstance();\n StringBuffer sb = registration(context);\n sb.append(\"?action=Create\");\n forward(context, sb.toString());\n return (null);\n\n }", "public SignUpForm(Context ctx) {\n super(ctx);\n init();\n }", "private void registerUser() {\n\n // Get register name\n EditText mRegisterNameField = (EditText) findViewById(R.id.register_name_field);\n String nickname = mRegisterNameField.getText().toString();\n\n // Get register email\n EditText mRegisterEmailField = (EditText) findViewById(R.id.register_email_field);\n String email = mRegisterEmailField.getText().toString();\n\n // Get register password\n EditText mRegisterPasswordField = (EditText) findViewById(R.id.register_password_field);\n String password = mRegisterPasswordField.getText().toString();\n\n AccountCredentials credentials = new AccountCredentials(email, password);\n credentials.setNickname(nickname);\n\n if (DataHolder.getInstance().isAnonymous()) {\n credentials.setOldUsername(DataHolder.getInstance().getUser().getUsername());\n }\n\n sendRegistrationRequest(credentials);\n }", "private void registerUser(){\n mAuth.createUserWithEmailAndPassword(correo, password).addOnCompleteListener(new OnCompleteListener<AuthResult>() {\n @Override\n public void onComplete(@NonNull Task<AuthResult> task) {\n if(task.isSuccessful()){\n //mapa de valores\n Map<String, Object> map = new HashMap<>();\n map.put(\"name\",name);\n map.put(\"email\",correo);\n map.put(\"password\",password);\n map.put(\"birthday\",cumple);\n map.put(\"genre\",genre);\n map.put(\"size\",size);\n //obtenemos el id asignado por la firebase\n String id= mAuth.getCurrentUser().getUid();\n //pasamos el mapa de valores\n mDatabase.child(\"Users\").child(id).setValue(map).addOnCompleteListener(new OnCompleteListener<Void>() {\n @Override\n public void onComplete(@NonNull Task<Void> task2) {\n //validams que la tarea sea exitosa\n if(task2.isSuccessful()){\n startActivity(new Intent(DatosIniciales.this, MainActivity.class));\n //evitamos que vuelva a la pantalla con finsh cuando ya se ha registrado\n finish();\n }else{\n Toast.makeText(DatosIniciales.this, \"Algo fallo ups!!\", Toast.LENGTH_SHORT).show();\n }\n }\n });\n }else{\n Toast.makeText(DatosIniciales.this, \"No pudimos completar su registro\", Toast.LENGTH_SHORT).show();\n }\n }\n });\n }", "public void createSignUpSession(Registration registration, RegResult regResult) {\n editor.putString(KEY_ID, String.valueOf(regResult.getAUId()));\n editor.putString(KEY_EMAIL, registration.getEmail());\n editor.putString(KEY_NAME, registration.getName());\n editor.putString(KEY_NUMBER,registration.getMobile());\n //editor.putString(KEY_CARDNO,registration.getCardno());\n // Storing login value as TRUE\n editor.putBoolean(IS_LOGIN, true);\n editor.commit();\n }", "@Override\n protected void onSubmit()\n {\n final ApplicationUser appUser = (ApplicationUser) getModelObject();\n UserRegistration userRegistration = new UserRegistration(appUser.getBusinessUser());\n paramUserId = userRegistration.getUserId();\n //paramDateTime = userRegistration.getRequestTimeAsString();\n //paramToken = userRegistration.getMailToken();\n\n // Note: Dccd does not use a validation Page!\n\n\t\t\t// Construct the url for the activation of member and/or organisation\n\t\t\tMap<String, String> parameterMap = new HashMap<String, String>();\n\t\t\tparameterMap.put(\"userId\", paramUserId);\n\t\t\tparameterMap.put(\"inEditMode\", \"0\"); // activation button is placed on non-edit page!\n\t\t\tparameterMap.put(\"enableModeSwitch\", \"1\");\n\t\t\tfinal String activationUrl = createPageURL(MemberPage.class, parameterMap);\n\t\t\tuserRegistration.setActivationUrl(activationUrl);\n\t\t\tlogger.debug(\"activationUrl: \" + activationUrl);\n\n if (isOrganisationEdit())\n {\n \tlogger.debug(\"new Organisation must now be registered\");\n \tassert(null != newOrganisation);\n \t// Also register the new organisation\n \tlogger.debug(\"New organistation: \" + newOrganisation.getId());\n \tOrganisationRegistration organisationRegistration =\n \t\tnew OrganisationRegistration(newOrganisation);\n\n \tuserRegistration.setOrganisation(newOrganisation);\n \tDccdUserService.getService().handleRegistrationRequest(userRegistration, organisationRegistration);\n\n \tif (!organisationRegistration.isCompleted())\n \t{\n \t\t// something went wrong!\n \tlogger.debug(\"Could not complete organisation registration\");\n for (String stateKey : organisationRegistration.getAccumulatedStateKeys())\n {\n //error(getString(stateKey));\n \t// allow for substitution\n error(getString(stateKey, new Model(organisationRegistration)));\n }\n \t}\n }\n else\n {\n \tuserRegistration.setOrganisation(selectedOrganisation);\n \tuserRegistration = DccdUserService.getService().handleRegistrationRequest(userRegistration);\n }\n\n if (userRegistration.isCompleted())\n {\n disableForm(new String[] {});\n info(getString(\"missionAccomplished\", new Model(appUser)));\n //setResponsePage(new InfoPage(getString(\"registrationpage.header\")));\n // use specific page for the confirmation\n setResponsePage(new RegistrationConfirmPage(appUser));\n }\n else\n {\n \tlogger.debug(\"Could not complete user registration\");\n for (String stateKey : userRegistration.getAccumulatedStateKeys())\n {\n error(getString(stateKey));\n }\n }\n logger.debug(\"End onSubmit: \" + userRegistration.toString());\n }", "@RequestMapping(value = \"/create\", method = { RequestMethod.POST })\r\n\tpublic ModelAndView create(HttpServletRequest request,\r\n\t\t\t@Valid @ModelAttribute(\"registerForm\") final UserRegisterForm form, final BindingResult errors,\r\n\t\t\tfinal @RequestParam CommonsMultipartFile[] fileUpload) {\r\n\t\tthis.userValidator.validate(form, errors);\r\n\t\tif (errors.hasErrors()) {\r\n\t\t\treturn register(form);\r\n\t\t}\r\n\t\t/*\r\n\t\t * Recoger los datos\r\n\t\t */\r\n\t\tInteger idTipo = null;\r\n\t\tString avatarTipo = \"\";\r\n\t\ttry {\r\n\t\t\tavatarTipo = request.getParameter(\"avatar_tipo\");\r\n\t\t} catch (Exception e) {\r\n\t\t\tavatarTipo = \"0\";\r\n\t\t}\r\n\t\ttry {\r\n\t\t\tidTipo = Integer.valueOf(avatarTipo);\r\n\t\t} catch (NumberFormatException ex) {\r\n\t\t\tidTipo = 0;\r\n\t\t}\r\n\t\t/*\r\n\t\t * Crear el usuario\r\n\t\t */\r\n\t\tUser user = us.createUser(form.getTelf(), form.getEmail(), form.getCity(), form.getCountry(), form.getCode(),\r\n\t\t\t\tform.getUsername(), passwordEncoder.encode(form.getPassword()), form.getDireccion(), idTipo, \"\",\r\n\t\t\t\tfileUpload, form.getLat(), form.getLon());\r\n\t\t/*\r\n\t\t * Comprovar el login del usuario\r\n\t\t */\r\n\t\tboolean login = false;\r\n\t\ttry {\r\n\t\t\tlogin = autoLogin(form.getUsername(), form.getPassword(), request);\r\n\t\t} catch (Exception e) {\r\n\t\t\treturn (new ModelAndView(\"error\"))\r\n\t\t\t\t\t.addObject(\"body\",\r\n\t\t\t\t\t\t\tmessageSource.getMessage(\"error.403.title\", null, LocaleContextHolder.getLocale()))\r\n\t\t\t\t\t.addObject(\"title\",\r\n\t\t\t\t\t\t\tmessageSource.getMessage(\"error.403.body\", null, LocaleContextHolder.getLocale()));\r\n\t\t}\r\n\t\tif (login) {\r\n\t\t\treturn new ModelAndView(\"redirect:/users/\" + user.getUserId());\r\n\t\t}\r\n\t\treturn new ModelAndView(\"redirect:/users/login\");\r\n\t}", "FORM createFORM();", "private void submitNewUser() {\n\t\tboolean validationFlag = true;\n\t\tArrayList<HashMap<String, String>> signUpFields = new ArrayList<HashMap<String, String>>();\n\t\tint size = lnr_form.getChildCount();\n\t\tfor (int i = 0; i < size; i++) {\n\t\t\tLinearLayout v = (LinearLayout) lnr_form.getChildAt(i);\n\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\tHashMap<String, String> field = (HashMap<String, String>) v.getTag();\n\n\t\t\tIjoomerEditText edtValue = null;\n\t\t\tSpinner spnrValue = null;\n\n\t\t\tif (field != null) {\n\t\t\t\tif (field.get(TYPE).equals(TEXT)) {\n\t\t\t\t\tedtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrEdit)).findViewById(R.id.txtValue);\n\t\t\t\t} else if (field.get(TYPE).equals(TEXTAREA)) {\n\t\t\t\t\tedtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrEditArea)).findViewById(R.id.txtValue);\n\t\t\t\t} else if (field.get(TYPE).equals(PASSWORD)) {\n\t\t\t\t\tedtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrPassword)).findViewById(R.id.txtValue);\n\t\t\t\t} else if (field.get(TYPE).equals(MAP)) {\n\t\t\t\t\tedtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrEditMap)).findViewById(R.id.txtValue);\n\t\t\t\t} else if (field.get(\"type\").equals(LABEL)) {\n\t\t\t\t\tedtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrLabel)).findViewById(R.id.txtValue);\n\t\t\t\t} else if (field.get(TYPE).equals(DATE)) {\n\t\t\t\t\tedtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrEditClickable)).findViewById(R.id.txtValue);\n\n\t\t\t\t\tif (edtValue.getText().toString().trim().length() > 0) {\n\t\t\t\t\t\tif (!IjoomerUtilities.birthdateValidator(edtValue.getText().toString().trim())) {\n\t\t\t\t\t\t\tedtValue.setFocusable(true);\n\t\t\t\t\t\t\tedtValue.setError(getString(R.string.validation_invalid_birth_date));\n\t\t\t\t\t\t\tvalidationFlag = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t} else if (field.get(TYPE).equals(MULTIPLESELECT)) {\n\t\t\t\t\tedtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrEditClickable)).findViewById(R.id.txtValue);\n\t\t\t\t}\n\t\t\t\tif (field.get(TYPE).equals(TIME)) {\n\t\t\t\t\tedtValue = (IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrEditClickable)).findViewById(R.id.txtValue);\n\t\t\t\t}\n\n\t\t\t\tif (field.get(TYPE).equals(SELECT)) {\n\t\t\t\t\tspnrValue = (Spinner) ((LinearLayout) v.findViewById(R.id.lnrSpin)).findViewById(R.id.txtValue);\n\t\t\t\t\tfield.put(VALUE, spnrValue.getSelectedItem().toString());\n\t\t\t\t\tsignUpFields.add(field);\n\t\t\t\t} else if (field.get(TYPE).equals(PASSWORD) && field.get(NAME).equals(\"Retype Password\")) {\n\t\t\t\t\tint len = lnr_form.getChildCount();\n\t\t\t\t\tfor (int j = 0; j < len; j++) {\n\t\t\t\t\t\tLinearLayout view = (LinearLayout) lnr_form.getChildAt(i);\n\t\t\t\t\t\t@SuppressWarnings(\"unchecked\")\n\t\t\t\t\t\tHashMap<String, String> row = (HashMap<String, String>) view.getTag();\n\t\t\t\t\t\tif (row.get(TYPE).equals(PASSWORD) && field.get(NAME).equals(\"Password\")) {\n\t\t\t\t\t\t\tString password = ((IjoomerEditText) ((LinearLayout) v.findViewById(R.id.lnrPassword)).findViewById(R.id.txtValue)).getText().toString();\n\t\t\t\t\t\t\tif (password.equals(edtValue.getText().toString())) {\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tedtValue.setError(getString(R.string.validation_password_not_match));\n\t\t\t\t\t\t\t\tvalidationFlag = false;\n\t\t\t\t\t\t\t\tbreak;\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} else if (edtValue != null && edtValue.getText().toString().trim().length() <= 0 && (field.get(REQUIRED).equals(\"1\"))) {\n\t\t\t\t\tedtValue.setError(getString(R.string.validation_value_required));\n\t\t\t\t\tvalidationFlag = false;\n\t\t\t\t} else {\n\t\t\t\t\tfield.put(VALUE, edtValue.getText().toString().trim());\n\t\t\t\t\tsignUpFields.add(field);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (validationFlag) {\n\t\t\tfinal SeekBar proSeekBar = IjoomerUtilities.getLoadingDialog(getString(R.string.dialog_loading_register_newuser));\n\t\t\tnew IjoomerRegistration(this).submitNewUser(signUpFields, new WebCallListener() {\n\n\t\t\t\t@Override\n\t\t\t\tpublic void onProgressUpdate(int progressCount) {\n\t\t\t\t\tproSeekBar.setProgress(progressCount);\n\t\t\t\t}\n\n\t\t\t\t@Override\n\t\t\t\tpublic void onCallComplete(final int responseCode, String errorMessage, ArrayList<HashMap<String, String>> data1, Object data2) {\n\t\t\t\t\tif (responseCode == 200) {\n\t\t\t\t\t\tIjoomerUtilities.getCustomOkDialog(getString(R.string.dialog_loading_profile), getString(R.string.registration_successfully), getString(R.string.ok),\n\t\t\t\t\t\t\t\tR.layout.ijoomer_ok_dialog, new CustomAlertNeutral() {\n\n\t\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\t\tpublic void NeutralMethod() {\n\n\t\t\t\t\t\t\t\t\t\tIntent intent = new Intent(\"clearStackActivity\");\n\t\t\t\t\t\t\t\t\t\tintent.setType(\"text/plain\");\n\t\t\t\t\t\t\t\t\t\tsendBroadcast(intent);\n\t\t\t\t\t\t\t\t\t\tIjoomerWebService.cookies = null;\n\n\t\t\t\t\t\t\t\t\t\tloadNew(IjoomerLoginActivity.class, IPropertyRegistrationActivity.this, true);\n\t\t\t\t\t\t\t\t\t\tfinish();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t} else {\n\t\t\t\t\t\tIjoomerUtilities.getCustomOkDialog(getString(R.string.dialog_loading_profile),\n\t\t\t\t\t\t\t\tgetString(getResources().getIdentifier(\"code\" + responseCode, \"string\", getPackageName())), getString(R.string.ok), R.layout.ijoomer_ok_dialog,\n\t\t\t\t\t\t\t\tnew CustomAlertNeutral() {\n\n\t\t\t\t\t\t\t\t\t@Override\n\t\t\t\t\t\t\t\t\tpublic void NeutralMethod() {\n\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}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}", "public static Result newForm() {\n return ok(newForm.render(palletForm, setOfArticleForm));\n }", "public void register(View view) {\n if(radioGroup.getCheckedRadioButtonId() == -1){\n Snackbar.make(getCurrentFocus(),\"Please select one of the Options: Student or Professor\",Snackbar.LENGTH_LONG).show();\n return;\n }\n if (usn.getText().toString().trim().equals(\"\")){\n usn.setError(\"This field cannot be empty\");\n return;\n } else if (password.getText().toString().trim().equals(\"\")){\n password.setError(\"This field cannot be empty\");\n return;\n } else if(password.getText().toString().trim().length() < 8){\n password.setError(\"Password too short.\");\n return;\n } else if(confirmPassword.getText().toString().trim().equals(\"\")){\n confirmPassword.setError(\"This field cannot be empty\");\n return;\n } else if(!(password.getText().toString().trim()\n .equals(confirmPassword.getText().toString().trim()))){\n password.setError(\"Passwords do not match\");\n confirmPassword.setError(\"Passwords do not match\");\n return;\n }\n progressBar.setVisibility(View.VISIBLE);\n mAuth.signInAnonymously().addOnSuccessListener(authResult -> myRef.child(usn.getText().toString().trim()).addValueEventListener(new ValueEventListener() {\n @Override\n public void onDataChange(@NonNull DataSnapshot dataSnapshot) {\n try {\n String username = dataSnapshot.child(\"emailId\").getValue().toString();\n String password = confirmPassword.getText().toString().trim();\n System.out.println(username);\n mAuth.createUserWithEmailAndPassword(username,password)\n .addOnCompleteListener(RegisterActivity.this,task -> {\n Log.d(\"TAG\",\"Created User:\"+task.isSuccessful());\n if(!task.isSuccessful()){\n Toast.makeText(RegisterActivity.this, \"Error occurred.\" +\n \" Could not create user. Please \" +\n \"check your internet connection\", Toast.LENGTH_LONG).show();\n return;\n }\n else {\n startActivity(new Intent(RegisterActivity.this,LoginActivity.class));\n finish();\n }\n });\n\n }catch (NullPointerException e){\n usn.setError(\"Invalid USN. Please check your input or contact\" +\n \" your department for help\");\n progressBar.setVisibility(View.INVISIBLE);\n }\n }\n @Override\n public void onCancelled(@NonNull DatabaseError databaseError) {\n\n }\n }))\n .addOnFailureListener(e -> {\n progressBar.setVisibility(View.INVISIBLE);\n Snackbar.make(view,\"Something went wrong.Please check if you have an internet connection or that the details\" +\n \"entered are valid\",Snackbar.LENGTH_LONG).show();\n });\n }", "@RequestMapping(value = { \"/addUser\" }, method = RequestMethod.POST)\n\t@Secured(CommonConstants.ROLE_ADMIN)\n public ModelAndView savePerson(@ModelAttribute(CommonConstants.ATTRIBUTE_USERFORM) UserForm userForm) {\n\t\tModelAndView model = new ModelAndView(CommonConstants.PAGE_REGISTER);\n\t\tfinal String validationMsg = this.service.doUserFormValidation(userForm);\n\t\t\n\t\tif (StringUtils.isNotEmpty(validationMsg)) model.addObject(CommonConstants.ATTRIBUTE_ERROR, validationMsg);\n\t\telse {\n\t\t\tif (this.service.save(new UserEntity(userForm))) {\n \t\tmodel.addObject(CommonConstants.ATTRIBUTE_SUCCESS, this.service.getProperty(CommonConstants.APP_PAGE_VALIDATION_SUCCESS_MSG));\n \t\tuserForm.reset();\n\t\t\t}\t\n \telse \n \t\tmodel.addObject(CommonConstants.ATTRIBUTE_ERROR, this.service.getProperty(CommonConstants.APP_PAGE_SAVE_ERROR_MSG));\n\t\t}\n\t\tmodel.addObject(CommonConstants.ATTRIBUTE_USERFORM, userForm); \n return model;\n }", "void createUser() throws SQLException {\n String name = regName.getText();\n String birthdate = regAge.getText();\n String username = regUserName.getText();\n String password = regPassword.getText();\n String query = \" insert into users (name, birthdate, username, password)\"\n + \" values (?, ?, ?, ?)\";\n\n DB.registerUser(name, birthdate, username, password, query);\n }", "@PostMapping(\"/register\")\r\n public Guardian createGuardian(@Valid @RequestBody RegistrationInfo registrationInfo) throws UserExistException {\r\n User user = userService.save(new User(registrationInfo));\r\n if (user != null) {\r\n return guardianRepository.save(new Guardian(registrationInfo));\r\n } else {\r\n throw new UserExistException(\"User is empty. Something went wrong.\");\r\n }\r\n }", "@RequestMapping(\"Home1\")\r\n\tpublic String createUser1(Model m) \r\n\t{\n\t\tm.addAttribute(\"employee\",new Employee());\r\n\t\treturn \"register\";//register.jsp==form action=register\r\n\t}", "@PostMapping(\"/signup\")\n public ResponseEntity<?> registerUser(@RequestBody RegistrationRequest registrationRequest){\n return userService.registerUser(registrationRequest);\n }", "@RequestMapping(value = \"/registration\", method = RequestMethod.GET)\n public String showPageRegistration(Model model)\n {\n model.addAttribute(\"registeredUser\", new User());\n return \"registration\";\n }", "public PatientRegForm() {\n initComponents();\n }", "public VentanaDialogRegister(ListadoUsuarios listadoUsuarios) {\n\t\tgetContentPane().setLayout(null);\n\t\t\n\t\tthis.listadoUsuarios = listadoUsuarios;\n\t\tJPanel panel = new JPanel();\n\t\tpanel.setBackground(new Color(0, 139, 139));\n\t\tpanel.setBounds(0, 0, 444, 271);\n\t\tgetContentPane().add(panel);\n\t\tpanel.setLayout(null);\n\t\t\n\t\ttxtContrasea = new JPasswordField();\n\t\ttxtContrasea.setHorizontalAlignment(SwingConstants.CENTER);\n\t\ttxtContrasea.setBounds(183, 114, 113, 23);\n\t\tpanel.add(txtContrasea);\n\t\ttxtContrasea.setColumns(10);\n\t\t\n\t\ttxtNombreDeUsuario = new JTextField();\n\t\ttxtNombreDeUsuario.setHorizontalAlignment(SwingConstants.CENTER);\n\t\ttxtNombreDeUsuario.setBounds(183, 73, 113, 30);\n\t\tpanel.add(txtNombreDeUsuario);\n\t\ttxtNombreDeUsuario.setColumns(10);\n\t\t\n\t\t\n\t\tJButton btnNewButton = new JButton(\"Registrar\");\n\t\t\n\t\tbtnNewButton.addActionListener(new ActionListener() {\n\t\t\tpublic void actionPerformed(ActionEvent arg0) {\n\t\t\t\t\t\n\t\t\t\t\tauxUsuario = listadoUsuarios.buscarUnUsuario(txtNombreDeUsuario.getText());\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\tif(auxUsuario==null){\n\t\t\t\t\tauxUsuario= new Usuario();\n\t\t\t\t\tauxUsuario.setAdmin(false);\n\t\t\t\t\tauxUsuario.setNombreU(txtNombreDeUsuario.getText());\n\t\t\t\t\tauxUsuario.setClave(txtContrasea.getText());\n\t\t\t\t\tlistadoUsuarios.agregarUsuario(auxUsuario);\n\t\t\t\t\tJOptionPane.showMessageDialog(null,\"USUARIO REGISTRADO\");\n\t\t\t\t\tdispose();\n\t\t\t\t\t}\n\t\t\t\t\telse {\n\t\t\t\t\t\tJOptionPane.showMessageDialog(null,\"ERROR! ESE NOMBRE DE USUARIO YA EXISTE\");\n\t\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tbtnNewButton.setBounds(172, 205, 124, 30);\n\t\tpanel.add(btnNewButton);\n\t\t\n\t\tJLabel lblNewLabel = new JLabel(\"REGISTRO DE USUARIOS\");\n\t\tlblNewLabel.setFont(new Font(\"Tahoma\", Font.BOLD, 14));\n\t\tlblNewLabel.setBounds(134, 11, 196, 37);\n\t\tpanel.add(lblNewLabel);\n\t\t\n\t\tJLabel lblNewLabel_1 = new JLabel(\"Nombre de Usuario:\");\n\t\tlblNewLabel_1.setFont(new Font(\"Trebuchet MS\", Font.BOLD, 14));\n\t\tlblNewLabel_1.setBounds(54, 76, 128, 23);\n\t\tpanel.add(lblNewLabel_1);\n\t\t\n\t\tJLabel lblNewLabel_1_1 = new JLabel(\"Clave:\");\n\t\tlblNewLabel_1_1.setFont(new Font(\"Trebuchet MS\", Font.BOLD, 14));\n\t\tlblNewLabel_1_1.setBounds(119, 113, 79, 23);\n\t\tpanel.add(lblNewLabel_1_1);\n\t}", "User registration(User user);", "private void createAccount()\n {\n // check for blank or invalid inputs\n if (Utils.isEmpty(edtFullName))\n {\n edtFullName.setError(\"Please enter your full name.\");\n return;\n }\n\n if (Utils.isEmpty(edtEmail) || !Utils.isValidEmail(edtEmail.getText().toString()))\n {\n edtEmail.setError(\"Please enter a valid email.\");\n return;\n }\n\n if (Utils.isEmpty(edtPassword))\n {\n edtPassword.setError(\"Please enter a valid password.\");\n return;\n }\n\n // check for existing user\n AppDataBase database = AppDataBase.getAppDataBase(this);\n User user = database.userDao().findByEmail(edtEmail.getText().toString());\n\n if (user != null)\n {\n edtEmail.setError(\"Email already registered.\");\n return;\n }\n\n user = new User();\n user.setId(database.userDao().findMaxId() + 1);\n user.setFullName(edtFullName.getText().toString());\n user.setEmail(edtEmail.getText().toString());\n user.setPassword(edtPassword.getText().toString());\n\n database.userDao().insert(user);\n\n Intent intent = new Intent(this, LoginActivity.class);\n intent.putExtra(\"user\", user);\n startActivity(intent);\n }", "@RequestMapping(value=\"/submission\",method = RequestMethod.POST)\r\n\tpublic String processRegistration(@ModelAttribute(\"userForm\") User user,Model model) {\r\n\t\tmodel.addAttribute(\"userForm\", uservalue);\r\n\t\tSystem.out.println(\"username: \" + user.getUsername());\r\n\t\tSystem.out.println(\"email: \" + user.getEmail());\r\n\r\n\t\treturn \"RegistrationSuccess\";\r\n\t}", "void registerNewUser(String login, String name, String password, String matchingPassword,\n String email);", "@Override\n\t\t\tpublic void onClick(View v) {\n\t\t\t\tEditText emailText = (EditText)findViewById(R.id.reg_email);\n\t\t\t\tEditText firstNameText = (EditText)findViewById(R.id.reg_first_name);\n\t\t\t\tEditText lastNameText = (EditText)findViewById(R.id.reg_last_name);\n\t\t\t\tEditText userNameText = (EditText)findViewById(R.id.reg_username);\n\t\t\t\tEditText passwordText = (EditText)findViewById(R.id.reg_password);\n\t\t\t\tEditText phoneNumberText = (EditText)findViewById(R.id.reg_phone);\n\t\t\t\t\n\t\t\t\tregister(firstNameText.getText().toString(), lastNameText.getText().toString(), userNameText.getText().toString(), passwordText.getText().toString(), emailText.getText().toString(), phoneNumberText.getText().toString());\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t}", "public Sign_Up() {\n initComponents();\n }", "public String register() {\r\n\t\tif (password.equals(passwordConfirm)) {\r\n\t\t\tUser newUser = new User(username, password);\r\n\t\t\t\r\n\t\t\tif (dataManager.addUser(newUser)) {\r\n\t\t\t\tFacesMessage message = new FacesMessage(\"User has been registered successfully.\");\r\n\t\t\t\tFacesContext.getCurrentInstance().addMessage(null, message);\r\n\t\t\t\tlogger.info(\"New user has been registered.\");\r\n\t\t\t\treturn \"login.xhtml\";\r\n\t\t\t\t\r\n\t\t\t}\t\t\t\r\n\t\t\tFacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, \"\", \"A user with the same username already exists.\");\r\n\t\t\tFacesContext.getCurrentInstance().addMessage(\"registration_form:username\", message);\t\t\t\r\n\t\t}\r\n\t\telse {\r\n\t\t\tFacesMessage message = new FacesMessage(FacesMessage.SEVERITY_ERROR, \"\", \"Password confirmation is incorrect.\");\r\n\t\t\tFacesContext.getCurrentInstance().addMessage(\"registration_form:password_confirm\", message);\t\r\n\t\t}\r\n\t\treturn null;\r\n\t}", "public RegistrationForm() {\n initComponents();\n this.setLocationRelativeTo(null);\n }", "public NewUser() {\n initComponents();\n }", "private void register() {\n Intent intent = new Intent(LoginActivity.this, RegisterActivity.class);\n startActivity(intent);\n }", "@Override\n public void onRegisterClick() {\n FragmentManager fm = getSupportFragmentManager();\n FragmentTransaction ft = fm.beginTransaction();\n if (fm.findFragmentByTag(TAG_FRG_REG_1) != null)\n ft.hide(fm.findFragmentByTag(TAG_FRG_REG_1));\n ft.add(site.getId(), new ControladorRegistro(),TAG_FRG_REG_12);\n ft.addToBackStack(TAG_FRG_REG_12);\n ft.commit();\n\n }", "@ResponseBody\n @PostMapping(\"/createAccount\")\n public ModelAndView postCreateAccount(@RequestParam(\"passwordProfessor2\") String password2, @ModelAttribute(\"Account\") Account newAccount, Model model)\n {\n // List of possible errors to return to user\n List<String> errors = new ArrayList<>();\n ModelAndView modelAndView = new ModelAndView();\n try\n {\n if (! password2.equals(newAccount.getPassword()))\n {\n throw new IllegalStateException(\"Passwörter stimmen nicht überein\");\n }\n Optional<Account> account = accountService.createAccount(newAccount);\n account.ifPresent(accountService::saveAccount);\n \n modelAndView.setViewName(getLogin(model.addAttribute(\"registeredEmail\", newAccount.getEmail())));\n return modelAndView;\n } catch (IllegalStateException e)\n {\n errors.add(e.getMessage());\n errors.add(\"Anmeldung Fehlgeschlagen\");\n \n modelAndView.setViewName(getRegistration(model.addAttribute(\"errorList\", errors)));\n return modelAndView;\n }\n }", "public RegisterPage fillRegisterPage (String name, String password, String confirmationPassword)\n {\n nameBox.sendKeys(name);\n passwordBox.sendKeys(password);\n confirmPasswordBox.sendKeys(confirmationPassword);\n return this;\n }", "public CreateAccount() {\n initComponents();\n selectionall();\n }", "@RequestMapping(method = RequestMethod.POST, value = {\"\",\"/\"})\r\n\tpublic ResponseEntity<FormularioDTO> add(@RequestBody @Valid Formulario formulario) throws AuthenticationException {\r\n\t\tformulario.setInstituicao(new Instituicao(authService.getDados().getInstituicaoId()));\r\n\t\treturn new ResponseEntity<>(formularioService.create(formulario), HttpStatus.CREATED);\r\n\t}", "public sign_up_page() {\n initComponents();\n }", "@RequestMapping(value = \"Register\", method = RequestMethod.POST)\n\tpublic ModelAndView register(@Valid @ModelAttribute(\"userMaster\") UserMaster userMaster, BindingResult result,\n\t\t\tModelMap model) {\n\t\tString viewName = \"home\";\n\t\tuserValidator.validate(userMaster, result);\n\t\tif (result.hasErrors()) {\n\t\t\tviewName = \"register\";\n\t\t\treturn new ModelAndView(viewName);\n\t\t}\n\t\tString id = userMasterService.save(userMaster);\n\t\tif (id.equalsIgnoreCase(\"username exits\") || id.equalsIgnoreCase(\"email exits\")) {\n\t\t\tmodel.addAttribute(\"error\", id);\n\t\t\tlogger.info(\"Cannot save because \" + id);\n\t\t\treturn new ModelAndView(\"register\");\n\t\t} else {\n\t\t\tviewName = \"login\";\n\t\t\tmodel.addAttribute(\"loginForm\", new LoginForm());\n\t\t\tmodel.addAttribute(\"error\", \"Successfully registered.<br>Please Login.\");\n\t\t\tlogger.info(\"New User:id = \" + id);\n\t\t\treturn new ModelAndView(viewName);\n\t\t}\n\n\t}" ]
[ "0.7493379", "0.7072342", "0.702028", "0.6972466", "0.6955177", "0.6947951", "0.6920914", "0.6830332", "0.6758642", "0.67431086", "0.6665234", "0.6647349", "0.6632788", "0.6632788", "0.6632788", "0.65853876", "0.65761566", "0.65601075", "0.6548096", "0.64678967", "0.6440578", "0.6432899", "0.6428691", "0.6424409", "0.6419468", "0.6389381", "0.6376859", "0.6374284", "0.6361186", "0.63503844", "0.63224614", "0.6302435", "0.6246746", "0.623176", "0.6221", "0.6215689", "0.61996037", "0.6185993", "0.6171076", "0.6131402", "0.61307967", "0.6109934", "0.6105642", "0.6102441", "0.6080043", "0.6071353", "0.6065135", "0.6061063", "0.60600835", "0.6056874", "0.6056874", "0.6044618", "0.6043349", "0.60417336", "0.6040175", "0.60389525", "0.60369855", "0.602285", "0.6012444", "0.60058236", "0.60031676", "0.59963244", "0.5995707", "0.5993517", "0.5989425", "0.59890294", "0.59823185", "0.5978355", "0.5977482", "0.5971133", "0.59603274", "0.5949823", "0.59474033", "0.5934661", "0.593242", "0.5926697", "0.59195447", "0.5911757", "0.590224", "0.5890265", "0.58886176", "0.58849114", "0.5882661", "0.5872979", "0.5863418", "0.58562785", "0.5851593", "0.58499694", "0.5844251", "0.5841686", "0.5834779", "0.5812074", "0.5810435", "0.5804873", "0.58042014", "0.58021665", "0.5797371", "0.57931733", "0.57887155", "0.5782792", "0.5762884" ]
0.0
-1
This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { buttonGroup1 = new javax.swing.ButtonGroup(); jPanel1 = new javax.swing.JPanel(); jPanel3 = new javax.swing.JPanel(); jLabel4 = new javax.swing.JLabel(); userNameTF = new javax.swing.JTextField(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); emailTF = new javax.swing.JTextField(); jLabel7 = new javax.swing.JLabel(); ageTF = new javax.swing.JTextField(); registerBtn = new javax.swing.JButton(); jLabel1 = new javax.swing.JLabel(); maleRBtn = new javax.swing.JRadioButton(); femaleRBtn = new javax.swing.JRadioButton(); passwordTF = new javax.swing.JPasswordField(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); jPanel3.setBackground(new java.awt.Color(249, 171, 220)); jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Registration")); jLabel4.setText("User Name"); jLabel5.setText("Password"); jLabel6.setText("Email"); jLabel7.setText("Age"); registerBtn.setText("Register"); registerBtn.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { registerBtnActionPerformed(evt); } }); jLabel1.setText("Gender"); buttonGroup1.add(maleRBtn); maleRBtn.setText("Male"); buttonGroup1.add(femaleRBtn); femaleRBtn.setText("Female"); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(54, 54, 54) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel4) .addComponent(jLabel5)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(userNameTF, javax.swing.GroupLayout.DEFAULT_SIZE, 204, Short.MAX_VALUE) .addComponent(passwordTF))) .addGroup(jPanel3Layout.createSequentialGroup() .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel7) .addComponent(jLabel6) .addComponent(jLabel1)) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(39, 39, 39) .addComponent(maleRBtn) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(femaleRBtn)) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(115, 115, 115) .addComponent(registerBtn, javax.swing.GroupLayout.PREFERRED_SIZE, 110, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(41, 41, 41) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(ageTF, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(emailTF, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE)))))) .addContainerGap(105, Short.MAX_VALUE)) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(29, 29, 29) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(userNameTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(29, 29, 29) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(passwordTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(29, 29, 29) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel6) .addComponent(emailTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(34, 34, 34) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(ageTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(maleRBtn) .addComponent(femaleRBtn) .addComponent(jLabel1)) .addGap(32, 32, 32) .addComponent(registerBtn) .addContainerGap(61, Short.MAX_VALUE)) ); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); pack(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Form() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n }", "public frmRectangulo() {\n initComponents();\n }", "public form() {\n initComponents();\n }", "public AdjointForm() {\n initComponents();\n setDefaultCloseOperation(HIDE_ON_CLOSE);\n }", "public FormListRemarking() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n \n }", "public FormPemilihan() {\n initComponents();\n }", "public GUIForm() { \n initComponents();\n }", "public FrameForm() {\n initComponents();\n }", "public TorneoForm() {\n initComponents();\n }", "public FormCompra() {\n initComponents();\n }", "public muveletek() {\n initComponents();\n }", "public Interfax_D() {\n initComponents();\n }", "public quanlixe_form() {\n initComponents();\n }", "public SettingsForm() {\n initComponents();\n }", "public RegistrationForm() {\n initComponents();\n this.setLocationRelativeTo(null);\n }", "public Soru1() {\n initComponents();\n }", "public FMainForm() {\n initComponents();\n this.setResizable(false);\n setLocationRelativeTo(null);\n }", "public soal2GUI() {\n initComponents();\n }", "public EindopdrachtGUI() {\n initComponents();\n }", "public MechanicForm() {\n initComponents();\n }", "public AddDocumentLineForm(java.awt.Frame parent) {\n super(parent);\n initComponents();\n myInit();\n }", "public BloodDonationGUI() {\n initComponents();\n }", "public quotaGUI() {\n initComponents();\n }", "public Customer_Form() {\n initComponents();\n setSize(890,740);\n \n \n }", "public PatientUI() {\n initComponents();\n }", "public myForm() {\n\t\t\tinitComponents();\n\t\t}", "public Oddeven() {\n initComponents();\n }", "public intrebarea() {\n initComponents();\n }", "public Magasin() {\n initComponents();\n }", "public RadioUI()\n {\n initComponents();\n }", "public NewCustomerGUI() {\n initComponents();\n }", "public ZobrazUdalost() {\n initComponents();\n }", "public FormUtama() {\n initComponents();\n }", "public p0() {\n initComponents();\n }", "public INFORMACION() {\n initComponents();\n this.setLocationRelativeTo(null); \n }", "public ProgramForm() {\n setLookAndFeel();\n initComponents();\n }", "public AmountReleasedCommentsForm() {\r\n initComponents();\r\n }", "public form2() {\n initComponents();\n }", "public MainForm() {\n\t\tsuper(\"Hospital\", List.IMPLICIT);\n\n\t\tstartComponents();\n\t}", "public LixeiraForm() {\n initComponents();\n setLocationRelativeTo(null);\n }", "public kunde() {\n initComponents();\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents() {\n\n setName(\"Form\"); // NOI18N\n setRequestFocusEnabled(false);\n setVerifyInputWhenFocusTarget(false);\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);\n this.setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 465, Short.MAX_VALUE)\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 357, Short.MAX_VALUE)\n );\n }", "public MusteriEkle() {\n initComponents();\n }", "public frmMain() {\n initComponents();\n }", "public frmMain() {\n initComponents();\n }", "public DESHBORDPANAL() {\n initComponents();\n }", "public frmVenda() {\n initComponents();\n }", "public GUIForm() {\n initComponents();\n inputField.setText(NO_FILE_SELECTED);\n outputField.setText(NO_FILE_SELECTED);\n progressLabel.setBackground(INFO);\n progressLabel.setText(SELECT_FILE);\n }", "public FrmMenu() {\n initComponents();\n }", "public Botonera() {\n initComponents();\n }", "public OffertoryGUI() {\n initComponents();\n setTypes();\n }", "public JFFornecedores() {\n initComponents();\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents()\n {\n\n setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);\n setBackground(new java.awt.Color(255, 255, 255));\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());\n getContentPane().setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 983, Short.MAX_VALUE)\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 769, Short.MAX_VALUE)\n );\n\n pack();\n }", "public EnterDetailsGUI() {\n initComponents();\n }", "public vpemesanan1() {\n initComponents();\n }", "public Kost() {\n initComponents();\n }", "public FormHorarioSSE() {\n initComponents();\n }", "public frmacceso() {\n initComponents();\n }", "public UploadForm() {\n initComponents();\n }", "public HW3() {\n initComponents();\n }", "public Managing_Staff_Main_Form() {\n initComponents();\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents()\n {\n\n setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);\n getContentPane().setLayout(null);\n\n pack();\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents() {\n\n setName(\"Form\"); // NOI18N\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);\n this.setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 400, Short.MAX_VALUE)\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 300, Short.MAX_VALUE)\n );\n }", "public sinavlar2() {\n initComponents();\n }", "public P0405() {\n initComponents();\n }", "public IssueBookForm() {\n initComponents();\n }", "public MiFrame2() {\n initComponents();\n }", "public Choose1() {\n initComponents();\n }", "public MainForm() {\n initComponents();\n\n String oldAuthor = prefs.get(\"AUTHOR\", \"\");\n if(oldAuthor != null) {\n this.authorTextField.setText(oldAuthor);\n }\n String oldBook = prefs.get(\"BOOK\", \"\");\n if(oldBook != null) {\n this.bookTextField.setText(oldBook);\n }\n String oldDisc = prefs.get(\"DISC\", \"\");\n if(oldDisc != null) {\n try {\n int oldDiscNum = Integer.parseInt(oldDisc);\n oldDiscNum++;\n this.discNumberTextField.setText(Integer.toString(oldDiscNum));\n } catch (Exception ex) {\n this.discNumberTextField.setText(oldDisc);\n }\n this.bookTextField.setText(oldBook);\n }\n\n\n }", "public GUI_StudentInfo() {\n initComponents();\n }", "public Lihat_Dokter_Keseluruhan() {\n initComponents();\n }", "public JFrmPrincipal() {\n initComponents();\n }", "public bt526() {\n initComponents();\n }", "public Pemilihan_Dokter() {\n initComponents();\n }", "@Override\n\tprotected void initUi() {\n\t\t\n\t}", "public Ablak() {\n initComponents();\n }", "@SuppressWarnings(\"unchecked\")\n\t// <editor-fold defaultstate=\"collapsed\" desc=\"Generated\n\t// Code\">//GEN-BEGIN:initComponents\n\tprivate void initComponents() {\n\n\t\tlabel1 = new java.awt.Label();\n\t\tlabel2 = new java.awt.Label();\n\t\tlabel3 = new java.awt.Label();\n\t\tlabel4 = new java.awt.Label();\n\t\tlabel5 = new java.awt.Label();\n\t\tlabel6 = new java.awt.Label();\n\t\tlabel7 = new java.awt.Label();\n\t\tlabel8 = new java.awt.Label();\n\t\tlabel9 = new java.awt.Label();\n\t\tlabel10 = new java.awt.Label();\n\t\ttextField1 = new java.awt.TextField();\n\t\ttextField2 = new java.awt.TextField();\n\t\tlabel14 = new java.awt.Label();\n\t\tlabel15 = new java.awt.Label();\n\t\tlabel16 = new java.awt.Label();\n\t\ttextField3 = new java.awt.TextField();\n\t\ttextField4 = new java.awt.TextField();\n\t\ttextField5 = new java.awt.TextField();\n\t\tlabel17 = new java.awt.Label();\n\t\tlabel18 = new java.awt.Label();\n\t\tlabel19 = new java.awt.Label();\n\t\tlabel20 = new java.awt.Label();\n\t\tlabel21 = new java.awt.Label();\n\t\tlabel22 = new java.awt.Label();\n\t\ttextField6 = new java.awt.TextField();\n\t\ttextField7 = new java.awt.TextField();\n\t\ttextField8 = new java.awt.TextField();\n\t\tlabel23 = new java.awt.Label();\n\t\ttextField9 = new java.awt.TextField();\n\t\ttextField10 = new java.awt.TextField();\n\t\ttextField11 = new java.awt.TextField();\n\t\ttextField12 = new java.awt.TextField();\n\t\tlabel24 = new java.awt.Label();\n\t\tlabel25 = new java.awt.Label();\n\t\tlabel26 = new java.awt.Label();\n\t\tlabel27 = new java.awt.Label();\n\t\tlabel28 = new java.awt.Label();\n\t\tlabel30 = new java.awt.Label();\n\t\tlabel31 = new java.awt.Label();\n\t\tlabel32 = new java.awt.Label();\n\t\tjButton1 = new javax.swing.JButton();\n\n\t\tlabel1.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 18)); // NOI18N\n\t\tlabel1.setText(\"It seems that some of the buttons on the ATM machine are not working!\");\n\n\t\tlabel2.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 18)); // NOI18N\n\t\tlabel2.setText(\"Unfortunately these numbers are exactly what Professor has to use to type in his password.\");\n\n\t\tlabel3.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 18)); // NOI18N\n\t\tlabel3.setText(\n\t\t\t\t\"If you want to eat tonight, you have to help him out and construct the numbers of the password with the working buttons and math operators.\");\n\n\t\tlabel4.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 14)); // NOI18N\n\t\tlabel4.setText(\"Denver's Password: 2792\");\n\n\t\tlabel5.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel5.setText(\"import java.util.Scanner;\\n\");\n\n\t\tlabel6.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel6.setText(\"public class ATM{\");\n\n\t\tlabel7.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel7.setText(\"public static void main(String[] args){\");\n\n\t\tlabel8.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel8.setText(\"System.out.print(\");\n\n\t\tlabel9.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel9.setText(\" -\");\n\n\t\tlabel10.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel10.setText(\");\");\n\n\t\ttextField1.addActionListener(new java.awt.event.ActionListener() {\n\t\t\tpublic void actionPerformed(java.awt.event.ActionEvent evt) {\n\t\t\t\ttextField1ActionPerformed(evt);\n\t\t\t}\n\t\t});\n\n\t\tlabel14.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel14.setText(\"System.out.print( (\");\n\n\t\tlabel15.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel15.setText(\"System.out.print(\");\n\n\t\tlabel16.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel16.setText(\"System.out.print( ( (\");\n\n\t\tlabel17.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel17.setText(\")\");\n\n\t\tlabel18.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel18.setText(\" +\");\n\n\t\tlabel19.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel19.setText(\");\");\n\n\t\tlabel20.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel20.setText(\" /\");\n\n\t\tlabel21.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel21.setText(\" %\");\n\n\t\tlabel22.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel22.setText(\" +\");\n\n\t\tlabel23.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel23.setText(\");\");\n\n\t\tlabel24.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel24.setText(\" +\");\n\n\t\tlabel25.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel25.setText(\" /\");\n\n\t\tlabel26.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel26.setText(\" *\");\n\n\t\tlabel27.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));\n\t\tlabel27.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel27.setText(\")\");\n\n\t\tlabel28.setFont(new java.awt.Font(\"Dialog\", 0, 14)); // NOI18N\n\t\tlabel28.setText(\")\");\n\n\t\tlabel30.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel30.setText(\"}\");\n\n\t\tlabel31.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel31.setText(\"}\");\n\n\t\tlabel32.setFont(new java.awt.Font(\"Consolas\", 0, 14)); // NOI18N\n\t\tlabel32.setText(\");\");\n\n\t\tjButton1.setFont(new java.awt.Font(\"Segoe UI Semibold\", 0, 14)); // NOI18N\n\t\tjButton1.setText(\"Check\");\n\t\tjButton1.addActionListener(new java.awt.event.ActionListener() {\n\t\t\tpublic void actionPerformed(java.awt.event.ActionEvent evt) {\n\t\t\t\tjButton1ActionPerformed(evt);\n\t\t\t}\n\t\t});\n\n\t\tjavax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);\n\t\tlayout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(28).addGroup(layout\n\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING).addComponent(getDoneButton()).addComponent(jButton1)\n\t\t\t\t\t\t.addComponent(label7, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addComponent(label6, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addComponent(label5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addComponent(label4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addComponent(label3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t.addComponent(label1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t.addGap(1)\n\t\t\t\t\t\t\t\t.addComponent(label2, GroupLayout.PREFERRED_SIZE, 774, GroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t.addGap(92).addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout\n\t\t\t\t\t\t\t\t\t\t.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING, false)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label15, GroupLayout.PREFERRED_SIZE, 145,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField8, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(2)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label21, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField7, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label8, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField1, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label9, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED).addComponent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttextField2, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label31, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label14, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(37))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(174)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField5, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t20, GroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label18, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(7)))\n\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING).addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING, false).addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField4, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t20, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label17, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label22, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField9, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t20, GroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGap(20)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label23, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label20, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField3, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t20, GroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGap(20).addComponent(label19, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(23).addComponent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel10, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))))\n\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label16, GroupLayout.PREFERRED_SIZE, 177,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField12, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label24, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField6, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label27, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label25, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField11, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label28, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGap(1)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label26, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField10, GroupLayout.PREFERRED_SIZE, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED).addComponent(label32,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))))\n\t\t\t\t\t\t.addComponent(label30, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));\n\t\tlayout.setVerticalGroup(\n\t\t\t\tlayout.createParallelGroup(Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap()\n\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t.addComponent(label1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t.addComponent(label2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t.addGap(1)\n\t\t\t\t\t\t.addComponent(label3, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(label4, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(label5, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(label6, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(label7, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t.addGroup(\n\t\t\t\t\t\t\t\t\t\tlayout.createSequentialGroup().addGroup(layout.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createSequentialGroup().addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING).addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label9,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label8,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField1,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\ttextField2, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label10,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(3)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(19)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField5,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label14,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label18,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label17,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField4,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(1))))\n\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label20, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label19, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField3, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(78)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label27, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(76)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField11, GroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup().addGap(75)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label32,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField10,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addPreferredGap(ComponentPlacement.RELATED, 20,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tShort.MAX_VALUE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.TRAILING, false)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label15,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField8,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label21,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField7,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(27))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField9,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAlignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label22,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlayout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(3)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tlabel23,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(29)))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label16,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField12,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout.createSequentialGroup()\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGroup(layout\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.createParallelGroup(\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tAlignment.TRAILING)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(label24,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addComponent(textField6,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE))\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t.addGap(1))))))\n\t\t\t\t\t\t\t\t.addGroup(layout.createParallelGroup(Alignment.LEADING)\n\t\t\t\t\t\t\t\t\t\t.addComponent(label25, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t.addComponent(label28, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t\t\t\t\t.addComponent(label26, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)))\n\t\t\t\t\t\t.addGap(30)\n\t\t\t\t\t\t.addComponent(label31, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addGap(25)\n\t\t\t\t\t\t.addComponent(label30, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,\n\t\t\t\t\t\t\t\tGroupLayout.PREFERRED_SIZE)\n\t\t\t\t\t\t.addGap(26).addComponent(jButton1).addPreferredGap(ComponentPlacement.RELATED)\n\t\t\t\t\t\t.addComponent(getDoneButton()).addContainerGap(23, Short.MAX_VALUE)));\n\t\tthis.setLayout(layout);\n\n\t\tlabel16.getAccessibleContext().setAccessibleName(\"System.out.print( ( (\");\n\t\tlabel17.getAccessibleContext().setAccessibleName(\"\");\n\t\tlabel18.getAccessibleContext().setAccessibleName(\" +\");\n\t}", "public Pregunta23() {\n initComponents();\n }", "public FormMenuUser() {\n super(\"Form Menu User\");\n initComponents();\n }", "public AvtekOkno() {\n initComponents();\n }", "public busdet() {\n initComponents();\n }", "public ViewPrescriptionForm() {\n initComponents();\n }", "public Ventaform() {\n initComponents();\n }", "public Kuis2() {\n initComponents();\n }", "public CreateAccount_GUI() {\n initComponents();\n }", "public Carrera() {\n initComponents();\n }", "public POS1() {\n initComponents();\n }", "public EqGUI() {\n initComponents();\n }", "public JFriau() {\n initComponents();\n this.setLocationRelativeTo(null);\n this.setTitle(\"BuNus - Budaya Nusantara\");\n }", "@SuppressWarnings(\"unchecked\")\n // <editor-fold defaultstate=\"collapsed\" desc=\"Generated Code\">//GEN-BEGIN:initComponents\n private void initComponents() {\n\n setBackground(new java.awt.Color(204, 204, 204));\n setMinimumSize(new java.awt.Dimension(1, 1));\n setPreferredSize(new java.awt.Dimension(760, 402));\n\n javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);\n this.setLayout(layout);\n layout.setHorizontalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 750, Short.MAX_VALUE)\n );\n layout.setVerticalGroup(\n layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)\n .addGap(0, 400, Short.MAX_VALUE)\n );\n }", "public nokno() {\n initComponents();\n }", "public dokter() {\n initComponents();\n }", "public ConverterGUI() {\n initComponents();\n }", "public hitungan() {\n initComponents();\n }", "public Modify() {\n initComponents();\n }", "public frmAddIncidencias() {\n initComponents();\n }", "public FP_Calculator_GUI() {\n initComponents();\n \n setVisible(true);\n }" ]
[ "0.7321245", "0.7292375", "0.7292375", "0.7292375", "0.7286756", "0.7250393", "0.7215278", "0.7208825", "0.7197639", "0.71918", "0.7185626", "0.716065", "0.71489197", "0.7094757", "0.7081307", "0.7057363", "0.69892997", "0.6978972", "0.6956389", "0.69543713", "0.69465107", "0.6943616", "0.69370526", "0.69335246", "0.6928895", "0.69262075", "0.69259804", "0.69132626", "0.69122165", "0.68949795", "0.6893638", "0.689148", "0.68909764", "0.6890215", "0.6884557", "0.688259", "0.68825203", "0.6878597", "0.6876452", "0.6876008", "0.6872711", "0.68606186", "0.6857626", "0.6856689", "0.6856538", "0.68560165", "0.6854488", "0.6853594", "0.6853594", "0.6844268", "0.68379426", "0.68377364", "0.6829578", "0.6829284", "0.6827213", "0.6825348", "0.6823862", "0.68184686", "0.68176556", "0.6810581", "0.6809514", "0.6809368", "0.68090004", "0.68081117", "0.680376", "0.67957234", "0.6795017", "0.6793054", "0.679084", "0.6790513", "0.6789456", "0.67890406", "0.6783252", "0.6767314", "0.6766593", "0.67663574", "0.67581284", "0.67565966", "0.67531246", "0.6752959", "0.67438525", "0.67397165", "0.6738271", "0.67369807", "0.67342347", "0.6728663", "0.67280626", "0.6720753", "0.6717359", "0.6715002", "0.671486", "0.67094135", "0.670803", "0.67050165", "0.67018557", "0.67018354", "0.67003953", "0.6698949", "0.6695529", "0.6692286", "0.6691619" ]
0.0
-1
TODO : Find a way to mock the triggers
@Test public void testDoNotifyCommitWithSingleStream() throws Exception { AccurevTrigger aMasterTrigger = setupProjectWithTrigger("host", "8080", "stream1", "depot", false); AccurevStatus spy = Mockito.spy(new AccurevStatus()); spy.doNotifyCommit(requestWithNoParameters, "host", "8080", "stream1", "1", "testPrincipal", "Updated"); Mockito.verify(spy).doNotifyCommit(requestWithNoParameters, "host", "8080", "stream1", "1", "testPrincipal", "Updated"); assertEquals("HOST: host PORT: 8080 Streams: stream1", spy.toString()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract void onTrigger();", "public void trigger(List<Entity> _trigger){\n\t\tif(event!=null){\n\t\t\tevent.activate(System.currentTimeMillis(), _trigger);\n\t\t}\n\t}", "void trigger();", "private boolean triggered() {\n\t\treturn true;\n\t}", "public interface TriggerHandler {\n\n String handleTrigger(String stateJson, Collection<Subscription> subscriptions, String cfgJson);\n\n String getTriggerType();\n\n}", "public abstract void setTriggers(Map<String, Trigger> triggers);", "protected abstract void createTriggerOrAction();", "void trigger(Entity e);", "public abstract Map<String, Trigger> getTriggers();", "public void trigger(Fact fact) {\n\t\t\n\t}", "public void executeTrigger(Object object);", "Set getTriggers();", "@Override\n\t\tvoid runCommand() {\n\t\t\ttrigger.execute();\n\t\t}", "@Override\r\n\t\tpublic Object trigger(Object... objects) {\n\t\t\tSystem.out.println(\"do,it\");\r\n\t\t\treturn null;\r\n\t\t}", "@Test\n public void trigger() throws FlywayException {\n flyway.setLocations(\"migration/dbsupport/oracle/sql/trigger\");\n flyway.migrate();\n flyway.clean();\n flyway.migrate();\n }", "@Override\n\tprotected boolean on_trigger_activated(String trigger_name) {\n\t\treturn false;\n\t}", "public List<Trigger> getTriggers();", "public abstract void setTriggerOrAction();", "public abstract boolean isTrigger();", "public interface EnchantmentTrigger {}", "boolean getUserChooseTrigger();", "@SuppressWarnings(\"unchecked\")\n @Before\n public void beforeEach()\n throws AccessException, RequestException, ConnectionException {\n server = mock(Server.class);\n triggersDelegator = new TriggersDelegator(server);\n resultMap = mock(Map.class);\n resultMap2 = mock(Map.class);\n resultMaps = List.of(resultMap, resultMap2);\n\n entryList = new ArrayList<>();\n ITriggerEntry triggerEntry = mock(ITriggerEntry.class);\n entryList.add(triggerEntry);\n\n when(server.execMapCmdList(eq(TRIGGERS.toString()), eq(getCmdArguments), eq(null)))\n .thenReturn(resultMaps);\n }", "@Test\n public void shouldReturnNonEmptyTriggerEntries() throws Exception {\n //given\n when(resultMap.get(TRIGGERS_KEY + 0)).thenReturn(\"my entry value 0\");\n when(resultMap.get(TRIGGERS_KEY + 1)).thenReturn(\"my entry value 1\");\n givenNoHandleErrorMap(resultMap);\n when(resultMap2.get(TRIGGERS_KEY + 0)).thenReturn(\"my entry2 value 0\");\n when(resultMap2.get(TRIGGERS_KEY + 1)).thenReturn(\"my entry2 value 1\");\n when(resultMap2.get(TRIGGERS_KEY + 2)).thenReturn(\"my entry2 value 2\");\n givenNoHandleErrorMap(resultMap2);\n //when\n List<ITriggerEntry> triggerEntries = triggersDelegator.getTriggerEntries();\n //then\n assertThat(triggerEntries.size(), is(5));\n assertThat(triggerEntries.get(1).getOrder(), is(1));\n assertThat(triggerEntries.get(4).getOrder(), is(2));\n }", "public abstract void handleMatching(EventBean[] triggerEvents, EventBean[] matchingEvents);", "protected TriggerFactory getTriggerFactory() {\n\t\treturn this.triggerFactory;\n\t}", "public void testSetProperties() throws Exception {\n final JettySolrRunner runner = cluster.getJettySolrRunner(0);\n final SolrResourceLoader resourceLoader = runner.getCoreContainer().getResourceLoader();\n final SolrCloudManager solrCloudManager = runner.getCoreContainer().getZkController().getSolrCloudManager();\n \n try (ScheduledTriggers scheduledTriggers = new ScheduledTriggers(resourceLoader, solrCloudManager)) {\n AutoScalingConfig config = new AutoScalingConfig(Collections.emptyMap());\n scheduledTriggers.setAutoScalingConfig(config);\n\n // Setup a trigger that records the timestamp of each time it was run\n // we only need 2 timestamps for the test, so limit the queue and make the trigger a No-Op if full\n final BlockingQueue<Long> timestamps = new ArrayBlockingQueue<Long>(2);\n final AutoScaling.Trigger t1 = new MockTrigger(TriggerEventType.NODELOST, \"mock-timestamper\") {\n @Override\n public void run() {\n log.info(\"Running {} in {}\", this.getName(), Thread.currentThread().getName());\n timestamps.offer(solrCloudManager.getTimeSource().getTimeNs());\n }\n };\n\n log.info(\"Configuring simple scheduler and adding trigger: {}\", t1.getName());\n t1.configure(resourceLoader, solrCloudManager, Collections.emptyMap());\n scheduledTriggers.add(t1);\n\n waitForAndDiffTimestamps(\"conf(default delay)\",\n ScheduledTriggers.DEFAULT_SCHEDULED_TRIGGER_DELAY_SECONDS, TimeUnit.SECONDS,\n timestamps);\n \n log.info(\"Reconfiguing scheduler to use 4s delay and clearing queue for trigger: {}\", t1.getName());\n config = config.withProperties(Collections.singletonMap\n (AutoScalingParams.TRIGGER_SCHEDULE_DELAY_SECONDS, 4));\n scheduledTriggers.setAutoScalingConfig(config);\n timestamps.clear();\n\n waitForAndDiffTimestamps(\"conf(four sec delay)\", \n 4, TimeUnit.SECONDS, \n timestamps);\n \n log.info(\"Removing trigger: {}\", t1.getName());\n scheduledTriggers.remove(t1.getName());\n \n log.info(\"Reconfiguing scheduler to use default props\");\n config = config.withProperties(ScheduledTriggers.DEFAULT_PROPERTIES);\n scheduledTriggers.setAutoScalingConfig(config);\n\n \n assertTrue(\"Test sanity check, need default thread pool to be at least 3 so we can\" +\n \"test lowering it by 2\", ScheduledTriggers.DEFAULT_TRIGGER_CORE_POOL_SIZE >= 3);\n final int numTriggers = ScheduledTriggers.DEFAULT_TRIGGER_CORE_POOL_SIZE;\n final int reducedThreadPoolSize = numTriggers - 2;\n \n // Setup X instances of a trigger that:\n // - records it's name as being run\n // - skipping all remaining execution if it's name has already been recorded\n // - records the name of the thread that ran it\n // - blocks on a cyclic barrier untill at Y instances have run (to hog a thread)\n // ...to test that the scheduler will add new threads as needed, up to the configured limit\n //\n // NOTE: the reason we need X unique instances is because the scheduler won't \"re-run\" a single\n // trigger while a previouss \"run\" is still in process\n final List<AutoScaling.Trigger> triggerList = new ArrayList<>(numTriggers);\n \n // Use a cyclic barrier gated by an atomic ref so we can swap it out later\n final AtomicReference<CyclicBarrier> latch = new AtomicReference<>(new CyclicBarrier(numTriggers));\n \n // variables for tracking state as we go\n // NOTE: all read/write must be gated by synchronizing on the barrier (ref),\n // so we we can ensure we are reading a consistent view\n final Set<String> threadNames = Collections.synchronizedSet(new LinkedHashSet<>());\n final Set<String> triggerNames = Collections.synchronizedSet(new LinkedHashSet<>());\n final AtomicLong fails = new AtomicLong(0);\n\n // Use a semaphore to track when each trigger *finishes* so our test thread\n // can know when to check & clear the tracking state\n final Semaphore completionSemaphore = new Semaphore(numTriggers);\n \n for (int i = 0; i < numTriggers; i++) {\n AutoScaling.Trigger trigger = new MockTrigger(TriggerEventType.NODELOST,\n \"mock-blocking-trigger-\" + i) {\n @Override\n public void run() {\n log.info(\"Running {} in {}\", this.getName(), Thread.currentThread().getName());\n CyclicBarrier barrier = null;\n synchronized (latch) {\n if (triggerNames.add(this.getName())) {\n log.info(\"{}: No-Op since we've already recorded a run\", this.getName());\n return;\n }\n threadNames.add(Thread.currentThread().getName());\n barrier = latch.get();\n }\n \n try {\n log.info(\"{}: waiting on barrier to hog a thread\", this.getName());\n barrier.await(30, TimeUnit.SECONDS);\n completionSemaphore.release();\n } catch (Exception e) {\n fails.incrementAndGet();\n log.error(this.getName() + \": failure waiting on cyclic barrier: \" + e.toString(), e);\n }\n }\n };\n\n trigger.configure(resourceLoader, solrCloudManager, Collections.emptyMap());\n triggerList.add(trigger);\n completionSemaphore.acquire();\n log.info(\"Adding trigger {} to scheduler\", trigger.getName());\n scheduledTriggers.add(trigger);\n }\n \n log.info(\"Waiting on semaphore for all triggers to signal completion...\");\n assertTrue(\"Timed out waiting for semaphore count to be released\",\n completionSemaphore.tryAcquire(numTriggers, 60, TimeUnit.SECONDS));\n \n synchronized (latch) {\n assertEquals(\"Unexpected number of trigger names found: \" + triggerNames.toString(),\n numTriggers, triggerNames.size());\n assertEquals(\"Unexpected number of thread ames found: \" + threadNames.toString(),\n numTriggers, threadNames.size());\n assertEquals(\"Unexpected number of trigger fails recorded, check logs?\",\n 0, fails.get());\n\n // before releasing the latch, clear the state and update our config to use a lower number of threads\n log.info(\"Updating scheduler config to use {} threads\", reducedThreadPoolSize);\n config = config.withProperties(Collections.singletonMap(AutoScalingParams.TRIGGER_CORE_POOL_SIZE,\n reducedThreadPoolSize));\n scheduledTriggers.setAutoScalingConfig(config);\n\n log.info(\"Updating cyclic barrier and clearing test state so triggers will 'run' again\");\n latch.set(new CyclicBarrier(reducedThreadPoolSize));\n threadNames.clear();\n triggerNames.clear();\n }\n \n log.info(\"Waiting on semaphore for all triggers to signal completion...\");\n assertTrue(\"Timed out waiting for semaphore count to be released\",\n completionSemaphore.tryAcquire(numTriggers, 60, TimeUnit.SECONDS));\n \n synchronized (latch) {\n assertEquals(\"Unexpected number of trigger names found: \" + triggerNames.toString(),\n numTriggers, triggerNames.size());\n assertEquals(\"Unexpected number of thread names found: \" + threadNames.toString(),\n reducedThreadPoolSize, threadNames.size());\n assertEquals(\"Unexpected number of trigger fails recorded, check logs?\",\n 0, fails.get());\n }\n }\n }", "@Test\n public void testDoNotifyCommitWitMultipleStreams() throws Exception {\n AccurevTrigger aMasterTrigger = setupProjectWithTrigger(\"host\", \"8080\", \"stream1\", \"depot\", false);\n AccurevTrigger bMasterTrigger = setupProjectWithTrigger(\"host\", \"8080\", \"stream2\", \"depot\", false);\n AccurevTrigger cMasterTrigger = setupProjectWithTrigger(\"host\", \"8080\", \"stream3\", \"depot\", false);\n\n AccurevStatus spy = Mockito.spy(new AccurevStatus());\n spy.doNotifyCommit(requestWithNoParameters, \"host\", \"8080\", \"stream1,stream2\", \"1\", \"testPrincipal\", \"Updated\");\n\n\n Mockito.verify(spy).doNotifyCommit(requestWithNoParameters, \"host\", \"8080\", \"stream1,stream2\", \"1\", \"testPrincipal\", \"Updated\");\n\n assertEquals(\"HOST: host PORT: 8080 Streams: stream1,stream2\", spy.toString());\n }", "protected void sequence_AT_DEFINE_DefinitionTrigger_TRIGGER(ISerializationContext context, DefinitionTrigger semanticObject) {\n\t\tgenericSequencer.createSequence(context, semanticObject);\n\t}", "@Override\n \tprotected void trigger(TriggerMessage message) {\n \t\tthis.getDataObjectService().saveObject(this.getUniqueProcessId(), message.getProcessInstanceId(), message.getPayload());\n \t\t\n \t\teventDefinition.trigger(message);\n \t\t\n \t\tthis.getNodeInstanceMediatorService().setNodeInstanceEndTime(message.getProcessInstanceId(), new Date());\n \t\t\n\t\tthis.getNodeInstanceMediatorService().setState(\n\t\t\t\tmessage.getProcessInstanceId(),\n\t\t\t\tNodeInstaceStates.PASSED_STATE);\n\t\t\n \t\tthis.getNodeInstanceMediatorService().persistChanges();\n \t\t\n \t\tthis.sendMessageToNodeActor(message, this.getActivatingGatewayNode());\n \t}", "public void trigger() {\n\n\t\tfor (Gadget gadget : getGadgetsToTrigger()) {\n\n\t\t\tgadget.trigger();\n\n\t\t}\n\n\t}", "@Override\n public TestRepositoryTriggersResult testRepositoryTriggers(TestRepositoryTriggersRequest request) {\n request = beforeClientExecution(request);\n return executeTestRepositoryTriggers(request);\n }", "boolean isSimpleTrigger();", "ETriggers getTriggers();", "@Test\n public void shouldThrowsExceptionWhenInnerMethodCallThrowsIt() throws Exception {\n thrown.expect(AccessException.class);\n //given\n // p4ic4idea: use a public, non-abstract class with default constructor\n doThrow(AccessException.AccessExceptionForTests.class).when(server).execMapCmdList(\n eq(TRIGGERS.toString()),\n eq(getCmdArguments),\n eq(null));\n //then\n triggersDelegator.getTriggerEntries();\n }", "public boolean triggersNow()\n\t{\n\t\tif(!this.canTrigger())\n\t\t\treturn false;\n\n\t\tfor(GameObject object: this.game.actualState.stack())\n\t\t\tif(object instanceof StateTriggeredAbility)\n\t\t\t\tif(((StateTriggeredAbility)object).printedVersionID == this.ID)\n\t\t\t\t\treturn false;\n\n\t\tIdentified source = this.getSource(this.state);\n\t\tint controller;\n\t\tif(source.isGameObject())\n\t\t\tcontroller = ((GameObject)source).controllerID;\n\t\telse\n\t\t\t// it's a player\n\t\t\tcontroller = source.ID;\n\t\tfor(GameObject object: this.game.actualState.waitingTriggers.get(controller))\n\t\t\tif((object instanceof StateTriggeredAbility) && (((StateTriggeredAbility)object).printedVersionID == this.ID))\n\t\t\t\treturn false;\n\n\t\tfor(SetGenerator condition: this.triggerConditions)\n\t\t\tif(!condition.evaluate(this.game, this).isEmpty())\n\t\t\t\treturn true;\n\n\t\treturn false;\n\t}", "public TriggerAccess getTrigger () {\n return this.trigger;\n }", "public void triggerAllAggregators() {\n Map<Integer, TimedDataAggregator> aggregatorMap = new HashMap<>();\n aggregatorMap.putAll(FeatureAggregators.getInstance().getAggregatorMap());\n aggregatorMap.putAll(StateAggregators.getInstance().getAggregatorMap());\n aggregatorMap.putAll(ClassificationAggregators.getInstance().getAggregatorMap());\n aggregatorMap.putAll(TrustLevelAggregators.getInstance().getAggregatorMap());\n\n // create shadow loopers for all aggregators\n Map<Integer, ShadowLooper> shadowLooperMap = createShadowLoopers(aggregatorMap);\n\n // set duration according to record\n long duration = record.getRecorder().getStopTimestamp() - record.getRecorder().getStartTimestamp();\n\n // trigger all aggregators\n triggerAggregators(aggregatorMap, shadowLooperMap, duration);\n }", "@Test\n public void ran() {\n List<ChangeSetStatus> changeSets = new ArrayList<>();\n ChangeSet mockChangeSet = Mockito.mock(ChangeSet.class);\n DatabaseChangeLog mockDbChangeLog =\n Mockito.mock(DatabaseChangeLog.class);\n Database mockDatabase = Mockito.mock(Database.class);\n\n LiquibaseMigrationWatcher w = new LiquibaseMigrationWatcher(changeSets);\n\n assertFalse(w.isMigrated());\n assertNull(w.getCurrentVersion());\n\n w.ran(mockChangeSet, mockDbChangeLog, mockDatabase, ExecType.EXECUTED);\n\n assertTrue(w.isMigrated());\n assertSame(mockChangeSet, w.getCurrentVersion());\n }", "@Test\n public void testDoNotifyCommitWithTwoStreams() throws Exception {\n AccurevTrigger bMasterTrigger = setupProjectWithTrigger(\"host\", \"8080\", \"stream2\", \"depot\", false);\n AccurevTrigger aMasterTrigger = setupProjectWithTrigger(\"host\", \"8080\", \"stream1\", \"depot\", false);\n\n\n AccurevStatus spy = Mockito.spy(new AccurevStatus());\n\n spy.doNotifyCommit(requestWithNoParameters, \"host\", \"8080\", \"stream1\", \"1\", \"testPrincipal\", \"Updated\");\n\n\n Mockito.verify(spy).doNotifyCommit(requestWithNoParameters, \"host\", \"8080\", \"stream1\", \"1\", \"testPrincipal\", \"Updated\");\n\n assertEquals(\"HOST: host PORT: 8080 Streams: stream1\", spy.toString());\n }", "@Ignore\n @Test\n public void testDslTriggerCreateUpdatedMergedApprovedPRAllowBranchesWithApproveActionsPipeline() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslTriggerCreateUpdatedMergedApprovedPRAllowBranchesWithApproveActionsPipeline.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n WorkflowJob createdJob = (WorkflowJob) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n PipelineTriggersJobProperty pipelineTriggers = (PipelineTriggersJobProperty) createdJob.getProperty(PipelineTriggersJobProperty.class);\n Map<TriggerDescriptor, Trigger<?>> triggers = pipelineTriggers.getTriggersMap();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Three different triggers expected */\n assertEquals(4, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(4, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestMergedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestApprovedActionFilter\");\n }", "@Ignore\n @Test\n public void testDslServerAllPRAllowedBranchesWithApproveActionsPipeline() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRAllowedBranchesWithApproveActionsPipeline.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n WorkflowJob createdJob = (WorkflowJob) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n PipelineTriggersJobProperty pipelineTriggers = (PipelineTriggersJobProperty) createdJob.getProperty(PipelineTriggersJobProperty.class);\n Map<TriggerDescriptor, Trigger<?>> triggers = pipelineTriggers.getTriggersMap();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Four different triggers expected */\n assertEquals(5, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(5, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n }", "private void fireEvents() {\n\n if (clockTickCount % clockTicksTillWorkloadChange == 0) {\n clockEventPublisher.fireTriggerWorkloadHandlerEvent(clockTickCount, intervalDurationInMilliSeconds);\n }\n\n // if (clockTickCount % clockTicksTillScalingDecision == 0) {\n // clockEventPublisher.fireTriggerAutoScalerEvent(clockTickCount,\n // intervalDurationInMilliSeconds);\n // }\n\n clockEventPublisher.fireClockEvent(clockTickCount, intervalDurationInMilliSeconds);\n\n // INfrastruktur\n if (clockTickCount % clockTicksTillPublishInfrastructureState == 0) {\n clockEventPublisher.fireTriggerPublishInfrastructureStateEvent(clockTickCount,\n intervalDurationInMilliSeconds);\n\n }\n\n // Queue\n if (clockTickCount % clockTicksTillPublishQueueState == 0) {\n\n clockEventPublisher.fireTriggerPublishQueueStateEvent(clockTickCount, intervalDurationInMilliSeconds);\n }\n\n }", "public void trigger() {\n\t\t\n//\t\t #ifdef DEBUG\n\t\t // The sensor should not have been scheduled if it has a NULL\n\t\t // callback function. Be safe and test here.\n\t\t if (func == null) {\n\t\t SoDebugError.post(\"SoSensor::trigger\",\n\t\t \"Cannot trigger a sensor with NULL callback\");\n\t\t return;\n\t\t }\n//\t\t #endif /* DEBUG */\n\t\t \n\t\t // Call the sensor function\n\t\t func.run(funcData, this);\n\t\t \n\t\t }", "Collection<ITrigger> getTriggers();", "@Test\n public void testDslServerAllPRAllowedBranchesWithApproveActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRAllowedBranchesWithApproveActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Four different triggers expected */\n assertEquals(5, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(5, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n }", "@Override\n\tpublic void addSelfTrigger(ISelfTrigger trigger) {\n\t\t\n\t}", "public int[] activateTrigger(int triggerId) {\n\n\t\tint[] triggerResults = {0,0,0,0,0,0,0,0,0,0};\n\t\t\n\t\ttry {\n\t\t\t\n\t\t\tMap<String, String> hm = db.selectTrigger(triggerId);\n\t\t\t\t\n\t\t\tint type = 0;\n\t\t\tint toTriggerId = 0;\t\n\t\t\t\t\t\n\t\t\ttype = Integer.parseInt(hm.get(\"type\"));\n\t\t\ttoTriggerId = Integer.parseInt(hm.get(\"to_trigger_id\"));\n\t\t\t\n\t\t\tswitch (type) {\n\t\t\t\t\t\t\n\t\t\t\tcase DB_TRIGGER_TYPE_ANIM:\t\t\t// an animation is launched\n\t\t\t\t\t\n\t\t\t\t\ttriggerResults[1] = toTriggerId;\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase DB_TRIGGER_TYPE_ACTION:\t// OR a change on items (combination, action, take item on screen...)\n\n\t\t\t\t\ttriggerResults[5] = activateModifier(toTriggerId);\n\t\t\t\t break;\n\n\t\t\t\tcase DB_TRIGGER_TYPE_DOLL:\t// OR move/hide doll\t\n\t\t\t\t\t\n\t\t\t\t\tMap<String, String> hmDoll = db.selectDollTrigger(toTriggerId);\n\t\t\t\t\tif (hmDoll.get(\"to_x\") != null)\t\t\t\ttriggerResults[2] = Integer.parseInt(hmDoll.get(\"to_x\"));\n\t\t\t\t\tif (hmDoll.get(\"doll_is_hidden\") != null)\ttriggerResults[3] = Integer.parseInt(hmDoll.get(\"doll_is_hidden\"));\n\t\t\t\t\tif (hmDoll.get(\"y_velocity\") != null)\t\ttriggerResults[6] = Integer.parseInt(hmDoll.get(\"y_velocity\"));\n\t\t\t\t\t\n\t\t\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 2 \" + hmDoll.get(\"to_x\"));\n\t\t\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 3 \" + hmDoll.get(\"doll_is_hidden\"));\n\t\t\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 6 \" + hmDoll.get(\"y_velocity\"));\n\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase DB_TRIGGER_TYPE_TEXT:\t// show a bubble\n\t\t\t\t\t\n\t\t\t\t\ttriggerResults[4] = toTriggerId;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase DB_TRIGGER_TYPE_SV_ITEM:\t// hide/show item\n\t\t\t\t\t\n\t\t\t\t\ttriggerResults[7] = toTriggerId;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase DB_TRIGGER_TYPE_SV_ANIM:\t// hide/show anim\n\t\t\t\t\t\n\t\t\t\t\ttriggerResults[8] = toTriggerId;\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\n\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 0 \" + hm.get(\"next_trigger_id\"));\n\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 5 \" + triggerResults[5]);\n\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 1, 4, 7 & 8: \" + toTriggerId);\n\t\t\t\n\t\t\tif (hm.get(\"next_trigger_id\") != null)\ttriggerResults[0] = Integer.parseInt(hm.get(\"next_trigger_id\"));\n\t\t\tif (hm.get(\"simultaneous_trigger_id\") != null)\ttriggerResults[9] = Integer.parseInt(hm.get(\"simultaneous_trigger_id\"));\n\t\t\t\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\treturn triggerResults;\n\t}", "public static boolean getTrigger() {\n\t\treturn true;\r\n\t}", "@Test\n public void triggeredForCatalogItemTest() {\n // TODO: test triggeredForCatalogItem\n }", "@Test\n\t@Ignore\n\tpublic void testScheduler() {\n\t\torg.springframework.scheduling.support.CronTrigger trigger = new CronTrigger(\"0 0 0 * * *\");\n\t\tCalendar today = Calendar.getInstance();\n\t\ttoday.add(Calendar.DAY_OF_MONTH, -1);\n\t\tSimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss z\");\n\t\tfinal Date yesterday = today.getTime();\n\t\tString lastMessage = (sdf.format(yesterday)) + \" : [Yesterday]\";\n\t\tlog.debug(lastMessage);\n\t\tDate nextExecution = trigger.nextExecutionTime(\n\t\t\t\tnew TriggerContext() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Date lastScheduledExecutionTime() {\n\t\t\t\t\t\treturn yesterday;\n\t\t\t\t\t}\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Date lastActualExecutionTime() {\n\t\t\t\t\t\treturn yesterday;\n\t\t\t\t\t}\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Date lastCompletionTime() {\n\t\t\t\t\t\treturn yesterday;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\tString nextMessage = sdf.format(nextExecution) + \" : [Execution] \";\n\t\tlog.debug(nextMessage);\n\t}", "public void setTriggers(List<CronTrigger> triggers) {\n this.triggers = triggers;\n\n CronExpression cronExpression;\n List<CronTrigger> schedulableTriggers = new ArrayList<CronTrigger>();\n\n for (CronTrigger cronTrigger : triggers) {\n try {\n cronExpression = new CronExpression(cronTrigger.getCronExpression());\n if (cronExpression.getNextValidTimeAfter(new Date()) == null) {\n // The cron expression is valid, but will never trigger.\n LOG.info(cronTrigger.getCronExpression() + \" not valid cronexpression. The job will not be scheduled.\");\n continue;\n }\n }\n catch (ParseException e) {\n LOG.info(cronTrigger.getCronExpression() + \" not valid cronexpression. The job will not be scheduled.\");\n continue;\n }\n schedulableTriggers.add(cronTrigger);\n }\n super.setTriggers(schedulableTriggers.toArray(new CronTrigger[0]));\n }", "@Test\n public void testDslServerAllPRActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Five different triggers expected */\n assertEquals(5, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(5, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "public interface TriggerService {\n\n /**\n * 获取所有的问题触发器ids\n * @return\n * @throws ServiceException\n */\n List<String> getProblemTriggerIds() throws ServiceException;\n\n <T> List<T> listTrigger(TriggerGetRequest triggerGetRequest, Class<T> clazz);\n\n /**\n * 根据 request 获取触发器数量\n * @return\n * @throws ServiceException\n */\n int countTrigger(TriggerGetRequest request) throws ServiceException;\n/*\nzabbix 方法\n */\n /**\n *\n * @return\n * @throws ServiceException\n */\n List<DashboardProblemVO> listBriefProblems() throws ServiceException;\n\n /**\n * 根据 triggerIds 查询对应的 triggerDTOS selectHost\n * @param triggerIds\n * @return\n * @throws ServiceException\n */\n List<BriefTriggerDTO> getTriggersByTriggerIds(List<String> triggerIds ) throws ServiceException;\n /**\n * 根据itemIds获取监控中的 trggierDTO list\n * @param itemIds\n * @return\n * @throws ServiceException\n */\n List<BriefTriggerDTO> getTriggersByItemIds(List<String> itemIds) throws ServiceException;\n\n /**\n * 列出所有触发器 排除依赖 触发器 BriefTriggerDTOS\n * @return\n * @throws ServiceException\n */\n List<BriefTriggerDTO> listTriggersSkipDependent() throws ServiceException;\n\n /**\n * 列出问题触发器 BriefTriggerDTOS\n * @return\n * @throws ServiceException\n */\n List<BriefTriggerDTO> listProblemTriggers() throws ServiceException;\n\n /**\n * 问题管理 问题列表 ProblemListVO\n * @return\n * @throws ServiceException\n */\n List<ProblemListVO> listProblemListVO() throws ServiceException;\n\n /**\n * 问题管理 问题详情 基础静态信息 ProblemDetailVO\n * @return\n * @throws ServiceException\n */\n ProblemDetailVO getProblemDetailVOByTriggerId(String triggerId) throws ServiceException;\n\n}", "@Test\n public void testDslServerAllPRActionsPipeline() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRActionsPipeline.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n WorkflowJob createdJob = (WorkflowJob) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n PipelineTriggersJobProperty pipelineTriggers = (PipelineTriggersJobProperty) createdJob.getProperty(PipelineTriggersJobProperty.class);\n Map<TriggerDescriptor, Trigger<?>> triggers = pipelineTriggers.getTriggersMap();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Five different triggers expected */\n assertEquals(5, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(5, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "@Before\n public void setup() {\n context.build().resource(OAK_INDEX).commit();\n context.registerService(Scheduler.class,scheduler);\n context.registerService(RequireAem.class,requireAem,\"distribution\",\"classic\");\n\n ScheduleOptions options = mock(ScheduleOptions.class);\n lenient().when(scheduler.NOW()).thenReturn(options);\n lenient().when(scheduler.schedule(any(), any())).thenAnswer((InvocationOnMock invocation) -> {\n EnsureOakIndexJobHandler handler = invocation.getArgument(0);\n handler.run();\n return true;\n });\n\n context.registerService(ChecksumGenerator.class, new ChecksumGeneratorImpl());\n \n ensureOakIndexManagerProperties = new HashMap<>();\n ensureOakIndexManagerProperties.put(\"properties.ignore\", null);\n \n }", "@Test\n public void testDslTriggerCreateUpdatedMergedApprovedPRAllowBranchesActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslTriggerCreateUpdatedMergedDeclinedApprovedPRAllowBranchesActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Five different triggers expected */\n assertEquals(5, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(5, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestMergedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestDeclinedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestApprovedActionFilter\");\n }", "public Trigger getTrigger() {\n \t\treturn trigger;\n \t}", "public void trigger(Event event);", "public void execute(RecordTriggerContext recordTriggerContext) {\n LogService logService = ServiceLocator.locate(LogService.class);\n /*\n * Get an instance of the User Defined Service we created.\n * User defined Services are used similarly to Vault SDK services.\n * User Defined Services don't contribute to the memory limit after the method has exited.\n */\n ProductSearchUserDefinedService productSearchUserDefinedService = ServiceLocator.locate(ProductSearchUserDefinedService.class);\n\n /*\n * Get an instance of the PickList Service used to retrieve picklist values.\n * More information about hor to retrive picklist values can be found here:\n * https://repo.veevavault.com/javadoc/vault-sdk-api/20.1.0/docs/api/com/veeva/vault/sdk/api/picklist/package-summary.html\n */\n PicklistService picklistService = ServiceLocator.locate(PicklistService.class);\n // Picklist of bicycle parts in bicycle part orders\n Picklist bicyclePartPicklist = picklistService.getPicklist(\"bicycle_part__c\");\n // Picklist of bicycle part manufacturers in bicycle part orders\n Picklist bicyclePartManufacturersPicklist = picklistService.getPicklist(\"bicycle_part_manufacturer__c\");\n\n @SuppressWarnings(\"unchecked\")\n Map<String, String> partAndManufacturerMap = VaultCollections.newMap();\n @SuppressWarnings(\"unchecked\")\n Map<String, BigDecimal> orderQuantityMap = VaultCollections.newMap();\n\n recordTriggerContext.getRecordChanges().forEach(recordChange -> {\n\n // Initialize part name and manufacture name strings\n String bicyclePartName = \"\";\n String bicyclePartManufacturerName = \"\";\n\n // Get the bicycle parts pick list values\n List<String> bicyclePartsListValues = recordChange.getNew().getValue(\"bicycle_part__c\", ValueType.PICKLIST_VALUES);\n\n // Get the name(label) of the bicycle part using the bicyclePartPickList\n if (bicyclePartsListValues != null && !bicyclePartsListValues.isEmpty()) {\n //Get single-picklist value name selected by user\n String partPicklistValueName = bicyclePartsListValues.get(0);\n //Get picklist value label\n bicyclePartName = bicyclePartPicklist.getPicklistValue(partPicklistValueName).getLabel();\n }\n\n // Get the name(label) of the bicycle part manufacturer using the bicyclePartManufacturerPickList\n List<String> bicyclePartManufacturersListValues = recordChange.getNew().getValue(\"bicycle_part_manufacturer__c\", ValueType.PICKLIST_VALUES);\n if (bicyclePartManufacturersListValues != null && !bicyclePartManufacturersListValues.isEmpty()) {\n //Get single-picklist value name selected by user\n String partManufacturerPicklistValueName = bicyclePartManufacturersListValues.get(0);\n //Get picklist value label\n bicyclePartManufacturerName = bicyclePartManufacturersPicklist.getPicklistValue(partManufacturerPicklistValueName).getLabel();\n }\n\n // If the bicycle part name or the manufacturer name are null or empty, then throw an error.\n if((bicyclePartName == null || bicyclePartName.isEmpty()) ||\n (bicyclePartManufacturerName == null || bicyclePartManufacturerName.isEmpty())) {\n recordChange.setError(\"INVALID_ARGUMENT\", \"Product with specified manufacturer does not exist.\");\n }\n\n // Get the order quantity\n BigDecimal orderQuantity = recordChange.getNew().getValue(\"order_quantity__c\", ValueType.NUMBER);\n\n // Add part name, part manufacturer name and order quantity to maps\n partAndManufacturerMap.put(\"'\" + bicyclePartName + \"'\", \"'\" + bicyclePartManufacturerName + \"'\");\n orderQuantityMap.put(bicyclePartName, orderQuantity);\n });\n logService.logResourceUsage(\"Before doesProductExist Method Call: \");\n Map<String, BicyclePartData> doProductsExist = productSearchUserDefinedService.doesProductExist(partAndManufacturerMap);\n logService.logResourceUsage(\"After doesProductExist Method Call: \" );\n\n // Validate that all user entered bicycle part name were found, if not setError on the record change.\n for (RecordChange recordChange : recordTriggerContext.getRecordChanges()) {\n // If no results were found, all user inputted products and manufacturer combinations are wrong.\n if (doProductsExist == null) {\n recordChange.setError(\"INVALID_ARGUMENT\", \"Product with specified manufacturer does not exist.\");\n continue;\n }\n\n // Get the bicycle parts pick list values\n List<String> bicyclePartsListValues = recordChange.getNew().getValue(\"bicycle_part__c\", ValueType.PICKLIST_VALUES);\n\n String bicyclePartName = \"\";\n // Get the name(label) of the bicycle part using the bicyclePartPickList\n if (bicyclePartsListValues != null && !bicyclePartsListValues.isEmpty()) {\n //Get single-picklist value name selected by user\n String partPicklistValueName = bicyclePartsListValues.get(0);\n //Get picklist value label\n bicyclePartName = bicyclePartPicklist.getPicklistValue(partPicklistValueName).getLabel();\n }\n\n if (bicyclePartName != null && !doProductsExist.get(bicyclePartName).getIdExists()) { // If Id of bicycle part is found then it exists\n // setError if the user specified bicycle part's record was not found.\n recordChange.setError(\"INVALID_ARGUMENT\", \"Product with specified manufacturer does not exist.\");\n }\n }\n\n // Reduce the quantity for the bicycle parts that we are creating an order for.\n if(doProductsExist != null) {\n logService.logResourceUsage(\"Before reduceProductQuantity Method Call: \");\n productSearchUserDefinedService.reduceProductQuantity(doProductsExist.values(), orderQuantityMap);\n logService.logResourceUsage(\"After reduceProductQuantity Method Call: \");\n }\n logService.logResourceUsage(\"End: \");\n }", "private void trigger() {\n\t\t\tif (repeatState == REPEAT_ADD) {\n\t\t\t\tadd();\n\t\t\t}\n\t\t\tif (repeatState == REPEAT_SUBTRACT) {\n\t\t\t\tsubtract();\n\t\t\t}\n\t\t}", "TriggerType createTriggerType();", "boolean hasTriggerFulfillment();", "@Test\n public void testDslTriggerCreateUpdatedApprovedPRActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslTriggerCreateUpdatedApprovedPRActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Three different triggers expected */\n assertEquals(3, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(3, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestApprovedActionFilter\");\n }", "ITrigger getTrigger(String sTriggerName);", "public void onTriggerChange() {\n findViewById(R.id.temp).post(new Runnable() {\n public void run() {\n ConsumerIrManager mCIR = ScaryUtil.getConsumerIRService(getApplicationContext());\n if (m_Inst.power) {\n TransmissionCode data = ScaryUtil.getIRCode(m_Inst.sequence, m_Inst.temp); // (TransmissionCode)samsung.get(m_Inst.temp);\n ScaryUtil.transmit(getApplicationContext(),data);\n }\n }\n });\n }", "@Test\n public void launchesEventhandlerUpdatelastmodificationTest() {\n // TODO: test launchesEventhandlerUpdatelastmodification\n }", "public interface ModelTrigger{\n\n\t/** Start's the simulation. */\n\tpublic void startSimulation();\n\n\t/** Stop's the simulation. */\n\tpublic void stopSimulation();\n\n\t/** Return true if the simulation is running. */\n\tpublic boolean isRunning();\n}", "@Test\n public void testNear()\n {\n String sName = \"near-client-listener\";\n generateEvents(sName);\n checkEvents(true, false);\n }", "@PostConstruct\n public void initTriggerEvaluateRunning() {\n this.triggerRepository.findAll().forEach(trigger -> {\n if (trigger.getEvaluateRunningDate() != null) {\n var unlocked = trigger.toBuilder().evaluateRunningDate(null).build();\n this.triggerRepository.save(unlocked);\n }\n });\n }", "protected void loadTrigger() {\n this.keyTrigger = getContentAssistTrigger();\n }", "public void trigger(PromiseManager pm) {\n\tthrow new SubclassResponsibilityException();\n/*\nudanax-top.st:15949:DetectorEvent methodsFor: 'triggering'!\n{void} trigger: pm {PromiseManager}\n\t\"Send the message across the wire.\"\n\t\n\tself subclassResponsibility!\n*/\n}", "@Test\n public void testDslServerAllPRUnfilteredAndAllowedBranchesActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRUnfilteredAndAllowedBranchesActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Twelve different triggers expected */\n assertEquals(12, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(5).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(6).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(7).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(8).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(9).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(10).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(11).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(12, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(5), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n\n assertEquals(dispNames.get(6), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(7), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(8), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(9), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(10), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(11), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "@Test\n public void testDslServerAllPRAllowedBranchesActionsPipeline() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRAllowedBranchesActionsPipeline.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n WorkflowJob createdJob = (WorkflowJob) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n PipelineTriggersJobProperty pipelineTriggers = (PipelineTriggersJobProperty) createdJob.getProperty(PipelineTriggersJobProperty.class);\n Map<TriggerDescriptor, Trigger<?>> triggers = pipelineTriggers.getTriggersMap();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Six different triggers expected */\n assertEquals(6, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(5).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(6, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(5), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "@Test\n public void testDslTriggerCreateUpdatedMergedApprovedPRAllowBranchesWithApproveActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslTriggerCreateUpdatedMergedApprovedPRAllowBranchesWithApproveActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Three different triggers expected */\n assertEquals(4, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(4, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestMergedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestApprovedActionFilter\");\n }", "@Test\n public void notifications() throws Exception {\n List<String> log = new ArrayList<>();\n\n fieldCfg.listen(ctx -> {\n log.add(\"update\");\n\n return completedFuture(null);\n });\n\n fieldCfg.joinTimeout().listen(ctx -> {\n log.add(\"join\");\n\n return completedFuture(null);\n });\n\n fieldCfg.failureDetectionTimeout().listen(ctx -> {\n log.add(\"failure\");\n\n return completedFuture(null);\n });\n\n fieldCfg.change(change -> change.changeJoinTimeout(1000_000)).get(1, TimeUnit.SECONDS);\n\n assertEquals(List.of(\"update\", \"join\"), log);\n\n log.clear();\n\n fieldCfg.failureDetectionTimeout().update(2000_000).get(1, TimeUnit.SECONDS);\n\n assertEquals(List.of(\"update\", \"failure\"), log);\n }", "@Test\n public void testDslServerAllPRAllowedBranchesActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRAllowedBranchesActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Six different triggers expected */\n assertEquals(6, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(5).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(6, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(5), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "boolean containsTrigger(String sTriggerName);", "public void mock(){\n\n }", "public T caseTrigger(Trigger object) {\r\n\t\treturn null;\r\n\t}", "private void processCreateTrigger() throws HsqlException {\n\n Table t;\n boolean isForEach;\n boolean isNowait;\n int queueSize;\n String triggerName;\n boolean isQuoted;\n String sWhen;\n String sOper;\n String tableName;\n String token;\n String className;\n TriggerDef td;\n Trigger o;\n\n triggerName = tokenizer.getName();\n\n String schemaname = tokenizer.getLongNameFirst();\n\n database.schemaManager.checkTriggerExists(triggerName,\n session.getSchemaNameForWrite(schemaname), false);\n\n isQuoted = tokenizer.wasQuotedIdentifier();\n isForEach = false;\n isNowait = false;\n queueSize = TriggerDef.getDefaultQueueSize();\n sWhen = tokenizer.getSimpleToken();\n sOper = tokenizer.getSimpleToken();\n\n tokenizer.getThis(Token.T_ON);\n\n tableName = tokenizer.getName();\n\n if (schemaname == null) {\n schemaname =\n session.getSchemaNameForWrite(tokenizer.getLongNameFirst());\n } else if (!schemaname.equals(\n session.getSchemaNameForWrite(tokenizer.getLongNameFirst()))) {\n throw Trace.error(Trace.INVALID_SCHEMA_NAME_NO_SUBCLASS);\n }\n\n t = database.schemaManager.getUserTable(session, tableName,\n schemaname);\n\n if (t.isView()) {\n throw Trace.error(Trace.NOT_A_TABLE);\n }\n\n session.setScripting(true);\n\n // \"FOR EACH ROW\" or \"CALL\"\n token = tokenizer.getSimpleToken();\n\n if (token.equals(Token.T_FOR)) {\n token = tokenizer.getSimpleToken();\n\n if (token.equals(Token.T_EACH)) {\n token = tokenizer.getSimpleToken();\n\n if (token.equals(Token.T_ROW)) {\n isForEach = true;\n\n // should be 'NOWAIT' or 'QUEUE' or 'CALL'\n token = tokenizer.getSimpleToken();\n } else {\n throw Trace.error(Trace.UNEXPECTED_END_OF_COMMAND, token);\n }\n } else {\n throw Trace.error(Trace.UNEXPECTED_END_OF_COMMAND, token);\n }\n }\n\n if (token.equals(Token.T_NOWAIT)) {\n isNowait = true;\n\n // should be 'CALL' or 'QUEUE'\n token = tokenizer.getSimpleToken();\n }\n\n if (token.equals(Token.T_QUEUE)) {\n queueSize = tokenizer.getInt();\n\n // should be 'CALL'\n token = tokenizer.getSimpleToken();\n }\n\n if (!token.equals(Token.T_CALL)) {\n throw Trace.error(Trace.UNEXPECTED_END_OF_COMMAND, token);\n }\n\n className = tokenizer.getSimpleName();\n\n if (!tokenizer.wasQuotedIdentifier()) {\n throw Trace.error(Trace.UNEXPECTED_END_OF_COMMAND, className);\n }\n\n HsqlName name = database.nameManager.newHsqlName(triggerName,\n isQuoted);\n\n td = new TriggerDef(name, sWhen, sOper, isForEach, t, className,\n isNowait, queueSize, database.classLoader);\n\n t.addTrigger(td);\n\n if (td.isValid()) {\n try {\n\n // start the trigger thread\n td.start();\n } catch (Exception e) {\n throw Trace.error(Trace.UNKNOWN_FUNCTION, e.toString());\n }\n }\n\n database.schemaManager.registerTriggerName(triggerName, t.getName());\n\n// --\n }", "private void processWTBy(WasTriggeredBy dep) {\n\n\t}", "@Test\n public void testDslTriggerIsToApprovePushActionFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslTriggerIsToApprovePushActionFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n boolean isToApprove = false;\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n assertEquals(1, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n BitBucketPPRRepositoryPushActionFilter tmp3 = (BitBucketPPRRepositoryPushActionFilter) tmp2.getTriggers().get(0).getActionFilter();\n isToApprove = tmp3.shouldSendApprove();\n }\n assertEquals(1, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRRepositoryPushActionFilter\");\n assertTrue(isToApprove);\n }", "@Test\n public void shouldReturnEmptyTriggerEntriesWhenResultMapsIsNull() throws Exception {\n shouldReturnEmptyTriggerEntries(new UnitTestGiven() {\n @Override\n public void given() throws P4JavaException {\n when(server.execMapCmdList(\n eq(TRIGGERS.toString()),\n eq(getCmdArguments),\n eq(null))).thenReturn(null);\n }\n });\n }", "@Test\n public void testDslServerAllPRUnfilteredAndAllowedBranchesActionsPipeline() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRUnfilteredAndAllowedBranchesActionsPipeline.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n WorkflowJob createdJob = (WorkflowJob) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n PipelineTriggersJobProperty pipelineTriggers = (PipelineTriggersJobProperty) createdJob.getProperty(PipelineTriggersJobProperty.class);\n Map<TriggerDescriptor, Trigger<?>> triggers = pipelineTriggers.getTriggersMap();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Eleven different triggers expected */\n assertEquals(11, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(5).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(6).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(7).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(8).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(9).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(10).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(11, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(5), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(6), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(7), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(8), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(9), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(10), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "boolean isTriggerPersistent(String sTriggerName);", "private void fireBatteryStatus(String trigger)\n\t{\n\t\tfireBatteryStatus(batteryLevel, isPowerConnected, trigger, null);\n\t}", "public void addTriggers(Map<String, Object> map) {\n }", "@Test\n public void testUnimplementedMethods() {\n List<ChangeSetStatus> changeSets = new ArrayList<>();\n LiquibaseMigrationWatcher w = new LiquibaseMigrationWatcher(changeSets);\n Change mockChange = Mockito.mock(Change.class);\n ChangeSet mockChangeSet = Mockito.mock(ChangeSet.class);\n DatabaseChangeLog mockDbChangeLog =\n Mockito.mock(DatabaseChangeLog.class);\n Database mockDatabase = Mockito.mock(Database.class);\n PreconditionFailedException mockPFE =\n Mockito.mock(PreconditionFailedException.class);\n PreconditionErrorException mockPEE =\n Mockito.mock(PreconditionErrorException.class);\n\n w.willRun(mockChangeSet, mockDbChangeLog, mockDatabase,\n RunStatus.MARK_RAN);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n\n w.willRun(mockChange, mockChangeSet, mockDbChangeLog, mockDatabase);\n Mockito.verifyNoMoreInteractions(mockChange);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n\n w.ran(mockChangeSet, mockDbChangeLog, mockDatabase, ExecType.EXECUTED);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n\n w.ran(mockChange, mockChangeSet, mockDbChangeLog, mockDatabase);\n Mockito.verifyNoMoreInteractions(mockChange);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n\n w.rolledBack(mockChangeSet, mockDbChangeLog, mockDatabase);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n\n w.runFailed(mockChangeSet, mockDbChangeLog, mockDatabase, mockPEE);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n Mockito.verifyNoMoreInteractions(mockPEE);\n\n w.preconditionFailed(mockPFE, FailOption.HALT);\n Mockito.verifyNoMoreInteractions(mockPFE);\n\n w.preconditionErrored(mockPEE, ErrorOption.HALT);\n Mockito.verifyNoMoreInteractions(mockPEE);\n }", "private TriggerUtils() {\n }", "@Property(\"triggerAction\")\n String getTriggerAction();", "public void preFire(){\n\t}", "@Override\n public void triggerProbe(DeviceId deviceId) {\n }", "public interface TriggerContext {\n\n /**\n * Return the last <i>scheduled</i> execution time of the task, or.\n *\n * @return the date\n * {@code null} if not scheduled before.\n */\n Date lastScheduledExecutionTime();\n\n /**\n * Return the last <i>actual</i> execution time of the task, or {@code null}\n * if not scheduled before.\n *\n * @return the date\n */\n Date lastActualExecutionTime();\n\n /**\n * Return the last completion time of the task, or {@code null} if not\n * scheduled before.\n *\n * @return the date\n */\n Date lastCompletionTime();\n}", "public boolean trigger (String name) {\n final TriggerReference trigger = module.getTrigger(name);\n if (trigger == null) {\n Logger.missing(\"TriggerReference\", name);\n return false;\n } else {\n return trigger.get();\n }\n }", "@Override\n public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {\n if (!canRun()) {\n return null;\n }\n return super.schedule(task, trigger);\n }", "@Test\n public void testRwbmInternalBoth()\n {\n generateEvents(\"dist-rwbm-internal-both\");\n checkEvents(true, true);\n }", "@Test\n public void testRegisterTrigger_NoServerSetup_NoErrors() throws Exception {\n Assume.assumeTrue(AdServicesInfo.INSTANCE.version() >= 5);\n\n assertThat(mMeasurementManager.registerTriggerAsync(TRIGGER_REGISTRATION_URI).get())\n .isNotNull();\n }", "public void sendTestFutureNotification() {\n\n }", "@Test\n public void testDslMultipleJobsInSeedVarious() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslMultipleJobsInSeedVarious.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job1\");\n WorkflowJob createdPipelineJob;\n PipelineTriggersJobProperty pipelineTriggers;\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n assertEquals(1, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(1, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestCreatedActionFilter\");\n\n /* Verify second job content */\n createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job2\");\n /* Go through all triggers to validate DSL */\n triggers = createdJob.getTriggers();\n assertEquals(1, triggers.size());\n dispNames.clear();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n assertEquals(1, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(1, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestUpdatedActionFilter\");\n\n /* Verify third job content */\n createdPipelineJob = (WorkflowJob) j.getInstance().getItem(\"test-job3\");\n /* Go through all triggers to validate DSL */\n pipelineTriggers = (PipelineTriggersJobProperty) createdPipelineJob.getProperty(PipelineTriggersJobProperty.class);\n triggers = pipelineTriggers.getTriggersMap();\n assertEquals(1, triggers.size());\n dispNames.clear();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n assertEquals(2, tmp2.getTriggers().size());\n String tmpName = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpName.substring(tmpName.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpName = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpName.substring(tmpName.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(2, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRRepositoryPushActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestCommentDeletedActionFilter\");\n }", "boolean isAlreadyTriggered();" ]
[ "0.68646234", "0.6657912", "0.66340166", "0.6497036", "0.6462506", "0.63940775", "0.63810295", "0.6317664", "0.63040847", "0.6251105", "0.6196133", "0.619544", "0.6147868", "0.60678947", "0.6019345", "0.5991254", "0.5987018", "0.5944322", "0.59162253", "0.5892377", "0.58923393", "0.5889937", "0.5889845", "0.58801144", "0.58715594", "0.5856232", "0.5850014", "0.5842487", "0.58400965", "0.58032453", "0.5775392", "0.5767945", "0.5744964", "0.5737253", "0.5721623", "0.57139885", "0.5704159", "0.57015586", "0.56991965", "0.5687427", "0.5682076", "0.56584126", "0.56543815", "0.56495756", "0.56308866", "0.5629386", "0.5613097", "0.56028944", "0.55870605", "0.55863386", "0.5565536", "0.5564817", "0.556364", "0.5559474", "0.55557585", "0.55530775", "0.5552785", "0.5541456", "0.55362576", "0.55145496", "0.55103695", "0.5480469", "0.5478716", "0.5471271", "0.5469394", "0.5466134", "0.5453018", "0.5448734", "0.54484445", "0.5440245", "0.5438929", "0.543355", "0.5424994", "0.53850305", "0.53817403", "0.53717405", "0.53560597", "0.5355085", "0.53550553", "0.53500384", "0.53482455", "0.53422064", "0.53414094", "0.5330741", "0.5327445", "0.5311706", "0.53063524", "0.53033245", "0.5297801", "0.5295818", "0.52917486", "0.52809703", "0.52780926", "0.5271121", "0.524975", "0.5243583", "0.5240925", "0.5239112", "0.5236217", "0.5231415" ]
0.56005526
48
TODO : Find a way to mock the triggers
@Test public void testDoNotifyCommitWithTwoStreams() throws Exception { AccurevTrigger bMasterTrigger = setupProjectWithTrigger("host", "8080", "stream2", "depot", false); AccurevTrigger aMasterTrigger = setupProjectWithTrigger("host", "8080", "stream1", "depot", false); AccurevStatus spy = Mockito.spy(new AccurevStatus()); spy.doNotifyCommit(requestWithNoParameters, "host", "8080", "stream1", "1", "testPrincipal", "Updated"); Mockito.verify(spy).doNotifyCommit(requestWithNoParameters, "host", "8080", "stream1", "1", "testPrincipal", "Updated"); assertEquals("HOST: host PORT: 8080 Streams: stream1", spy.toString()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract void onTrigger();", "public void trigger(List<Entity> _trigger){\n\t\tif(event!=null){\n\t\t\tevent.activate(System.currentTimeMillis(), _trigger);\n\t\t}\n\t}", "void trigger();", "private boolean triggered() {\n\t\treturn true;\n\t}", "public interface TriggerHandler {\n\n String handleTrigger(String stateJson, Collection<Subscription> subscriptions, String cfgJson);\n\n String getTriggerType();\n\n}", "public abstract void setTriggers(Map<String, Trigger> triggers);", "protected abstract void createTriggerOrAction();", "void trigger(Entity e);", "public abstract Map<String, Trigger> getTriggers();", "public void trigger(Fact fact) {\n\t\t\n\t}", "public void executeTrigger(Object object);", "Set getTriggers();", "@Override\n\t\tvoid runCommand() {\n\t\t\ttrigger.execute();\n\t\t}", "@Override\r\n\t\tpublic Object trigger(Object... objects) {\n\t\t\tSystem.out.println(\"do,it\");\r\n\t\t\treturn null;\r\n\t\t}", "@Test\n public void trigger() throws FlywayException {\n flyway.setLocations(\"migration/dbsupport/oracle/sql/trigger\");\n flyway.migrate();\n flyway.clean();\n flyway.migrate();\n }", "@Override\n\tprotected boolean on_trigger_activated(String trigger_name) {\n\t\treturn false;\n\t}", "public List<Trigger> getTriggers();", "public abstract void setTriggerOrAction();", "public abstract boolean isTrigger();", "public interface EnchantmentTrigger {}", "boolean getUserChooseTrigger();", "@SuppressWarnings(\"unchecked\")\n @Before\n public void beforeEach()\n throws AccessException, RequestException, ConnectionException {\n server = mock(Server.class);\n triggersDelegator = new TriggersDelegator(server);\n resultMap = mock(Map.class);\n resultMap2 = mock(Map.class);\n resultMaps = List.of(resultMap, resultMap2);\n\n entryList = new ArrayList<>();\n ITriggerEntry triggerEntry = mock(ITriggerEntry.class);\n entryList.add(triggerEntry);\n\n when(server.execMapCmdList(eq(TRIGGERS.toString()), eq(getCmdArguments), eq(null)))\n .thenReturn(resultMaps);\n }", "@Test\n public void shouldReturnNonEmptyTriggerEntries() throws Exception {\n //given\n when(resultMap.get(TRIGGERS_KEY + 0)).thenReturn(\"my entry value 0\");\n when(resultMap.get(TRIGGERS_KEY + 1)).thenReturn(\"my entry value 1\");\n givenNoHandleErrorMap(resultMap);\n when(resultMap2.get(TRIGGERS_KEY + 0)).thenReturn(\"my entry2 value 0\");\n when(resultMap2.get(TRIGGERS_KEY + 1)).thenReturn(\"my entry2 value 1\");\n when(resultMap2.get(TRIGGERS_KEY + 2)).thenReturn(\"my entry2 value 2\");\n givenNoHandleErrorMap(resultMap2);\n //when\n List<ITriggerEntry> triggerEntries = triggersDelegator.getTriggerEntries();\n //then\n assertThat(triggerEntries.size(), is(5));\n assertThat(triggerEntries.get(1).getOrder(), is(1));\n assertThat(triggerEntries.get(4).getOrder(), is(2));\n }", "public abstract void handleMatching(EventBean[] triggerEvents, EventBean[] matchingEvents);", "protected TriggerFactory getTriggerFactory() {\n\t\treturn this.triggerFactory;\n\t}", "public void testSetProperties() throws Exception {\n final JettySolrRunner runner = cluster.getJettySolrRunner(0);\n final SolrResourceLoader resourceLoader = runner.getCoreContainer().getResourceLoader();\n final SolrCloudManager solrCloudManager = runner.getCoreContainer().getZkController().getSolrCloudManager();\n \n try (ScheduledTriggers scheduledTriggers = new ScheduledTriggers(resourceLoader, solrCloudManager)) {\n AutoScalingConfig config = new AutoScalingConfig(Collections.emptyMap());\n scheduledTriggers.setAutoScalingConfig(config);\n\n // Setup a trigger that records the timestamp of each time it was run\n // we only need 2 timestamps for the test, so limit the queue and make the trigger a No-Op if full\n final BlockingQueue<Long> timestamps = new ArrayBlockingQueue<Long>(2);\n final AutoScaling.Trigger t1 = new MockTrigger(TriggerEventType.NODELOST, \"mock-timestamper\") {\n @Override\n public void run() {\n log.info(\"Running {} in {}\", this.getName(), Thread.currentThread().getName());\n timestamps.offer(solrCloudManager.getTimeSource().getTimeNs());\n }\n };\n\n log.info(\"Configuring simple scheduler and adding trigger: {}\", t1.getName());\n t1.configure(resourceLoader, solrCloudManager, Collections.emptyMap());\n scheduledTriggers.add(t1);\n\n waitForAndDiffTimestamps(\"conf(default delay)\",\n ScheduledTriggers.DEFAULT_SCHEDULED_TRIGGER_DELAY_SECONDS, TimeUnit.SECONDS,\n timestamps);\n \n log.info(\"Reconfiguing scheduler to use 4s delay and clearing queue for trigger: {}\", t1.getName());\n config = config.withProperties(Collections.singletonMap\n (AutoScalingParams.TRIGGER_SCHEDULE_DELAY_SECONDS, 4));\n scheduledTriggers.setAutoScalingConfig(config);\n timestamps.clear();\n\n waitForAndDiffTimestamps(\"conf(four sec delay)\", \n 4, TimeUnit.SECONDS, \n timestamps);\n \n log.info(\"Removing trigger: {}\", t1.getName());\n scheduledTriggers.remove(t1.getName());\n \n log.info(\"Reconfiguing scheduler to use default props\");\n config = config.withProperties(ScheduledTriggers.DEFAULT_PROPERTIES);\n scheduledTriggers.setAutoScalingConfig(config);\n\n \n assertTrue(\"Test sanity check, need default thread pool to be at least 3 so we can\" +\n \"test lowering it by 2\", ScheduledTriggers.DEFAULT_TRIGGER_CORE_POOL_SIZE >= 3);\n final int numTriggers = ScheduledTriggers.DEFAULT_TRIGGER_CORE_POOL_SIZE;\n final int reducedThreadPoolSize = numTriggers - 2;\n \n // Setup X instances of a trigger that:\n // - records it's name as being run\n // - skipping all remaining execution if it's name has already been recorded\n // - records the name of the thread that ran it\n // - blocks on a cyclic barrier untill at Y instances have run (to hog a thread)\n // ...to test that the scheduler will add new threads as needed, up to the configured limit\n //\n // NOTE: the reason we need X unique instances is because the scheduler won't \"re-run\" a single\n // trigger while a previouss \"run\" is still in process\n final List<AutoScaling.Trigger> triggerList = new ArrayList<>(numTriggers);\n \n // Use a cyclic barrier gated by an atomic ref so we can swap it out later\n final AtomicReference<CyclicBarrier> latch = new AtomicReference<>(new CyclicBarrier(numTriggers));\n \n // variables for tracking state as we go\n // NOTE: all read/write must be gated by synchronizing on the barrier (ref),\n // so we we can ensure we are reading a consistent view\n final Set<String> threadNames = Collections.synchronizedSet(new LinkedHashSet<>());\n final Set<String> triggerNames = Collections.synchronizedSet(new LinkedHashSet<>());\n final AtomicLong fails = new AtomicLong(0);\n\n // Use a semaphore to track when each trigger *finishes* so our test thread\n // can know when to check & clear the tracking state\n final Semaphore completionSemaphore = new Semaphore(numTriggers);\n \n for (int i = 0; i < numTriggers; i++) {\n AutoScaling.Trigger trigger = new MockTrigger(TriggerEventType.NODELOST,\n \"mock-blocking-trigger-\" + i) {\n @Override\n public void run() {\n log.info(\"Running {} in {}\", this.getName(), Thread.currentThread().getName());\n CyclicBarrier barrier = null;\n synchronized (latch) {\n if (triggerNames.add(this.getName())) {\n log.info(\"{}: No-Op since we've already recorded a run\", this.getName());\n return;\n }\n threadNames.add(Thread.currentThread().getName());\n barrier = latch.get();\n }\n \n try {\n log.info(\"{}: waiting on barrier to hog a thread\", this.getName());\n barrier.await(30, TimeUnit.SECONDS);\n completionSemaphore.release();\n } catch (Exception e) {\n fails.incrementAndGet();\n log.error(this.getName() + \": failure waiting on cyclic barrier: \" + e.toString(), e);\n }\n }\n };\n\n trigger.configure(resourceLoader, solrCloudManager, Collections.emptyMap());\n triggerList.add(trigger);\n completionSemaphore.acquire();\n log.info(\"Adding trigger {} to scheduler\", trigger.getName());\n scheduledTriggers.add(trigger);\n }\n \n log.info(\"Waiting on semaphore for all triggers to signal completion...\");\n assertTrue(\"Timed out waiting for semaphore count to be released\",\n completionSemaphore.tryAcquire(numTriggers, 60, TimeUnit.SECONDS));\n \n synchronized (latch) {\n assertEquals(\"Unexpected number of trigger names found: \" + triggerNames.toString(),\n numTriggers, triggerNames.size());\n assertEquals(\"Unexpected number of thread ames found: \" + threadNames.toString(),\n numTriggers, threadNames.size());\n assertEquals(\"Unexpected number of trigger fails recorded, check logs?\",\n 0, fails.get());\n\n // before releasing the latch, clear the state and update our config to use a lower number of threads\n log.info(\"Updating scheduler config to use {} threads\", reducedThreadPoolSize);\n config = config.withProperties(Collections.singletonMap(AutoScalingParams.TRIGGER_CORE_POOL_SIZE,\n reducedThreadPoolSize));\n scheduledTriggers.setAutoScalingConfig(config);\n\n log.info(\"Updating cyclic barrier and clearing test state so triggers will 'run' again\");\n latch.set(new CyclicBarrier(reducedThreadPoolSize));\n threadNames.clear();\n triggerNames.clear();\n }\n \n log.info(\"Waiting on semaphore for all triggers to signal completion...\");\n assertTrue(\"Timed out waiting for semaphore count to be released\",\n completionSemaphore.tryAcquire(numTriggers, 60, TimeUnit.SECONDS));\n \n synchronized (latch) {\n assertEquals(\"Unexpected number of trigger names found: \" + triggerNames.toString(),\n numTriggers, triggerNames.size());\n assertEquals(\"Unexpected number of thread names found: \" + threadNames.toString(),\n reducedThreadPoolSize, threadNames.size());\n assertEquals(\"Unexpected number of trigger fails recorded, check logs?\",\n 0, fails.get());\n }\n }\n }", "@Test\n public void testDoNotifyCommitWitMultipleStreams() throws Exception {\n AccurevTrigger aMasterTrigger = setupProjectWithTrigger(\"host\", \"8080\", \"stream1\", \"depot\", false);\n AccurevTrigger bMasterTrigger = setupProjectWithTrigger(\"host\", \"8080\", \"stream2\", \"depot\", false);\n AccurevTrigger cMasterTrigger = setupProjectWithTrigger(\"host\", \"8080\", \"stream3\", \"depot\", false);\n\n AccurevStatus spy = Mockito.spy(new AccurevStatus());\n spy.doNotifyCommit(requestWithNoParameters, \"host\", \"8080\", \"stream1,stream2\", \"1\", \"testPrincipal\", \"Updated\");\n\n\n Mockito.verify(spy).doNotifyCommit(requestWithNoParameters, \"host\", \"8080\", \"stream1,stream2\", \"1\", \"testPrincipal\", \"Updated\");\n\n assertEquals(\"HOST: host PORT: 8080 Streams: stream1,stream2\", spy.toString());\n }", "protected void sequence_AT_DEFINE_DefinitionTrigger_TRIGGER(ISerializationContext context, DefinitionTrigger semanticObject) {\n\t\tgenericSequencer.createSequence(context, semanticObject);\n\t}", "@Override\n \tprotected void trigger(TriggerMessage message) {\n \t\tthis.getDataObjectService().saveObject(this.getUniqueProcessId(), message.getProcessInstanceId(), message.getPayload());\n \t\t\n \t\teventDefinition.trigger(message);\n \t\t\n \t\tthis.getNodeInstanceMediatorService().setNodeInstanceEndTime(message.getProcessInstanceId(), new Date());\n \t\t\n\t\tthis.getNodeInstanceMediatorService().setState(\n\t\t\t\tmessage.getProcessInstanceId(),\n\t\t\t\tNodeInstaceStates.PASSED_STATE);\n\t\t\n \t\tthis.getNodeInstanceMediatorService().persistChanges();\n \t\t\n \t\tthis.sendMessageToNodeActor(message, this.getActivatingGatewayNode());\n \t}", "public void trigger() {\n\n\t\tfor (Gadget gadget : getGadgetsToTrigger()) {\n\n\t\t\tgadget.trigger();\n\n\t\t}\n\n\t}", "@Override\n public TestRepositoryTriggersResult testRepositoryTriggers(TestRepositoryTriggersRequest request) {\n request = beforeClientExecution(request);\n return executeTestRepositoryTriggers(request);\n }", "boolean isSimpleTrigger();", "ETriggers getTriggers();", "@Test\n public void shouldThrowsExceptionWhenInnerMethodCallThrowsIt() throws Exception {\n thrown.expect(AccessException.class);\n //given\n // p4ic4idea: use a public, non-abstract class with default constructor\n doThrow(AccessException.AccessExceptionForTests.class).when(server).execMapCmdList(\n eq(TRIGGERS.toString()),\n eq(getCmdArguments),\n eq(null));\n //then\n triggersDelegator.getTriggerEntries();\n }", "public boolean triggersNow()\n\t{\n\t\tif(!this.canTrigger())\n\t\t\treturn false;\n\n\t\tfor(GameObject object: this.game.actualState.stack())\n\t\t\tif(object instanceof StateTriggeredAbility)\n\t\t\t\tif(((StateTriggeredAbility)object).printedVersionID == this.ID)\n\t\t\t\t\treturn false;\n\n\t\tIdentified source = this.getSource(this.state);\n\t\tint controller;\n\t\tif(source.isGameObject())\n\t\t\tcontroller = ((GameObject)source).controllerID;\n\t\telse\n\t\t\t// it's a player\n\t\t\tcontroller = source.ID;\n\t\tfor(GameObject object: this.game.actualState.waitingTriggers.get(controller))\n\t\t\tif((object instanceof StateTriggeredAbility) && (((StateTriggeredAbility)object).printedVersionID == this.ID))\n\t\t\t\treturn false;\n\n\t\tfor(SetGenerator condition: this.triggerConditions)\n\t\t\tif(!condition.evaluate(this.game, this).isEmpty())\n\t\t\t\treturn true;\n\n\t\treturn false;\n\t}", "public TriggerAccess getTrigger () {\n return this.trigger;\n }", "public void triggerAllAggregators() {\n Map<Integer, TimedDataAggregator> aggregatorMap = new HashMap<>();\n aggregatorMap.putAll(FeatureAggregators.getInstance().getAggregatorMap());\n aggregatorMap.putAll(StateAggregators.getInstance().getAggregatorMap());\n aggregatorMap.putAll(ClassificationAggregators.getInstance().getAggregatorMap());\n aggregatorMap.putAll(TrustLevelAggregators.getInstance().getAggregatorMap());\n\n // create shadow loopers for all aggregators\n Map<Integer, ShadowLooper> shadowLooperMap = createShadowLoopers(aggregatorMap);\n\n // set duration according to record\n long duration = record.getRecorder().getStopTimestamp() - record.getRecorder().getStartTimestamp();\n\n // trigger all aggregators\n triggerAggregators(aggregatorMap, shadowLooperMap, duration);\n }", "@Test\n public void ran() {\n List<ChangeSetStatus> changeSets = new ArrayList<>();\n ChangeSet mockChangeSet = Mockito.mock(ChangeSet.class);\n DatabaseChangeLog mockDbChangeLog =\n Mockito.mock(DatabaseChangeLog.class);\n Database mockDatabase = Mockito.mock(Database.class);\n\n LiquibaseMigrationWatcher w = new LiquibaseMigrationWatcher(changeSets);\n\n assertFalse(w.isMigrated());\n assertNull(w.getCurrentVersion());\n\n w.ran(mockChangeSet, mockDbChangeLog, mockDatabase, ExecType.EXECUTED);\n\n assertTrue(w.isMigrated());\n assertSame(mockChangeSet, w.getCurrentVersion());\n }", "@Ignore\n @Test\n public void testDslTriggerCreateUpdatedMergedApprovedPRAllowBranchesWithApproveActionsPipeline() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslTriggerCreateUpdatedMergedApprovedPRAllowBranchesWithApproveActionsPipeline.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n WorkflowJob createdJob = (WorkflowJob) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n PipelineTriggersJobProperty pipelineTriggers = (PipelineTriggersJobProperty) createdJob.getProperty(PipelineTriggersJobProperty.class);\n Map<TriggerDescriptor, Trigger<?>> triggers = pipelineTriggers.getTriggersMap();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Three different triggers expected */\n assertEquals(4, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(4, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestMergedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestApprovedActionFilter\");\n }", "@Ignore\n @Test\n public void testDslServerAllPRAllowedBranchesWithApproveActionsPipeline() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRAllowedBranchesWithApproveActionsPipeline.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n WorkflowJob createdJob = (WorkflowJob) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n PipelineTriggersJobProperty pipelineTriggers = (PipelineTriggersJobProperty) createdJob.getProperty(PipelineTriggersJobProperty.class);\n Map<TriggerDescriptor, Trigger<?>> triggers = pipelineTriggers.getTriggersMap();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Four different triggers expected */\n assertEquals(5, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(5, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n }", "private void fireEvents() {\n\n if (clockTickCount % clockTicksTillWorkloadChange == 0) {\n clockEventPublisher.fireTriggerWorkloadHandlerEvent(clockTickCount, intervalDurationInMilliSeconds);\n }\n\n // if (clockTickCount % clockTicksTillScalingDecision == 0) {\n // clockEventPublisher.fireTriggerAutoScalerEvent(clockTickCount,\n // intervalDurationInMilliSeconds);\n // }\n\n clockEventPublisher.fireClockEvent(clockTickCount, intervalDurationInMilliSeconds);\n\n // INfrastruktur\n if (clockTickCount % clockTicksTillPublishInfrastructureState == 0) {\n clockEventPublisher.fireTriggerPublishInfrastructureStateEvent(clockTickCount,\n intervalDurationInMilliSeconds);\n\n }\n\n // Queue\n if (clockTickCount % clockTicksTillPublishQueueState == 0) {\n\n clockEventPublisher.fireTriggerPublishQueueStateEvent(clockTickCount, intervalDurationInMilliSeconds);\n }\n\n }", "public void trigger() {\n\t\t\n//\t\t #ifdef DEBUG\n\t\t // The sensor should not have been scheduled if it has a NULL\n\t\t // callback function. Be safe and test here.\n\t\t if (func == null) {\n\t\t SoDebugError.post(\"SoSensor::trigger\",\n\t\t \"Cannot trigger a sensor with NULL callback\");\n\t\t return;\n\t\t }\n//\t\t #endif /* DEBUG */\n\t\t \n\t\t // Call the sensor function\n\t\t func.run(funcData, this);\n\t\t \n\t\t }", "Collection<ITrigger> getTriggers();", "@Test\n public void testDslServerAllPRAllowedBranchesWithApproveActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRAllowedBranchesWithApproveActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Four different triggers expected */\n assertEquals(5, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(5, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n }", "@Override\n\tpublic void addSelfTrigger(ISelfTrigger trigger) {\n\t\t\n\t}", "public int[] activateTrigger(int triggerId) {\n\n\t\tint[] triggerResults = {0,0,0,0,0,0,0,0,0,0};\n\t\t\n\t\ttry {\n\t\t\t\n\t\t\tMap<String, String> hm = db.selectTrigger(triggerId);\n\t\t\t\t\n\t\t\tint type = 0;\n\t\t\tint toTriggerId = 0;\t\n\t\t\t\t\t\n\t\t\ttype = Integer.parseInt(hm.get(\"type\"));\n\t\t\ttoTriggerId = Integer.parseInt(hm.get(\"to_trigger_id\"));\n\t\t\t\n\t\t\tswitch (type) {\n\t\t\t\t\t\t\n\t\t\t\tcase DB_TRIGGER_TYPE_ANIM:\t\t\t// an animation is launched\n\t\t\t\t\t\n\t\t\t\t\ttriggerResults[1] = toTriggerId;\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase DB_TRIGGER_TYPE_ACTION:\t// OR a change on items (combination, action, take item on screen...)\n\n\t\t\t\t\ttriggerResults[5] = activateModifier(toTriggerId);\n\t\t\t\t break;\n\n\t\t\t\tcase DB_TRIGGER_TYPE_DOLL:\t// OR move/hide doll\t\n\t\t\t\t\t\n\t\t\t\t\tMap<String, String> hmDoll = db.selectDollTrigger(toTriggerId);\n\t\t\t\t\tif (hmDoll.get(\"to_x\") != null)\t\t\t\ttriggerResults[2] = Integer.parseInt(hmDoll.get(\"to_x\"));\n\t\t\t\t\tif (hmDoll.get(\"doll_is_hidden\") != null)\ttriggerResults[3] = Integer.parseInt(hmDoll.get(\"doll_is_hidden\"));\n\t\t\t\t\tif (hmDoll.get(\"y_velocity\") != null)\t\ttriggerResults[6] = Integer.parseInt(hmDoll.get(\"y_velocity\"));\n\t\t\t\t\t\n\t\t\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 2 \" + hmDoll.get(\"to_x\"));\n\t\t\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 3 \" + hmDoll.get(\"doll_is_hidden\"));\n\t\t\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 6 \" + hmDoll.get(\"y_velocity\"));\n\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase DB_TRIGGER_TYPE_TEXT:\t// show a bubble\n\t\t\t\t\t\n\t\t\t\t\ttriggerResults[4] = toTriggerId;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase DB_TRIGGER_TYPE_SV_ITEM:\t// hide/show item\n\t\t\t\t\t\n\t\t\t\t\ttriggerResults[7] = toTriggerId;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase DB_TRIGGER_TYPE_SV_ANIM:\t// hide/show anim\n\t\t\t\t\t\n\t\t\t\t\ttriggerResults[8] = toTriggerId;\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\n\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 0 \" + hm.get(\"next_trigger_id\"));\n\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 5 \" + triggerResults[5]);\n\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 1, 4, 7 & 8: \" + toTriggerId);\n\t\t\t\n\t\t\tif (hm.get(\"next_trigger_id\") != null)\ttriggerResults[0] = Integer.parseInt(hm.get(\"next_trigger_id\"));\n\t\t\tif (hm.get(\"simultaneous_trigger_id\") != null)\ttriggerResults[9] = Integer.parseInt(hm.get(\"simultaneous_trigger_id\"));\n\t\t\t\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\treturn triggerResults;\n\t}", "public static boolean getTrigger() {\n\t\treturn true;\r\n\t}", "@Test\n public void testDoNotifyCommitWithSingleStream() throws Exception {\n AccurevTrigger aMasterTrigger = setupProjectWithTrigger(\"host\", \"8080\", \"stream1\", \"depot\", false);\n\n AccurevStatus spy = Mockito.spy(new AccurevStatus());\n spy.doNotifyCommit(requestWithNoParameters, \"host\", \"8080\", \"stream1\", \"1\", \"testPrincipal\", \"Updated\");\n\n Mockito.verify(spy).doNotifyCommit(requestWithNoParameters, \"host\", \"8080\", \"stream1\", \"1\", \"testPrincipal\", \"Updated\");\n assertEquals(\"HOST: host PORT: 8080 Streams: stream1\", spy.toString());\n }", "@Test\n public void triggeredForCatalogItemTest() {\n // TODO: test triggeredForCatalogItem\n }", "@Test\n\t@Ignore\n\tpublic void testScheduler() {\n\t\torg.springframework.scheduling.support.CronTrigger trigger = new CronTrigger(\"0 0 0 * * *\");\n\t\tCalendar today = Calendar.getInstance();\n\t\ttoday.add(Calendar.DAY_OF_MONTH, -1);\n\t\tSimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss z\");\n\t\tfinal Date yesterday = today.getTime();\n\t\tString lastMessage = (sdf.format(yesterday)) + \" : [Yesterday]\";\n\t\tlog.debug(lastMessage);\n\t\tDate nextExecution = trigger.nextExecutionTime(\n\t\t\t\tnew TriggerContext() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Date lastScheduledExecutionTime() {\n\t\t\t\t\t\treturn yesterday;\n\t\t\t\t\t}\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Date lastActualExecutionTime() {\n\t\t\t\t\t\treturn yesterday;\n\t\t\t\t\t}\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Date lastCompletionTime() {\n\t\t\t\t\t\treturn yesterday;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\tString nextMessage = sdf.format(nextExecution) + \" : [Execution] \";\n\t\tlog.debug(nextMessage);\n\t}", "public void setTriggers(List<CronTrigger> triggers) {\n this.triggers = triggers;\n\n CronExpression cronExpression;\n List<CronTrigger> schedulableTriggers = new ArrayList<CronTrigger>();\n\n for (CronTrigger cronTrigger : triggers) {\n try {\n cronExpression = new CronExpression(cronTrigger.getCronExpression());\n if (cronExpression.getNextValidTimeAfter(new Date()) == null) {\n // The cron expression is valid, but will never trigger.\n LOG.info(cronTrigger.getCronExpression() + \" not valid cronexpression. The job will not be scheduled.\");\n continue;\n }\n }\n catch (ParseException e) {\n LOG.info(cronTrigger.getCronExpression() + \" not valid cronexpression. The job will not be scheduled.\");\n continue;\n }\n schedulableTriggers.add(cronTrigger);\n }\n super.setTriggers(schedulableTriggers.toArray(new CronTrigger[0]));\n }", "@Test\n public void testDslServerAllPRActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Five different triggers expected */\n assertEquals(5, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(5, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "public interface TriggerService {\n\n /**\n * 获取所有的问题触发器ids\n * @return\n * @throws ServiceException\n */\n List<String> getProblemTriggerIds() throws ServiceException;\n\n <T> List<T> listTrigger(TriggerGetRequest triggerGetRequest, Class<T> clazz);\n\n /**\n * 根据 request 获取触发器数量\n * @return\n * @throws ServiceException\n */\n int countTrigger(TriggerGetRequest request) throws ServiceException;\n/*\nzabbix 方法\n */\n /**\n *\n * @return\n * @throws ServiceException\n */\n List<DashboardProblemVO> listBriefProblems() throws ServiceException;\n\n /**\n * 根据 triggerIds 查询对应的 triggerDTOS selectHost\n * @param triggerIds\n * @return\n * @throws ServiceException\n */\n List<BriefTriggerDTO> getTriggersByTriggerIds(List<String> triggerIds ) throws ServiceException;\n /**\n * 根据itemIds获取监控中的 trggierDTO list\n * @param itemIds\n * @return\n * @throws ServiceException\n */\n List<BriefTriggerDTO> getTriggersByItemIds(List<String> itemIds) throws ServiceException;\n\n /**\n * 列出所有触发器 排除依赖 触发器 BriefTriggerDTOS\n * @return\n * @throws ServiceException\n */\n List<BriefTriggerDTO> listTriggersSkipDependent() throws ServiceException;\n\n /**\n * 列出问题触发器 BriefTriggerDTOS\n * @return\n * @throws ServiceException\n */\n List<BriefTriggerDTO> listProblemTriggers() throws ServiceException;\n\n /**\n * 问题管理 问题列表 ProblemListVO\n * @return\n * @throws ServiceException\n */\n List<ProblemListVO> listProblemListVO() throws ServiceException;\n\n /**\n * 问题管理 问题详情 基础静态信息 ProblemDetailVO\n * @return\n * @throws ServiceException\n */\n ProblemDetailVO getProblemDetailVOByTriggerId(String triggerId) throws ServiceException;\n\n}", "@Test\n public void testDslServerAllPRActionsPipeline() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRActionsPipeline.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n WorkflowJob createdJob = (WorkflowJob) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n PipelineTriggersJobProperty pipelineTriggers = (PipelineTriggersJobProperty) createdJob.getProperty(PipelineTriggersJobProperty.class);\n Map<TriggerDescriptor, Trigger<?>> triggers = pipelineTriggers.getTriggersMap();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Five different triggers expected */\n assertEquals(5, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(5, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "@Before\n public void setup() {\n context.build().resource(OAK_INDEX).commit();\n context.registerService(Scheduler.class,scheduler);\n context.registerService(RequireAem.class,requireAem,\"distribution\",\"classic\");\n\n ScheduleOptions options = mock(ScheduleOptions.class);\n lenient().when(scheduler.NOW()).thenReturn(options);\n lenient().when(scheduler.schedule(any(), any())).thenAnswer((InvocationOnMock invocation) -> {\n EnsureOakIndexJobHandler handler = invocation.getArgument(0);\n handler.run();\n return true;\n });\n\n context.registerService(ChecksumGenerator.class, new ChecksumGeneratorImpl());\n \n ensureOakIndexManagerProperties = new HashMap<>();\n ensureOakIndexManagerProperties.put(\"properties.ignore\", null);\n \n }", "@Test\n public void testDslTriggerCreateUpdatedMergedApprovedPRAllowBranchesActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslTriggerCreateUpdatedMergedDeclinedApprovedPRAllowBranchesActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Five different triggers expected */\n assertEquals(5, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(5, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestMergedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestDeclinedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestApprovedActionFilter\");\n }", "public Trigger getTrigger() {\n \t\treturn trigger;\n \t}", "public void trigger(Event event);", "public void execute(RecordTriggerContext recordTriggerContext) {\n LogService logService = ServiceLocator.locate(LogService.class);\n /*\n * Get an instance of the User Defined Service we created.\n * User defined Services are used similarly to Vault SDK services.\n * User Defined Services don't contribute to the memory limit after the method has exited.\n */\n ProductSearchUserDefinedService productSearchUserDefinedService = ServiceLocator.locate(ProductSearchUserDefinedService.class);\n\n /*\n * Get an instance of the PickList Service used to retrieve picklist values.\n * More information about hor to retrive picklist values can be found here:\n * https://repo.veevavault.com/javadoc/vault-sdk-api/20.1.0/docs/api/com/veeva/vault/sdk/api/picklist/package-summary.html\n */\n PicklistService picklistService = ServiceLocator.locate(PicklistService.class);\n // Picklist of bicycle parts in bicycle part orders\n Picklist bicyclePartPicklist = picklistService.getPicklist(\"bicycle_part__c\");\n // Picklist of bicycle part manufacturers in bicycle part orders\n Picklist bicyclePartManufacturersPicklist = picklistService.getPicklist(\"bicycle_part_manufacturer__c\");\n\n @SuppressWarnings(\"unchecked\")\n Map<String, String> partAndManufacturerMap = VaultCollections.newMap();\n @SuppressWarnings(\"unchecked\")\n Map<String, BigDecimal> orderQuantityMap = VaultCollections.newMap();\n\n recordTriggerContext.getRecordChanges().forEach(recordChange -> {\n\n // Initialize part name and manufacture name strings\n String bicyclePartName = \"\";\n String bicyclePartManufacturerName = \"\";\n\n // Get the bicycle parts pick list values\n List<String> bicyclePartsListValues = recordChange.getNew().getValue(\"bicycle_part__c\", ValueType.PICKLIST_VALUES);\n\n // Get the name(label) of the bicycle part using the bicyclePartPickList\n if (bicyclePartsListValues != null && !bicyclePartsListValues.isEmpty()) {\n //Get single-picklist value name selected by user\n String partPicklistValueName = bicyclePartsListValues.get(0);\n //Get picklist value label\n bicyclePartName = bicyclePartPicklist.getPicklistValue(partPicklistValueName).getLabel();\n }\n\n // Get the name(label) of the bicycle part manufacturer using the bicyclePartManufacturerPickList\n List<String> bicyclePartManufacturersListValues = recordChange.getNew().getValue(\"bicycle_part_manufacturer__c\", ValueType.PICKLIST_VALUES);\n if (bicyclePartManufacturersListValues != null && !bicyclePartManufacturersListValues.isEmpty()) {\n //Get single-picklist value name selected by user\n String partManufacturerPicklistValueName = bicyclePartManufacturersListValues.get(0);\n //Get picklist value label\n bicyclePartManufacturerName = bicyclePartManufacturersPicklist.getPicklistValue(partManufacturerPicklistValueName).getLabel();\n }\n\n // If the bicycle part name or the manufacturer name are null or empty, then throw an error.\n if((bicyclePartName == null || bicyclePartName.isEmpty()) ||\n (bicyclePartManufacturerName == null || bicyclePartManufacturerName.isEmpty())) {\n recordChange.setError(\"INVALID_ARGUMENT\", \"Product with specified manufacturer does not exist.\");\n }\n\n // Get the order quantity\n BigDecimal orderQuantity = recordChange.getNew().getValue(\"order_quantity__c\", ValueType.NUMBER);\n\n // Add part name, part manufacturer name and order quantity to maps\n partAndManufacturerMap.put(\"'\" + bicyclePartName + \"'\", \"'\" + bicyclePartManufacturerName + \"'\");\n orderQuantityMap.put(bicyclePartName, orderQuantity);\n });\n logService.logResourceUsage(\"Before doesProductExist Method Call: \");\n Map<String, BicyclePartData> doProductsExist = productSearchUserDefinedService.doesProductExist(partAndManufacturerMap);\n logService.logResourceUsage(\"After doesProductExist Method Call: \" );\n\n // Validate that all user entered bicycle part name were found, if not setError on the record change.\n for (RecordChange recordChange : recordTriggerContext.getRecordChanges()) {\n // If no results were found, all user inputted products and manufacturer combinations are wrong.\n if (doProductsExist == null) {\n recordChange.setError(\"INVALID_ARGUMENT\", \"Product with specified manufacturer does not exist.\");\n continue;\n }\n\n // Get the bicycle parts pick list values\n List<String> bicyclePartsListValues = recordChange.getNew().getValue(\"bicycle_part__c\", ValueType.PICKLIST_VALUES);\n\n String bicyclePartName = \"\";\n // Get the name(label) of the bicycle part using the bicyclePartPickList\n if (bicyclePartsListValues != null && !bicyclePartsListValues.isEmpty()) {\n //Get single-picklist value name selected by user\n String partPicklistValueName = bicyclePartsListValues.get(0);\n //Get picklist value label\n bicyclePartName = bicyclePartPicklist.getPicklistValue(partPicklistValueName).getLabel();\n }\n\n if (bicyclePartName != null && !doProductsExist.get(bicyclePartName).getIdExists()) { // If Id of bicycle part is found then it exists\n // setError if the user specified bicycle part's record was not found.\n recordChange.setError(\"INVALID_ARGUMENT\", \"Product with specified manufacturer does not exist.\");\n }\n }\n\n // Reduce the quantity for the bicycle parts that we are creating an order for.\n if(doProductsExist != null) {\n logService.logResourceUsage(\"Before reduceProductQuantity Method Call: \");\n productSearchUserDefinedService.reduceProductQuantity(doProductsExist.values(), orderQuantityMap);\n logService.logResourceUsage(\"After reduceProductQuantity Method Call: \");\n }\n logService.logResourceUsage(\"End: \");\n }", "private void trigger() {\n\t\t\tif (repeatState == REPEAT_ADD) {\n\t\t\t\tadd();\n\t\t\t}\n\t\t\tif (repeatState == REPEAT_SUBTRACT) {\n\t\t\t\tsubtract();\n\t\t\t}\n\t\t}", "TriggerType createTriggerType();", "boolean hasTriggerFulfillment();", "@Test\n public void testDslTriggerCreateUpdatedApprovedPRActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslTriggerCreateUpdatedApprovedPRActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Three different triggers expected */\n assertEquals(3, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(3, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestApprovedActionFilter\");\n }", "ITrigger getTrigger(String sTriggerName);", "public void onTriggerChange() {\n findViewById(R.id.temp).post(new Runnable() {\n public void run() {\n ConsumerIrManager mCIR = ScaryUtil.getConsumerIRService(getApplicationContext());\n if (m_Inst.power) {\n TransmissionCode data = ScaryUtil.getIRCode(m_Inst.sequence, m_Inst.temp); // (TransmissionCode)samsung.get(m_Inst.temp);\n ScaryUtil.transmit(getApplicationContext(),data);\n }\n }\n });\n }", "@Test\n public void launchesEventhandlerUpdatelastmodificationTest() {\n // TODO: test launchesEventhandlerUpdatelastmodification\n }", "public interface ModelTrigger{\n\n\t/** Start's the simulation. */\n\tpublic void startSimulation();\n\n\t/** Stop's the simulation. */\n\tpublic void stopSimulation();\n\n\t/** Return true if the simulation is running. */\n\tpublic boolean isRunning();\n}", "@Test\n public void testNear()\n {\n String sName = \"near-client-listener\";\n generateEvents(sName);\n checkEvents(true, false);\n }", "@PostConstruct\n public void initTriggerEvaluateRunning() {\n this.triggerRepository.findAll().forEach(trigger -> {\n if (trigger.getEvaluateRunningDate() != null) {\n var unlocked = trigger.toBuilder().evaluateRunningDate(null).build();\n this.triggerRepository.save(unlocked);\n }\n });\n }", "protected void loadTrigger() {\n this.keyTrigger = getContentAssistTrigger();\n }", "public void trigger(PromiseManager pm) {\n\tthrow new SubclassResponsibilityException();\n/*\nudanax-top.st:15949:DetectorEvent methodsFor: 'triggering'!\n{void} trigger: pm {PromiseManager}\n\t\"Send the message across the wire.\"\n\t\n\tself subclassResponsibility!\n*/\n}", "@Test\n public void testDslServerAllPRUnfilteredAndAllowedBranchesActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRUnfilteredAndAllowedBranchesActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Twelve different triggers expected */\n assertEquals(12, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(5).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(6).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(7).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(8).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(9).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(10).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(11).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(12, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(5), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n\n assertEquals(dispNames.get(6), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(7), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(8), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(9), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(10), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(11), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "@Test\n public void testDslServerAllPRAllowedBranchesActionsPipeline() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRAllowedBranchesActionsPipeline.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n WorkflowJob createdJob = (WorkflowJob) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n PipelineTriggersJobProperty pipelineTriggers = (PipelineTriggersJobProperty) createdJob.getProperty(PipelineTriggersJobProperty.class);\n Map<TriggerDescriptor, Trigger<?>> triggers = pipelineTriggers.getTriggersMap();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Six different triggers expected */\n assertEquals(6, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(5).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(6, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(5), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "@Test\n public void testDslTriggerCreateUpdatedMergedApprovedPRAllowBranchesWithApproveActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslTriggerCreateUpdatedMergedApprovedPRAllowBranchesWithApproveActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Three different triggers expected */\n assertEquals(4, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(4, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestMergedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestApprovedActionFilter\");\n }", "@Test\n public void notifications() throws Exception {\n List<String> log = new ArrayList<>();\n\n fieldCfg.listen(ctx -> {\n log.add(\"update\");\n\n return completedFuture(null);\n });\n\n fieldCfg.joinTimeout().listen(ctx -> {\n log.add(\"join\");\n\n return completedFuture(null);\n });\n\n fieldCfg.failureDetectionTimeout().listen(ctx -> {\n log.add(\"failure\");\n\n return completedFuture(null);\n });\n\n fieldCfg.change(change -> change.changeJoinTimeout(1000_000)).get(1, TimeUnit.SECONDS);\n\n assertEquals(List.of(\"update\", \"join\"), log);\n\n log.clear();\n\n fieldCfg.failureDetectionTimeout().update(2000_000).get(1, TimeUnit.SECONDS);\n\n assertEquals(List.of(\"update\", \"failure\"), log);\n }", "@Test\n public void testDslServerAllPRAllowedBranchesActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRAllowedBranchesActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Six different triggers expected */\n assertEquals(6, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(5).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(6, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(5), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "boolean containsTrigger(String sTriggerName);", "public void mock(){\n\n }", "public T caseTrigger(Trigger object) {\r\n\t\treturn null;\r\n\t}", "private void processCreateTrigger() throws HsqlException {\n\n Table t;\n boolean isForEach;\n boolean isNowait;\n int queueSize;\n String triggerName;\n boolean isQuoted;\n String sWhen;\n String sOper;\n String tableName;\n String token;\n String className;\n TriggerDef td;\n Trigger o;\n\n triggerName = tokenizer.getName();\n\n String schemaname = tokenizer.getLongNameFirst();\n\n database.schemaManager.checkTriggerExists(triggerName,\n session.getSchemaNameForWrite(schemaname), false);\n\n isQuoted = tokenizer.wasQuotedIdentifier();\n isForEach = false;\n isNowait = false;\n queueSize = TriggerDef.getDefaultQueueSize();\n sWhen = tokenizer.getSimpleToken();\n sOper = tokenizer.getSimpleToken();\n\n tokenizer.getThis(Token.T_ON);\n\n tableName = tokenizer.getName();\n\n if (schemaname == null) {\n schemaname =\n session.getSchemaNameForWrite(tokenizer.getLongNameFirst());\n } else if (!schemaname.equals(\n session.getSchemaNameForWrite(tokenizer.getLongNameFirst()))) {\n throw Trace.error(Trace.INVALID_SCHEMA_NAME_NO_SUBCLASS);\n }\n\n t = database.schemaManager.getUserTable(session, tableName,\n schemaname);\n\n if (t.isView()) {\n throw Trace.error(Trace.NOT_A_TABLE);\n }\n\n session.setScripting(true);\n\n // \"FOR EACH ROW\" or \"CALL\"\n token = tokenizer.getSimpleToken();\n\n if (token.equals(Token.T_FOR)) {\n token = tokenizer.getSimpleToken();\n\n if (token.equals(Token.T_EACH)) {\n token = tokenizer.getSimpleToken();\n\n if (token.equals(Token.T_ROW)) {\n isForEach = true;\n\n // should be 'NOWAIT' or 'QUEUE' or 'CALL'\n token = tokenizer.getSimpleToken();\n } else {\n throw Trace.error(Trace.UNEXPECTED_END_OF_COMMAND, token);\n }\n } else {\n throw Trace.error(Trace.UNEXPECTED_END_OF_COMMAND, token);\n }\n }\n\n if (token.equals(Token.T_NOWAIT)) {\n isNowait = true;\n\n // should be 'CALL' or 'QUEUE'\n token = tokenizer.getSimpleToken();\n }\n\n if (token.equals(Token.T_QUEUE)) {\n queueSize = tokenizer.getInt();\n\n // should be 'CALL'\n token = tokenizer.getSimpleToken();\n }\n\n if (!token.equals(Token.T_CALL)) {\n throw Trace.error(Trace.UNEXPECTED_END_OF_COMMAND, token);\n }\n\n className = tokenizer.getSimpleName();\n\n if (!tokenizer.wasQuotedIdentifier()) {\n throw Trace.error(Trace.UNEXPECTED_END_OF_COMMAND, className);\n }\n\n HsqlName name = database.nameManager.newHsqlName(triggerName,\n isQuoted);\n\n td = new TriggerDef(name, sWhen, sOper, isForEach, t, className,\n isNowait, queueSize, database.classLoader);\n\n t.addTrigger(td);\n\n if (td.isValid()) {\n try {\n\n // start the trigger thread\n td.start();\n } catch (Exception e) {\n throw Trace.error(Trace.UNKNOWN_FUNCTION, e.toString());\n }\n }\n\n database.schemaManager.registerTriggerName(triggerName, t.getName());\n\n// --\n }", "private void processWTBy(WasTriggeredBy dep) {\n\n\t}", "@Test\n public void testDslTriggerIsToApprovePushActionFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslTriggerIsToApprovePushActionFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n boolean isToApprove = false;\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n assertEquals(1, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n BitBucketPPRRepositoryPushActionFilter tmp3 = (BitBucketPPRRepositoryPushActionFilter) tmp2.getTriggers().get(0).getActionFilter();\n isToApprove = tmp3.shouldSendApprove();\n }\n assertEquals(1, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRRepositoryPushActionFilter\");\n assertTrue(isToApprove);\n }", "@Test\n public void shouldReturnEmptyTriggerEntriesWhenResultMapsIsNull() throws Exception {\n shouldReturnEmptyTriggerEntries(new UnitTestGiven() {\n @Override\n public void given() throws P4JavaException {\n when(server.execMapCmdList(\n eq(TRIGGERS.toString()),\n eq(getCmdArguments),\n eq(null))).thenReturn(null);\n }\n });\n }", "@Test\n public void testDslServerAllPRUnfilteredAndAllowedBranchesActionsPipeline() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRUnfilteredAndAllowedBranchesActionsPipeline.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n WorkflowJob createdJob = (WorkflowJob) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n PipelineTriggersJobProperty pipelineTriggers = (PipelineTriggersJobProperty) createdJob.getProperty(PipelineTriggersJobProperty.class);\n Map<TriggerDescriptor, Trigger<?>> triggers = pipelineTriggers.getTriggersMap();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Eleven different triggers expected */\n assertEquals(11, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(5).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(6).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(7).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(8).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(9).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(10).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(11, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(5), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(6), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(7), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(8), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(9), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(10), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "boolean isTriggerPersistent(String sTriggerName);", "private void fireBatteryStatus(String trigger)\n\t{\n\t\tfireBatteryStatus(batteryLevel, isPowerConnected, trigger, null);\n\t}", "public void addTriggers(Map<String, Object> map) {\n }", "@Test\n public void testUnimplementedMethods() {\n List<ChangeSetStatus> changeSets = new ArrayList<>();\n LiquibaseMigrationWatcher w = new LiquibaseMigrationWatcher(changeSets);\n Change mockChange = Mockito.mock(Change.class);\n ChangeSet mockChangeSet = Mockito.mock(ChangeSet.class);\n DatabaseChangeLog mockDbChangeLog =\n Mockito.mock(DatabaseChangeLog.class);\n Database mockDatabase = Mockito.mock(Database.class);\n PreconditionFailedException mockPFE =\n Mockito.mock(PreconditionFailedException.class);\n PreconditionErrorException mockPEE =\n Mockito.mock(PreconditionErrorException.class);\n\n w.willRun(mockChangeSet, mockDbChangeLog, mockDatabase,\n RunStatus.MARK_RAN);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n\n w.willRun(mockChange, mockChangeSet, mockDbChangeLog, mockDatabase);\n Mockito.verifyNoMoreInteractions(mockChange);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n\n w.ran(mockChangeSet, mockDbChangeLog, mockDatabase, ExecType.EXECUTED);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n\n w.ran(mockChange, mockChangeSet, mockDbChangeLog, mockDatabase);\n Mockito.verifyNoMoreInteractions(mockChange);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n\n w.rolledBack(mockChangeSet, mockDbChangeLog, mockDatabase);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n\n w.runFailed(mockChangeSet, mockDbChangeLog, mockDatabase, mockPEE);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n Mockito.verifyNoMoreInteractions(mockPEE);\n\n w.preconditionFailed(mockPFE, FailOption.HALT);\n Mockito.verifyNoMoreInteractions(mockPFE);\n\n w.preconditionErrored(mockPEE, ErrorOption.HALT);\n Mockito.verifyNoMoreInteractions(mockPEE);\n }", "private TriggerUtils() {\n }", "@Property(\"triggerAction\")\n String getTriggerAction();", "public void preFire(){\n\t}", "@Override\n public void triggerProbe(DeviceId deviceId) {\n }", "public interface TriggerContext {\n\n /**\n * Return the last <i>scheduled</i> execution time of the task, or.\n *\n * @return the date\n * {@code null} if not scheduled before.\n */\n Date lastScheduledExecutionTime();\n\n /**\n * Return the last <i>actual</i> execution time of the task, or {@code null}\n * if not scheduled before.\n *\n * @return the date\n */\n Date lastActualExecutionTime();\n\n /**\n * Return the last completion time of the task, or {@code null} if not\n * scheduled before.\n *\n * @return the date\n */\n Date lastCompletionTime();\n}", "public boolean trigger (String name) {\n final TriggerReference trigger = module.getTrigger(name);\n if (trigger == null) {\n Logger.missing(\"TriggerReference\", name);\n return false;\n } else {\n return trigger.get();\n }\n }", "@Override\n public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {\n if (!canRun()) {\n return null;\n }\n return super.schedule(task, trigger);\n }", "@Test\n public void testRwbmInternalBoth()\n {\n generateEvents(\"dist-rwbm-internal-both\");\n checkEvents(true, true);\n }", "@Test\n public void testRegisterTrigger_NoServerSetup_NoErrors() throws Exception {\n Assume.assumeTrue(AdServicesInfo.INSTANCE.version() >= 5);\n\n assertThat(mMeasurementManager.registerTriggerAsync(TRIGGER_REGISTRATION_URI).get())\n .isNotNull();\n }", "public void sendTestFutureNotification() {\n\n }", "@Test\n public void testDslMultipleJobsInSeedVarious() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslMultipleJobsInSeedVarious.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job1\");\n WorkflowJob createdPipelineJob;\n PipelineTriggersJobProperty pipelineTriggers;\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n assertEquals(1, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(1, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestCreatedActionFilter\");\n\n /* Verify second job content */\n createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job2\");\n /* Go through all triggers to validate DSL */\n triggers = createdJob.getTriggers();\n assertEquals(1, triggers.size());\n dispNames.clear();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n assertEquals(1, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(1, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestUpdatedActionFilter\");\n\n /* Verify third job content */\n createdPipelineJob = (WorkflowJob) j.getInstance().getItem(\"test-job3\");\n /* Go through all triggers to validate DSL */\n pipelineTriggers = (PipelineTriggersJobProperty) createdPipelineJob.getProperty(PipelineTriggersJobProperty.class);\n triggers = pipelineTriggers.getTriggersMap();\n assertEquals(1, triggers.size());\n dispNames.clear();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n assertEquals(2, tmp2.getTriggers().size());\n String tmpName = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpName.substring(tmpName.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpName = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpName.substring(tmpName.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(2, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRRepositoryPushActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestCommentDeletedActionFilter\");\n }", "boolean isAlreadyTriggered();" ]
[ "0.68646234", "0.6657912", "0.66340166", "0.6497036", "0.6462506", "0.63940775", "0.63810295", "0.6317664", "0.63040847", "0.6251105", "0.6196133", "0.619544", "0.6147868", "0.60678947", "0.6019345", "0.5991254", "0.5987018", "0.5944322", "0.59162253", "0.5892377", "0.58923393", "0.5889937", "0.5889845", "0.58801144", "0.58715594", "0.5856232", "0.5850014", "0.5842487", "0.58400965", "0.58032453", "0.5775392", "0.5767945", "0.5744964", "0.5737253", "0.5721623", "0.57139885", "0.5704159", "0.57015586", "0.5687427", "0.5682076", "0.56584126", "0.56543815", "0.56495756", "0.56308866", "0.5629386", "0.5613097", "0.56028944", "0.56005526", "0.55870605", "0.55863386", "0.5565536", "0.5564817", "0.556364", "0.5559474", "0.55557585", "0.55530775", "0.5552785", "0.5541456", "0.55362576", "0.55145496", "0.55103695", "0.5480469", "0.5478716", "0.5471271", "0.5469394", "0.5466134", "0.5453018", "0.5448734", "0.54484445", "0.5440245", "0.5438929", "0.543355", "0.5424994", "0.53850305", "0.53817403", "0.53717405", "0.53560597", "0.5355085", "0.53550553", "0.53500384", "0.53482455", "0.53422064", "0.53414094", "0.5330741", "0.5327445", "0.5311706", "0.53063524", "0.53033245", "0.5297801", "0.5295818", "0.52917486", "0.52809703", "0.52780926", "0.5271121", "0.524975", "0.5243583", "0.5240925", "0.5239112", "0.5236217", "0.5231415" ]
0.56991965
38
TODO : Find a way to mock the triggers
@Test public void testDoNotifyCommitWitMultipleStreams() throws Exception { AccurevTrigger aMasterTrigger = setupProjectWithTrigger("host", "8080", "stream1", "depot", false); AccurevTrigger bMasterTrigger = setupProjectWithTrigger("host", "8080", "stream2", "depot", false); AccurevTrigger cMasterTrigger = setupProjectWithTrigger("host", "8080", "stream3", "depot", false); AccurevStatus spy = Mockito.spy(new AccurevStatus()); spy.doNotifyCommit(requestWithNoParameters, "host", "8080", "stream1,stream2", "1", "testPrincipal", "Updated"); Mockito.verify(spy).doNotifyCommit(requestWithNoParameters, "host", "8080", "stream1,stream2", "1", "testPrincipal", "Updated"); assertEquals("HOST: host PORT: 8080 Streams: stream1,stream2", spy.toString()); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public abstract void onTrigger();", "public void trigger(List<Entity> _trigger){\n\t\tif(event!=null){\n\t\t\tevent.activate(System.currentTimeMillis(), _trigger);\n\t\t}\n\t}", "void trigger();", "private boolean triggered() {\n\t\treturn true;\n\t}", "public interface TriggerHandler {\n\n String handleTrigger(String stateJson, Collection<Subscription> subscriptions, String cfgJson);\n\n String getTriggerType();\n\n}", "public abstract void setTriggers(Map<String, Trigger> triggers);", "protected abstract void createTriggerOrAction();", "void trigger(Entity e);", "public abstract Map<String, Trigger> getTriggers();", "public void trigger(Fact fact) {\n\t\t\n\t}", "public void executeTrigger(Object object);", "Set getTriggers();", "@Override\n\t\tvoid runCommand() {\n\t\t\ttrigger.execute();\n\t\t}", "@Override\r\n\t\tpublic Object trigger(Object... objects) {\n\t\t\tSystem.out.println(\"do,it\");\r\n\t\t\treturn null;\r\n\t\t}", "@Test\n public void trigger() throws FlywayException {\n flyway.setLocations(\"migration/dbsupport/oracle/sql/trigger\");\n flyway.migrate();\n flyway.clean();\n flyway.migrate();\n }", "@Override\n\tprotected boolean on_trigger_activated(String trigger_name) {\n\t\treturn false;\n\t}", "public List<Trigger> getTriggers();", "public abstract void setTriggerOrAction();", "public abstract boolean isTrigger();", "public interface EnchantmentTrigger {}", "boolean getUserChooseTrigger();", "@SuppressWarnings(\"unchecked\")\n @Before\n public void beforeEach()\n throws AccessException, RequestException, ConnectionException {\n server = mock(Server.class);\n triggersDelegator = new TriggersDelegator(server);\n resultMap = mock(Map.class);\n resultMap2 = mock(Map.class);\n resultMaps = List.of(resultMap, resultMap2);\n\n entryList = new ArrayList<>();\n ITriggerEntry triggerEntry = mock(ITriggerEntry.class);\n entryList.add(triggerEntry);\n\n when(server.execMapCmdList(eq(TRIGGERS.toString()), eq(getCmdArguments), eq(null)))\n .thenReturn(resultMaps);\n }", "@Test\n public void shouldReturnNonEmptyTriggerEntries() throws Exception {\n //given\n when(resultMap.get(TRIGGERS_KEY + 0)).thenReturn(\"my entry value 0\");\n when(resultMap.get(TRIGGERS_KEY + 1)).thenReturn(\"my entry value 1\");\n givenNoHandleErrorMap(resultMap);\n when(resultMap2.get(TRIGGERS_KEY + 0)).thenReturn(\"my entry2 value 0\");\n when(resultMap2.get(TRIGGERS_KEY + 1)).thenReturn(\"my entry2 value 1\");\n when(resultMap2.get(TRIGGERS_KEY + 2)).thenReturn(\"my entry2 value 2\");\n givenNoHandleErrorMap(resultMap2);\n //when\n List<ITriggerEntry> triggerEntries = triggersDelegator.getTriggerEntries();\n //then\n assertThat(triggerEntries.size(), is(5));\n assertThat(triggerEntries.get(1).getOrder(), is(1));\n assertThat(triggerEntries.get(4).getOrder(), is(2));\n }", "public abstract void handleMatching(EventBean[] triggerEvents, EventBean[] matchingEvents);", "protected TriggerFactory getTriggerFactory() {\n\t\treturn this.triggerFactory;\n\t}", "public void testSetProperties() throws Exception {\n final JettySolrRunner runner = cluster.getJettySolrRunner(0);\n final SolrResourceLoader resourceLoader = runner.getCoreContainer().getResourceLoader();\n final SolrCloudManager solrCloudManager = runner.getCoreContainer().getZkController().getSolrCloudManager();\n \n try (ScheduledTriggers scheduledTriggers = new ScheduledTriggers(resourceLoader, solrCloudManager)) {\n AutoScalingConfig config = new AutoScalingConfig(Collections.emptyMap());\n scheduledTriggers.setAutoScalingConfig(config);\n\n // Setup a trigger that records the timestamp of each time it was run\n // we only need 2 timestamps for the test, so limit the queue and make the trigger a No-Op if full\n final BlockingQueue<Long> timestamps = new ArrayBlockingQueue<Long>(2);\n final AutoScaling.Trigger t1 = new MockTrigger(TriggerEventType.NODELOST, \"mock-timestamper\") {\n @Override\n public void run() {\n log.info(\"Running {} in {}\", this.getName(), Thread.currentThread().getName());\n timestamps.offer(solrCloudManager.getTimeSource().getTimeNs());\n }\n };\n\n log.info(\"Configuring simple scheduler and adding trigger: {}\", t1.getName());\n t1.configure(resourceLoader, solrCloudManager, Collections.emptyMap());\n scheduledTriggers.add(t1);\n\n waitForAndDiffTimestamps(\"conf(default delay)\",\n ScheduledTriggers.DEFAULT_SCHEDULED_TRIGGER_DELAY_SECONDS, TimeUnit.SECONDS,\n timestamps);\n \n log.info(\"Reconfiguing scheduler to use 4s delay and clearing queue for trigger: {}\", t1.getName());\n config = config.withProperties(Collections.singletonMap\n (AutoScalingParams.TRIGGER_SCHEDULE_DELAY_SECONDS, 4));\n scheduledTriggers.setAutoScalingConfig(config);\n timestamps.clear();\n\n waitForAndDiffTimestamps(\"conf(four sec delay)\", \n 4, TimeUnit.SECONDS, \n timestamps);\n \n log.info(\"Removing trigger: {}\", t1.getName());\n scheduledTriggers.remove(t1.getName());\n \n log.info(\"Reconfiguing scheduler to use default props\");\n config = config.withProperties(ScheduledTriggers.DEFAULT_PROPERTIES);\n scheduledTriggers.setAutoScalingConfig(config);\n\n \n assertTrue(\"Test sanity check, need default thread pool to be at least 3 so we can\" +\n \"test lowering it by 2\", ScheduledTriggers.DEFAULT_TRIGGER_CORE_POOL_SIZE >= 3);\n final int numTriggers = ScheduledTriggers.DEFAULT_TRIGGER_CORE_POOL_SIZE;\n final int reducedThreadPoolSize = numTriggers - 2;\n \n // Setup X instances of a trigger that:\n // - records it's name as being run\n // - skipping all remaining execution if it's name has already been recorded\n // - records the name of the thread that ran it\n // - blocks on a cyclic barrier untill at Y instances have run (to hog a thread)\n // ...to test that the scheduler will add new threads as needed, up to the configured limit\n //\n // NOTE: the reason we need X unique instances is because the scheduler won't \"re-run\" a single\n // trigger while a previouss \"run\" is still in process\n final List<AutoScaling.Trigger> triggerList = new ArrayList<>(numTriggers);\n \n // Use a cyclic barrier gated by an atomic ref so we can swap it out later\n final AtomicReference<CyclicBarrier> latch = new AtomicReference<>(new CyclicBarrier(numTriggers));\n \n // variables for tracking state as we go\n // NOTE: all read/write must be gated by synchronizing on the barrier (ref),\n // so we we can ensure we are reading a consistent view\n final Set<String> threadNames = Collections.synchronizedSet(new LinkedHashSet<>());\n final Set<String> triggerNames = Collections.synchronizedSet(new LinkedHashSet<>());\n final AtomicLong fails = new AtomicLong(0);\n\n // Use a semaphore to track when each trigger *finishes* so our test thread\n // can know when to check & clear the tracking state\n final Semaphore completionSemaphore = new Semaphore(numTriggers);\n \n for (int i = 0; i < numTriggers; i++) {\n AutoScaling.Trigger trigger = new MockTrigger(TriggerEventType.NODELOST,\n \"mock-blocking-trigger-\" + i) {\n @Override\n public void run() {\n log.info(\"Running {} in {}\", this.getName(), Thread.currentThread().getName());\n CyclicBarrier barrier = null;\n synchronized (latch) {\n if (triggerNames.add(this.getName())) {\n log.info(\"{}: No-Op since we've already recorded a run\", this.getName());\n return;\n }\n threadNames.add(Thread.currentThread().getName());\n barrier = latch.get();\n }\n \n try {\n log.info(\"{}: waiting on barrier to hog a thread\", this.getName());\n barrier.await(30, TimeUnit.SECONDS);\n completionSemaphore.release();\n } catch (Exception e) {\n fails.incrementAndGet();\n log.error(this.getName() + \": failure waiting on cyclic barrier: \" + e.toString(), e);\n }\n }\n };\n\n trigger.configure(resourceLoader, solrCloudManager, Collections.emptyMap());\n triggerList.add(trigger);\n completionSemaphore.acquire();\n log.info(\"Adding trigger {} to scheduler\", trigger.getName());\n scheduledTriggers.add(trigger);\n }\n \n log.info(\"Waiting on semaphore for all triggers to signal completion...\");\n assertTrue(\"Timed out waiting for semaphore count to be released\",\n completionSemaphore.tryAcquire(numTriggers, 60, TimeUnit.SECONDS));\n \n synchronized (latch) {\n assertEquals(\"Unexpected number of trigger names found: \" + triggerNames.toString(),\n numTriggers, triggerNames.size());\n assertEquals(\"Unexpected number of thread ames found: \" + threadNames.toString(),\n numTriggers, threadNames.size());\n assertEquals(\"Unexpected number of trigger fails recorded, check logs?\",\n 0, fails.get());\n\n // before releasing the latch, clear the state and update our config to use a lower number of threads\n log.info(\"Updating scheduler config to use {} threads\", reducedThreadPoolSize);\n config = config.withProperties(Collections.singletonMap(AutoScalingParams.TRIGGER_CORE_POOL_SIZE,\n reducedThreadPoolSize));\n scheduledTriggers.setAutoScalingConfig(config);\n\n log.info(\"Updating cyclic barrier and clearing test state so triggers will 'run' again\");\n latch.set(new CyclicBarrier(reducedThreadPoolSize));\n threadNames.clear();\n triggerNames.clear();\n }\n \n log.info(\"Waiting on semaphore for all triggers to signal completion...\");\n assertTrue(\"Timed out waiting for semaphore count to be released\",\n completionSemaphore.tryAcquire(numTriggers, 60, TimeUnit.SECONDS));\n \n synchronized (latch) {\n assertEquals(\"Unexpected number of trigger names found: \" + triggerNames.toString(),\n numTriggers, triggerNames.size());\n assertEquals(\"Unexpected number of thread names found: \" + threadNames.toString(),\n reducedThreadPoolSize, threadNames.size());\n assertEquals(\"Unexpected number of trigger fails recorded, check logs?\",\n 0, fails.get());\n }\n }\n }", "protected void sequence_AT_DEFINE_DefinitionTrigger_TRIGGER(ISerializationContext context, DefinitionTrigger semanticObject) {\n\t\tgenericSequencer.createSequence(context, semanticObject);\n\t}", "@Override\n \tprotected void trigger(TriggerMessage message) {\n \t\tthis.getDataObjectService().saveObject(this.getUniqueProcessId(), message.getProcessInstanceId(), message.getPayload());\n \t\t\n \t\teventDefinition.trigger(message);\n \t\t\n \t\tthis.getNodeInstanceMediatorService().setNodeInstanceEndTime(message.getProcessInstanceId(), new Date());\n \t\t\n\t\tthis.getNodeInstanceMediatorService().setState(\n\t\t\t\tmessage.getProcessInstanceId(),\n\t\t\t\tNodeInstaceStates.PASSED_STATE);\n\t\t\n \t\tthis.getNodeInstanceMediatorService().persistChanges();\n \t\t\n \t\tthis.sendMessageToNodeActor(message, this.getActivatingGatewayNode());\n \t}", "public void trigger() {\n\n\t\tfor (Gadget gadget : getGadgetsToTrigger()) {\n\n\t\t\tgadget.trigger();\n\n\t\t}\n\n\t}", "@Override\n public TestRepositoryTriggersResult testRepositoryTriggers(TestRepositoryTriggersRequest request) {\n request = beforeClientExecution(request);\n return executeTestRepositoryTriggers(request);\n }", "boolean isSimpleTrigger();", "ETriggers getTriggers();", "@Test\n public void shouldThrowsExceptionWhenInnerMethodCallThrowsIt() throws Exception {\n thrown.expect(AccessException.class);\n //given\n // p4ic4idea: use a public, non-abstract class with default constructor\n doThrow(AccessException.AccessExceptionForTests.class).when(server).execMapCmdList(\n eq(TRIGGERS.toString()),\n eq(getCmdArguments),\n eq(null));\n //then\n triggersDelegator.getTriggerEntries();\n }", "public boolean triggersNow()\n\t{\n\t\tif(!this.canTrigger())\n\t\t\treturn false;\n\n\t\tfor(GameObject object: this.game.actualState.stack())\n\t\t\tif(object instanceof StateTriggeredAbility)\n\t\t\t\tif(((StateTriggeredAbility)object).printedVersionID == this.ID)\n\t\t\t\t\treturn false;\n\n\t\tIdentified source = this.getSource(this.state);\n\t\tint controller;\n\t\tif(source.isGameObject())\n\t\t\tcontroller = ((GameObject)source).controllerID;\n\t\telse\n\t\t\t// it's a player\n\t\t\tcontroller = source.ID;\n\t\tfor(GameObject object: this.game.actualState.waitingTriggers.get(controller))\n\t\t\tif((object instanceof StateTriggeredAbility) && (((StateTriggeredAbility)object).printedVersionID == this.ID))\n\t\t\t\treturn false;\n\n\t\tfor(SetGenerator condition: this.triggerConditions)\n\t\t\tif(!condition.evaluate(this.game, this).isEmpty())\n\t\t\t\treturn true;\n\n\t\treturn false;\n\t}", "public TriggerAccess getTrigger () {\n return this.trigger;\n }", "public void triggerAllAggregators() {\n Map<Integer, TimedDataAggregator> aggregatorMap = new HashMap<>();\n aggregatorMap.putAll(FeatureAggregators.getInstance().getAggregatorMap());\n aggregatorMap.putAll(StateAggregators.getInstance().getAggregatorMap());\n aggregatorMap.putAll(ClassificationAggregators.getInstance().getAggregatorMap());\n aggregatorMap.putAll(TrustLevelAggregators.getInstance().getAggregatorMap());\n\n // create shadow loopers for all aggregators\n Map<Integer, ShadowLooper> shadowLooperMap = createShadowLoopers(aggregatorMap);\n\n // set duration according to record\n long duration = record.getRecorder().getStopTimestamp() - record.getRecorder().getStartTimestamp();\n\n // trigger all aggregators\n triggerAggregators(aggregatorMap, shadowLooperMap, duration);\n }", "@Test\n public void ran() {\n List<ChangeSetStatus> changeSets = new ArrayList<>();\n ChangeSet mockChangeSet = Mockito.mock(ChangeSet.class);\n DatabaseChangeLog mockDbChangeLog =\n Mockito.mock(DatabaseChangeLog.class);\n Database mockDatabase = Mockito.mock(Database.class);\n\n LiquibaseMigrationWatcher w = new LiquibaseMigrationWatcher(changeSets);\n\n assertFalse(w.isMigrated());\n assertNull(w.getCurrentVersion());\n\n w.ran(mockChangeSet, mockDbChangeLog, mockDatabase, ExecType.EXECUTED);\n\n assertTrue(w.isMigrated());\n assertSame(mockChangeSet, w.getCurrentVersion());\n }", "@Test\n public void testDoNotifyCommitWithTwoStreams() throws Exception {\n AccurevTrigger bMasterTrigger = setupProjectWithTrigger(\"host\", \"8080\", \"stream2\", \"depot\", false);\n AccurevTrigger aMasterTrigger = setupProjectWithTrigger(\"host\", \"8080\", \"stream1\", \"depot\", false);\n\n\n AccurevStatus spy = Mockito.spy(new AccurevStatus());\n\n spy.doNotifyCommit(requestWithNoParameters, \"host\", \"8080\", \"stream1\", \"1\", \"testPrincipal\", \"Updated\");\n\n\n Mockito.verify(spy).doNotifyCommit(requestWithNoParameters, \"host\", \"8080\", \"stream1\", \"1\", \"testPrincipal\", \"Updated\");\n\n assertEquals(\"HOST: host PORT: 8080 Streams: stream1\", spy.toString());\n }", "@Ignore\n @Test\n public void testDslTriggerCreateUpdatedMergedApprovedPRAllowBranchesWithApproveActionsPipeline() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslTriggerCreateUpdatedMergedApprovedPRAllowBranchesWithApproveActionsPipeline.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n WorkflowJob createdJob = (WorkflowJob) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n PipelineTriggersJobProperty pipelineTriggers = (PipelineTriggersJobProperty) createdJob.getProperty(PipelineTriggersJobProperty.class);\n Map<TriggerDescriptor, Trigger<?>> triggers = pipelineTriggers.getTriggersMap();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Three different triggers expected */\n assertEquals(4, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(4, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestMergedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestApprovedActionFilter\");\n }", "@Ignore\n @Test\n public void testDslServerAllPRAllowedBranchesWithApproveActionsPipeline() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRAllowedBranchesWithApproveActionsPipeline.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n WorkflowJob createdJob = (WorkflowJob) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n PipelineTriggersJobProperty pipelineTriggers = (PipelineTriggersJobProperty) createdJob.getProperty(PipelineTriggersJobProperty.class);\n Map<TriggerDescriptor, Trigger<?>> triggers = pipelineTriggers.getTriggersMap();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Four different triggers expected */\n assertEquals(5, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(5, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n }", "private void fireEvents() {\n\n if (clockTickCount % clockTicksTillWorkloadChange == 0) {\n clockEventPublisher.fireTriggerWorkloadHandlerEvent(clockTickCount, intervalDurationInMilliSeconds);\n }\n\n // if (clockTickCount % clockTicksTillScalingDecision == 0) {\n // clockEventPublisher.fireTriggerAutoScalerEvent(clockTickCount,\n // intervalDurationInMilliSeconds);\n // }\n\n clockEventPublisher.fireClockEvent(clockTickCount, intervalDurationInMilliSeconds);\n\n // INfrastruktur\n if (clockTickCount % clockTicksTillPublishInfrastructureState == 0) {\n clockEventPublisher.fireTriggerPublishInfrastructureStateEvent(clockTickCount,\n intervalDurationInMilliSeconds);\n\n }\n\n // Queue\n if (clockTickCount % clockTicksTillPublishQueueState == 0) {\n\n clockEventPublisher.fireTriggerPublishQueueStateEvent(clockTickCount, intervalDurationInMilliSeconds);\n }\n\n }", "public void trigger() {\n\t\t\n//\t\t #ifdef DEBUG\n\t\t // The sensor should not have been scheduled if it has a NULL\n\t\t // callback function. Be safe and test here.\n\t\t if (func == null) {\n\t\t SoDebugError.post(\"SoSensor::trigger\",\n\t\t \"Cannot trigger a sensor with NULL callback\");\n\t\t return;\n\t\t }\n//\t\t #endif /* DEBUG */\n\t\t \n\t\t // Call the sensor function\n\t\t func.run(funcData, this);\n\t\t \n\t\t }", "Collection<ITrigger> getTriggers();", "@Test\n public void testDslServerAllPRAllowedBranchesWithApproveActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRAllowedBranchesWithApproveActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Four different triggers expected */\n assertEquals(5, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(5, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n }", "@Override\n\tpublic void addSelfTrigger(ISelfTrigger trigger) {\n\t\t\n\t}", "public int[] activateTrigger(int triggerId) {\n\n\t\tint[] triggerResults = {0,0,0,0,0,0,0,0,0,0};\n\t\t\n\t\ttry {\n\t\t\t\n\t\t\tMap<String, String> hm = db.selectTrigger(triggerId);\n\t\t\t\t\n\t\t\tint type = 0;\n\t\t\tint toTriggerId = 0;\t\n\t\t\t\t\t\n\t\t\ttype = Integer.parseInt(hm.get(\"type\"));\n\t\t\ttoTriggerId = Integer.parseInt(hm.get(\"to_trigger_id\"));\n\t\t\t\n\t\t\tswitch (type) {\n\t\t\t\t\t\t\n\t\t\t\tcase DB_TRIGGER_TYPE_ANIM:\t\t\t// an animation is launched\n\t\t\t\t\t\n\t\t\t\t\ttriggerResults[1] = toTriggerId;\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\t\n\t\t\t\tcase DB_TRIGGER_TYPE_ACTION:\t// OR a change on items (combination, action, take item on screen...)\n\n\t\t\t\t\ttriggerResults[5] = activateModifier(toTriggerId);\n\t\t\t\t break;\n\n\t\t\t\tcase DB_TRIGGER_TYPE_DOLL:\t// OR move/hide doll\t\n\t\t\t\t\t\n\t\t\t\t\tMap<String, String> hmDoll = db.selectDollTrigger(toTriggerId);\n\t\t\t\t\tif (hmDoll.get(\"to_x\") != null)\t\t\t\ttriggerResults[2] = Integer.parseInt(hmDoll.get(\"to_x\"));\n\t\t\t\t\tif (hmDoll.get(\"doll_is_hidden\") != null)\ttriggerResults[3] = Integer.parseInt(hmDoll.get(\"doll_is_hidden\"));\n\t\t\t\t\tif (hmDoll.get(\"y_velocity\") != null)\t\ttriggerResults[6] = Integer.parseInt(hmDoll.get(\"y_velocity\"));\n\t\t\t\t\t\n\t\t\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 2 \" + hmDoll.get(\"to_x\"));\n\t\t\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 3 \" + hmDoll.get(\"doll_is_hidden\"));\n\t\t\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 6 \" + hmDoll.get(\"y_velocity\"));\n\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase DB_TRIGGER_TYPE_TEXT:\t// show a bubble\n\t\t\t\t\t\n\t\t\t\t\ttriggerResults[4] = toTriggerId;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase DB_TRIGGER_TYPE_SV_ITEM:\t// hide/show item\n\t\t\t\t\t\n\t\t\t\t\ttriggerResults[7] = toTriggerId;\n\t\t\t\t\tbreak;\n\t\t\t\t\t\n\t\t\t\tcase DB_TRIGGER_TYPE_SV_ANIM:\t// hide/show anim\n\t\t\t\t\t\n\t\t\t\t\ttriggerResults[8] = toTriggerId;\t\t\t\t\t\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\n\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 0 \" + hm.get(\"next_trigger_id\"));\n\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 5 \" + triggerResults[5]);\n\t\t\tif (LOG_ON) Log.d(\"Clementime\", className + \"/activateTrigger(): Trigger results 1, 4, 7 & 8: \" + toTriggerId);\n\t\t\t\n\t\t\tif (hm.get(\"next_trigger_id\") != null)\ttriggerResults[0] = Integer.parseInt(hm.get(\"next_trigger_id\"));\n\t\t\tif (hm.get(\"simultaneous_trigger_id\") != null)\ttriggerResults[9] = Integer.parseInt(hm.get(\"simultaneous_trigger_id\"));\n\t\t\t\n\t\t} catch (Exception e) {\n\t\t\te.printStackTrace();\n\t\t}\n\t\t\n\t\treturn triggerResults;\n\t}", "public static boolean getTrigger() {\n\t\treturn true;\r\n\t}", "@Test\n public void testDoNotifyCommitWithSingleStream() throws Exception {\n AccurevTrigger aMasterTrigger = setupProjectWithTrigger(\"host\", \"8080\", \"stream1\", \"depot\", false);\n\n AccurevStatus spy = Mockito.spy(new AccurevStatus());\n spy.doNotifyCommit(requestWithNoParameters, \"host\", \"8080\", \"stream1\", \"1\", \"testPrincipal\", \"Updated\");\n\n Mockito.verify(spy).doNotifyCommit(requestWithNoParameters, \"host\", \"8080\", \"stream1\", \"1\", \"testPrincipal\", \"Updated\");\n assertEquals(\"HOST: host PORT: 8080 Streams: stream1\", spy.toString());\n }", "@Test\n public void triggeredForCatalogItemTest() {\n // TODO: test triggeredForCatalogItem\n }", "@Test\n\t@Ignore\n\tpublic void testScheduler() {\n\t\torg.springframework.scheduling.support.CronTrigger trigger = new CronTrigger(\"0 0 0 * * *\");\n\t\tCalendar today = Calendar.getInstance();\n\t\ttoday.add(Calendar.DAY_OF_MONTH, -1);\n\t\tSimpleDateFormat sdf = new SimpleDateFormat(\"yyyy-MM-dd HH:mm:ss z\");\n\t\tfinal Date yesterday = today.getTime();\n\t\tString lastMessage = (sdf.format(yesterday)) + \" : [Yesterday]\";\n\t\tlog.debug(lastMessage);\n\t\tDate nextExecution = trigger.nextExecutionTime(\n\t\t\t\tnew TriggerContext() {\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Date lastScheduledExecutionTime() {\n\t\t\t\t\t\treturn yesterday;\n\t\t\t\t\t}\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Date lastActualExecutionTime() {\n\t\t\t\t\t\treturn yesterday;\n\t\t\t\t\t}\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic Date lastCompletionTime() {\n\t\t\t\t\t\treturn yesterday;\n\t\t\t\t\t}\n\t\t\t\t});\n\t\tString nextMessage = sdf.format(nextExecution) + \" : [Execution] \";\n\t\tlog.debug(nextMessage);\n\t}", "public void setTriggers(List<CronTrigger> triggers) {\n this.triggers = triggers;\n\n CronExpression cronExpression;\n List<CronTrigger> schedulableTriggers = new ArrayList<CronTrigger>();\n\n for (CronTrigger cronTrigger : triggers) {\n try {\n cronExpression = new CronExpression(cronTrigger.getCronExpression());\n if (cronExpression.getNextValidTimeAfter(new Date()) == null) {\n // The cron expression is valid, but will never trigger.\n LOG.info(cronTrigger.getCronExpression() + \" not valid cronexpression. The job will not be scheduled.\");\n continue;\n }\n }\n catch (ParseException e) {\n LOG.info(cronTrigger.getCronExpression() + \" not valid cronexpression. The job will not be scheduled.\");\n continue;\n }\n schedulableTriggers.add(cronTrigger);\n }\n super.setTriggers(schedulableTriggers.toArray(new CronTrigger[0]));\n }", "@Test\n public void testDslServerAllPRActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Five different triggers expected */\n assertEquals(5, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(5, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "public interface TriggerService {\n\n /**\n * 获取所有的问题触发器ids\n * @return\n * @throws ServiceException\n */\n List<String> getProblemTriggerIds() throws ServiceException;\n\n <T> List<T> listTrigger(TriggerGetRequest triggerGetRequest, Class<T> clazz);\n\n /**\n * 根据 request 获取触发器数量\n * @return\n * @throws ServiceException\n */\n int countTrigger(TriggerGetRequest request) throws ServiceException;\n/*\nzabbix 方法\n */\n /**\n *\n * @return\n * @throws ServiceException\n */\n List<DashboardProblemVO> listBriefProblems() throws ServiceException;\n\n /**\n * 根据 triggerIds 查询对应的 triggerDTOS selectHost\n * @param triggerIds\n * @return\n * @throws ServiceException\n */\n List<BriefTriggerDTO> getTriggersByTriggerIds(List<String> triggerIds ) throws ServiceException;\n /**\n * 根据itemIds获取监控中的 trggierDTO list\n * @param itemIds\n * @return\n * @throws ServiceException\n */\n List<BriefTriggerDTO> getTriggersByItemIds(List<String> itemIds) throws ServiceException;\n\n /**\n * 列出所有触发器 排除依赖 触发器 BriefTriggerDTOS\n * @return\n * @throws ServiceException\n */\n List<BriefTriggerDTO> listTriggersSkipDependent() throws ServiceException;\n\n /**\n * 列出问题触发器 BriefTriggerDTOS\n * @return\n * @throws ServiceException\n */\n List<BriefTriggerDTO> listProblemTriggers() throws ServiceException;\n\n /**\n * 问题管理 问题列表 ProblemListVO\n * @return\n * @throws ServiceException\n */\n List<ProblemListVO> listProblemListVO() throws ServiceException;\n\n /**\n * 问题管理 问题详情 基础静态信息 ProblemDetailVO\n * @return\n * @throws ServiceException\n */\n ProblemDetailVO getProblemDetailVOByTriggerId(String triggerId) throws ServiceException;\n\n}", "@Test\n public void testDslServerAllPRActionsPipeline() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRActionsPipeline.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n WorkflowJob createdJob = (WorkflowJob) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n PipelineTriggersJobProperty pipelineTriggers = (PipelineTriggersJobProperty) createdJob.getProperty(PipelineTriggersJobProperty.class);\n Map<TriggerDescriptor, Trigger<?>> triggers = pipelineTriggers.getTriggersMap();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Five different triggers expected */\n assertEquals(5, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(5, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "@Before\n public void setup() {\n context.build().resource(OAK_INDEX).commit();\n context.registerService(Scheduler.class,scheduler);\n context.registerService(RequireAem.class,requireAem,\"distribution\",\"classic\");\n\n ScheduleOptions options = mock(ScheduleOptions.class);\n lenient().when(scheduler.NOW()).thenReturn(options);\n lenient().when(scheduler.schedule(any(), any())).thenAnswer((InvocationOnMock invocation) -> {\n EnsureOakIndexJobHandler handler = invocation.getArgument(0);\n handler.run();\n return true;\n });\n\n context.registerService(ChecksumGenerator.class, new ChecksumGeneratorImpl());\n \n ensureOakIndexManagerProperties = new HashMap<>();\n ensureOakIndexManagerProperties.put(\"properties.ignore\", null);\n \n }", "@Test\n public void testDslTriggerCreateUpdatedMergedApprovedPRAllowBranchesActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslTriggerCreateUpdatedMergedDeclinedApprovedPRAllowBranchesActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Five different triggers expected */\n assertEquals(5, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(5, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestMergedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestDeclinedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestApprovedActionFilter\");\n }", "public Trigger getTrigger() {\n \t\treturn trigger;\n \t}", "public void trigger(Event event);", "public void execute(RecordTriggerContext recordTriggerContext) {\n LogService logService = ServiceLocator.locate(LogService.class);\n /*\n * Get an instance of the User Defined Service we created.\n * User defined Services are used similarly to Vault SDK services.\n * User Defined Services don't contribute to the memory limit after the method has exited.\n */\n ProductSearchUserDefinedService productSearchUserDefinedService = ServiceLocator.locate(ProductSearchUserDefinedService.class);\n\n /*\n * Get an instance of the PickList Service used to retrieve picklist values.\n * More information about hor to retrive picklist values can be found here:\n * https://repo.veevavault.com/javadoc/vault-sdk-api/20.1.0/docs/api/com/veeva/vault/sdk/api/picklist/package-summary.html\n */\n PicklistService picklistService = ServiceLocator.locate(PicklistService.class);\n // Picklist of bicycle parts in bicycle part orders\n Picklist bicyclePartPicklist = picklistService.getPicklist(\"bicycle_part__c\");\n // Picklist of bicycle part manufacturers in bicycle part orders\n Picklist bicyclePartManufacturersPicklist = picklistService.getPicklist(\"bicycle_part_manufacturer__c\");\n\n @SuppressWarnings(\"unchecked\")\n Map<String, String> partAndManufacturerMap = VaultCollections.newMap();\n @SuppressWarnings(\"unchecked\")\n Map<String, BigDecimal> orderQuantityMap = VaultCollections.newMap();\n\n recordTriggerContext.getRecordChanges().forEach(recordChange -> {\n\n // Initialize part name and manufacture name strings\n String bicyclePartName = \"\";\n String bicyclePartManufacturerName = \"\";\n\n // Get the bicycle parts pick list values\n List<String> bicyclePartsListValues = recordChange.getNew().getValue(\"bicycle_part__c\", ValueType.PICKLIST_VALUES);\n\n // Get the name(label) of the bicycle part using the bicyclePartPickList\n if (bicyclePartsListValues != null && !bicyclePartsListValues.isEmpty()) {\n //Get single-picklist value name selected by user\n String partPicklistValueName = bicyclePartsListValues.get(0);\n //Get picklist value label\n bicyclePartName = bicyclePartPicklist.getPicklistValue(partPicklistValueName).getLabel();\n }\n\n // Get the name(label) of the bicycle part manufacturer using the bicyclePartManufacturerPickList\n List<String> bicyclePartManufacturersListValues = recordChange.getNew().getValue(\"bicycle_part_manufacturer__c\", ValueType.PICKLIST_VALUES);\n if (bicyclePartManufacturersListValues != null && !bicyclePartManufacturersListValues.isEmpty()) {\n //Get single-picklist value name selected by user\n String partManufacturerPicklistValueName = bicyclePartManufacturersListValues.get(0);\n //Get picklist value label\n bicyclePartManufacturerName = bicyclePartManufacturersPicklist.getPicklistValue(partManufacturerPicklistValueName).getLabel();\n }\n\n // If the bicycle part name or the manufacturer name are null or empty, then throw an error.\n if((bicyclePartName == null || bicyclePartName.isEmpty()) ||\n (bicyclePartManufacturerName == null || bicyclePartManufacturerName.isEmpty())) {\n recordChange.setError(\"INVALID_ARGUMENT\", \"Product with specified manufacturer does not exist.\");\n }\n\n // Get the order quantity\n BigDecimal orderQuantity = recordChange.getNew().getValue(\"order_quantity__c\", ValueType.NUMBER);\n\n // Add part name, part manufacturer name and order quantity to maps\n partAndManufacturerMap.put(\"'\" + bicyclePartName + \"'\", \"'\" + bicyclePartManufacturerName + \"'\");\n orderQuantityMap.put(bicyclePartName, orderQuantity);\n });\n logService.logResourceUsage(\"Before doesProductExist Method Call: \");\n Map<String, BicyclePartData> doProductsExist = productSearchUserDefinedService.doesProductExist(partAndManufacturerMap);\n logService.logResourceUsage(\"After doesProductExist Method Call: \" );\n\n // Validate that all user entered bicycle part name were found, if not setError on the record change.\n for (RecordChange recordChange : recordTriggerContext.getRecordChanges()) {\n // If no results were found, all user inputted products and manufacturer combinations are wrong.\n if (doProductsExist == null) {\n recordChange.setError(\"INVALID_ARGUMENT\", \"Product with specified manufacturer does not exist.\");\n continue;\n }\n\n // Get the bicycle parts pick list values\n List<String> bicyclePartsListValues = recordChange.getNew().getValue(\"bicycle_part__c\", ValueType.PICKLIST_VALUES);\n\n String bicyclePartName = \"\";\n // Get the name(label) of the bicycle part using the bicyclePartPickList\n if (bicyclePartsListValues != null && !bicyclePartsListValues.isEmpty()) {\n //Get single-picklist value name selected by user\n String partPicklistValueName = bicyclePartsListValues.get(0);\n //Get picklist value label\n bicyclePartName = bicyclePartPicklist.getPicklistValue(partPicklistValueName).getLabel();\n }\n\n if (bicyclePartName != null && !doProductsExist.get(bicyclePartName).getIdExists()) { // If Id of bicycle part is found then it exists\n // setError if the user specified bicycle part's record was not found.\n recordChange.setError(\"INVALID_ARGUMENT\", \"Product with specified manufacturer does not exist.\");\n }\n }\n\n // Reduce the quantity for the bicycle parts that we are creating an order for.\n if(doProductsExist != null) {\n logService.logResourceUsage(\"Before reduceProductQuantity Method Call: \");\n productSearchUserDefinedService.reduceProductQuantity(doProductsExist.values(), orderQuantityMap);\n logService.logResourceUsage(\"After reduceProductQuantity Method Call: \");\n }\n logService.logResourceUsage(\"End: \");\n }", "private void trigger() {\n\t\t\tif (repeatState == REPEAT_ADD) {\n\t\t\t\tadd();\n\t\t\t}\n\t\t\tif (repeatState == REPEAT_SUBTRACT) {\n\t\t\t\tsubtract();\n\t\t\t}\n\t\t}", "TriggerType createTriggerType();", "boolean hasTriggerFulfillment();", "@Test\n public void testDslTriggerCreateUpdatedApprovedPRActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslTriggerCreateUpdatedApprovedPRActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Three different triggers expected */\n assertEquals(3, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(3, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestApprovedActionFilter\");\n }", "ITrigger getTrigger(String sTriggerName);", "public void onTriggerChange() {\n findViewById(R.id.temp).post(new Runnable() {\n public void run() {\n ConsumerIrManager mCIR = ScaryUtil.getConsumerIRService(getApplicationContext());\n if (m_Inst.power) {\n TransmissionCode data = ScaryUtil.getIRCode(m_Inst.sequence, m_Inst.temp); // (TransmissionCode)samsung.get(m_Inst.temp);\n ScaryUtil.transmit(getApplicationContext(),data);\n }\n }\n });\n }", "@Test\n public void launchesEventhandlerUpdatelastmodificationTest() {\n // TODO: test launchesEventhandlerUpdatelastmodification\n }", "public interface ModelTrigger{\n\n\t/** Start's the simulation. */\n\tpublic void startSimulation();\n\n\t/** Stop's the simulation. */\n\tpublic void stopSimulation();\n\n\t/** Return true if the simulation is running. */\n\tpublic boolean isRunning();\n}", "@Test\n public void testNear()\n {\n String sName = \"near-client-listener\";\n generateEvents(sName);\n checkEvents(true, false);\n }", "@PostConstruct\n public void initTriggerEvaluateRunning() {\n this.triggerRepository.findAll().forEach(trigger -> {\n if (trigger.getEvaluateRunningDate() != null) {\n var unlocked = trigger.toBuilder().evaluateRunningDate(null).build();\n this.triggerRepository.save(unlocked);\n }\n });\n }", "protected void loadTrigger() {\n this.keyTrigger = getContentAssistTrigger();\n }", "public void trigger(PromiseManager pm) {\n\tthrow new SubclassResponsibilityException();\n/*\nudanax-top.st:15949:DetectorEvent methodsFor: 'triggering'!\n{void} trigger: pm {PromiseManager}\n\t\"Send the message across the wire.\"\n\t\n\tself subclassResponsibility!\n*/\n}", "@Test\n public void testDslServerAllPRUnfilteredAndAllowedBranchesActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRUnfilteredAndAllowedBranchesActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Twelve different triggers expected */\n assertEquals(12, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(5).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(6).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(7).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(8).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(9).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(10).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(11).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(12, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(5), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n\n assertEquals(dispNames.get(6), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(7), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(8), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(9), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(10), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(11), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "@Test\n public void testDslServerAllPRAllowedBranchesActionsPipeline() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRAllowedBranchesActionsPipeline.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n WorkflowJob createdJob = (WorkflowJob) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n PipelineTriggersJobProperty pipelineTriggers = (PipelineTriggersJobProperty) createdJob.getProperty(PipelineTriggersJobProperty.class);\n Map<TriggerDescriptor, Trigger<?>> triggers = pipelineTriggers.getTriggersMap();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Six different triggers expected */\n assertEquals(6, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(5).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(6, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(5), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "@Test\n public void testDslTriggerCreateUpdatedMergedApprovedPRAllowBranchesWithApproveActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslTriggerCreateUpdatedMergedApprovedPRAllowBranchesWithApproveActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Three different triggers expected */\n assertEquals(4, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(4, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestMergedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestApprovedActionFilter\");\n }", "@Test\n public void notifications() throws Exception {\n List<String> log = new ArrayList<>();\n\n fieldCfg.listen(ctx -> {\n log.add(\"update\");\n\n return completedFuture(null);\n });\n\n fieldCfg.joinTimeout().listen(ctx -> {\n log.add(\"join\");\n\n return completedFuture(null);\n });\n\n fieldCfg.failureDetectionTimeout().listen(ctx -> {\n log.add(\"failure\");\n\n return completedFuture(null);\n });\n\n fieldCfg.change(change -> change.changeJoinTimeout(1000_000)).get(1, TimeUnit.SECONDS);\n\n assertEquals(List.of(\"update\", \"join\"), log);\n\n log.clear();\n\n fieldCfg.failureDetectionTimeout().update(2000_000).get(1, TimeUnit.SECONDS);\n\n assertEquals(List.of(\"update\", \"failure\"), log);\n }", "@Test\n public void testDslServerAllPRAllowedBranchesActionsFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRAllowedBranchesActionsFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Six different triggers expected */\n assertEquals(6, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(5).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(6, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(5), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "boolean containsTrigger(String sTriggerName);", "public void mock(){\n\n }", "public T caseTrigger(Trigger object) {\r\n\t\treturn null;\r\n\t}", "private void processCreateTrigger() throws HsqlException {\n\n Table t;\n boolean isForEach;\n boolean isNowait;\n int queueSize;\n String triggerName;\n boolean isQuoted;\n String sWhen;\n String sOper;\n String tableName;\n String token;\n String className;\n TriggerDef td;\n Trigger o;\n\n triggerName = tokenizer.getName();\n\n String schemaname = tokenizer.getLongNameFirst();\n\n database.schemaManager.checkTriggerExists(triggerName,\n session.getSchemaNameForWrite(schemaname), false);\n\n isQuoted = tokenizer.wasQuotedIdentifier();\n isForEach = false;\n isNowait = false;\n queueSize = TriggerDef.getDefaultQueueSize();\n sWhen = tokenizer.getSimpleToken();\n sOper = tokenizer.getSimpleToken();\n\n tokenizer.getThis(Token.T_ON);\n\n tableName = tokenizer.getName();\n\n if (schemaname == null) {\n schemaname =\n session.getSchemaNameForWrite(tokenizer.getLongNameFirst());\n } else if (!schemaname.equals(\n session.getSchemaNameForWrite(tokenizer.getLongNameFirst()))) {\n throw Trace.error(Trace.INVALID_SCHEMA_NAME_NO_SUBCLASS);\n }\n\n t = database.schemaManager.getUserTable(session, tableName,\n schemaname);\n\n if (t.isView()) {\n throw Trace.error(Trace.NOT_A_TABLE);\n }\n\n session.setScripting(true);\n\n // \"FOR EACH ROW\" or \"CALL\"\n token = tokenizer.getSimpleToken();\n\n if (token.equals(Token.T_FOR)) {\n token = tokenizer.getSimpleToken();\n\n if (token.equals(Token.T_EACH)) {\n token = tokenizer.getSimpleToken();\n\n if (token.equals(Token.T_ROW)) {\n isForEach = true;\n\n // should be 'NOWAIT' or 'QUEUE' or 'CALL'\n token = tokenizer.getSimpleToken();\n } else {\n throw Trace.error(Trace.UNEXPECTED_END_OF_COMMAND, token);\n }\n } else {\n throw Trace.error(Trace.UNEXPECTED_END_OF_COMMAND, token);\n }\n }\n\n if (token.equals(Token.T_NOWAIT)) {\n isNowait = true;\n\n // should be 'CALL' or 'QUEUE'\n token = tokenizer.getSimpleToken();\n }\n\n if (token.equals(Token.T_QUEUE)) {\n queueSize = tokenizer.getInt();\n\n // should be 'CALL'\n token = tokenizer.getSimpleToken();\n }\n\n if (!token.equals(Token.T_CALL)) {\n throw Trace.error(Trace.UNEXPECTED_END_OF_COMMAND, token);\n }\n\n className = tokenizer.getSimpleName();\n\n if (!tokenizer.wasQuotedIdentifier()) {\n throw Trace.error(Trace.UNEXPECTED_END_OF_COMMAND, className);\n }\n\n HsqlName name = database.nameManager.newHsqlName(triggerName,\n isQuoted);\n\n td = new TriggerDef(name, sWhen, sOper, isForEach, t, className,\n isNowait, queueSize, database.classLoader);\n\n t.addTrigger(td);\n\n if (td.isValid()) {\n try {\n\n // start the trigger thread\n td.start();\n } catch (Exception e) {\n throw Trace.error(Trace.UNKNOWN_FUNCTION, e.toString());\n }\n }\n\n database.schemaManager.registerTriggerName(triggerName, t.getName());\n\n// --\n }", "private void processWTBy(WasTriggeredBy dep) {\n\n\t}", "@Test\n public void testDslTriggerIsToApprovePushActionFreeStyle() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslTriggerIsToApprovePushActionFreeStyle.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n boolean isToApprove = false;\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n assertEquals(1, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n\n BitBucketPPRRepositoryPushActionFilter tmp3 = (BitBucketPPRRepositoryPushActionFilter) tmp2.getTriggers().get(0).getActionFilter();\n isToApprove = tmp3.shouldSendApprove();\n }\n assertEquals(1, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRRepositoryPushActionFilter\");\n assertTrue(isToApprove);\n }", "@Test\n public void shouldReturnEmptyTriggerEntriesWhenResultMapsIsNull() throws Exception {\n shouldReturnEmptyTriggerEntries(new UnitTestGiven() {\n @Override\n public void given() throws P4JavaException {\n when(server.execMapCmdList(\n eq(TRIGGERS.toString()),\n eq(getCmdArguments),\n eq(null))).thenReturn(null);\n }\n });\n }", "@Test\n public void testDslServerAllPRUnfilteredAndAllowedBranchesActionsPipeline() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslServerAllPRUnfilteredAndAllowedBranchesActionsPipeline.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n WorkflowJob createdJob = (WorkflowJob) j.getInstance().getItem(\"test-job\");\n /* Go through all triggers to validate DSL */\n PipelineTriggersJobProperty pipelineTriggers = (PipelineTriggersJobProperty) createdJob.getProperty(PipelineTriggersJobProperty.class);\n Map<TriggerDescriptor, Trigger<?>> triggers = pipelineTriggers.getTriggersMap();\n /* Only one 'triggers{}' closure */\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n /* Eleven different triggers expected */\n assertEquals(11, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(2).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(3).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(4).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(5).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(6).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(7).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(8).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(9).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpNname = tmp2.getTriggers().get(10).getActionFilter().getClass().getName();\n dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(11, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(2), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(3), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(4), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(5), \"BitBucketPPRPullRequestServerCreatedActionFilter\");\n assertEquals(dispNames.get(6), \"BitBucketPPRPullRequestServerUpdatedActionFilter\");\n assertEquals(dispNames.get(7), \"BitBucketPPRPullRequestServerSourceUpdatedActionFilter\");\n assertEquals(dispNames.get(8), \"BitBucketPPRPullRequestServerApprovedActionFilter\");\n assertEquals(dispNames.get(9), \"BitBucketPPRPullRequestServerMergedActionFilter\");\n assertEquals(dispNames.get(10), \"BitBucketPPRPullRequestServerDeclinedActionFilter\");\n }", "boolean isTriggerPersistent(String sTriggerName);", "private void fireBatteryStatus(String trigger)\n\t{\n\t\tfireBatteryStatus(batteryLevel, isPowerConnected, trigger, null);\n\t}", "public void addTriggers(Map<String, Object> map) {\n }", "@Test\n public void testUnimplementedMethods() {\n List<ChangeSetStatus> changeSets = new ArrayList<>();\n LiquibaseMigrationWatcher w = new LiquibaseMigrationWatcher(changeSets);\n Change mockChange = Mockito.mock(Change.class);\n ChangeSet mockChangeSet = Mockito.mock(ChangeSet.class);\n DatabaseChangeLog mockDbChangeLog =\n Mockito.mock(DatabaseChangeLog.class);\n Database mockDatabase = Mockito.mock(Database.class);\n PreconditionFailedException mockPFE =\n Mockito.mock(PreconditionFailedException.class);\n PreconditionErrorException mockPEE =\n Mockito.mock(PreconditionErrorException.class);\n\n w.willRun(mockChangeSet, mockDbChangeLog, mockDatabase,\n RunStatus.MARK_RAN);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n\n w.willRun(mockChange, mockChangeSet, mockDbChangeLog, mockDatabase);\n Mockito.verifyNoMoreInteractions(mockChange);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n\n w.ran(mockChangeSet, mockDbChangeLog, mockDatabase, ExecType.EXECUTED);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n\n w.ran(mockChange, mockChangeSet, mockDbChangeLog, mockDatabase);\n Mockito.verifyNoMoreInteractions(mockChange);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n\n w.rolledBack(mockChangeSet, mockDbChangeLog, mockDatabase);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n\n w.runFailed(mockChangeSet, mockDbChangeLog, mockDatabase, mockPEE);\n Mockito.verifyNoMoreInteractions(mockChangeSet);\n Mockito.verifyNoMoreInteractions(mockDbChangeLog);\n Mockito.verifyNoMoreInteractions(mockDatabase);\n Mockito.verifyNoMoreInteractions(mockPEE);\n\n w.preconditionFailed(mockPFE, FailOption.HALT);\n Mockito.verifyNoMoreInteractions(mockPFE);\n\n w.preconditionErrored(mockPEE, ErrorOption.HALT);\n Mockito.verifyNoMoreInteractions(mockPEE);\n }", "private TriggerUtils() {\n }", "@Property(\"triggerAction\")\n String getTriggerAction();", "public void preFire(){\n\t}", "@Override\n public void triggerProbe(DeviceId deviceId) {\n }", "public interface TriggerContext {\n\n /**\n * Return the last <i>scheduled</i> execution time of the task, or.\n *\n * @return the date\n * {@code null} if not scheduled before.\n */\n Date lastScheduledExecutionTime();\n\n /**\n * Return the last <i>actual</i> execution time of the task, or {@code null}\n * if not scheduled before.\n *\n * @return the date\n */\n Date lastActualExecutionTime();\n\n /**\n * Return the last completion time of the task, or {@code null} if not\n * scheduled before.\n *\n * @return the date\n */\n Date lastCompletionTime();\n}", "public boolean trigger (String name) {\n final TriggerReference trigger = module.getTrigger(name);\n if (trigger == null) {\n Logger.missing(\"TriggerReference\", name);\n return false;\n } else {\n return trigger.get();\n }\n }", "@Override\n public ScheduledFuture<?> schedule(Runnable task, Trigger trigger) {\n if (!canRun()) {\n return null;\n }\n return super.schedule(task, trigger);\n }", "@Test\n public void testRwbmInternalBoth()\n {\n generateEvents(\"dist-rwbm-internal-both\");\n checkEvents(true, true);\n }", "@Test\n public void testRegisterTrigger_NoServerSetup_NoErrors() throws Exception {\n Assume.assumeTrue(AdServicesInfo.INSTANCE.version() >= 5);\n\n assertThat(mMeasurementManager.registerTriggerAsync(TRIGGER_REGISTRATION_URI).get())\n .isNotNull();\n }", "public void sendTestFutureNotification() {\n\n }", "@Test\n public void testDslMultipleJobsInSeedVarious() throws Exception {\n createSeedJob(readDslScript(\"./dsl/testDslMultipleJobsInSeedVarious.groovy\"));\n /* Fetch the newly created job and check its trigger configuration */\n FreeStyleProject createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job1\");\n WorkflowJob createdPipelineJob;\n PipelineTriggersJobProperty pipelineTriggers;\n /* Go through all triggers to validate DSL */\n Map<TriggerDescriptor, Trigger<?>> triggers = createdJob.getTriggers();\n assertEquals(1, triggers.size());\n List<String> dispNames = new ArrayList<>();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n assertEquals(1, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(1, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestCreatedActionFilter\");\n\n /* Verify second job content */\n createdJob = (FreeStyleProject) j.getInstance().getItem(\"test-job2\");\n /* Go through all triggers to validate DSL */\n triggers = createdJob.getTriggers();\n assertEquals(1, triggers.size());\n dispNames.clear();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n assertEquals(1, tmp2.getTriggers().size());\n String tmpNname = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpNname.substring(tmpNname.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(1, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRPullRequestUpdatedActionFilter\");\n\n /* Verify third job content */\n createdPipelineJob = (WorkflowJob) j.getInstance().getItem(\"test-job3\");\n /* Go through all triggers to validate DSL */\n pipelineTriggers = (PipelineTriggersJobProperty) createdPipelineJob.getProperty(PipelineTriggersJobProperty.class);\n triggers = pipelineTriggers.getTriggersMap();\n assertEquals(1, triggers.size());\n dispNames.clear();\n for (Trigger<?> entry : triggers.values()) {\n BitBucketPPRTrigger tmp2 = (BitBucketPPRTrigger) entry;\n assertEquals(2, tmp2.getTriggers().size());\n String tmpName = tmp2.getTriggers().get(0).getActionFilter().getClass().getName();\n String dispName = tmpName.substring(tmpName.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n tmpName = tmp2.getTriggers().get(1).getActionFilter().getClass().getName();\n dispName = tmpName.substring(tmpName.lastIndexOf(\".\") + 1);\n dispNames.add(dispName);\n }\n assertEquals(2, dispNames.size());\n assertEquals(dispNames.get(0), \"BitBucketPPRRepositoryPushActionFilter\");\n assertEquals(dispNames.get(1), \"BitBucketPPRPullRequestCommentDeletedActionFilter\");\n }", "boolean isAlreadyTriggered();" ]
[ "0.68646234", "0.6657912", "0.66340166", "0.6497036", "0.6462506", "0.63940775", "0.63810295", "0.6317664", "0.63040847", "0.6251105", "0.6196133", "0.619544", "0.6147868", "0.60678947", "0.6019345", "0.5991254", "0.5987018", "0.5944322", "0.59162253", "0.5892377", "0.58923393", "0.5889937", "0.5889845", "0.58801144", "0.58715594", "0.5856232", "0.5842487", "0.58400965", "0.58032453", "0.5775392", "0.5767945", "0.5744964", "0.5737253", "0.5721623", "0.57139885", "0.5704159", "0.57015586", "0.56991965", "0.5687427", "0.5682076", "0.56584126", "0.56543815", "0.56495756", "0.56308866", "0.5629386", "0.5613097", "0.56028944", "0.56005526", "0.55870605", "0.55863386", "0.5565536", "0.5564817", "0.556364", "0.5559474", "0.55557585", "0.55530775", "0.5552785", "0.5541456", "0.55362576", "0.55145496", "0.55103695", "0.5480469", "0.5478716", "0.5471271", "0.5469394", "0.5466134", "0.5453018", "0.5448734", "0.54484445", "0.5440245", "0.5438929", "0.543355", "0.5424994", "0.53850305", "0.53817403", "0.53717405", "0.53560597", "0.5355085", "0.53550553", "0.53500384", "0.53482455", "0.53422064", "0.53414094", "0.5330741", "0.5327445", "0.5311706", "0.53063524", "0.53033245", "0.5297801", "0.5295818", "0.52917486", "0.52809703", "0.52780926", "0.5271121", "0.524975", "0.5243583", "0.5240925", "0.5239112", "0.5236217", "0.5231415" ]
0.5850014
26
/ Affichage de la page d'inscription
@Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { req.setAttribute("message", "Bienvenue sur ce site en MVC"); RequestDispatcher rq = getServletContext().getRequestDispatcher("/WEB-INF/formulaire.jsp"); rq.forward(req, resp); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@Override\n public void afficher() {\n super.afficher();\n System.out.println(\"Sexe : \" + getSexe());\n System.out.println(\"Numéro de sécurité sociale : \" + getNumeroSecuriteSociale());\n System.out.println(\"Date de naissance : \" + getDateDeNaissance().format(DateTimeFormatter.ofLocalizedDate(FormatStyle.LONG)));\n System.out.println(\"Commentaires : \" + getCommentaires());\n this.adresse.afficher();\n }", "String getAnnoPubblicazione();", "String getAuteur();", "String pageDetails();", "@Override // Métodos que fazem a anulação\n\tpublic void pagaIR() {\n\t\t// TODO Auto-generated method stub\n\t\t\n\t}", "@Override\r\n\tpublic int nombrePage() {\n\t\treturn 0;\r\n\t}", "public int getReferencia() {\n return referencia;\n }", "private void Inscrire() {\n\t\t\r\n\t\tSystem.out.println(\"inscription\");\r\n }", "public void setPage(Page page) {this.page = page;}", "protected void elaboraPagina() {\n testoPagina = VUOTA;\n\n //header\n testoPagina += this.elaboraHead();\n\n //body\n testoPagina += this.elaboraBody();\n\n //footer\n //di fila nella stessa riga, senza ritorno a capo (se inizia con <include>)\n testoPagina += this.elaboraFooter();\n\n //--registra la pagina principale\n if (dimensioniValide()) {\n testoPagina = testoPagina.trim();\n\n if (pref.isBool(FlowCost.USA_DEBUG)) {\n testoPagina = titoloPagina + A_CAPO + testoPagina;\n titoloPagina = PAGINA_PROVA;\n }// end of if cycle\n\n //--nelle sottopagine non eseguo il controllo e le registro sempre (per adesso)\n if (checkPossoRegistrare(titoloPagina, testoPagina) || pref.isBool(FlowCost.USA_DEBUG)) {\n appContext.getBean(AQueryWrite.class, titoloPagina, testoPagina, summary);\n logger.info(\"Registrata la pagina: \" + titoloPagina);\n } else {\n logger.info(\"Non modificata la pagina: \" + titoloPagina);\n }// end of if/else cycle\n\n //--registra eventuali sottopagine\n if (usaBodySottopagine) {\n uploadSottoPagine();\n }// end of if cycle\n }// end of if cycle\n\n }", "void entrerAuGarage();", "public void setPage(Integer page) {\n this.page = page;\n }", "public String getAuteur() {\n return auteur;\n }", "protected String getTitoloPaginaMadre() {\n return VUOTA;\n }", "public void setPage(int page) {\n this.page = page;\n }", "@Override\r\n\tpublic void publierEnchere() {\n\t\t\r\n\t}", "public String retourPageAuthentification() {\r\n\t\tdefaultVue.setPassword(null);\r\n\t\t// Retour à la page d'authentification\r\n\t\treturn \"LoginPassword\";\r\n\t}", "protected abstract String getInitialPageId();", "public abstract AdvertisingPageType mo11614e();", "@UML(identifier=\"page\", obligation=OPTIONAL, specification=ISO_19115)\n String getPage();", "public void setAuteur(String auteur) {\n this.auteur = auteur;\n }", "public int getId_anneeScolaire() {return id_anneeScolaire;}", "public void setReferencia(int value) {\n this.referencia = value;\n }", "@Override\n\tpublic void transmetDonnee() {\n\n\t}", "Reserva Obtener();", "@Override\n public void PageFistLoad() {\n }", "public String soumettreRv(){\n\t\t// Traitement ici ...\n\t\t// Un exemple d'utilisation du service\n\t\tserviceRv.ajouterRendezVous(this.getRv());\n\t\treturn REDIRECT;\n\t}", "@Override\r\n\tpublic void mypage() {\n\t\t\r\n\t}", "public String getPageText();", "public void rechercheEtudiantInscripEcheanceParMatricule(){\r\n try { \r\n setViewEtudiantInscripEcheance(viewEtudiantInscripEcheanceFacadeL.findByMatricule(getViewEtudiantInscripEcheance().getMatricule())); \r\n \r\n //initialisation des echeances\r\n// viewEtudiantInscripEcheance.setVers1(0); \r\n// viewEtudiantInscripEcheance.setVers2(0); \r\n// viewEtudiantInscripEcheance.setVers3(0); \r\n// viewEtudiantInscripEcheance.setVers4(0); \r\n// viewEtudiantInscripEcheance.setVers5(0); \r\n// viewEtudiantInscripEcheance.setVers6(0); \r\n } catch (Exception e) {\r\n FacesMessage message = new FacesMessage(\"Accun étudiant n'a été trouvé! \");\r\n message.setSeverity(FacesMessage.SEVERITY_WARN);\r\n FacesContext.getCurrentInstance().addMessage(null, message); \r\n \r\n viewEtudiantInscripEcheance = new ViewEtudiantInscriptionEcheance();\r\n } \r\n }", "long getAmountPage();", "@Override\n public String getText(int page) {\n String text = null;\n switch (page) {\n case E19_ALLPAGES:\n text = E19AllPages();\n break;\n case E19_COVER:\n text = E19Cover();\n break;\n case E19_MAPPAGE:\n text = E19MapPage();\n break;\n case E19_BENCHMARKS:\n text = E19Benchmarks();\n break;\n case E19_GAGES:\n text = E19Gages();\n break;\n case E19_HISTORY:\n text = E19History();\n break;\n case E19_CRESTS:\n text = E19Crests();\n break;\n case E19_LOWWATER:\n text = E19LowWater();\n break;\n case E19_CONDITIONS:\n text = E19Conditions();\n break;\n case E19_DAMAGE:\n text = E19Damage();\n break;\n case E19_STAFFGAGE:\n text = E19StaffGage();\n break;\n case E19_CONTACTS:\n text = E19Contacts();\n break;\n }\n\n return text;\n }", "public void printAnnuNom() \n {\n System.out.println(\"Annuaire de \"+nomAnnuaire);\n }", "@Override\n protected void onNextPageRequested(int page) {\n\n }", "public String getAkadimischerTitel() {\r\n return akadimischerTitel;\r\n }", "public void setPage(String page) {\r\n pageEL = page;\r\n }", "public abstract java.lang.String getAcma_cierre();", "@Command\n\t@NotifyChange(\"*\")\n\tpublic void paginarLista(){\n\t\tint page=pagAnalistas.getActivePage();\n\t\tcambiarAnalistas(page, null, null);\n\t}", "@Override\n\t\t\tpublic void onPageSelected(int arg0) {\n\t\t\t\t\n\t\t\t}", "@Override\n\t\t\tpublic void onPageSelected(int arg0) {\n\t\t\t\t\n\t\t\t}", "public String getConsultaPaginada() {\r\n\t\treturn consultaPaginada;\r\n\t}", "protected void creaPagine() {\n Pagina pag;\n Pannello pan;\n\n try { // prova ad eseguire il codice\n\n /* crea la pagina e aggiunge campi e pannelli */\n pag = this.addPagina(\"generale\");\n\n pan = PannelloFactory.orizzontale(this);\n pan.add(Cam.data);\n pan.add(Cam.importo.get());\n pan.add(Cam.note.get());\n pag.add(pan);\n\n } catch (Exception unErrore) { // intercetta l'errore\n Errore.crea(unErrore);\n }// fine del blocco try-catch\n\n }", "public Page getPage() {return page;}", "public int getPage() {\n return page;\n }", "public int getPage() {\n return page;\n }", "public int getPage() {\n return page;\n }", "public int getPage() {\n return page;\n }", "@RequestMapping(path = \"drugprescription\", method = RequestMethod.GET, params = \"page\")\n public List<DrugPrescription> getAllDrugPresByPage(int page){\n return drugPrescriptionService.getAllDrugPresByPage(page);\n }", "public void setPage(Page page) {\n this.page=page;\n }", "public void setPage(Page page) {\n this.page=page;\n }", "public void afficherPageDesJeux() throws SQLException{\n this.pageDesJeux.maj();\n VBox fp = ((VBox) windows.getRoot());\n fp.getChildren().remove(1);\n fp.getChildren().add(pageDesJeux);\n }", "@Override\n public void onPageSelected(int arg0) {\n current = arg0;\n // title.setText(content[current]);\n\n //\tToast.makeText(LearningActivity.this, \"Current = \"+arg0, Toast.LENGTH_SHORT).show();\n\n }", "protected void agregarUbicacion(){\n\n\n\n }", "private void onValider() {\n recuperation​(Reponse.getText());\r\n\r\n }", "void onPagesAdded(List<Integer> pageList);", "@Override\n\tpublic void process(Page page) {\n\t\tboolean contain=false;\n\t\tint idindex=page.getUrl().toString().lastIndexOf(\"=\");\n\t\tString id=\"\";\n\t\tif(page.getUrl().toString().length()>=(idindex+1))\n\t\t id=page.getUrl().toString().substring(idindex+1);\n\t\tSystem.out.println(id);\n\t\tif(id.contains(\".\"))\n\t\t{\n\t\t\tcontain=true;\n\t\t\tSystem.out.println(\"contain is true\");\n\t\t}\n\t\telse\n\t\t{\n\t\t\tString ziduan=page.getHtml().xpath(\"//tbody/tr[3]/td[1]/text()\").all().get(0);\n\t\t\tString legal=\"法律状态:\";\n\t\t\tif(ziduan.equals(legal))\n\t\t\t{\n\t\t\t\tcontain=true;\n\t\t\t}\n\t\t}\n\t\t\n\t\t/*`patent_name` '专利名称',\n\t\t `patent_type` '专利类型',\n\t\t `legal_status`'法律状态',\n\t\t `abstract` '文摘',\n\t\t `sovereignty` '主权项',\n\t\t `apply_data` '申请日期',\n\t\t `public_data`'公开(公告)日期',\n\t\t `patent_number` '申请(专利)号',\n\t\t `public_number` '公开(公告)号',\n\t\t `main_type_number` '主分类号',\n\t\t `type_number` '分类号',\n\t\t `apply_people` '申请人',\n\t\t `patent_people` '发明人',\n\t\t `people_address` '主申请人地址',\n\t\t `city_code` '省市、代码',\n\t\t */\n\t\t\n\t\tpage.putField(\"patent_name\", page.getHtml().xpath(\"//tbody/tr[1]/td[2]/text()\").all().get(0));\n\t\t\n\t\t//x类\n\t\tif(contain)\n\t\t{\n\t\t\t//专利类型\n\t\t\tpage.putField(\"patent_type\", page.getHtml().xpath(\"//tbody/tr[2]/td[2]/text()\").all().get(0));\n\t\t\t\n\t\t\t//法律状态\n\t\t\tList<String> legal=new ArrayList<String>();\n\t\t\tlegal=page.getHtml().xpath(\"//tbody/tr[3]/td[2]/div/div/span/text()\").all();\n\t\t\tString templegal=\"\";\n\t\t\tfor(int i=0;i<legal.size();i++)\n\t\t\t\ttemplegal+=legal.get(i);\n\t\t\tpage.putField(\"legal_status\",templegal);\n\t\t\t\n\t\t\t//文摘\n\t\t\tpage.putField(\"abstract\", page.getHtml().xpath(\"//tbody/tr[4]/td[2]//*/text()\").all().get(0));\n\t\t\t\n\t\t\t//主权项\n\t\t\tpage.putField(\"sovereignty\", page.getHtml().xpath(\"//tbody/tr[5]/td[2]//*/text()\").all().get(0));\n\t\t\t\n\t\t\t//申请日期\n\t\t\tpage.putField(\"apply_date\", page.getHtml().xpath(\"//tbody/tr[6]/td[2]/span/text()\").all().get(0));\n\t\t\t\n\t\t\t//公开日期\n\t\t\tpage.putField(\"public_date\",page.getHtml().xpath(\"//tbody/tr[7]/td[2]/span/text()\").all().get(0));\n\t\t\t\n\t\t\t//申请号\n\t\t\tpage.putField(\"patent_number\",page.getHtml().xpath(\"//tbody/tr[8]/td[2]/span/text()\").all().get(0));\n\t\t\t\n\t\t\t//公开号\n\t\t\tpage.putField(\"public_number\", page.getHtml().xpath(\"//tbody/tr[9]/td[2]/span/text()\").all().get(0));\n\t\t\t\n\t\t\t//主分类号\n\t\t\tpage.putField(\"main_type_number\",page.getHtml().xpath(\"//tbody/tr[10]/td[2]/span/text()\").all().get(0));\n\t\t\t\n\t\t\t//分类号\n\t\t\tpage.putField(\"type_number\",page.getHtml().xpath(\"//tbody/tr[11]/td[2]/span/text()\").all().get(0));\n\t\t\t\n\t\t\t//申请人\n\t\t\tpage.putField(\"apply_people\",page.getHtml().xpath(\"//tbody/tr[6]/td[4]/span/text()\").all().get(0));\n\t\t\t\n\t\t\t//发明人\n\t\t\tpage.putField(\"patent_people\",page.getHtml().xpath(\"//tbody/tr[7]/td[4]/span/text()\").all().get(0));\n\t\t\t\n\t\t\t//主申请人地址\n\t\t\tpage.putField(\"people_address\", page.getHtml().xpath(\"//tbody/tr[10]/td[4]/span/text()\").all().get(0));\n\t\t\t\n\t\t\t//省市代码\n\t\t\tpage.putField(\"city_code\", page.getHtml().xpath(\"//tbody/tr[11]/td[4]/span/text()\").all().get(0));\n\t\t}\n\t\t//n类\n\t\telse{\n\t\t\t//文摘\n\t\t\tpage.putField(\"abstract\", page.getHtml().xpath(\"//tbody/tr[2]/td[2]//*/text()\").all().get(0));\n\t\t\t\n\t\t\t//申请日期\n\t\t\tpage.putField(\"apply_date\",page.getHtml().xpath(\"//tbody/tr[3]/td[2]/text()\").all().get(0));\n\t\t\t\n\t\t\t//公开日期\n\t\t\tpage.putField(\"public_date\",page.getHtml().xpath(\"//tbody/tr[4]/td[2]/text()\").all().get(0));\n\t\t\t\n\t\t\t//申请号\n\t\t\tpage.putField(\"patent_number\", page.getHtml().xpath(\"//tbody/tr[5]/td[2]/text()\").all().get(0));\n\t\t\t\n\t\t\t//公开号\n\t\t\tpage.putField(\"public_number\", page.getHtml().xpath(\"//tbody/tr[6]/td[2]/text()\").all().get(0));\n\t\t\t\n\t\t\t//主分类号\n\t\t\tpage.putField(\"main_type_number\",page.getHtml().xpath(\"//tbody/tr[7]/td[2]/text()\").all().get(0));\n\t\t\t\n\t\t\t//分类号\n\t\t\tpage.putField(\"type_number\",page.getHtml().xpath(\"//tbody/tr[8]/td[2]/text()\").all().get(0));\n\t\t\t\n\t\t\t//申请人\n\t\t\t//如果申请人为空,则没有span标签\n\t\t\tList<String> apply=new ArrayList<String>();\n\t\t\tapply=page.getHtml().xpath(\"//tbody/tr[10]/td[2]/span/text()\").all();\n\t\t\tif(apply.size()==0)\n\t\t\t{\n\t\t\t\tpage.putField(\"apply_people\",page.getHtml().xpath(\"//tbody/tr[10]/td[2]/text()\").all().get(0));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tpage.putField(\"apply_people\",apply.get(0));\n\t\t\t}\n\t\t\t\n\t\t\t//发明人\n\t\t\t//如果发明人为空,则没有span标签\n\t\t\tapply=page.getHtml().xpath(\"//tbody/tr[11]/td[2]/span/text()\").all();\n\t\t\tif(apply.size()==0)\n\t\t\t{\n\t\t\t\tpage.putField(\"patent_people\",page.getHtml().xpath(\"//tbody/tr[11]/td[2]/text()\").all().get(0));\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tpage.putField(\"patent_people\",apply.get(0));\n\t\t\t}\t\n\t\t}\t\n\t\t\n\t\tpage.putField(\"url\", page.getRequest().getUrl());\n//\t\tSystem.out.println(page.getResultItems().get(\"patent_name\"));\n\t}", "public String getTitre() {\n return titre;\n }", "public String getTitre() {\n return titre;\n }", "Publication getPubli();", "public int getPages(){\n return pages;\n }", "public void setPage(ICPage page) {\n \t\t_page = page;\n \t}", "@Override\n public void onPageSelected(int page) {\n \n Multimedia m = multimediaList.get(page);\n \n if(m.getMas_info() == null || m.getMas_info().trim().equals(\"\"))\n {\n moreInfoButton.setVisibility(View.GONE);\n }\n else\n {\n moreInfoButton.setVisibility(View.VISIBLE);\n }\n \n\n if(m.getTipo() != MMType.Video){\n continuarButton.setVisibility(View.GONE);\n }\n else\n {\n continuarButton.setVisibility(View.VISIBLE);\n }\n }", "@Override\n public void onPageChanged(int page, int pageCount) {\n }", "@Override\n public void onPageSelected(int position) {\n tljr_txt_page.setText(position + 1 + \"/\" + uList.size());\n currentPosition = position;\n }", "public void sendeSpielfeld();", "public String nuevaSubasta() {\n\t\tofer_id = null;\n\t\tofer_valor_oferta = null;\n\t\tofer_fecha_oferta = null;\n\t\tpostulante = null;\n\t\titem_nombre = \"\";\n\t\titem_caracteristicas = \"\";\n\t\titem_imagen = \"\";\n\t\tpos_nombre = \"\";\n\t\tpos_apellido = \"\";\n\t\tpos_direccion = \"\";\n\t\tpos_correo = \"\";\n\t\tpos_telefono = \"\";\n\t\tpos_celular = \"\";\n\t\tpos_institucion = \"\";\n\t\tpos_gerencia = \"\";\n\t\tpos_area = \"\";\n\t\treturn \"nitem?faces-redirect=true\";\n\t}", "@Override\n\t\t\tpublic void onPageSelected(int arg0) {\n\n\t\t\t}", "@Override\r\n\tpublic String toString() {\n\t\treturn \"Titre : \"+_titre+\" Auteur: \"+_auteur+\" NbEcoutes : \"+_nbEcoutes;\r\n\t}", "private void remplirUtiliseData() {\n\t}", "@Override // com.zhihu.android.app.p1311ui.fragment.BaseFragment\n public String onSendPageId() {\n return C6969H.m41409d(\"G3DD28D\");\n }", "private void publishTenders(final HtmlPage resutlsPage, final HashMap<String, Object> metaData) {\n HtmlTable resultsTable = (HtmlTable) resutlsPage.getElementById(RESULTS_TABLE_ID);\n\n List<HtmlTableRow> tableRows = resultsTable\n .getByXPath(\"//table[@id='\" + RESULTS_TABLE_ID + \"']//tr[position() > 1]\");\n\n for (HtmlTableRow row : tableRows) {\n HtmlAnchor detailButton = (HtmlAnchor) row.getFirstByXPath(\"td[last()]/a\");\n if (detailButton == null) {\n continue;\n }\n\n try {\n createAndPublishMessage(SOURCE_DOMAIN, detailButton.click().getWebResponse().getContentAsString(),\n metaData);\n } catch (IOException e) {\n logger.error(\"Unable to load detail page of tender with CIG {} because of\",\n row.getFirstChild().getTextContent(), e);\n throw new UnrecoverableException(\"Unable to load detail page\");\n }\n }\n }", "protected void doAdditionalPageInitialization(IPage page) {\n }", "PageAgent getPage();", "@Override\n\t\tpublic void onPageSelected(int arg0)\n\t\t{\n\t\t\t\n\t\t}", "int getPage();", "protected String getPageNavigation()\n {\n return \"\";\n }", "private void aumentarPilha() {\n this.pilhaMovimentos++;\n }", "void addHasInstitutionHomePage(Object newHasInstitutionHomePage);", "String getTitre();", "@Override\n\tpublic void rotiereNachRechts() {\n\n\t}", "@Override\n\tpublic void onPageSelected(int arg0) {\n\t\t\n\t}", "@Override\n\tpublic void onPageSelected(int arg0) {\n\t\t\n\t}", "private RicercaSinteticaPreDocumentoEntrataResponse ricercaSinteticaPreDocumentoEntrata(int numeroPagina){\n\t\tRicercaSinteticaPreDocumentoEntrata reqRSPD = req.getRicercaSinteticaPreDocumentoEntrata();\t\t\n\t\tParametriPaginazione pp = new ParametriPaginazione(numeroPagina);\n\t\tpp.setElementiPerPagina(100);\n\t\treqRSPD.setParametriPaginazione(pp);\n\t\treqRSPD.setRichiedente(req.getRichiedente());\t\t\n\t\tRicercaSinteticaPreDocumentoEntrataResponse resRSPD = executeExternalService(ricercaSinteticaPreDocumentoEntrata, reqRSPD);\n\t\treturn resRSPD;\n\t}", "public java.lang.String getReferenciado();", "@Override\r\n public String getPageTitle() {\r\n return getTranslation(Routes.getPageTitleKey(Routes.NEW_VECHILE));\r\n }", "@Override\n public String toString() {\n return super.toString() + \"\\nSố trang sách: \"+amountPage\n +\"\\nTình trang sách: \"+status+\"\\nSố lượng mượn: \"+amountBorrow;\n }", "public void setPage(SQLInteger page) {\n\t\tthis.page = page;\n\t}", "@Override\n public void process(Page page) {\n PageStore.prePage = page.getHtml().toString();\n }", "@Override\n\tpublic void loadPrePage() {\n\t\t\n\t\tif(curr_content.isFirstPage){\n\t\t\tPigAndroidUtil.showToast(mContext, \"以是第一页:\", 3000);\n\t\t}else{\n\t\t\texchangePre(m_bookFactory.getPrePageContent(pre_content));\n\t\t}\n\t}", "public NewCZ_DPPHRProcessPage(){ super(); }", "public void actualiserAffichage();", "public void setPage(int value) {\n this.page = value;\n }", "@FXML void pagoCredito(ActionEvent event) {\n pagar(CREDITO);\n }", "private void show(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {\n\t\tInteger page = request.getParameter(\"page\") == \"\" || request.getParameter(\"page\") == null ? 1\r\n\t\t\t\t: Integer.valueOf(request.getParameter(\"page\"));\r\n\t\tint count = service.selectCount();\r\n\t\trequest.setAttribute(\"page\", page);\r\n\t\trequest.setAttribute(\"count\", count);\r\n\t\tList<Notice> list = service.selectAll((page - 1) * 5, 5);\r\n\t\trequest.setAttribute(\"list\", list);\r\n\r\n\t\trequest.getRequestDispatcher(\"/WEB-INF/jsp/GongGaoGuanLi.jsp\").forward(request, response);\r\n\t}", "Page getPage();", "private ShowConferenceSectionsPage() {\n this.service = UserService.retrieve();\n this.validator = Validator.retrieve();\n }", "public List<Element> monitorPage(String link){\n\t\tSystem.out.println(\"monitor Page \" + link);\n\t\tDocument document;\n\t\tList<Element> results = new ArrayList<Element>();\n\t\t// se connecte au site\n\t\tdocument = connectToPage(link);\n\t\t// liste tous les éléments de la classe inner-article (i.e. tout ce qu'il y a sur la page\n\t\tSystem.out.println(document.toString());\n\t\t/*List<Element> articlesGeneral = new ArrayList<Element>();\n\t\tfor (Element element : elements) {\n\t\t\t// extrait chaque link a des articles \n\t\t\tElement linkPage = element.select(\"a\").first();\n\t\t\tarticlesGeneral.add(linkPage);\n\t\t}\n\t\tresults = articlesGeneral;*/\t\t\n\n\t\treturn results;\n\n\t}", "private void afficheSuiv(){\n\t\ttry{ // Essayer ceci\n\t\t\tif(numCourant <= rep.taille()){\n\t\t\t\tnumCourant ++;\n\t\t\t\tPersonne e = rep.recherchePersonne(numCourant); // Rechercher la personne en fonction du numCourant\n\t\t\t\tafficherPersonne(e);\n\t\t\t}else{\n\t\t\t\tafficherMessageErreur();\n\t\t\t}\n\t\t}catch(Exception e){ // Permet de voir s'il y a cette exception\n\t\t\tafficherMessageErreur();\n\t\t\tnumCourant --;\n\t\t}\n\t}", "public void showPageWord(int page) {\n ArrayList<Word> fullDictionary = dictionaryManagement.getDictionary().getWords();\n System.out.println(\"No\\t|English\\t|Type\\t|Vietnamese\");\n \n for (int i = (page - 1) * 20; i < (page - 1) * 20 + 20; i ++) {\n if (i < fullDictionary.size()) {\n String aWord = String.valueOf(i + 1) + \"\\t|\" + fullDictionary.get(i).getWordTarget()\n + \"\\t|\" + fullDictionary.get(i).getWordExplain();\n System.out.println(aWord);\n }\n }\n }", "public List<ViewEtudiantInscriptionEcheance> rechercheEtudiantInscripEcheanceParNomEtPrenom(){ \r\n try{ \r\n setListRechercheEtudiantInscripEcheance(viewEtudiantInscripEcheanceFacadeL.findEtudInscripByNonEtPrenomWithJocker(getViewEtudiantInscripEcheance().getNomEtPrenom())); \r\n }catch (Exception ex) {\r\n System.err.println(\"Erreur capturée : \"+ex);\r\n }\r\n return listRechercheEtudiantInscripEcheance;\r\n }", "@Override\n protected void elaboraParametri() {\n super.elaboraParametri();\n titoloPagina = TITOLO_PAGINA;\n }" ]
[ "0.6100153", "0.59706706", "0.5853512", "0.5828847", "0.5781248", "0.5746245", "0.5718242", "0.5699265", "0.56519645", "0.56477416", "0.56224895", "0.5571309", "0.5562923", "0.5554857", "0.5507193", "0.5499366", "0.5498099", "0.5492855", "0.5447723", "0.5421949", "0.5409815", "0.53938395", "0.53837174", "0.5383493", "0.53795385", "0.5370728", "0.5368211", "0.53606504", "0.53376204", "0.53354746", "0.53308827", "0.5330806", "0.5326666", "0.5324764", "0.5302119", "0.52960354", "0.52947605", "0.52804637", "0.527926", "0.527926", "0.52760106", "0.52721107", "0.52711785", "0.5259512", "0.5259512", "0.5259512", "0.5259512", "0.52509636", "0.524152", "0.524152", "0.5239011", "0.5234334", "0.52222145", "0.5219974", "0.52034646", "0.5196136", "0.5195553", "0.5195553", "0.51929754", "0.5178533", "0.5177429", "0.5176417", "0.51666117", "0.51524496", "0.5152125", "0.51468766", "0.5131209", "0.513095", "0.51304847", "0.5129461", "0.51290905", "0.5120007", "0.5119851", "0.5118365", "0.5115514", "0.51126474", "0.5101996", "0.5096051", "0.508814", "0.50866526", "0.50859976", "0.50859976", "0.50843924", "0.50842065", "0.5084041", "0.5082559", "0.50821376", "0.5080168", "0.5078537", "0.507735", "0.50705194", "0.5068175", "0.5066988", "0.5062505", "0.5061925", "0.5061081", "0.5060769", "0.5059403", "0.5058578", "0.5056712", "0.505245" ]
0.0
-1
/ Valide l'adresse mail saisie
private void validationEmail(String email) throws Exception { if (email != null && email.trim().length() != 0) { if (!email.matches("([^.@]+)(\\.[^.@]+)*@([^.@]+\\.)+([^.@]+)")) { throw new Exception("Merci de saisir une adresse mail valide."); } } else { throw new Exception("Merci de saisir une adresse mail."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public String adcionarEmail() {\n\t\tpessoa.adicionaEmail(email);\n\t\tthis.email = new Email();\n\t\treturn null;\n\t}", "String getUserMail();", "public void setMailing(String mail) {\n mailing = mail;\n }", "public String getMail() {\r\n\t\treturn mail;\r\n\t}", "public synchronized String getMail()\r\n {\r\n return mail;\r\n }", "public void setEmail(String p) { this.idcorreo = p; }", "private String extractEMailAddress() {\n return SwingUtil.extract(emailJTextField, Boolean.TRUE);\n }", "java.lang.String getEmail();", "java.lang.String getEmail();", "java.lang.String getEmail();", "java.lang.String getEmail();", "java.lang.String getEmail();", "java.lang.String getEmail();", "public java.lang.String getMail() {\n return mail;\n }", "public String getWallaMailAddress() {\r\n return WallaMailAddress;\r\n }", "public void enviarEmail(String c, Ciudadano a){\n\t}", "Object getMailhost();", "public static String getBiblioMail() {\n\t\treturn \"mail\";\n\t}", "public void setMail(java.lang.String mail) {\n this.mail = mail;\n }", "private boolean comprobar_email() {\n\t\tString mail = email.getText().toString();\n\n\t\tif (mail.matches(\".*@.*\\\\.upv.es\")) {\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}", "public String getEmailad() {\n\treturn emailad;\n}", "public String getMailing() {\n return mailing;\n }", "public String getFromEMail() {\n return fromEMail;\n }", "String getEmail();", "String getEmail();", "String getEmail();", "String getEmail();", "String getEmail();", "public Mail getMail() {\n return mail;\n }", "public void setEmailad(String emailad) {\n\tthis.emailad = emailad;\n}", "public void posaljiZaboravljenaSifraMail(final ZaboravljenaSifraDto dto, final String host) {\n var optionalPartner = partnerRepository.findByEmail(dto.getEmail());\n if (!optionalPartner.isPresent()) {\n optionalPartner = partnerRepository.findByWebKorisnik(dto.getEmail());\n }\n\n if (optionalPartner.isPresent()) {\n final Partner partner = optionalPartner.get();\n validateEmail(partner);\n zaboravljenaSifraPripremaISlanje(dto, partner, host);\n } else {\n log.error(\"Ne postoji email ili korisinicko ime korisnika u bazi\", dto.getEmail());\n throw new MailSendException(\"Mail not found\");\n }\n }", "public void enviarAlertaDeQueEstaOnline(){\n //mandaria un mail a los usuarios avisando que ya esta disponible para ver.\n System.out.println(\"Enviando mail con url \" + this.url);\n }", "public boolean mailRecuperarPassword(String nombreusuario, String password, String mail){\n\n try {\n\n// //seteamos el asunto\n// message.setSubject(\"UNDEC - Activar Cuenta Nortia UNDEC\");\n//\n// //seteamos el mensaje que vamos a enviar\n// message.setContent(\"<html>\\n\" +\n// \"<body>\\n\" +\n// \"\\nHola, usuario = \" +nombreusuario+ \",\\n su nuevo password es = \"+password+\n// \"\\n\" +\n// \"\\nUsted puede cambiar el password cuando ingrese al sistema\\n \"+\n// \n// \"Muchas Gracias\"+\n// \"</body>\\n\" +\n// \"</html>\", \"text/html\");\n// //colocamos la direccion de donde enviamos el correo\n// Address address = new InternetAddress(mail);\n// message.setFrom(address);\n// //Colocamos la direccion de la persona a enviar\n// Address send = new InternetAddress(mail,false);\n// message.addRecipient(Message.RecipientType.TO,send);\n// \n// //la persona que envia con la validacion de su cuenta.\n// Transport trans = session.getTransport(\"smtp\");\n// //Aca se autentifica que la direccion de la persona que envia sea válida\n//\n// trans.connect(\"[email protected]\",\"momomomo\");\n// trans.sendMessage(message,message.getAllRecipients());\n// trans.close();\n System.out.println(\"maiñll\");\n Email email = new Email();\n email.setFromAddress(\"Nortia UNDEC\", \"[email protected]\");\n email.addRecipient(nombreusuario, mail, RecipientType.TO);\n //email.addRecipient(agente.getApellido(), agente.getOtroemail(), RecipientType.BCC);\n email.setTextHTML(\"Hola, usuario = \"+nombreusuario+ \"su nuevo password es = \"+password +\n\n\" <br />Usted puede cambiar el password cuando ingrese al sistema <br />\" +\n\n\"Muchas Gracias\");\n System.out.println(\"-----------\"+mail);\n email.setSubject(\"UNDEC - Recuperar Password Nortia UNDEC\");\n \n // or:\n new Mailer(\"localhost\", 25, \"[email protected]\", \"sgap*9812\").sendMail(email);\n System.out.println(\"-----------enviado\");\n } catch (Exception ex) {\n\n ex.printStackTrace();\n //Si el correo tiene algun error lo retornaremos aca\n JsfUtil.addErrorMessage(ex,\"No se pudo crear el Usuario\");\n\n return false;\n\n \n }\n //Correo tuvo exito dara una salida en este punto indicando que si se envio\n return true;\n \n }", "void send(String email, Locale locale);", "public java.lang.String getEmailAddress();", "public void setWallaMailAddress(String wallaMailAddress) {\r\n WallaMailAddress = wallaMailAddress;\r\n }", "public String geteMail() {\n return eMail;\n }", "public String geteMail() {\n return eMail;\n }", "public String getEmail() { return (this.idcorreo == null) ? \"\" : this.idcorreo; }", "private String getPlayerMail() {\n EditText mail = (EditText) findViewById(R.id.mail_edittext_view);\n return mail.getText().toString();\n }", "String getPlayerMail() {\r\n EditText editText = (EditText) findViewById(R.id.mail_edit_text_view);\r\n return editText.getText().toString();\r\n }", "public String getEmail_pelanggan(){\r\n \r\n return email_pelanggan;\r\n }", "public void enterEmail(String umail) {\n driver.findElement(Email).sendKeys(umail);\n }", "@AutoEscape\n\tpublic String getEmail_address();", "public void EnvoyerEmailSurveillant(Utilisateur user) {\n\t\t\t\t MimeMessage mimeMessage = mailSender.createMimeMessage(); \n\t\t\t try {\n\t\t\t MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, true);\n\t\t\t mimeMessageHelper.setSubject(\"Compte Surveillant \");\n\t\t\t mimeMessageHelper.setFrom(\"[email protected]\");\n\n\t\t\t mimeMessageHelper.setTo(user.getEmail());\n\t\t\t String url =\"scolarity.dpc.com.tn\";\n\t\t String content = \"Bonjour Mr ( Mmme), \" + user.getNom()+\" + \" + user.getPrenom()\n\t\t + \", votre nom d'utilisateur par la platforme scolarity est : \\n \" + user.getUsername() +\" \\n\"+\"et votre mot de passe est : \\n\"+ user.getPassword()+\"\\n\"+\"vous pouvez accéder au espace surveillant via l'adresse suivante : \\n\"+url+\"\\n\"+\" \\n Cordialement.\";\n\t\t System.out.println(content);\n\n\t\t\t mimeMessageHelper.setTo(user.getEmail());\n\t\t mimeMessageHelper.setText(content);\n\t\t // Add a resource as an attachment\n\t\t mimeMessageHelper.setText(\"<html><body><p>\" + content + \"</p> <img src=\\\"http://207.180.211.158:/logodpc.bmp\\\" width=\\\"50\\\" alt=\\\"Apen\\\"></body></html>\", true);\n\n\t\t\t \n\t\t\t \n\t\t\t mailSender.send(mimeMessageHelper.getMimeMessage());\n\t\t\t } catch (MessagingException e) {\n\t\t\t e.printStackTrace();\n\t\t\t }\n\t\t\t\t\n\t\t\t}", "public void sendMail(String address, String content) {\n }", "private boolean verificaEmail(String cadena) {\n if (validate.esVacio(cadena)) {\n setErrorEmail(getMsjVacio());\n return false;\n }\n if (!validate.esEmailValido(cadena)) {\n setErrorEmail(getMsjEmailInvalido());\n return false;\n }\n setErrorEmail(null);\n return true;\n }", "public String getEmailAddress();", "public void setEmail(final String e)\n {\n this.email = e;\n }", "java.lang.String getUserEmail();", "public static String validEmail(String message){\n boolean success = false;\n String line = \"\";\n do {\n line = readLine(message).trim();\n success = checkEmail(line);\n if (!success)\n System.out.println(\"Debes introducir una dirección de correo \"\n + \"válida... \");\n } while(!success);\n return line;\n }", "public void setEmailCom(String emailCom);", "public String getEmailAddress() {\r\n return email;\r\n }", "public Email getEmail()\r\n {\r\n /**\r\n * Ya hemos leido. Se devuelve una nueva instancia en cada envio de mail para evitar problemas de sincronizacion.\r\n */\r\n return createEmailInstance();\r\n }", "public void seteMail(String eMail) {\n this.eMail = eMail;\n }", "public String getEmail() {return email; }", "public static void sendMail (String email, String name, String surname) throws AddressException,MessagingException {\n \n Properties props = new Properties();\n props.put(\"mail.smtp.host\", \"smtp.gmail.com\");\n props.put(\"mail.smtp.auth\", \"true\");\n props.put(\"mail.smtp.port\", \"587\");\n props.put(\"mail.smtp.starttls.enable\", \"true\");\n props.put(\"mail.smtp.ssl.trust\", \"smtp.gmail.com\");\n\n Session session = Session.getDefaultInstance(props,\n new javax.mail.Authenticator() {\n protected PasswordAuthentication getPasswordAuthentication() {\n return new PasswordAuthentication(\"[email protected]\",\"progettoweb2018\");\n }\n });\n\n try {\n\n Message message = new MimeMessage(session);\n message.setFrom(new InternetAddress(\"[email protected]\"));\n message.setRecipients(Message.RecipientType.TO,\n InternetAddress.parse(email));\n message.setSubject(\"Benvenuto in Friday!\");\n message.setText(name+\" \"+surname+\", Benvenuto in Friday!\"+\n \"\\n\\n link di conferma : http://localhost:8080/Friday/confirmRegistrationServlet?email=\"+email);\n\n Transport.send(message);\n\n } catch (MessagingException e) {\n throw new RuntimeException(e);\n }\n }", "public java.lang.String getEmail() {\n return localEmail;\n }", "private EmailAddress getEmail(final String mail) {\r\n\t\treturn (EmailAddress) this.getSingleResult(this.em.createNativeQuery(\"select * from emailaddress WHERE eMailAddress ='\" + mail + \"'\",\r\n\t\t\t\tEmailAddress.class));\r\n\t}", "public String getEmailAddress() {\n return email;\n }", "@Override\r\n\tpublic String getEmailAdrress() {\n\t\treturn null;\r\n\t}", "public java.lang.CharSequence getEmailAddress() {\n return email_address;\n }", "public String getEmail() {\r\n // Bouml preserved body begin 00040D82\r\n\t System.out.println(email);\r\n\t return email;\r\n // Bouml preserved body end 00040D82\r\n }", "public String getMailNo() {\n return mailNo;\n }", "public EditAccountPage fillEmailField(String e_mail){\n cleanElement(emailElement);\n setElementText(emailElement, e_mail);\n return this;\n }", "@Override\r\n\tpublic String getEmail() {\n\t\treturn email;\r\n\t}", "public String getContactEmail() {\r\n return tfContactEmail.getText().trim();\r\n }", "public java.lang.String getEMail () {\r\n\t\treturn eMail;\r\n\t}", "public String getEmail() {\r\n return email;\r\n }", "public String getEmail() {\r\n return email;\r\n }", "public String getEmail() {\r\n return email;\r\n }", "public String getEmail() {\r\n return email;\r\n }", "public String getEmail() {\r\n return email;\r\n }", "public String getEmail() {\r\n return email;\r\n }", "public String getEmail() {\r\n return email;\r\n }", "public String getEmail() {\r\n return email;\r\n }", "public String getEmail() {\r\n return email;\r\n }", "public String getEmail() {\r\n return email;\r\n }", "public String getEmail() {\r\n return email;\r\n }", "public String getEmail()\n {\n return emailAddress;\n }", "public String getEmail() { return email; }", "String getEmail(int type);", "public java.lang.CharSequence getEmailAddress() {\n return email_address;\n }", "public void setEmail_pelanggan(String Email_Pelanggan){\r\n \r\n this.email_pelanggan = Email_Pelanggan;\r\n }", "public String getEmail(){\n\t\treturn email;\n\t}", "public String getEmail(){\n\t\treturn email;\n\t}", "public String getEmail()\r\n {\r\n return email;\r\n }", "private static void testMail() throws Exception {\n\t\tUser user=new User();\n\t\tuser.setUsername(\"若水\");\n\t\tuser.setEmail(\"[email protected]\");\n\t\tMail mail=new Mail();\n\t\tboolean b=mail.sendMail(user, \"http://www.baidu.com\", \"http://www.zzuli.edu.cn\", 2);\n\t\tSystem.out.println(b);\n\t}", "public void setEmailAddress(java.lang.CharSequence value) {\n this.email_address = value;\n }", "Optional<String> email();", "public boolean verificaEmail(String correo) {\n Pattern pat = null;\r\n Matcher mat = null;\r\n pat = Pattern.compile(\"^([0-9a-zA-Z]([_.w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-w]*[0-9a-zA-Z].)+([a-zA-Z]{2,9}.)+[a-zA-Z]{2,3})$\");\r\n mat = pat.matcher(correo);\r\n if (mat.find()) {\r\n return true;\r\n }else{\r\n return false;\r\n }\r\n }", "public JTextField getTxtEmail() {\n return this.txtEmail;\n }", "public void setMailNo(String mailNo) {\n this.mailNo = mailNo;\n }", "public String getEmail() {return email;}", "public String getEmail()\n {\n return email;\n }", "public String getEmail()\n {\n return email;\n }", "public String getEmail() {\n return email;\n }", "public String getEmail() {\n return email;\n }", "public String getGmailAddress() {\r\n return GmailAddress;\r\n }", "public String getEmail() {\n return email;\n }", "public String getEmail() {\n return email;\n }" ]
[ "0.7339011", "0.705475", "0.70253354", "0.7003911", "0.68891466", "0.68231696", "0.68093234", "0.6780108", "0.6780108", "0.6780108", "0.6780108", "0.6780108", "0.6780108", "0.6774574", "0.6756112", "0.6726197", "0.66952807", "0.66726553", "0.6621977", "0.6539143", "0.65190095", "0.6502482", "0.6502191", "0.64916617", "0.64916617", "0.64916617", "0.64916617", "0.64916617", "0.64807105", "0.64746934", "0.6449249", "0.64467293", "0.64221644", "0.6373596", "0.63308096", "0.6324437", "0.63239795", "0.63239795", "0.632173", "0.630567", "0.62999904", "0.6284322", "0.6281385", "0.62558675", "0.6246513", "0.6233881", "0.62220556", "0.62111205", "0.6209539", "0.6207646", "0.6200936", "0.61993766", "0.6179292", "0.61743754", "0.6134995", "0.61347646", "0.61311877", "0.6129901", "0.61249876", "0.61158466", "0.61139405", "0.61126816", "0.6108804", "0.60997015", "0.60910636", "0.608689", "0.6083611", "0.6070846", "0.6062377", "0.6062377", "0.6062377", "0.6062377", "0.6062377", "0.6062377", "0.6062377", "0.6062377", "0.6062377", "0.6062377", "0.6062377", "0.6050528", "0.60494214", "0.60457295", "0.6034551", "0.6031401", "0.6014722", "0.6014722", "0.6012932", "0.6010475", "0.6010325", "0.60055035", "0.6003651", "0.6003556", "0.59997004", "0.59984106", "0.5993499", "0.5993499", "0.5987353", "0.5987353", "0.59860593", "0.59835756", "0.59835756" ]
0.0
-1
/ Valide les mots de passe saisis
private void validationMotsDePasse(String motDePasse, String confirmation) throws Exception { if (motDePasse != null && motDePasse.trim().length() != 0 && confirmation != null && confirmation.trim().length() != 0) { if (!motDePasse.equals(confirmation)) { throw new Exception("Les mots de passe entrés sont différents, merci de les saisir à nouveau."); } else if (motDePasse.trim().length() < 8) { throw new Exception("Les mots de passe doivent contenir au moins 8 caractères."); } } else { throw new Exception("Merci de saisir et confirmer votre mot de passe."); } }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Password getPsw();", "@Override\n\t\t\tpublic void onTextChanged(CharSequence s, int start, int before, int count) {\n\t\t\t\tu.setPassword(s.toString());\n\t\t\t\n\t\t\t}", "public char[] getPassword() {\r\n return senha;\r\n }", "String getUserPassword();", "String getPassword();", "String getPassword();", "String getPassword();", "String getPassword();", "String getPassword();", "String getPassword();", "String getPassword();", "String getPassword();", "String getPassword();", "@Override\npublic String getPassword() {\n\treturn senha;\n}", "String getPass();", "public String getReceptionist_password(){ return receptionist_password;}", "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 getNewPassword();", "java.lang.String getPass();", "java.lang.String getPass();", "public void setPassword(String pass);", "public void makePassword() {\n String str = \"\";\r\n StringBuilder strBuilder = new StringBuilder(str);\r\n Random generator = new Random();\r\n int[] senha = new int[6];\r\n for (int i = 0; i < 6; i++) {\r\n senha[i] = generator.nextInt(10);\r\n strBuilder.append(Integer.toString(senha[i]));\r\n }\r\n str = strBuilder.toString();\r\n this.setPassword(str);\r\n //passwordList.add(l);\r\n }", "public java.lang.String getSpPassword(){\r\n return localSpPassword;\r\n }", "@Override\n\tpublic String getPassword() {\n\t\treturn senha;\n\t}", "@Override\n public void onClick(View v) {\n valOldPassword(edPass1);\n valNewPassword(edPass2);\n if (valOldPassword(edPass1) && valNewPassword(edPass2)){\n String antPass = edPass1.getText().toString();\n String sigPass = edPass2.getText().toString();\n //Validar que la password anterior edPass1 sea correcta.\n valPassword(antPass);\n if (valPassword(antPass)){\n //Se cambiará la password\n dialogUpdatePass(sigPass);\n }else{\n Toast.makeText(CambiarPassword.this, \"La contraseña ingresada no es correcta\", Toast.LENGTH_SHORT).show();\n }\n }else{\n Toast.makeText(CambiarPassword.this, \"Debe llenar todos los campos\", Toast.LENGTH_SHORT).show();\n }\n }", "public String getPassword();", "public String getPassword();", "public void setPassword2(String password2);", "public char[] getPassword();", "private void validationMotDePasse( String motDePasse ) throws Exception {\n if ( motDePasse != null ) {\n if ( motDePasse.length() < 3 ) {\n throw new Exception( \"Le mot de passe doit contenir au moins 3 caractères.\" );\n }\n } else {\n throw new Exception( \"Merci de saisir votre mot de passe.\" );\n }\n }", "private boolean valPassword(String pass){\n if (usuario.getPassword().equals(pass)){\n return true;\n }\n return false;\n }", "public java.lang.String getPassword();", "@Override\n public void setOnPasswordFinished() {\n if (passwordView.getOriginText().length() == passwordView.getMaxPasswordLength()) {\n Toast.makeText(this, \"密码为\" + passwordView.getOriginText(), Toast.LENGTH_LONG).show();\n }\n }", "public String setPassword(){\n String passWord = \"\";\n while(passWord.isBlank()) {\n System.out.print(\"Please Enter PassWord: \");\n passWord = supplyString.get();\n }\n return passWord.trim();\n }", "private String getPassword(){\n System.out.println(\"Enter the Password Minimum Of 8 Charters\");\n return sc.next();\n }", "@Override\n\tpublic String getPassword() {\n\t\treturn this.senha;\n\t}", "@Override\n\tpublic String getPassword() {\n\t\treturn this.senha;\n\t}", "void setErrorPassword();", "String password();", "void setPassword(String ps) {\n this.password = ps;\n }", "private char[] getPass()\n {\n return password.getPassword();\n }", "@Override\n\t\t\tpublic void afterTextChanged(Editable s) {\n\t\t\t\tpasswordET.setText(sp.getString(cardNumAuto.getText()\n\t\t\t\t\t\t.toString(), \"\"));// 自动输入密码\n\n\t\t\t}", "public String getaPass() {\n return aPass;\n }", "public String valiationOfPasswordField()\n\t{\n\t\twaitForVisibility(validationPassword);\n\t\treturn validationPassword.getText();\n\t}", "public void setSpPassword(java.lang.String param){\r\n \r\n if (param != null){\r\n //update the setting tracker\r\n localSpPasswordTracker = true;\r\n } else {\r\n localSpPasswordTracker = false;\r\n \r\n }\r\n \r\n this.localSpPassword=param;\r\n \r\n\r\n }", "public String getUserPass() {\n\t\treturn passText.getText().toString();\n\t}", "public String getPassword()\r\n/* 21: */ {\r\n/* 22:38 */ return this.password;\r\n/* 23: */ }", "private void actualitzaPasswd(String nou){\n user.setPasswd(nou);\n try{\n helperU.actualitzar(user, false);\n \n info(\"Contrasenya actualitzada!\");\n }catch(Exception ex){\n avis(\"Error al actualitzar la contrasenya!\");\n }\n }", "public String getPass_pelanggan(){\r\n \r\n return pass_pelanggan;\r\n }", "public String preuzmiPassword() {\n return konfiguracija.dajPostavku(\"OpenSkyNetwork.lozinka\");\n }", "@Override\r\n\t\t\tpublic void afterTextChanged(Editable edit) {\n\t\t\t\tpassword = edit.toString();\r\n\t\t\t}", "void checkSavePwd(){\n\t\tString acc = MyConstants.STR_BLANK;\n\t\tString pwd = MyConstants.STR_BLANK;\n\t\tif(cbox.isChecked()){\n\t\t\t\tacc = edAccount.getText().toString();\n\t\t\t\tpwd = edPassword.getText().toString();\n\t\t}\n\t\tSetting.getInstance().saveValue(MyConstants.ACC_KEY, acc, Setting.TYPE_STRING);\n\t\tSetting.getInstance().saveValue(MyConstants.PWD_KEY, pwd, Setting.TYPE_STRING);\n\t}", "void mo33731Pw();", "String getTemporaryPassword();", "public int getPassword(){\n return password;\r\n }", "private static String getEncryptedStoredPassword(String args[]) {\n return args[1].trim() ;\n }", "public void setPassUsuario(String passUsuario) {\r\n this.passUsuario = passUsuario;\r\n }", "protected void botonAceptarPulsado() {\n\t\tString pass = this.vista.getClave();\n\t\tchar[] arrayC = campoClave.getPassword();\n\t\tString clave = new String(arrayC);\n\t\tclave = Vista.md5(clave);\n\t\t\n\t\tif (pass.equals(clave)) {\n\t\t\tarrayC = campoClaveNueva.getPassword();\n\t\t\tString pass1 = new String(arrayC);\n\t\t\t\n\t\t\tarrayC = campoClaveRepita.getPassword();\n\t\t\tString pass2 = new String(arrayC);\n\t\t\t\n\t\t\tif (pass1.equals(pass2)) {\n\t\t\t\tif (this.vista.cambiarClave(pass1)) {\n\t\t\t\t\tthis.vista.msg(this, \"Contraseña maestra cambiada con éxito\");\n\t\t\t\t\tthis.setVisible(false);\n\t\t\t\t}\n\t\t\t\telse {\n\t\t\t\t\tthis.vista.error(this, \"Error al cambiar la contraseña maestra\");\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthis.vista.error(this, \"Las contraseñas no coinciden\");\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tthis.vista.error(this, \"Contraseña incorrecta\");\n\t\t}\n\t}", "void setPassword(String password);", "void setPassword(String password);", "void setPassword(String password);", "@Override\n public void onClick(View v) {\n String num1 = Integer.toString(pin1.getValue());\n String num2 = Integer.toString(pin2.getValue());\n String num3 = Integer.toString(pin3.getValue());\n String num4 = Integer.toString(pin4.getValue());\n StringBuilder passBuilder = new StringBuilder();\n passBuilder.append(num1);\n passBuilder.append(num2);\n passBuilder.append(num3);\n passBuilder.append(num4);\n String password = passBuilder.toString();\n\n if(password.equals(selected_user.getPassword())) {\n changeUser(position);\n dialog.dismiss();\n } else {\n Toast.makeText(activity, \"Wrong password, you've entered : \" + password, Toast.LENGTH_SHORT).show();\n }\n }", "boolean hasPassword2();", "private void exibirSenha() {\n if (exibeSenha) {\n txtSenha.setTransformationMethod(PasswordTransformationMethod.getInstance());\n exibeSenha = false;\n } else {\n txtSenha.setTransformationMethod(HideReturnsTransformationMethod.getInstance());\n exibeSenha = true;\n }\n }", "public boolean cambiarClave(String pass) {\n\t\tConnection conexion;\n\n\t\ttry {\n\t\t\tconexion = DriverManager.getConnection(\"jdbc:mysql://localhost/keyring\", \"root\" ,\"\");\n\t\t\tStatement sql = conexion.createStatement();\n\t\t\tint resultado;\n\t\t\tString clave = getClave();\n\n\t\t\tif (clave.length() > 0) {\n\t\t\t\tresultado = sql.executeUpdate(\"UPDATE password SET Password='\" + pass + \"'\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tresultado = sql.executeUpdate(\"INSERT INTO password (Password) VALUES ('\" + pass + \"')\");\n\t\t\t}\n\n\t\t\tif (resultado > 0) {\n\t\t\t\treturn true;\n\t\t\t}\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 false;\n\t}", "private int userLoing() {\n\t\t\n\t\tScanner scan2 = new Scanner(System.in);\n\t\tSystem.out.println(\"\\nPour vous rappler, pour quitter il faut entrer q ou quit pour quitter \\navant de commencer de saisir de mot de passe.\\n\"+\n\t\t\t\t\n\t\t\t\t\"--------------------------------------------------------------------------------------\");\n\t\tboolean correct = true; //To check the confirmation of the password\n\t\t\n\t\t\n\t\t//to get the user's name\n\t\tString nom;\n\t\tdo {\n\t\t System.out.print(\"Entrez un nom d'une longueur qui > 4: \");\n\t\t nom = scan2.nextLine();\n\t\t} while ((nom.length() < 4) && !(nom.equalsIgnoreCase(\"q\")) && !(nom.equalsIgnoreCase(\"quit\")));\n\t\t\n\t\tif(nom.equalsIgnoreCase(\"q\") || nom.equalsIgnoreCase(\"quit\")) {\n\t\t\tSystem.out.println(\"\\n-----------------------------------------------------\\nVous avez été dérigé vers le meun principal!\\n-----------------------------------------------------\");\n\t\t\tcorrect = true;\n\t\t\t\n\t\t} else {\n\t\t\t\n\t\t\t\n\t\t\t//for the password and the confirmation\n\t\t\t\n\t\t\twhile(correct) {\n\t\t\t\tint mdp;\n\t\t\t\tdo {\n\t\t\t\t System.out.print(\"Entrez un mot de passe qui contient au moins 6 chiffres SVP: \");\n\t\t\t\t while (!scan2.hasNextInt()) {\n\t\t\t\t\t System.err.print(\"Entrez un mot de passe qui contient au moins 6 chiffres SVP: \");\n\t\t\t\t scan2.next();\n\t\t\t\t }\n\t\t\t\t mdp = scan2.nextInt();\n\t\t\t\t} while (Integer.toString(mdp).length() < 6);\n\t\t\t\t\n\t\t\t\tint mdp2;\n\t\t\t\tdo {\n\t\t\t\t System.out.print(\"Confirmez vôtre mot de passe SVP : \");\n\t\t\t\t while (!scan2.hasNextInt()) {\n\t\t\t\t\t System.err.print(\"Confirmez vôtre mot de passe : \");\n\t\t\t\t scan2.next(); \n\t\t\t\t }\n\t\t\t\t mdp2 = scan2.nextInt();\n\t\t\t\t} while (Integer.toString(mdp2).length() < 6);\n\t\t\t\t\n\t\t\t\tcorrect = mdp == mdp2 ? false: true;\n\t\t\t}\n\t\t}\n\t\t\n\t\tint res = !correct? 1 : 0;\n\t\treturn res;\n\t\t\n\t}", "public String getPassUsuario() {\r\n return passUsuario;\r\n }", "private boolean isPasswordValid(String password){\n return password.length() > 2; //mot de passe de longueur sup à 2\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 String getPassWord(){\n return passWord;\n }", "private String extractPassword() {\n return SwingUtil.extract(passwordJPasswordField, Boolean.TRUE);\n }", "public String getPasswordValue() {\r\n\t\treturn txtPassword.getValue();\r\n\t}", "private boolean cekPassword(String password){\n return password.equals(Preferences.getRegisteredPass(getBaseContext()));\n }", "void onChangePasswordSuccess(ConformationRes data);", "public List<String> passwordMessageValidations() {\n name.sendKeys(\"Karan Prinja\");\n email.sendKeys(\"[email protected]\");\n password.sendKeys(\"12345678\");\n helperMethods.waitForWebElement(smallPassword, 30);\n String sosoPassword = smallPassword.getText();\n password.clear();\n password.sendKeys(\"Randomer12345678\");\n helperMethods.waitForWebElement(smallPassword, 30);\n String goodPassword = smallPassword.getText();\n List<String> passwordValidationText = new ArrayList<>();\n passwordValidationText.add(sosoPassword);\n passwordValidationText.add(goodPassword);\n return passwordValidationText;\n }", "public void typePassword(String text) {\n txtPassword().typeText(text);\n }", "@Override\n public void onClick(View v) {\n biensoxe = etBienSoXe.getText().toString().toLowerCase().trim();\n passwordtx = etPasswordtx.getText().toString().trim();\n confirmPassword = etConfirmPassword.getText().toString().trim();\n tenchuxe = etTenChuXe.getText().toString().trim();\n sdt = etSDT.getText().toString().trim();\n mota = edMoTa.getText().toString().trim();\n loaixe = tenloaixe;\n trongtaixe = trongtai;\n if (validateInputs()) {\n registerUser();\n }\n\n }", "PasswordProtection protection();", "private void tencarFinestra(){\n Stage secondaryStage = (Stage)Panel.getScene().getWindow(); \n this.passwd = encripta(pfNou2.getText()); \n secondaryStage.close();\n \n }", "@Override\n\tpublic String getPassword() {\n\t\treturn \"ajay\";\n\t}", "public void set_pass(String password)\n {\n pass=password;\n }", "@Override\n\tpublic void setPlainPassword(String arg0) {\n\t\t\n\t}", "public String getpasswordinput() {\n return tf2.getText();\n }", "public String getMotDePasse() {\r\n return motDePasse;\r\n }", "void onPasswordSuccess();", "public String getPassword() {\n return txtPassword().getText();\n }", "public void login_pw() {\n\t\tIntent intent = new Intent(this, ResetPasswordActivity.class);\n\t\tstartActivity(intent);\n\t}", "public String getRetypePasswordValue() {\r\n\t\treturn txtRetypePassword.getValue();\r\n\t}", "@Test\n\tpublic void checkconfirmpassword_characters()\n\t{\n\t\t\n\t\tPageFactory.initElements(driver, Resetpassword.class);\n\t\tResetpassword.confirm_password.sendKeys(\"co12!@\");\n\t\tString user_text=Resetpassword.error_message.getText();\n\t\tAssert.assertEquals(user_text,\"co12!@\");\n\t\t\n\t}", "public static String getMobileAdminPassword(){\n\t\treturn \"wildspace12\";\n\t}", "public String getaPassword() {\n return aPassword;\n }", "private void passwordvalidation( String password ) throws Exception {\r\n if ( password != null ) {\r\n if ( password.length() < 6 ) {\r\n throw new Exception( \"Le mot de passe doit contenir au moins 6 caracteres.\" );\r\n }\r\n } else {\r\n throw new Exception( \"Merci de saisir votre mot de passe.\" );\r\n }\r\n }", "private void logIn() {\n char[] password = jPasswordField1.getPassword();\n String userCode = jTextField1.getText();\n\n String txtpassword = \"\";\n for (char pw : password) {\n txtpassword += pw;\n }\n if (\"\".equals(txtpassword)) {\n JOptionPane.showMessageDialog(this, textBundle.getTextBundle().getString(\"enterPassword\"), \"No Password\", JOptionPane.WARNING_MESSAGE);\n } else if (txtpassword.equals(userData.get(0).toString())) {\n jPasswordField2.setEnabled(true);\n jPasswordField3.setEnabled(true);\n jPasswordField2.setEditable(true);\n jPasswordField3.setEditable(true);\n jPasswordField2.grabFocus();\n }\n }", "@Override\n public void onClick(View view) {\n\n String nombre = etNombre.getText().toString();\n String password = etPassword.getText().toString();\n String nombreVolteado = \"\";\n\n //Mostrar el dato\n for (int i = nombre.length()-1; i>=0; i--){\n nombreVolteado += nombre.charAt(i);\n }\n\n if (password.equals(nombreVolteado)){\n tvCrearCuenta.setText(\"Correcto\");\n }else{\n tvCrearCuenta.setText(\"La contraseña debe ser el nombre de usuario volteado\");\n }\n\n //Segunda, mostrar dato al usuario, temporal\n Toast.makeText(getApplicationContext(), \"Su nombre es \" + nombre, Toast.LENGTH_SHORT).show();\n\n //Tercera, mostrar datos al desarrollador (Logcat)\n Log.i(\"PRUEBA\", \"El nombre de usuario es \" + nombre);\n\n }", "public String getPassword(){\n return mPassword;\n }" ]
[ "0.6815945", "0.673235", "0.6562615", "0.6556795", "0.65436935", "0.65436935", "0.65436935", "0.65436935", "0.65436935", "0.65436935", "0.65436935", "0.65436935", "0.65436935", "0.6504651", "0.6488158", "0.64771456", "0.64441794", "0.64441794", "0.64441794", "0.64441794", "0.64441794", "0.64441794", "0.64441794", "0.64387774", "0.64361703", "0.64361703", "0.64334124", "0.6412991", "0.6392213", "0.63874614", "0.6382223", "0.6364224", "0.6364224", "0.6352863", "0.6317962", "0.62955093", "0.62692463", "0.62667155", "0.6265968", "0.62371314", "0.6236838", "0.6230646", "0.6230646", "0.6207574", "0.6178125", "0.6171084", "0.616797", "0.61520433", "0.6143166", "0.6126934", "0.6125509", "0.6099115", "0.6094478", "0.60882336", "0.60863674", "0.6081655", "0.60716254", "0.60714334", "0.60581136", "0.60519636", "0.6028467", "0.60270584", "0.60187817", "0.6015836", "0.5992558", "0.5992558", "0.5992558", "0.59890914", "0.59884787", "0.59838325", "0.59825337", "0.59781665", "0.5972879", "0.59691334", "0.59690183", "0.5967762", "0.5967555", "0.5945117", "0.5943828", "0.59367776", "0.5936213", "0.5927662", "0.5904261", "0.58939147", "0.5891426", "0.5889723", "0.58874434", "0.58847755", "0.58707076", "0.5861535", "0.5857018", "0.58558714", "0.58443356", "0.5838721", "0.5838447", "0.58315617", "0.5829701", "0.5825685", "0.5822985", "0.58200544", "0.581928" ]
0.0
-1
Instantiates a new booking quota exceeded excpetion.
public BookingQuotaExceededExcpetion(Quota quota, double limit, String userid) { this.quota = quota; this.quotaLimit = limit; this.userId = userid; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public BookingQuotaExceededExcpetion(String message, Quota quota, double limit, String userid) {\n\t\tsuper(message);\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public BookingQuotaExceededExcpetion(Throwable cause, Quota quota, double limit, String userid) {\n\t\tsuper(cause);\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public BookingQuotaExceededExcpetion(String message, Throwable cause, Quota quota, double limit, String userid) {\n\t\tsuper(message, cause);\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public ApiLimitException() {\n super();\n }", "public InvalidHourlyPayRateException() {}", "public OutOfBoundException() {\n super(\"Task does not exist. Please send a correct task number ><\");\n }", "public OfferingException() {\n }", "@Test\n public void testExceedsQuotaOnStartup() throws Exception {\n List<Dag<JobExecutionPlan>> dags = DagManagerTest.buildDagList(2, \"user\", ConfigFactory.empty());\n // Ensure that the current attempt is 1, normally done by DagManager\n dags.get(0).getNodes().get(0).getValue().setCurrentAttempts(1);\n dags.get(1).getNodes().get(0).getValue().setCurrentAttempts(1);\n\n // Should not be throwing the exception\n this._quotaManager.init(dags);\n }", "public MicrosoftGraphQuota() {\n }", "public InstanceOverflowException() {\n\t\tsuper();\n\t}", "public LimitExceededException(String message) {\n super(message, true);\n }", "public withdrawException() {\n super(\"The Sum you entered is greater than your available money... \");\n }", "public NotEnoughFundsException() {\n super(\"Not enough money rock star, try again\");\n }", "public InvalidRatingException(int inNumberSent)\r\n {\r\n this.numberSent = inNumberSent;\r\n }", "private void raiseLimitException() {\n\t\t\tthrow new DataBufferLimitException(\"Exceeded limit on max bytes to buffer : \" + getMaxInMemorySize());\n\t\t}", "public PriQOverflowException() {\n\t}", "public ScheduleException() {\r\n }", "public ApiLimitException(final Throwable e) {\n super(e);\n }", "PastReservation createPastReservation();", "public LimitExceededException(String anomalyDetectorId, String message) {\n super(anomalyDetectorId, message, true);\n this.countedInStats(false);\n }", "public OccupiedSlotExtraStorageLeaderCardException(){\n super(\"This leader card cannot accept anymore resources!\");\n }", "public OfferingException(String msg) {\n super(msg);\n }", "Booking createBooking(Booking newBooking) throws Exception;", "@Test(expected = IllegalDateException.class)\n\tpublic void testBookStartDateInPast() throws Exception {\n\t\tCalendar cal = Calendar.getInstance();\n\t\tcal.add(Calendar.HOUR, -2);\n\t\t// start is current date - 2\n\t\tDate invalidStartDate = cal.getTime();\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), invalidStartDate, validEndDate);\n\t}", "private void doReserve() {\n pickParkingLot();\n pickParkingSpot();\n pickTime();\n pickDuration();\n int amount = pickedparkinglot.getPrice() * pickedduration;\n if (pickedAccount.getBalance() >= amount) {\n currentReservation = new Reservation(pickedparkingspot, pickedAccount, pickedtime, pickedduration);\n validateReservation(currentReservation);\n } else {\n System.out.println(\"Insufficient balance\");\n }\n }", "public BucketOverflowException(String msg){\n\t\tsuper(msg);\n\t}", "public com.vodafone.global.er.decoupling.binding.request.UsageAuthRate createUsageAuthRate()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.UsageAuthRateImpl();\n }", "public LimitExceededException(String anomalyDetectorId, String message, boolean stopNow) {\n super(anomalyDetectorId, message, stopNow);\n this.countedInStats(false);\n }", "Limit createLimit();", "public ApiLimitException(final String s) {\n super(s);\n }", "@Test(expected = FacilityNotFreeException.class)\n\tpublic void testBookNotFree() throws Exception {\n\t\t// create a reservation\n\t\tdataHelper.createPersistedReservation(\"aUser\", Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t\t// book should fail..\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t}", "public LimitExceededException(String message, boolean endRun) {\n super(null, message, endRun);\n }", "public Booking createBooking(\n UserAccount customer, Employee employee, Product product, BookingRequest bookingRequest\n ) {\n Schedule schedule =\n scheduleService.findByEmployeeAndDate(employee, bookingRequest.getDate());\n boolean employeeNotScheduled = schedule == null;\n\n // date must be in next 14 days (including today)\n LocalDate future = LocalDate.now().plusDays(14);\n boolean invalidDate = !bookingRequest.getDate().isBefore(future);\n\n // time must be one of the permitted options\n boolean unsupportedTime = !Booking.permittedTimes.contains(bookingRequest.getTimeSlot());\n\n // booking must not have already started\n LocalDateTime startTime = LocalDateTime.of(bookingRequest.getDate(),\n LocalTime.parse(bookingRequest.getTimeSlot())\n );\n boolean invalidAppointmentStart = !startTime.isAfter(LocalDateTime.now());\n\n // employee must not have any preexisting overlapping bookings\n LocalDateTime endTime = startTime.plusMinutes(product.getDuration());\n boolean bookingConflict =\n this.conflictsWithExisting(schedule, employee, startTime, endTime);\n\n if (employeeNotScheduled ||\n invalidDate ||\n unsupportedTime ||\n invalidAppointmentStart ||\n bookingConflict) {\n throw new ConflictException(\"Appointment time not available\");\n }\n\n // now we can make the booking (and hopefully no new conflict has arisen in the\n // meantime)\n // TODO: handle race conditions (create, check conflicts, maybe rollback and error)\n\n Booking booking = new Booking();\n booking.setStatus(BookingStatus.PENDING);\n booking.setCustomer(customer);\n booking.setEmployee(employee);\n booking.setProduct(product);\n booking.setSchedule(schedule);\n booking.setTime(bookingRequest.getTimeSlot());\n this.saveOrUpdateBooking(booking);\n\n return booking;\n }", "public DeferConsultationException() {\n }", "public MyMoneyException() {\r\n\t\tsuper();\r\n\t}", "public NotBoundException(){\n\t\t super();\n\t }", "public Booking() {\r\n\t\t/**\r\n\t\t*\tGet the number of milliSeconds from the system time and set it to the java.sql.Date\r\n\t\t*\tobject to create a booking number and also to set the start time.\r\n\t\t*/\r\n\t\tlong dateTimeMillis = System.currentTimeMillis();\r\n\t\t/**\r\n\t\t*\tThis date is for generating String bookingNo using the date and time values\r\n\t\t*/\r\n\t\tjava.util.Date date = new java.util.Date(dateTimeMillis);\r\n\t\t/**\r\n\t\t*\tPass the current date in sql.Timestamp object.\r\n\t\t*/\r\n\t\tstartTime = new java.sql.Timestamp(date.getTime());\r\n\t\t/**\r\n\t\t*\tLet it be 0 initially and then update it at the time of checkout\r\n\t\t*/\r\n\t\tendTime = new java.sql.Timestamp(0);\r\n\t}", "@Test(expected = BookingNotAllowedException.class)\n\tpublic void testBookNotAllowed() throws Exception {\n\t\tdataHelper.createPersistedReservation(USER_ID, new ArrayList<String>(), validStartDate, validEndDate);\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t}", "public GameBuyException() {\n }", "public Employee() throws OutOfRangeException { //default constructors have no parameters\n\t\t//must create a default constructor, if a subclass is created\n\t\tthis(\"\",\"\",10.0f,40);\n\t\temployeeCount++;\n\t}", "public PriceModelException() {\n\n }", "public TrafficspacesAPIException() {\n \tthis(null, DEFAULT_MESSAGE);\n }", "public SimDemand(double time, I_Event event, Location location, I_Element element, DemandSet demands) {\n\t\tsuper(time, event, \"Insufficient resources for demand: \" + demands);\n\t\tthis.location = location;\n\t\tthis.element = element;\n\t\tdemands.clean();\n\t\tsetMessage(\"Insufficient resources for demand: \" + demands);\n\t\tthis.demands = demands;\n\t}", "@Override\n public Reservation call() throws ReservationNotCreatedException {\n return reservationService.create(reservation);\n }", "protected ResourceLimitException(String tableName, String msg) {\n super(msg, true /* isRemote */);\n this.tableName = tableName;\n }", "Reservation createReservation();", "public BadDiceException() {\n }", "public BusinessObjectException() {\r\n super();\r\n }", "public DynamicDeckDynamoException() {\n }", "@Test(expected = BidAmountException.class)\n public void bidIsLessThanHighestBidIsRejected() {\n knownUsers.login(seller.userName(), seller.password());\n knownUsers.annointSeller(seller.userName());\n\n knownUsers.login(bidder.userName(), bidder.password());\n\n Auction testAuction = new Auction(seller, item, startingPrice, startTime, endTime);\n testAuction.onStart();\n\n Bid firstBid = new Bid(bidder, startingPrice, startTime.plusMinutes(2));\n\n testAuction.submitBid(firstBid);\n\n testAuction.submitBid(firstBid);\n\n\n }", "public ApiLimitException(final String s, final Throwable e) {\n super(s, e);\n }", "public InstanceOverflowException(\n\t\t\tString msg, \n\t\t\ttv.amwa.maj.record.InstanceNumberGeneration generator) {\n\n\t\tsuper(msg);\n\t\tthis.generator = generator;\n\t}", "public DepotTimetableAsk() {\n }", "@Test(expected = Exception.class)\n public void shouldThrowAnExceptionIfTheOccupanyIsNotIn48Hours()\n\t throws Exception {\n\n\tfinal CreateRoomCommand command = new CreateRoomCommand(\n\t\tArrays.asList(validRoomOfferValues));\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, isOccupancyIn48Hours, isRoomBookable);\n\n\twhen(isOccupancyIn48Hours.isSatisfiedBy((Date) any()))\n\t\t.thenReturn(false);\n\n\troomOfferService.createRoomOffer(command);\n\n\tverify(dao, never()).create(Arrays.asList(validRoomOfferValues));\n }", "public LimitConfiguration() {\n try {\n yellowLimit = new AlertLimit((float) 0.75);\n redLimit = new AlertLimit((float)0.9);\n } catch(Exception e){\n //This exception should not happen\n System.out.println(e.getMessage());\n }\n }", "@Test\n public void testTracking_OutOfQuota() {\n JobStatus jobStatus = createJobStatus(\"testTracking_OutOfQuota\", 1);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(jobStatus, null);\n }\n setStandbyBucket(WORKING_INDEX, jobStatus); // 2 hour window\n setProcessState(ActivityManager.PROCESS_STATE_HOME);\n // Now the package only has two seconds to run.\n final long remainingTimeMs = 2 * SECOND_IN_MILLIS;\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(\n JobSchedulerService.sElapsedRealtimeClock.millis() - HOUR_IN_MILLIS,\n 10 * MINUTE_IN_MILLIS - remainingTimeMs, 1), false);\n\n // Start the job.\n synchronized (mQuotaController.mLock) {\n mQuotaController.prepareForExecutionLocked(jobStatus);\n }\n advanceElapsedClock(remainingTimeMs);\n\n // Wait for some extra time to allow for job processing.\n verify(mJobSchedulerService,\n timeout(remainingTimeMs + 2 * SECOND_IN_MILLIS).times(1))\n .onControllerStateChanged(argThat(jobs -> jobs.size() == 1));\n assertFalse(jobStatus.isConstraintSatisfied(JobStatus.CONSTRAINT_WITHIN_QUOTA));\n assertEquals(JobSchedulerService.sElapsedRealtimeClock.millis(),\n jobStatus.getWhenStandbyDeferred());\n }", "CurrentReservation createCurrentReservation();", "public SureBetNotFoundException() {\r\n\t\tsuper();\r\n\t}", "public OtpErlangRangeException(final String msg) {\n super(msg);\n }", "public Agent(String name, double commissionRate) throws ValueOutOfRangeException {\n this.name = name;\n this.collectionOfCurrentListings = new ArrayList<>();\n this.checkCommissionRate(commissionRate);\n this.commissionRate = commissionRate;\n this.totalEarnings = 0;\n }", "public ItemInvalidoException() {\r\n }", "public QueueOverFlowException(String message){\r\n\t\tsuper(message);\r\n\t}", "public NoAvailableBayException() {\n\t\tsuper(\"There are no bay's free.\");\n\t}", "private void runTestMaybeScheduleStartAlarmLocked_SmallRollingQuota_AllowedTimeCheck() {\n spyOn(mQuotaController);\n doNothing().when(mQuotaController).maybeScheduleCleanupAlarmLocked();\n\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(\n createJobStatus(\"testMaybeScheduleStartAlarmLocked\", 1), null);\n }\n\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n // Working set window size is 2 hours.\n final int standbyBucket = WORKING_INDEX;\n final long contributionMs = mQcConstants.IN_QUOTA_BUFFER_MS / 2;\n final long remainingTimeMs =\n mQcConstants.ALLOWED_TIME_PER_PERIOD_WORKING_MS - contributionMs;\n\n // Session straddles edge of bucket window. Only the contribution should be counted towards\n // the quota.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (2 * HOUR_IN_MILLIS + 3 * MINUTE_IN_MILLIS),\n 3 * MINUTE_IN_MILLIS + contributionMs, 3), false);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - HOUR_IN_MILLIS, remainingTimeMs, 2), false);\n // Expected alarm time should be when the app will have QUOTA_BUFFER_MS time of quota, which\n // is 2 hours + (QUOTA_BUFFER_MS - contributionMs) after the start of the second session.\n final long expectedAlarmTime = now - HOUR_IN_MILLIS + 2 * HOUR_IN_MILLIS\n + (mQcConstants.IN_QUOTA_BUFFER_MS - contributionMs);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeScheduleStartAlarmLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE, standbyBucket);\n }\n verify(mAlarmManager, timeout(1000).times(1)).setWindow(\n anyInt(), eq(expectedAlarmTime), anyLong(), eq(TAG_QUOTA_CHECK), any(), any());\n }", "public com.vodafone.global.er.decoupling.binding.request.UsageAuthRatePlus createUsageAuthRatePlus()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.UsageAuthRatePlusImpl();\n }", "private GuestBooking createGuestBookingInstance(Customer customer, Long taxiId, Date bookingDate ){\n GuestBooking booking = new GuestBooking();\n booking.setCustomer(customer);\n booking.setTaxiId(taxiId);\n booking.setBookingDate(bookingDate);\n return booking;\n }", "GitletException() {\n super();\n }", "public Timeslot() {\n }", "public StockException() {\r\n\t\tsuper();\r\n\t}", "public VTorInUseException() {\n super();\n }", "@Test\n @Date(\"2018-06-28\")\n public void getEmigrationAssumption() {\n assertThrows(SCBClientResponseTooLargeException.class, () -> this.client.getEmigrationRateAssumption().size());\n }", "public void insertBooking(){\n \n Validator v = new Validator();\n if (createBookingType.getValue() == null)\n {\n \n Dialogs.create()\n .owner(prevStage)\n .title(\"Error!\")\n .masthead(null)\n .message(\"Set Booking Type!\")\n .showInformation();\n \n return;\n \n }\n if (createBookingType.getValue().toString().equals(\"Repair\"))\n Dialogs.create()\n .owner(prevStage)\n .title(\"Error!\")\n .masthead(null)\n .message(\"Go to Diagnosis and Repair tab for creating Repair Bookings!\")\n .showInformation();\n \n \n if(v.checkBookingDate(parseToDate(createBookingDate.getValue(),createBookingTimeStart.localTimeProperty().getValue()),\n parseToDate(createBookingDate.getValue(),createBookingTimeEnd.localTimeProperty().getValue()))\n && customerSet)\n \n { \n \n int mID = GLOBAL.getMechanicID();\n \n try {\n mID = Integer.parseInt(createBookingMechanic.getSelectionModel().getSelectedItem().toString().substring(0,1));\n } catch (Exception ex) {\n Dialogs.create()\n .owner(prevStage)\n .title(\"Error!\")\n .masthead(null)\n .message(\"Set Mechanic!\")\n .showInformation();\n return;\n }\n \n if (mID != GLOBAL.getMechanicID())\n if (!getAuth(mID)) return;\n \n createBookingClass();\n dbH.insertBooking(booking);\n booking.setID(dbH.getLastBookingID());\n appointment = createAppointment(booking);\n closeWindow();\n \n }\n else\n {\n String extra = \"\";\n if (!customerSet) extra = \" Customer and/or Vehicle is not set!\";\n Dialogs.create()\n .owner(prevStage)\n .title(\"Error!\")\n .masthead(null)\n .message(\"Errors with booking:\"+v.getError()+extra)\n .showInformation();\n }\n \n }", "public Reservation build() throws BuilderException \n{\n\tif (date == null) {\n\t\tthrow new BuilderException(\"Valid date not found\");\n\t}\n\tif (city == null) {\n\t\tthrow new BuilderException(\"Valid city not found\");\n\t}\n\tif (headcount < MINHEAD) {\n\t\tthrow new BuilderException(\n\t\t\t\"Minimum headcount is \" + MINHEAD); \n\t}\n\tif (dollarsPerHead * headcount < MINTOTAL) {\n\t\tthrow new BuilderException(\n\t\t\t\"Minimum total cost is \" + MINTOTAL); \n\t}\n\treturn new Reservation(\n\t\tdate, \n\t\theadcount, \n\t\tcity, \n\t\tdollarsPerHead, \n\t\thasSite); \n}", "@SuppressWarnings(\"unused\")\n private Booking() {\n }", "public void createFailure() {\n\t\tgetController().changeFree(true);\t\t\n\t\tdisplayAdvertisement(\"opponent failure\");\n\t\tvalidate();\n\t}", "protected StockItem()\r\n \t{\r\n \t\tlimit = new LimitSystem(this);\r\n \t}", "private void runTestMaybeScheduleStartAlarmLocked_SmallRollingQuota_MaxTimeCheck() {\n spyOn(mQuotaController);\n doNothing().when(mQuotaController).maybeScheduleCleanupAlarmLocked();\n\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(\n createJobStatus(\"testMaybeScheduleStartAlarmLocked\", 1), null);\n }\n\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n // Working set window size is 2 hours.\n final int standbyBucket = WORKING_INDEX;\n final long contributionMs = mQcConstants.IN_QUOTA_BUFFER_MS / 2;\n final long remainingTimeMs = mQcConstants.MAX_EXECUTION_TIME_MS - contributionMs;\n\n // Session straddles edge of 24 hour window. Only the contribution should be counted towards\n // the quota.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (24 * HOUR_IN_MILLIS + 3 * MINUTE_IN_MILLIS),\n 3 * MINUTE_IN_MILLIS + contributionMs, 3), false);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - 20 * HOUR_IN_MILLIS, remainingTimeMs, 300), false);\n // Expected alarm time should be when the app will have QUOTA_BUFFER_MS time of quota, which\n // is 24 hours + (QUOTA_BUFFER_MS - contributionMs) after the start of the second session.\n final long expectedAlarmTime = now - 20 * HOUR_IN_MILLIS\n + 24 * HOUR_IN_MILLIS\n + (mQcConstants.IN_QUOTA_BUFFER_MS - contributionMs);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeScheduleStartAlarmLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE, standbyBucket);\n }\n verify(mAlarmManager, timeout(1000).times(1)).setWindow(\n anyInt(), eq(expectedAlarmTime), anyLong(), eq(TAG_QUOTA_CHECK), any(), any());\n }", "@Test\n public void testMaybeScheduleStartAlarmLocked_Ej_SmallRollingQuota() {\n // saveTimingSession calls maybeScheduleCleanupAlarmLocked which interferes with these tests\n // because it schedules an alarm too. Prevent it from doing so.\n spyOn(mQuotaController);\n doNothing().when(mQuotaController).maybeScheduleCleanupAlarmLocked();\n\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(\n createJobStatus(\"testMaybeScheduleStartAlarmLocked_Ej_SRQ\", 1), null);\n }\n\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n setStandbyBucket(WORKING_INDEX);\n final long contributionMs = mQcConstants.IN_QUOTA_BUFFER_MS / 2;\n final long remainingTimeMs = mQcConstants.EJ_LIMIT_WORKING_MS - contributionMs;\n\n // Session straddles edge of bucket window. Only the contribution should be counted towards\n // the quota.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (24 * HOUR_IN_MILLIS + 3 * MINUTE_IN_MILLIS),\n 3 * MINUTE_IN_MILLIS + contributionMs, 3), true);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - 23 * HOUR_IN_MILLIS, remainingTimeMs, 2), true);\n // Expected alarm time should be when the app will have QUOTA_BUFFER_MS time of quota, which\n // is 24 hours + (QUOTA_BUFFER_MS - contributionMs) after the start of the second session.\n final long expectedAlarmTime =\n now + HOUR_IN_MILLIS + (mQcConstants.IN_QUOTA_BUFFER_MS - contributionMs);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeScheduleStartAlarmLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE, WORKING_INDEX);\n }\n verify(mAlarmManager, timeout(1000).times(1)).setWindow(\n anyInt(), eq(expectedAlarmTime), anyLong(), eq(TAG_QUOTA_CHECK), any(), any());\n }", "private void createAlarm(long backoffTimeMs) {\n Log.d(TAG, \"Scheduling registration retry, backoff = \" + backoffTimeMs);\n Intent retryIntent = new Intent(C2DM_RETRY);\n PendingIntent retryPIntent = PendingIntent.getBroadcast(context, 0, retryIntent, 0);\n AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\n am.set(AlarmManager.ELAPSED_REALTIME, backoffTimeMs, retryPIntent);\n }", "public ReservedCardOutOfRangeException(String message) {\n super(message);\n }", "public IndexException(int min, int max, int value) {\n super(\"Index is out of range\");\n this.min = min;\n this.max = max;\n this.value = value;\n }", "public ReservationApi()\r\n {\r\n }", "protected abstract T create(final double idealStartTime);", "public com.vodafone.global.er.decoupling.binding.request.BasePrice createBasePrice()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.BasePriceImpl();\n }", "@Test(expected = Exception.class)\n public void shouldNotBookAnInvalidRoomAndInformTheClientWithAnException()\n\t throws Exception {\n\n\tfinal int index = 1;\n\tfinal String customerId = \"12\";\n\tfinal BookRoomCommand command = new BookRoomCommand(validRoomOffer,\n\t\tcustomerId);\n\n\twhen(dao.read(index)).thenReturn(validRoomOffer);\n\twhen(\n\t\tbuilder.createRoomOffer(Arrays.asList(validRoomOfferValues),\n\t\t\tindex)).thenThrow(\n\t\tnew ConstraintViolationException(\"Test\"));\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(true);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\troomOfferService.bookRoomOffer(command);\n }", "public Loyalty() {}", "@Test\r\n\tpublic void testDamageWithinOldRange() throws TooManyAttachmentsException \r\n\t{\r\n\t\tWeapon w = new Pistol();\r\n\t\tassertEquals(10, w.getDamage(5));\r\n\t\tw = new Scope(w);\r\n\t\tassertEquals(18, w.getDamage(5));\r\n\t}", "public ExpiredProductAddedException(){\r\n super(\"Attedmpted to add expired product to the database\");\r\n }", "public com.vodafone.global.er.decoupling.binding.request.ResourceBalanceType createResourceBalanceType()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.ResourceBalanceTypeImpl();\n }", "private void checkCapacity(int capacity) \n {\n if (capacity > MAX_CAPACITY)\n throw new IllegalStateException(\"Attempt to create a bag whose \" +\n \"capacity exeeds allowed \" +\n \"maximum of \" + MAX_CAPACITY);\n }", "public com.vodafone.global.er.decoupling.binding.request.ModifySpendLimitsRequest createModifySpendLimitsRequest()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.ModifySpendLimitsRequestImpl();\n }", "@TargetApi(Build.VERSION_CODES.KITKAT)\n @RequiresApi(api = Build.VERSION_CODES.KITKAT)\n public void createReservation() {\n Time timeObj = null;\n DateFormat formatter= new SimpleDateFormat(\"kk:mm\");\n try {\n timeObj = new Time(formatter.parse(time).getTime());\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n Bitmap generatedQR = generateQR();\n //Create reservation & save to Repository\n Reservation reservation = new Reservation(film, timeObj, listPlaces, generatedQR);\n Repository.addReservation(reservation);\n }", "public CheckingAccount(int id, double balance, double overdraftLimit) {\n\t\tsuper(id, balance);\n\t\tthis.overdraftLimit = overdraftLimit;\n\t}", "@Test(expected = ValidationException.class)\n\tpublic void testFailedBooking_OverlappedBookings1() throws ParseException {\n\t\t// Preparing booking data\n\t\tBooking booking = getExpectedBookingEntity();\n\t\t\n\t\tcom.paypal.bfs.test.bookingserv.service.model.Booking bookingServiceLayer \n\t\t = getServiceLayerBooking();\n\n\t\tMockito.when(bookingRepository.save(Mockito.any())).thenReturn(booking);\n\t\t\n\t\tbookingClient.createBooking(bookingServiceLayer);\n\t\t\n\t\tMockito.when(bookingRepository.findExistingBookings(booking.getFirstName(), \n\t\t\t\tbooking.getLastName(), booking.getDateOfBirth(), \n\t\t\t\tbooking.getAddress().getZipCode())).thenReturn(Arrays.asList(booking));\n\t\tMockito.when(messageUtil.getLocalizedMessage(Mockito.anyString())).thenReturn(\"Test message\");\n\t\t\n\t\t//Try to persist same booking again\n\t\tbookingServiceLayer.setCheckIn(bookingServiceLayer.getCheckIn()+2);\n\t\tbookingClient.createBooking(bookingServiceLayer);\n\t\t\n\t}", "public com.vodafone.global.er.decoupling.binding.request.UsageAuthRateCharge createUsageAuthRateCharge()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.UsageAuthRateChargeImpl();\n }", "public InvalidMarkException() { }", "private Reservation(Integer id, Person person, Seat seat, Showing showing, boolean objectOnly)\n throws PersistenceException{\n super();\n this.setId(id);\n personReservationSupervisor.getInstance().set(this, person);\n reservationSeatSupervisor.getInstance().set(this, seat);\n if(objectOnly) return;\n try{reservationShowingSupervisor.getInstance().add(showing,this);}catch(ConstraintViolation cv){}// Ok, because consistency is guaranteed with this statement\n }", "public CardExpiredException() {\n super();\n }", "public Booking(String inUName, String inCarNo, int inLotNo) {\r\n\t\t/**\r\n\t\t*\tGet the number of milliSeconds from the system time and set it to the java.sql.Date\r\n\t\t*\tobject to create a booking number and also to set the start time.\r\n\t\t*/\r\n\t\tlong dateTimeMillis = System.currentTimeMillis();\r\n\t\t/**\r\n\t\t*\tThis date is for generating String bookingNo using the date and time values\r\n\t\t*/\r\n\t\tjava.util.Date date = new java.util.Date(dateTimeMillis);\r\n\t\t/**\r\n\t\t*\tSet a serialized booking Number generated using the present date and time\r\n\t\t*\tThe format of this string is:\r\n\t\t*\tDayMonthYearHourMinuteSecond\r\n\t\t*/\r\n\t\tbookingNo = \"\" + (date.getDay() + 1) + (date.getMonth() + 1) + (date.getYear() + 1900) + date.getHours() + date.getMinutes() + date.getSeconds();\r\n\t\t/**\r\n\t\t*\tSet the values of these fields as passed in the arguments\r\n\t\t*/\r\n\t\tuName = inUName;\r\n\t\tcarNo = inCarNo;\r\n\t\tlotNo = inLotNo;\r\n\t\tcost = 0;\r\n\t\t/**\r\n\t\t*\tPass the current date in sql.Timestamp object.\r\n\t\t*/\r\n\t\tstartTime = new java.sql.Timestamp(date.getTime());\r\n\t\t/**\r\n\t\t*\tLet it be 0 initially and then update it at the time of checkout\r\n\t\t*/\r\n\t\tendTime = new java.sql.Timestamp(0);\r\n\t}", "@Test\n public void setResolutionConfigSlot_faultCreation() throws Exception {\n SdFaultTable lUnsavedFault = getUnsavedFault();\n EqpAssmblBom lResolutionConfigSlot =\n createResolutionConfigSlot( CONFIG_SLOT_1_ATA, CONFIG_SLOT_1_NAME );\n\n iService.setResolutionConfigSlot( lUnsavedFault, lResolutionConfigSlot.getAlternateKey(),\n HumanResourceKey.ADMIN );\n\n // Ensure the value has been set on the fault object\n assertEquals( lResolutionConfigSlot.getPk(), lUnsavedFault.getResolutionConfigSlot() );\n\n // Ensure no history note is logged on creation\n assertTrue( getFaultHistoryNotes( lUnsavedFault.getPk() ).isEmpty() );\n }" ]
[ "0.64679694", "0.6338044", "0.62430686", "0.6066136", "0.59528124", "0.5880841", "0.5830902", "0.57992095", "0.57834023", "0.5645203", "0.5579128", "0.5569882", "0.5505068", "0.54121745", "0.5407174", "0.53861135", "0.53693056", "0.53499424", "0.53433067", "0.5323099", "0.5320679", "0.5310876", "0.529601", "0.5277483", "0.5250737", "0.52392715", "0.5221119", "0.52164537", "0.51895046", "0.51771396", "0.5172991", "0.5172854", "0.51722986", "0.517062", "0.51631194", "0.5147308", "0.51376694", "0.5122375", "0.5114089", "0.5109023", "0.50982237", "0.50585127", "0.50485104", "0.50447387", "0.5028609", "0.50160116", "0.50057894", "0.5002251", "0.5000824", "0.49986407", "0.49936292", "0.49757263", "0.49700156", "0.49592113", "0.4956963", "0.49424914", "0.49382612", "0.49269778", "0.49267432", "0.49262774", "0.4924609", "0.4911331", "0.49011266", "0.4886504", "0.48789993", "0.48776433", "0.48634338", "0.4862871", "0.4857705", "0.48505688", "0.4831638", "0.48151097", "0.48108068", "0.48101246", "0.48083934", "0.48044065", "0.4801256", "0.47957674", "0.47926417", "0.47874057", "0.4784453", "0.47780988", "0.4771454", "0.47692597", "0.47607833", "0.4744261", "0.47419164", "0.47289118", "0.47241753", "0.47178584", "0.47169232", "0.47098902", "0.4706081", "0.47050714", "0.47046316", "0.4701528", "0.4700603", "0.4698091", "0.46948", "0.46831438" ]
0.6543666
0
Instantiates a new booking quota exceeded excpetion.
public BookingQuotaExceededExcpetion(String message, Quota quota, double limit, String userid) { super(message); this.quota = quota; this.quotaLimit = limit; this.userId = userid; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public BookingQuotaExceededExcpetion(Quota quota, double limit, String userid) {\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public BookingQuotaExceededExcpetion(Throwable cause, Quota quota, double limit, String userid) {\n\t\tsuper(cause);\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public BookingQuotaExceededExcpetion(String message, Throwable cause, Quota quota, double limit, String userid) {\n\t\tsuper(message, cause);\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public ApiLimitException() {\n super();\n }", "public InvalidHourlyPayRateException() {}", "public OutOfBoundException() {\n super(\"Task does not exist. Please send a correct task number ><\");\n }", "public OfferingException() {\n }", "@Test\n public void testExceedsQuotaOnStartup() throws Exception {\n List<Dag<JobExecutionPlan>> dags = DagManagerTest.buildDagList(2, \"user\", ConfigFactory.empty());\n // Ensure that the current attempt is 1, normally done by DagManager\n dags.get(0).getNodes().get(0).getValue().setCurrentAttempts(1);\n dags.get(1).getNodes().get(0).getValue().setCurrentAttempts(1);\n\n // Should not be throwing the exception\n this._quotaManager.init(dags);\n }", "public MicrosoftGraphQuota() {\n }", "public InstanceOverflowException() {\n\t\tsuper();\n\t}", "public LimitExceededException(String message) {\n super(message, true);\n }", "public withdrawException() {\n super(\"The Sum you entered is greater than your available money... \");\n }", "public NotEnoughFundsException() {\n super(\"Not enough money rock star, try again\");\n }", "public InvalidRatingException(int inNumberSent)\r\n {\r\n this.numberSent = inNumberSent;\r\n }", "private void raiseLimitException() {\n\t\t\tthrow new DataBufferLimitException(\"Exceeded limit on max bytes to buffer : \" + getMaxInMemorySize());\n\t\t}", "public PriQOverflowException() {\n\t}", "public ScheduleException() {\r\n }", "public ApiLimitException(final Throwable e) {\n super(e);\n }", "PastReservation createPastReservation();", "public LimitExceededException(String anomalyDetectorId, String message) {\n super(anomalyDetectorId, message, true);\n this.countedInStats(false);\n }", "public OccupiedSlotExtraStorageLeaderCardException(){\n super(\"This leader card cannot accept anymore resources!\");\n }", "public OfferingException(String msg) {\n super(msg);\n }", "Booking createBooking(Booking newBooking) throws Exception;", "@Test(expected = IllegalDateException.class)\n\tpublic void testBookStartDateInPast() throws Exception {\n\t\tCalendar cal = Calendar.getInstance();\n\t\tcal.add(Calendar.HOUR, -2);\n\t\t// start is current date - 2\n\t\tDate invalidStartDate = cal.getTime();\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), invalidStartDate, validEndDate);\n\t}", "private void doReserve() {\n pickParkingLot();\n pickParkingSpot();\n pickTime();\n pickDuration();\n int amount = pickedparkinglot.getPrice() * pickedduration;\n if (pickedAccount.getBalance() >= amount) {\n currentReservation = new Reservation(pickedparkingspot, pickedAccount, pickedtime, pickedduration);\n validateReservation(currentReservation);\n } else {\n System.out.println(\"Insufficient balance\");\n }\n }", "public BucketOverflowException(String msg){\n\t\tsuper(msg);\n\t}", "public com.vodafone.global.er.decoupling.binding.request.UsageAuthRate createUsageAuthRate()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.UsageAuthRateImpl();\n }", "public LimitExceededException(String anomalyDetectorId, String message, boolean stopNow) {\n super(anomalyDetectorId, message, stopNow);\n this.countedInStats(false);\n }", "Limit createLimit();", "public ApiLimitException(final String s) {\n super(s);\n }", "@Test(expected = FacilityNotFreeException.class)\n\tpublic void testBookNotFree() throws Exception {\n\t\t// create a reservation\n\t\tdataHelper.createPersistedReservation(\"aUser\", Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t\t// book should fail..\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t}", "public LimitExceededException(String message, boolean endRun) {\n super(null, message, endRun);\n }", "public Booking createBooking(\n UserAccount customer, Employee employee, Product product, BookingRequest bookingRequest\n ) {\n Schedule schedule =\n scheduleService.findByEmployeeAndDate(employee, bookingRequest.getDate());\n boolean employeeNotScheduled = schedule == null;\n\n // date must be in next 14 days (including today)\n LocalDate future = LocalDate.now().plusDays(14);\n boolean invalidDate = !bookingRequest.getDate().isBefore(future);\n\n // time must be one of the permitted options\n boolean unsupportedTime = !Booking.permittedTimes.contains(bookingRequest.getTimeSlot());\n\n // booking must not have already started\n LocalDateTime startTime = LocalDateTime.of(bookingRequest.getDate(),\n LocalTime.parse(bookingRequest.getTimeSlot())\n );\n boolean invalidAppointmentStart = !startTime.isAfter(LocalDateTime.now());\n\n // employee must not have any preexisting overlapping bookings\n LocalDateTime endTime = startTime.plusMinutes(product.getDuration());\n boolean bookingConflict =\n this.conflictsWithExisting(schedule, employee, startTime, endTime);\n\n if (employeeNotScheduled ||\n invalidDate ||\n unsupportedTime ||\n invalidAppointmentStart ||\n bookingConflict) {\n throw new ConflictException(\"Appointment time not available\");\n }\n\n // now we can make the booking (and hopefully no new conflict has arisen in the\n // meantime)\n // TODO: handle race conditions (create, check conflicts, maybe rollback and error)\n\n Booking booking = new Booking();\n booking.setStatus(BookingStatus.PENDING);\n booking.setCustomer(customer);\n booking.setEmployee(employee);\n booking.setProduct(product);\n booking.setSchedule(schedule);\n booking.setTime(bookingRequest.getTimeSlot());\n this.saveOrUpdateBooking(booking);\n\n return booking;\n }", "public DeferConsultationException() {\n }", "public MyMoneyException() {\r\n\t\tsuper();\r\n\t}", "public NotBoundException(){\n\t\t super();\n\t }", "public Booking() {\r\n\t\t/**\r\n\t\t*\tGet the number of milliSeconds from the system time and set it to the java.sql.Date\r\n\t\t*\tobject to create a booking number and also to set the start time.\r\n\t\t*/\r\n\t\tlong dateTimeMillis = System.currentTimeMillis();\r\n\t\t/**\r\n\t\t*\tThis date is for generating String bookingNo using the date and time values\r\n\t\t*/\r\n\t\tjava.util.Date date = new java.util.Date(dateTimeMillis);\r\n\t\t/**\r\n\t\t*\tPass the current date in sql.Timestamp object.\r\n\t\t*/\r\n\t\tstartTime = new java.sql.Timestamp(date.getTime());\r\n\t\t/**\r\n\t\t*\tLet it be 0 initially and then update it at the time of checkout\r\n\t\t*/\r\n\t\tendTime = new java.sql.Timestamp(0);\r\n\t}", "@Test(expected = BookingNotAllowedException.class)\n\tpublic void testBookNotAllowed() throws Exception {\n\t\tdataHelper.createPersistedReservation(USER_ID, new ArrayList<String>(), validStartDate, validEndDate);\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t}", "public GameBuyException() {\n }", "public Employee() throws OutOfRangeException { //default constructors have no parameters\n\t\t//must create a default constructor, if a subclass is created\n\t\tthis(\"\",\"\",10.0f,40);\n\t\temployeeCount++;\n\t}", "public PriceModelException() {\n\n }", "public TrafficspacesAPIException() {\n \tthis(null, DEFAULT_MESSAGE);\n }", "public SimDemand(double time, I_Event event, Location location, I_Element element, DemandSet demands) {\n\t\tsuper(time, event, \"Insufficient resources for demand: \" + demands);\n\t\tthis.location = location;\n\t\tthis.element = element;\n\t\tdemands.clean();\n\t\tsetMessage(\"Insufficient resources for demand: \" + demands);\n\t\tthis.demands = demands;\n\t}", "@Override\n public Reservation call() throws ReservationNotCreatedException {\n return reservationService.create(reservation);\n }", "protected ResourceLimitException(String tableName, String msg) {\n super(msg, true /* isRemote */);\n this.tableName = tableName;\n }", "Reservation createReservation();", "public BadDiceException() {\n }", "public BusinessObjectException() {\r\n super();\r\n }", "public DynamicDeckDynamoException() {\n }", "@Test(expected = BidAmountException.class)\n public void bidIsLessThanHighestBidIsRejected() {\n knownUsers.login(seller.userName(), seller.password());\n knownUsers.annointSeller(seller.userName());\n\n knownUsers.login(bidder.userName(), bidder.password());\n\n Auction testAuction = new Auction(seller, item, startingPrice, startTime, endTime);\n testAuction.onStart();\n\n Bid firstBid = new Bid(bidder, startingPrice, startTime.plusMinutes(2));\n\n testAuction.submitBid(firstBid);\n\n testAuction.submitBid(firstBid);\n\n\n }", "public ApiLimitException(final String s, final Throwable e) {\n super(s, e);\n }", "public InstanceOverflowException(\n\t\t\tString msg, \n\t\t\ttv.amwa.maj.record.InstanceNumberGeneration generator) {\n\n\t\tsuper(msg);\n\t\tthis.generator = generator;\n\t}", "public DepotTimetableAsk() {\n }", "@Test(expected = Exception.class)\n public void shouldThrowAnExceptionIfTheOccupanyIsNotIn48Hours()\n\t throws Exception {\n\n\tfinal CreateRoomCommand command = new CreateRoomCommand(\n\t\tArrays.asList(validRoomOfferValues));\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, isOccupancyIn48Hours, isRoomBookable);\n\n\twhen(isOccupancyIn48Hours.isSatisfiedBy((Date) any()))\n\t\t.thenReturn(false);\n\n\troomOfferService.createRoomOffer(command);\n\n\tverify(dao, never()).create(Arrays.asList(validRoomOfferValues));\n }", "public LimitConfiguration() {\n try {\n yellowLimit = new AlertLimit((float) 0.75);\n redLimit = new AlertLimit((float)0.9);\n } catch(Exception e){\n //This exception should not happen\n System.out.println(e.getMessage());\n }\n }", "@Test\n public void testTracking_OutOfQuota() {\n JobStatus jobStatus = createJobStatus(\"testTracking_OutOfQuota\", 1);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(jobStatus, null);\n }\n setStandbyBucket(WORKING_INDEX, jobStatus); // 2 hour window\n setProcessState(ActivityManager.PROCESS_STATE_HOME);\n // Now the package only has two seconds to run.\n final long remainingTimeMs = 2 * SECOND_IN_MILLIS;\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(\n JobSchedulerService.sElapsedRealtimeClock.millis() - HOUR_IN_MILLIS,\n 10 * MINUTE_IN_MILLIS - remainingTimeMs, 1), false);\n\n // Start the job.\n synchronized (mQuotaController.mLock) {\n mQuotaController.prepareForExecutionLocked(jobStatus);\n }\n advanceElapsedClock(remainingTimeMs);\n\n // Wait for some extra time to allow for job processing.\n verify(mJobSchedulerService,\n timeout(remainingTimeMs + 2 * SECOND_IN_MILLIS).times(1))\n .onControllerStateChanged(argThat(jobs -> jobs.size() == 1));\n assertFalse(jobStatus.isConstraintSatisfied(JobStatus.CONSTRAINT_WITHIN_QUOTA));\n assertEquals(JobSchedulerService.sElapsedRealtimeClock.millis(),\n jobStatus.getWhenStandbyDeferred());\n }", "CurrentReservation createCurrentReservation();", "public SureBetNotFoundException() {\r\n\t\tsuper();\r\n\t}", "public OtpErlangRangeException(final String msg) {\n super(msg);\n }", "public Agent(String name, double commissionRate) throws ValueOutOfRangeException {\n this.name = name;\n this.collectionOfCurrentListings = new ArrayList<>();\n this.checkCommissionRate(commissionRate);\n this.commissionRate = commissionRate;\n this.totalEarnings = 0;\n }", "public ItemInvalidoException() {\r\n }", "public QueueOverFlowException(String message){\r\n\t\tsuper(message);\r\n\t}", "public NoAvailableBayException() {\n\t\tsuper(\"There are no bay's free.\");\n\t}", "private void runTestMaybeScheduleStartAlarmLocked_SmallRollingQuota_AllowedTimeCheck() {\n spyOn(mQuotaController);\n doNothing().when(mQuotaController).maybeScheduleCleanupAlarmLocked();\n\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(\n createJobStatus(\"testMaybeScheduleStartAlarmLocked\", 1), null);\n }\n\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n // Working set window size is 2 hours.\n final int standbyBucket = WORKING_INDEX;\n final long contributionMs = mQcConstants.IN_QUOTA_BUFFER_MS / 2;\n final long remainingTimeMs =\n mQcConstants.ALLOWED_TIME_PER_PERIOD_WORKING_MS - contributionMs;\n\n // Session straddles edge of bucket window. Only the contribution should be counted towards\n // the quota.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (2 * HOUR_IN_MILLIS + 3 * MINUTE_IN_MILLIS),\n 3 * MINUTE_IN_MILLIS + contributionMs, 3), false);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - HOUR_IN_MILLIS, remainingTimeMs, 2), false);\n // Expected alarm time should be when the app will have QUOTA_BUFFER_MS time of quota, which\n // is 2 hours + (QUOTA_BUFFER_MS - contributionMs) after the start of the second session.\n final long expectedAlarmTime = now - HOUR_IN_MILLIS + 2 * HOUR_IN_MILLIS\n + (mQcConstants.IN_QUOTA_BUFFER_MS - contributionMs);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeScheduleStartAlarmLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE, standbyBucket);\n }\n verify(mAlarmManager, timeout(1000).times(1)).setWindow(\n anyInt(), eq(expectedAlarmTime), anyLong(), eq(TAG_QUOTA_CHECK), any(), any());\n }", "public com.vodafone.global.er.decoupling.binding.request.UsageAuthRatePlus createUsageAuthRatePlus()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.UsageAuthRatePlusImpl();\n }", "private GuestBooking createGuestBookingInstance(Customer customer, Long taxiId, Date bookingDate ){\n GuestBooking booking = new GuestBooking();\n booking.setCustomer(customer);\n booking.setTaxiId(taxiId);\n booking.setBookingDate(bookingDate);\n return booking;\n }", "GitletException() {\n super();\n }", "public Timeslot() {\n }", "public StockException() {\r\n\t\tsuper();\r\n\t}", "public VTorInUseException() {\n super();\n }", "@Test\n @Date(\"2018-06-28\")\n public void getEmigrationAssumption() {\n assertThrows(SCBClientResponseTooLargeException.class, () -> this.client.getEmigrationRateAssumption().size());\n }", "public void insertBooking(){\n \n Validator v = new Validator();\n if (createBookingType.getValue() == null)\n {\n \n Dialogs.create()\n .owner(prevStage)\n .title(\"Error!\")\n .masthead(null)\n .message(\"Set Booking Type!\")\n .showInformation();\n \n return;\n \n }\n if (createBookingType.getValue().toString().equals(\"Repair\"))\n Dialogs.create()\n .owner(prevStage)\n .title(\"Error!\")\n .masthead(null)\n .message(\"Go to Diagnosis and Repair tab for creating Repair Bookings!\")\n .showInformation();\n \n \n if(v.checkBookingDate(parseToDate(createBookingDate.getValue(),createBookingTimeStart.localTimeProperty().getValue()),\n parseToDate(createBookingDate.getValue(),createBookingTimeEnd.localTimeProperty().getValue()))\n && customerSet)\n \n { \n \n int mID = GLOBAL.getMechanicID();\n \n try {\n mID = Integer.parseInt(createBookingMechanic.getSelectionModel().getSelectedItem().toString().substring(0,1));\n } catch (Exception ex) {\n Dialogs.create()\n .owner(prevStage)\n .title(\"Error!\")\n .masthead(null)\n .message(\"Set Mechanic!\")\n .showInformation();\n return;\n }\n \n if (mID != GLOBAL.getMechanicID())\n if (!getAuth(mID)) return;\n \n createBookingClass();\n dbH.insertBooking(booking);\n booking.setID(dbH.getLastBookingID());\n appointment = createAppointment(booking);\n closeWindow();\n \n }\n else\n {\n String extra = \"\";\n if (!customerSet) extra = \" Customer and/or Vehicle is not set!\";\n Dialogs.create()\n .owner(prevStage)\n .title(\"Error!\")\n .masthead(null)\n .message(\"Errors with booking:\"+v.getError()+extra)\n .showInformation();\n }\n \n }", "public Reservation build() throws BuilderException \n{\n\tif (date == null) {\n\t\tthrow new BuilderException(\"Valid date not found\");\n\t}\n\tif (city == null) {\n\t\tthrow new BuilderException(\"Valid city not found\");\n\t}\n\tif (headcount < MINHEAD) {\n\t\tthrow new BuilderException(\n\t\t\t\"Minimum headcount is \" + MINHEAD); \n\t}\n\tif (dollarsPerHead * headcount < MINTOTAL) {\n\t\tthrow new BuilderException(\n\t\t\t\"Minimum total cost is \" + MINTOTAL); \n\t}\n\treturn new Reservation(\n\t\tdate, \n\t\theadcount, \n\t\tcity, \n\t\tdollarsPerHead, \n\t\thasSite); \n}", "@SuppressWarnings(\"unused\")\n private Booking() {\n }", "public void createFailure() {\n\t\tgetController().changeFree(true);\t\t\n\t\tdisplayAdvertisement(\"opponent failure\");\n\t\tvalidate();\n\t}", "protected StockItem()\r\n \t{\r\n \t\tlimit = new LimitSystem(this);\r\n \t}", "private void runTestMaybeScheduleStartAlarmLocked_SmallRollingQuota_MaxTimeCheck() {\n spyOn(mQuotaController);\n doNothing().when(mQuotaController).maybeScheduleCleanupAlarmLocked();\n\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(\n createJobStatus(\"testMaybeScheduleStartAlarmLocked\", 1), null);\n }\n\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n // Working set window size is 2 hours.\n final int standbyBucket = WORKING_INDEX;\n final long contributionMs = mQcConstants.IN_QUOTA_BUFFER_MS / 2;\n final long remainingTimeMs = mQcConstants.MAX_EXECUTION_TIME_MS - contributionMs;\n\n // Session straddles edge of 24 hour window. Only the contribution should be counted towards\n // the quota.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (24 * HOUR_IN_MILLIS + 3 * MINUTE_IN_MILLIS),\n 3 * MINUTE_IN_MILLIS + contributionMs, 3), false);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - 20 * HOUR_IN_MILLIS, remainingTimeMs, 300), false);\n // Expected alarm time should be when the app will have QUOTA_BUFFER_MS time of quota, which\n // is 24 hours + (QUOTA_BUFFER_MS - contributionMs) after the start of the second session.\n final long expectedAlarmTime = now - 20 * HOUR_IN_MILLIS\n + 24 * HOUR_IN_MILLIS\n + (mQcConstants.IN_QUOTA_BUFFER_MS - contributionMs);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeScheduleStartAlarmLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE, standbyBucket);\n }\n verify(mAlarmManager, timeout(1000).times(1)).setWindow(\n anyInt(), eq(expectedAlarmTime), anyLong(), eq(TAG_QUOTA_CHECK), any(), any());\n }", "@Test\n public void testMaybeScheduleStartAlarmLocked_Ej_SmallRollingQuota() {\n // saveTimingSession calls maybeScheduleCleanupAlarmLocked which interferes with these tests\n // because it schedules an alarm too. Prevent it from doing so.\n spyOn(mQuotaController);\n doNothing().when(mQuotaController).maybeScheduleCleanupAlarmLocked();\n\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(\n createJobStatus(\"testMaybeScheduleStartAlarmLocked_Ej_SRQ\", 1), null);\n }\n\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n setStandbyBucket(WORKING_INDEX);\n final long contributionMs = mQcConstants.IN_QUOTA_BUFFER_MS / 2;\n final long remainingTimeMs = mQcConstants.EJ_LIMIT_WORKING_MS - contributionMs;\n\n // Session straddles edge of bucket window. Only the contribution should be counted towards\n // the quota.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (24 * HOUR_IN_MILLIS + 3 * MINUTE_IN_MILLIS),\n 3 * MINUTE_IN_MILLIS + contributionMs, 3), true);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - 23 * HOUR_IN_MILLIS, remainingTimeMs, 2), true);\n // Expected alarm time should be when the app will have QUOTA_BUFFER_MS time of quota, which\n // is 24 hours + (QUOTA_BUFFER_MS - contributionMs) after the start of the second session.\n final long expectedAlarmTime =\n now + HOUR_IN_MILLIS + (mQcConstants.IN_QUOTA_BUFFER_MS - contributionMs);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeScheduleStartAlarmLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE, WORKING_INDEX);\n }\n verify(mAlarmManager, timeout(1000).times(1)).setWindow(\n anyInt(), eq(expectedAlarmTime), anyLong(), eq(TAG_QUOTA_CHECK), any(), any());\n }", "private void createAlarm(long backoffTimeMs) {\n Log.d(TAG, \"Scheduling registration retry, backoff = \" + backoffTimeMs);\n Intent retryIntent = new Intent(C2DM_RETRY);\n PendingIntent retryPIntent = PendingIntent.getBroadcast(context, 0, retryIntent, 0);\n AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\n am.set(AlarmManager.ELAPSED_REALTIME, backoffTimeMs, retryPIntent);\n }", "public ReservedCardOutOfRangeException(String message) {\n super(message);\n }", "public IndexException(int min, int max, int value) {\n super(\"Index is out of range\");\n this.min = min;\n this.max = max;\n this.value = value;\n }", "public ReservationApi()\r\n {\r\n }", "protected abstract T create(final double idealStartTime);", "public com.vodafone.global.er.decoupling.binding.request.BasePrice createBasePrice()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.BasePriceImpl();\n }", "@Test(expected = Exception.class)\n public void shouldNotBookAnInvalidRoomAndInformTheClientWithAnException()\n\t throws Exception {\n\n\tfinal int index = 1;\n\tfinal String customerId = \"12\";\n\tfinal BookRoomCommand command = new BookRoomCommand(validRoomOffer,\n\t\tcustomerId);\n\n\twhen(dao.read(index)).thenReturn(validRoomOffer);\n\twhen(\n\t\tbuilder.createRoomOffer(Arrays.asList(validRoomOfferValues),\n\t\t\tindex)).thenThrow(\n\t\tnew ConstraintViolationException(\"Test\"));\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(true);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\troomOfferService.bookRoomOffer(command);\n }", "public Loyalty() {}", "@Test\r\n\tpublic void testDamageWithinOldRange() throws TooManyAttachmentsException \r\n\t{\r\n\t\tWeapon w = new Pistol();\r\n\t\tassertEquals(10, w.getDamage(5));\r\n\t\tw = new Scope(w);\r\n\t\tassertEquals(18, w.getDamage(5));\r\n\t}", "public ExpiredProductAddedException(){\r\n super(\"Attedmpted to add expired product to the database\");\r\n }", "public com.vodafone.global.er.decoupling.binding.request.ResourceBalanceType createResourceBalanceType()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.ResourceBalanceTypeImpl();\n }", "private void checkCapacity(int capacity) \n {\n if (capacity > MAX_CAPACITY)\n throw new IllegalStateException(\"Attempt to create a bag whose \" +\n \"capacity exeeds allowed \" +\n \"maximum of \" + MAX_CAPACITY);\n }", "public com.vodafone.global.er.decoupling.binding.request.ModifySpendLimitsRequest createModifySpendLimitsRequest()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.ModifySpendLimitsRequestImpl();\n }", "@TargetApi(Build.VERSION_CODES.KITKAT)\n @RequiresApi(api = Build.VERSION_CODES.KITKAT)\n public void createReservation() {\n Time timeObj = null;\n DateFormat formatter= new SimpleDateFormat(\"kk:mm\");\n try {\n timeObj = new Time(formatter.parse(time).getTime());\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n Bitmap generatedQR = generateQR();\n //Create reservation & save to Repository\n Reservation reservation = new Reservation(film, timeObj, listPlaces, generatedQR);\n Repository.addReservation(reservation);\n }", "public CheckingAccount(int id, double balance, double overdraftLimit) {\n\t\tsuper(id, balance);\n\t\tthis.overdraftLimit = overdraftLimit;\n\t}", "@Test(expected = ValidationException.class)\n\tpublic void testFailedBooking_OverlappedBookings1() throws ParseException {\n\t\t// Preparing booking data\n\t\tBooking booking = getExpectedBookingEntity();\n\t\t\n\t\tcom.paypal.bfs.test.bookingserv.service.model.Booking bookingServiceLayer \n\t\t = getServiceLayerBooking();\n\n\t\tMockito.when(bookingRepository.save(Mockito.any())).thenReturn(booking);\n\t\t\n\t\tbookingClient.createBooking(bookingServiceLayer);\n\t\t\n\t\tMockito.when(bookingRepository.findExistingBookings(booking.getFirstName(), \n\t\t\t\tbooking.getLastName(), booking.getDateOfBirth(), \n\t\t\t\tbooking.getAddress().getZipCode())).thenReturn(Arrays.asList(booking));\n\t\tMockito.when(messageUtil.getLocalizedMessage(Mockito.anyString())).thenReturn(\"Test message\");\n\t\t\n\t\t//Try to persist same booking again\n\t\tbookingServiceLayer.setCheckIn(bookingServiceLayer.getCheckIn()+2);\n\t\tbookingClient.createBooking(bookingServiceLayer);\n\t\t\n\t}", "public com.vodafone.global.er.decoupling.binding.request.UsageAuthRateCharge createUsageAuthRateCharge()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.UsageAuthRateChargeImpl();\n }", "public InvalidMarkException() { }", "private Reservation(Integer id, Person person, Seat seat, Showing showing, boolean objectOnly)\n throws PersistenceException{\n super();\n this.setId(id);\n personReservationSupervisor.getInstance().set(this, person);\n reservationSeatSupervisor.getInstance().set(this, seat);\n if(objectOnly) return;\n try{reservationShowingSupervisor.getInstance().add(showing,this);}catch(ConstraintViolation cv){}// Ok, because consistency is guaranteed with this statement\n }", "public CardExpiredException() {\n super();\n }", "public Booking(String inUName, String inCarNo, int inLotNo) {\r\n\t\t/**\r\n\t\t*\tGet the number of milliSeconds from the system time and set it to the java.sql.Date\r\n\t\t*\tobject to create a booking number and also to set the start time.\r\n\t\t*/\r\n\t\tlong dateTimeMillis = System.currentTimeMillis();\r\n\t\t/**\r\n\t\t*\tThis date is for generating String bookingNo using the date and time values\r\n\t\t*/\r\n\t\tjava.util.Date date = new java.util.Date(dateTimeMillis);\r\n\t\t/**\r\n\t\t*\tSet a serialized booking Number generated using the present date and time\r\n\t\t*\tThe format of this string is:\r\n\t\t*\tDayMonthYearHourMinuteSecond\r\n\t\t*/\r\n\t\tbookingNo = \"\" + (date.getDay() + 1) + (date.getMonth() + 1) + (date.getYear() + 1900) + date.getHours() + date.getMinutes() + date.getSeconds();\r\n\t\t/**\r\n\t\t*\tSet the values of these fields as passed in the arguments\r\n\t\t*/\r\n\t\tuName = inUName;\r\n\t\tcarNo = inCarNo;\r\n\t\tlotNo = inLotNo;\r\n\t\tcost = 0;\r\n\t\t/**\r\n\t\t*\tPass the current date in sql.Timestamp object.\r\n\t\t*/\r\n\t\tstartTime = new java.sql.Timestamp(date.getTime());\r\n\t\t/**\r\n\t\t*\tLet it be 0 initially and then update it at the time of checkout\r\n\t\t*/\r\n\t\tendTime = new java.sql.Timestamp(0);\r\n\t}", "@Test\n public void setResolutionConfigSlot_faultCreation() throws Exception {\n SdFaultTable lUnsavedFault = getUnsavedFault();\n EqpAssmblBom lResolutionConfigSlot =\n createResolutionConfigSlot( CONFIG_SLOT_1_ATA, CONFIG_SLOT_1_NAME );\n\n iService.setResolutionConfigSlot( lUnsavedFault, lResolutionConfigSlot.getAlternateKey(),\n HumanResourceKey.ADMIN );\n\n // Ensure the value has been set on the fault object\n assertEquals( lResolutionConfigSlot.getPk(), lUnsavedFault.getResolutionConfigSlot() );\n\n // Ensure no history note is logged on creation\n assertTrue( getFaultHistoryNotes( lUnsavedFault.getPk() ).isEmpty() );\n }" ]
[ "0.6543666", "0.6338044", "0.62430686", "0.6066136", "0.59528124", "0.5880841", "0.5830902", "0.57992095", "0.57834023", "0.5645203", "0.5579128", "0.5569882", "0.5505068", "0.54121745", "0.5407174", "0.53861135", "0.53693056", "0.53499424", "0.53433067", "0.5323099", "0.5320679", "0.5310876", "0.529601", "0.5277483", "0.5250737", "0.52392715", "0.5221119", "0.52164537", "0.51895046", "0.51771396", "0.5172991", "0.5172854", "0.51722986", "0.517062", "0.51631194", "0.5147308", "0.51376694", "0.5122375", "0.5114089", "0.5109023", "0.50982237", "0.50585127", "0.50485104", "0.50447387", "0.5028609", "0.50160116", "0.50057894", "0.5002251", "0.5000824", "0.49986407", "0.49936292", "0.49757263", "0.49700156", "0.49592113", "0.4956963", "0.49424914", "0.49382612", "0.49269778", "0.49267432", "0.49262774", "0.4924609", "0.4911331", "0.49011266", "0.4886504", "0.48789993", "0.48776433", "0.48634338", "0.4862871", "0.4857705", "0.48505688", "0.4831638", "0.48151097", "0.48108068", "0.48101246", "0.48083934", "0.48044065", "0.4801256", "0.47957674", "0.47926417", "0.47874057", "0.4784453", "0.47780988", "0.4771454", "0.47692597", "0.47607833", "0.4744261", "0.47419164", "0.47289118", "0.47241753", "0.47178584", "0.47169232", "0.47098902", "0.4706081", "0.47050714", "0.47046316", "0.4701528", "0.4700603", "0.4698091", "0.46948", "0.46831438" ]
0.64679694
1
Instantiates a new booking quota exceeded excpetion.
public BookingQuotaExceededExcpetion(Throwable cause, Quota quota, double limit, String userid) { super(cause); this.quota = quota; this.quotaLimit = limit; this.userId = userid; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public BookingQuotaExceededExcpetion(Quota quota, double limit, String userid) {\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public BookingQuotaExceededExcpetion(String message, Quota quota, double limit, String userid) {\n\t\tsuper(message);\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public BookingQuotaExceededExcpetion(String message, Throwable cause, Quota quota, double limit, String userid) {\n\t\tsuper(message, cause);\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public ApiLimitException() {\n super();\n }", "public InvalidHourlyPayRateException() {}", "public OutOfBoundException() {\n super(\"Task does not exist. Please send a correct task number ><\");\n }", "public OfferingException() {\n }", "@Test\n public void testExceedsQuotaOnStartup() throws Exception {\n List<Dag<JobExecutionPlan>> dags = DagManagerTest.buildDagList(2, \"user\", ConfigFactory.empty());\n // Ensure that the current attempt is 1, normally done by DagManager\n dags.get(0).getNodes().get(0).getValue().setCurrentAttempts(1);\n dags.get(1).getNodes().get(0).getValue().setCurrentAttempts(1);\n\n // Should not be throwing the exception\n this._quotaManager.init(dags);\n }", "public MicrosoftGraphQuota() {\n }", "public InstanceOverflowException() {\n\t\tsuper();\n\t}", "public LimitExceededException(String message) {\n super(message, true);\n }", "public withdrawException() {\n super(\"The Sum you entered is greater than your available money... \");\n }", "public NotEnoughFundsException() {\n super(\"Not enough money rock star, try again\");\n }", "public InvalidRatingException(int inNumberSent)\r\n {\r\n this.numberSent = inNumberSent;\r\n }", "private void raiseLimitException() {\n\t\t\tthrow new DataBufferLimitException(\"Exceeded limit on max bytes to buffer : \" + getMaxInMemorySize());\n\t\t}", "public PriQOverflowException() {\n\t}", "public ScheduleException() {\r\n }", "public ApiLimitException(final Throwable e) {\n super(e);\n }", "PastReservation createPastReservation();", "public LimitExceededException(String anomalyDetectorId, String message) {\n super(anomalyDetectorId, message, true);\n this.countedInStats(false);\n }", "public OccupiedSlotExtraStorageLeaderCardException(){\n super(\"This leader card cannot accept anymore resources!\");\n }", "public OfferingException(String msg) {\n super(msg);\n }", "Booking createBooking(Booking newBooking) throws Exception;", "@Test(expected = IllegalDateException.class)\n\tpublic void testBookStartDateInPast() throws Exception {\n\t\tCalendar cal = Calendar.getInstance();\n\t\tcal.add(Calendar.HOUR, -2);\n\t\t// start is current date - 2\n\t\tDate invalidStartDate = cal.getTime();\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), invalidStartDate, validEndDate);\n\t}", "private void doReserve() {\n pickParkingLot();\n pickParkingSpot();\n pickTime();\n pickDuration();\n int amount = pickedparkinglot.getPrice() * pickedduration;\n if (pickedAccount.getBalance() >= amount) {\n currentReservation = new Reservation(pickedparkingspot, pickedAccount, pickedtime, pickedduration);\n validateReservation(currentReservation);\n } else {\n System.out.println(\"Insufficient balance\");\n }\n }", "public BucketOverflowException(String msg){\n\t\tsuper(msg);\n\t}", "public com.vodafone.global.er.decoupling.binding.request.UsageAuthRate createUsageAuthRate()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.UsageAuthRateImpl();\n }", "public LimitExceededException(String anomalyDetectorId, String message, boolean stopNow) {\n super(anomalyDetectorId, message, stopNow);\n this.countedInStats(false);\n }", "Limit createLimit();", "public ApiLimitException(final String s) {\n super(s);\n }", "@Test(expected = FacilityNotFreeException.class)\n\tpublic void testBookNotFree() throws Exception {\n\t\t// create a reservation\n\t\tdataHelper.createPersistedReservation(\"aUser\", Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t\t// book should fail..\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t}", "public LimitExceededException(String message, boolean endRun) {\n super(null, message, endRun);\n }", "public Booking createBooking(\n UserAccount customer, Employee employee, Product product, BookingRequest bookingRequest\n ) {\n Schedule schedule =\n scheduleService.findByEmployeeAndDate(employee, bookingRequest.getDate());\n boolean employeeNotScheduled = schedule == null;\n\n // date must be in next 14 days (including today)\n LocalDate future = LocalDate.now().plusDays(14);\n boolean invalidDate = !bookingRequest.getDate().isBefore(future);\n\n // time must be one of the permitted options\n boolean unsupportedTime = !Booking.permittedTimes.contains(bookingRequest.getTimeSlot());\n\n // booking must not have already started\n LocalDateTime startTime = LocalDateTime.of(bookingRequest.getDate(),\n LocalTime.parse(bookingRequest.getTimeSlot())\n );\n boolean invalidAppointmentStart = !startTime.isAfter(LocalDateTime.now());\n\n // employee must not have any preexisting overlapping bookings\n LocalDateTime endTime = startTime.plusMinutes(product.getDuration());\n boolean bookingConflict =\n this.conflictsWithExisting(schedule, employee, startTime, endTime);\n\n if (employeeNotScheduled ||\n invalidDate ||\n unsupportedTime ||\n invalidAppointmentStart ||\n bookingConflict) {\n throw new ConflictException(\"Appointment time not available\");\n }\n\n // now we can make the booking (and hopefully no new conflict has arisen in the\n // meantime)\n // TODO: handle race conditions (create, check conflicts, maybe rollback and error)\n\n Booking booking = new Booking();\n booking.setStatus(BookingStatus.PENDING);\n booking.setCustomer(customer);\n booking.setEmployee(employee);\n booking.setProduct(product);\n booking.setSchedule(schedule);\n booking.setTime(bookingRequest.getTimeSlot());\n this.saveOrUpdateBooking(booking);\n\n return booking;\n }", "public DeferConsultationException() {\n }", "public MyMoneyException() {\r\n\t\tsuper();\r\n\t}", "public NotBoundException(){\n\t\t super();\n\t }", "public Booking() {\r\n\t\t/**\r\n\t\t*\tGet the number of milliSeconds from the system time and set it to the java.sql.Date\r\n\t\t*\tobject to create a booking number and also to set the start time.\r\n\t\t*/\r\n\t\tlong dateTimeMillis = System.currentTimeMillis();\r\n\t\t/**\r\n\t\t*\tThis date is for generating String bookingNo using the date and time values\r\n\t\t*/\r\n\t\tjava.util.Date date = new java.util.Date(dateTimeMillis);\r\n\t\t/**\r\n\t\t*\tPass the current date in sql.Timestamp object.\r\n\t\t*/\r\n\t\tstartTime = new java.sql.Timestamp(date.getTime());\r\n\t\t/**\r\n\t\t*\tLet it be 0 initially and then update it at the time of checkout\r\n\t\t*/\r\n\t\tendTime = new java.sql.Timestamp(0);\r\n\t}", "@Test(expected = BookingNotAllowedException.class)\n\tpublic void testBookNotAllowed() throws Exception {\n\t\tdataHelper.createPersistedReservation(USER_ID, new ArrayList<String>(), validStartDate, validEndDate);\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t}", "public GameBuyException() {\n }", "public Employee() throws OutOfRangeException { //default constructors have no parameters\n\t\t//must create a default constructor, if a subclass is created\n\t\tthis(\"\",\"\",10.0f,40);\n\t\temployeeCount++;\n\t}", "public PriceModelException() {\n\n }", "public TrafficspacesAPIException() {\n \tthis(null, DEFAULT_MESSAGE);\n }", "public SimDemand(double time, I_Event event, Location location, I_Element element, DemandSet demands) {\n\t\tsuper(time, event, \"Insufficient resources for demand: \" + demands);\n\t\tthis.location = location;\n\t\tthis.element = element;\n\t\tdemands.clean();\n\t\tsetMessage(\"Insufficient resources for demand: \" + demands);\n\t\tthis.demands = demands;\n\t}", "@Override\n public Reservation call() throws ReservationNotCreatedException {\n return reservationService.create(reservation);\n }", "protected ResourceLimitException(String tableName, String msg) {\n super(msg, true /* isRemote */);\n this.tableName = tableName;\n }", "Reservation createReservation();", "public BadDiceException() {\n }", "public BusinessObjectException() {\r\n super();\r\n }", "public DynamicDeckDynamoException() {\n }", "@Test(expected = BidAmountException.class)\n public void bidIsLessThanHighestBidIsRejected() {\n knownUsers.login(seller.userName(), seller.password());\n knownUsers.annointSeller(seller.userName());\n\n knownUsers.login(bidder.userName(), bidder.password());\n\n Auction testAuction = new Auction(seller, item, startingPrice, startTime, endTime);\n testAuction.onStart();\n\n Bid firstBid = new Bid(bidder, startingPrice, startTime.plusMinutes(2));\n\n testAuction.submitBid(firstBid);\n\n testAuction.submitBid(firstBid);\n\n\n }", "public ApiLimitException(final String s, final Throwable e) {\n super(s, e);\n }", "public InstanceOverflowException(\n\t\t\tString msg, \n\t\t\ttv.amwa.maj.record.InstanceNumberGeneration generator) {\n\n\t\tsuper(msg);\n\t\tthis.generator = generator;\n\t}", "public DepotTimetableAsk() {\n }", "@Test(expected = Exception.class)\n public void shouldThrowAnExceptionIfTheOccupanyIsNotIn48Hours()\n\t throws Exception {\n\n\tfinal CreateRoomCommand command = new CreateRoomCommand(\n\t\tArrays.asList(validRoomOfferValues));\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, isOccupancyIn48Hours, isRoomBookable);\n\n\twhen(isOccupancyIn48Hours.isSatisfiedBy((Date) any()))\n\t\t.thenReturn(false);\n\n\troomOfferService.createRoomOffer(command);\n\n\tverify(dao, never()).create(Arrays.asList(validRoomOfferValues));\n }", "public LimitConfiguration() {\n try {\n yellowLimit = new AlertLimit((float) 0.75);\n redLimit = new AlertLimit((float)0.9);\n } catch(Exception e){\n //This exception should not happen\n System.out.println(e.getMessage());\n }\n }", "@Test\n public void testTracking_OutOfQuota() {\n JobStatus jobStatus = createJobStatus(\"testTracking_OutOfQuota\", 1);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(jobStatus, null);\n }\n setStandbyBucket(WORKING_INDEX, jobStatus); // 2 hour window\n setProcessState(ActivityManager.PROCESS_STATE_HOME);\n // Now the package only has two seconds to run.\n final long remainingTimeMs = 2 * SECOND_IN_MILLIS;\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(\n JobSchedulerService.sElapsedRealtimeClock.millis() - HOUR_IN_MILLIS,\n 10 * MINUTE_IN_MILLIS - remainingTimeMs, 1), false);\n\n // Start the job.\n synchronized (mQuotaController.mLock) {\n mQuotaController.prepareForExecutionLocked(jobStatus);\n }\n advanceElapsedClock(remainingTimeMs);\n\n // Wait for some extra time to allow for job processing.\n verify(mJobSchedulerService,\n timeout(remainingTimeMs + 2 * SECOND_IN_MILLIS).times(1))\n .onControllerStateChanged(argThat(jobs -> jobs.size() == 1));\n assertFalse(jobStatus.isConstraintSatisfied(JobStatus.CONSTRAINT_WITHIN_QUOTA));\n assertEquals(JobSchedulerService.sElapsedRealtimeClock.millis(),\n jobStatus.getWhenStandbyDeferred());\n }", "CurrentReservation createCurrentReservation();", "public SureBetNotFoundException() {\r\n\t\tsuper();\r\n\t}", "public OtpErlangRangeException(final String msg) {\n super(msg);\n }", "public Agent(String name, double commissionRate) throws ValueOutOfRangeException {\n this.name = name;\n this.collectionOfCurrentListings = new ArrayList<>();\n this.checkCommissionRate(commissionRate);\n this.commissionRate = commissionRate;\n this.totalEarnings = 0;\n }", "public ItemInvalidoException() {\r\n }", "public QueueOverFlowException(String message){\r\n\t\tsuper(message);\r\n\t}", "public NoAvailableBayException() {\n\t\tsuper(\"There are no bay's free.\");\n\t}", "private void runTestMaybeScheduleStartAlarmLocked_SmallRollingQuota_AllowedTimeCheck() {\n spyOn(mQuotaController);\n doNothing().when(mQuotaController).maybeScheduleCleanupAlarmLocked();\n\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(\n createJobStatus(\"testMaybeScheduleStartAlarmLocked\", 1), null);\n }\n\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n // Working set window size is 2 hours.\n final int standbyBucket = WORKING_INDEX;\n final long contributionMs = mQcConstants.IN_QUOTA_BUFFER_MS / 2;\n final long remainingTimeMs =\n mQcConstants.ALLOWED_TIME_PER_PERIOD_WORKING_MS - contributionMs;\n\n // Session straddles edge of bucket window. Only the contribution should be counted towards\n // the quota.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (2 * HOUR_IN_MILLIS + 3 * MINUTE_IN_MILLIS),\n 3 * MINUTE_IN_MILLIS + contributionMs, 3), false);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - HOUR_IN_MILLIS, remainingTimeMs, 2), false);\n // Expected alarm time should be when the app will have QUOTA_BUFFER_MS time of quota, which\n // is 2 hours + (QUOTA_BUFFER_MS - contributionMs) after the start of the second session.\n final long expectedAlarmTime = now - HOUR_IN_MILLIS + 2 * HOUR_IN_MILLIS\n + (mQcConstants.IN_QUOTA_BUFFER_MS - contributionMs);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeScheduleStartAlarmLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE, standbyBucket);\n }\n verify(mAlarmManager, timeout(1000).times(1)).setWindow(\n anyInt(), eq(expectedAlarmTime), anyLong(), eq(TAG_QUOTA_CHECK), any(), any());\n }", "public com.vodafone.global.er.decoupling.binding.request.UsageAuthRatePlus createUsageAuthRatePlus()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.UsageAuthRatePlusImpl();\n }", "private GuestBooking createGuestBookingInstance(Customer customer, Long taxiId, Date bookingDate ){\n GuestBooking booking = new GuestBooking();\n booking.setCustomer(customer);\n booking.setTaxiId(taxiId);\n booking.setBookingDate(bookingDate);\n return booking;\n }", "GitletException() {\n super();\n }", "public Timeslot() {\n }", "public StockException() {\r\n\t\tsuper();\r\n\t}", "public VTorInUseException() {\n super();\n }", "@Test\n @Date(\"2018-06-28\")\n public void getEmigrationAssumption() {\n assertThrows(SCBClientResponseTooLargeException.class, () -> this.client.getEmigrationRateAssumption().size());\n }", "public void insertBooking(){\n \n Validator v = new Validator();\n if (createBookingType.getValue() == null)\n {\n \n Dialogs.create()\n .owner(prevStage)\n .title(\"Error!\")\n .masthead(null)\n .message(\"Set Booking Type!\")\n .showInformation();\n \n return;\n \n }\n if (createBookingType.getValue().toString().equals(\"Repair\"))\n Dialogs.create()\n .owner(prevStage)\n .title(\"Error!\")\n .masthead(null)\n .message(\"Go to Diagnosis and Repair tab for creating Repair Bookings!\")\n .showInformation();\n \n \n if(v.checkBookingDate(parseToDate(createBookingDate.getValue(),createBookingTimeStart.localTimeProperty().getValue()),\n parseToDate(createBookingDate.getValue(),createBookingTimeEnd.localTimeProperty().getValue()))\n && customerSet)\n \n { \n \n int mID = GLOBAL.getMechanicID();\n \n try {\n mID = Integer.parseInt(createBookingMechanic.getSelectionModel().getSelectedItem().toString().substring(0,1));\n } catch (Exception ex) {\n Dialogs.create()\n .owner(prevStage)\n .title(\"Error!\")\n .masthead(null)\n .message(\"Set Mechanic!\")\n .showInformation();\n return;\n }\n \n if (mID != GLOBAL.getMechanicID())\n if (!getAuth(mID)) return;\n \n createBookingClass();\n dbH.insertBooking(booking);\n booking.setID(dbH.getLastBookingID());\n appointment = createAppointment(booking);\n closeWindow();\n \n }\n else\n {\n String extra = \"\";\n if (!customerSet) extra = \" Customer and/or Vehicle is not set!\";\n Dialogs.create()\n .owner(prevStage)\n .title(\"Error!\")\n .masthead(null)\n .message(\"Errors with booking:\"+v.getError()+extra)\n .showInformation();\n }\n \n }", "public Reservation build() throws BuilderException \n{\n\tif (date == null) {\n\t\tthrow new BuilderException(\"Valid date not found\");\n\t}\n\tif (city == null) {\n\t\tthrow new BuilderException(\"Valid city not found\");\n\t}\n\tif (headcount < MINHEAD) {\n\t\tthrow new BuilderException(\n\t\t\t\"Minimum headcount is \" + MINHEAD); \n\t}\n\tif (dollarsPerHead * headcount < MINTOTAL) {\n\t\tthrow new BuilderException(\n\t\t\t\"Minimum total cost is \" + MINTOTAL); \n\t}\n\treturn new Reservation(\n\t\tdate, \n\t\theadcount, \n\t\tcity, \n\t\tdollarsPerHead, \n\t\thasSite); \n}", "@SuppressWarnings(\"unused\")\n private Booking() {\n }", "public void createFailure() {\n\t\tgetController().changeFree(true);\t\t\n\t\tdisplayAdvertisement(\"opponent failure\");\n\t\tvalidate();\n\t}", "protected StockItem()\r\n \t{\r\n \t\tlimit = new LimitSystem(this);\r\n \t}", "private void runTestMaybeScheduleStartAlarmLocked_SmallRollingQuota_MaxTimeCheck() {\n spyOn(mQuotaController);\n doNothing().when(mQuotaController).maybeScheduleCleanupAlarmLocked();\n\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(\n createJobStatus(\"testMaybeScheduleStartAlarmLocked\", 1), null);\n }\n\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n // Working set window size is 2 hours.\n final int standbyBucket = WORKING_INDEX;\n final long contributionMs = mQcConstants.IN_QUOTA_BUFFER_MS / 2;\n final long remainingTimeMs = mQcConstants.MAX_EXECUTION_TIME_MS - contributionMs;\n\n // Session straddles edge of 24 hour window. Only the contribution should be counted towards\n // the quota.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (24 * HOUR_IN_MILLIS + 3 * MINUTE_IN_MILLIS),\n 3 * MINUTE_IN_MILLIS + contributionMs, 3), false);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - 20 * HOUR_IN_MILLIS, remainingTimeMs, 300), false);\n // Expected alarm time should be when the app will have QUOTA_BUFFER_MS time of quota, which\n // is 24 hours + (QUOTA_BUFFER_MS - contributionMs) after the start of the second session.\n final long expectedAlarmTime = now - 20 * HOUR_IN_MILLIS\n + 24 * HOUR_IN_MILLIS\n + (mQcConstants.IN_QUOTA_BUFFER_MS - contributionMs);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeScheduleStartAlarmLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE, standbyBucket);\n }\n verify(mAlarmManager, timeout(1000).times(1)).setWindow(\n anyInt(), eq(expectedAlarmTime), anyLong(), eq(TAG_QUOTA_CHECK), any(), any());\n }", "@Test\n public void testMaybeScheduleStartAlarmLocked_Ej_SmallRollingQuota() {\n // saveTimingSession calls maybeScheduleCleanupAlarmLocked which interferes with these tests\n // because it schedules an alarm too. Prevent it from doing so.\n spyOn(mQuotaController);\n doNothing().when(mQuotaController).maybeScheduleCleanupAlarmLocked();\n\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(\n createJobStatus(\"testMaybeScheduleStartAlarmLocked_Ej_SRQ\", 1), null);\n }\n\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n setStandbyBucket(WORKING_INDEX);\n final long contributionMs = mQcConstants.IN_QUOTA_BUFFER_MS / 2;\n final long remainingTimeMs = mQcConstants.EJ_LIMIT_WORKING_MS - contributionMs;\n\n // Session straddles edge of bucket window. Only the contribution should be counted towards\n // the quota.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (24 * HOUR_IN_MILLIS + 3 * MINUTE_IN_MILLIS),\n 3 * MINUTE_IN_MILLIS + contributionMs, 3), true);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - 23 * HOUR_IN_MILLIS, remainingTimeMs, 2), true);\n // Expected alarm time should be when the app will have QUOTA_BUFFER_MS time of quota, which\n // is 24 hours + (QUOTA_BUFFER_MS - contributionMs) after the start of the second session.\n final long expectedAlarmTime =\n now + HOUR_IN_MILLIS + (mQcConstants.IN_QUOTA_BUFFER_MS - contributionMs);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeScheduleStartAlarmLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE, WORKING_INDEX);\n }\n verify(mAlarmManager, timeout(1000).times(1)).setWindow(\n anyInt(), eq(expectedAlarmTime), anyLong(), eq(TAG_QUOTA_CHECK), any(), any());\n }", "private void createAlarm(long backoffTimeMs) {\n Log.d(TAG, \"Scheduling registration retry, backoff = \" + backoffTimeMs);\n Intent retryIntent = new Intent(C2DM_RETRY);\n PendingIntent retryPIntent = PendingIntent.getBroadcast(context, 0, retryIntent, 0);\n AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\n am.set(AlarmManager.ELAPSED_REALTIME, backoffTimeMs, retryPIntent);\n }", "public ReservedCardOutOfRangeException(String message) {\n super(message);\n }", "public IndexException(int min, int max, int value) {\n super(\"Index is out of range\");\n this.min = min;\n this.max = max;\n this.value = value;\n }", "public ReservationApi()\r\n {\r\n }", "protected abstract T create(final double idealStartTime);", "public com.vodafone.global.er.decoupling.binding.request.BasePrice createBasePrice()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.BasePriceImpl();\n }", "@Test(expected = Exception.class)\n public void shouldNotBookAnInvalidRoomAndInformTheClientWithAnException()\n\t throws Exception {\n\n\tfinal int index = 1;\n\tfinal String customerId = \"12\";\n\tfinal BookRoomCommand command = new BookRoomCommand(validRoomOffer,\n\t\tcustomerId);\n\n\twhen(dao.read(index)).thenReturn(validRoomOffer);\n\twhen(\n\t\tbuilder.createRoomOffer(Arrays.asList(validRoomOfferValues),\n\t\t\tindex)).thenThrow(\n\t\tnew ConstraintViolationException(\"Test\"));\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(true);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\troomOfferService.bookRoomOffer(command);\n }", "public Loyalty() {}", "@Test\r\n\tpublic void testDamageWithinOldRange() throws TooManyAttachmentsException \r\n\t{\r\n\t\tWeapon w = new Pistol();\r\n\t\tassertEquals(10, w.getDamage(5));\r\n\t\tw = new Scope(w);\r\n\t\tassertEquals(18, w.getDamage(5));\r\n\t}", "public ExpiredProductAddedException(){\r\n super(\"Attedmpted to add expired product to the database\");\r\n }", "public com.vodafone.global.er.decoupling.binding.request.ResourceBalanceType createResourceBalanceType()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.ResourceBalanceTypeImpl();\n }", "private void checkCapacity(int capacity) \n {\n if (capacity > MAX_CAPACITY)\n throw new IllegalStateException(\"Attempt to create a bag whose \" +\n \"capacity exeeds allowed \" +\n \"maximum of \" + MAX_CAPACITY);\n }", "public com.vodafone.global.er.decoupling.binding.request.ModifySpendLimitsRequest createModifySpendLimitsRequest()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.ModifySpendLimitsRequestImpl();\n }", "@TargetApi(Build.VERSION_CODES.KITKAT)\n @RequiresApi(api = Build.VERSION_CODES.KITKAT)\n public void createReservation() {\n Time timeObj = null;\n DateFormat formatter= new SimpleDateFormat(\"kk:mm\");\n try {\n timeObj = new Time(formatter.parse(time).getTime());\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n Bitmap generatedQR = generateQR();\n //Create reservation & save to Repository\n Reservation reservation = new Reservation(film, timeObj, listPlaces, generatedQR);\n Repository.addReservation(reservation);\n }", "public CheckingAccount(int id, double balance, double overdraftLimit) {\n\t\tsuper(id, balance);\n\t\tthis.overdraftLimit = overdraftLimit;\n\t}", "@Test(expected = ValidationException.class)\n\tpublic void testFailedBooking_OverlappedBookings1() throws ParseException {\n\t\t// Preparing booking data\n\t\tBooking booking = getExpectedBookingEntity();\n\t\t\n\t\tcom.paypal.bfs.test.bookingserv.service.model.Booking bookingServiceLayer \n\t\t = getServiceLayerBooking();\n\n\t\tMockito.when(bookingRepository.save(Mockito.any())).thenReturn(booking);\n\t\t\n\t\tbookingClient.createBooking(bookingServiceLayer);\n\t\t\n\t\tMockito.when(bookingRepository.findExistingBookings(booking.getFirstName(), \n\t\t\t\tbooking.getLastName(), booking.getDateOfBirth(), \n\t\t\t\tbooking.getAddress().getZipCode())).thenReturn(Arrays.asList(booking));\n\t\tMockito.when(messageUtil.getLocalizedMessage(Mockito.anyString())).thenReturn(\"Test message\");\n\t\t\n\t\t//Try to persist same booking again\n\t\tbookingServiceLayer.setCheckIn(bookingServiceLayer.getCheckIn()+2);\n\t\tbookingClient.createBooking(bookingServiceLayer);\n\t\t\n\t}", "public com.vodafone.global.er.decoupling.binding.request.UsageAuthRateCharge createUsageAuthRateCharge()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.UsageAuthRateChargeImpl();\n }", "public InvalidMarkException() { }", "private Reservation(Integer id, Person person, Seat seat, Showing showing, boolean objectOnly)\n throws PersistenceException{\n super();\n this.setId(id);\n personReservationSupervisor.getInstance().set(this, person);\n reservationSeatSupervisor.getInstance().set(this, seat);\n if(objectOnly) return;\n try{reservationShowingSupervisor.getInstance().add(showing,this);}catch(ConstraintViolation cv){}// Ok, because consistency is guaranteed with this statement\n }", "public CardExpiredException() {\n super();\n }", "public Booking(String inUName, String inCarNo, int inLotNo) {\r\n\t\t/**\r\n\t\t*\tGet the number of milliSeconds from the system time and set it to the java.sql.Date\r\n\t\t*\tobject to create a booking number and also to set the start time.\r\n\t\t*/\r\n\t\tlong dateTimeMillis = System.currentTimeMillis();\r\n\t\t/**\r\n\t\t*\tThis date is for generating String bookingNo using the date and time values\r\n\t\t*/\r\n\t\tjava.util.Date date = new java.util.Date(dateTimeMillis);\r\n\t\t/**\r\n\t\t*\tSet a serialized booking Number generated using the present date and time\r\n\t\t*\tThe format of this string is:\r\n\t\t*\tDayMonthYearHourMinuteSecond\r\n\t\t*/\r\n\t\tbookingNo = \"\" + (date.getDay() + 1) + (date.getMonth() + 1) + (date.getYear() + 1900) + date.getHours() + date.getMinutes() + date.getSeconds();\r\n\t\t/**\r\n\t\t*\tSet the values of these fields as passed in the arguments\r\n\t\t*/\r\n\t\tuName = inUName;\r\n\t\tcarNo = inCarNo;\r\n\t\tlotNo = inLotNo;\r\n\t\tcost = 0;\r\n\t\t/**\r\n\t\t*\tPass the current date in sql.Timestamp object.\r\n\t\t*/\r\n\t\tstartTime = new java.sql.Timestamp(date.getTime());\r\n\t\t/**\r\n\t\t*\tLet it be 0 initially and then update it at the time of checkout\r\n\t\t*/\r\n\t\tendTime = new java.sql.Timestamp(0);\r\n\t}", "@Test\n public void setResolutionConfigSlot_faultCreation() throws Exception {\n SdFaultTable lUnsavedFault = getUnsavedFault();\n EqpAssmblBom lResolutionConfigSlot =\n createResolutionConfigSlot( CONFIG_SLOT_1_ATA, CONFIG_SLOT_1_NAME );\n\n iService.setResolutionConfigSlot( lUnsavedFault, lResolutionConfigSlot.getAlternateKey(),\n HumanResourceKey.ADMIN );\n\n // Ensure the value has been set on the fault object\n assertEquals( lResolutionConfigSlot.getPk(), lUnsavedFault.getResolutionConfigSlot() );\n\n // Ensure no history note is logged on creation\n assertTrue( getFaultHistoryNotes( lUnsavedFault.getPk() ).isEmpty() );\n }" ]
[ "0.6543666", "0.64679694", "0.62430686", "0.6066136", "0.59528124", "0.5880841", "0.5830902", "0.57992095", "0.57834023", "0.5645203", "0.5579128", "0.5569882", "0.5505068", "0.54121745", "0.5407174", "0.53861135", "0.53693056", "0.53499424", "0.53433067", "0.5323099", "0.5320679", "0.5310876", "0.529601", "0.5277483", "0.5250737", "0.52392715", "0.5221119", "0.52164537", "0.51895046", "0.51771396", "0.5172991", "0.5172854", "0.51722986", "0.517062", "0.51631194", "0.5147308", "0.51376694", "0.5122375", "0.5114089", "0.5109023", "0.50982237", "0.50585127", "0.50485104", "0.50447387", "0.5028609", "0.50160116", "0.50057894", "0.5002251", "0.5000824", "0.49986407", "0.49936292", "0.49757263", "0.49700156", "0.49592113", "0.4956963", "0.49424914", "0.49382612", "0.49269778", "0.49267432", "0.49262774", "0.4924609", "0.4911331", "0.49011266", "0.4886504", "0.48789993", "0.48776433", "0.48634338", "0.4862871", "0.4857705", "0.48505688", "0.4831638", "0.48151097", "0.48108068", "0.48101246", "0.48083934", "0.48044065", "0.4801256", "0.47957674", "0.47926417", "0.47874057", "0.4784453", "0.47780988", "0.4771454", "0.47692597", "0.47607833", "0.4744261", "0.47419164", "0.47289118", "0.47241753", "0.47178584", "0.47169232", "0.47098902", "0.4706081", "0.47050714", "0.47046316", "0.4701528", "0.4700603", "0.4698091", "0.46948", "0.46831438" ]
0.6338044
2
Instantiates a new booking quota exceeded excpetion.
public BookingQuotaExceededExcpetion(String message, Throwable cause, Quota quota, double limit, String userid) { super(message, cause); this.quota = quota; this.quotaLimit = limit; this.userId = userid; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public BookingQuotaExceededExcpetion(Quota quota, double limit, String userid) {\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public BookingQuotaExceededExcpetion(String message, Quota quota, double limit, String userid) {\n\t\tsuper(message);\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public BookingQuotaExceededExcpetion(Throwable cause, Quota quota, double limit, String userid) {\n\t\tsuper(cause);\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public ApiLimitException() {\n super();\n }", "public InvalidHourlyPayRateException() {}", "public OutOfBoundException() {\n super(\"Task does not exist. Please send a correct task number ><\");\n }", "public OfferingException() {\n }", "@Test\n public void testExceedsQuotaOnStartup() throws Exception {\n List<Dag<JobExecutionPlan>> dags = DagManagerTest.buildDagList(2, \"user\", ConfigFactory.empty());\n // Ensure that the current attempt is 1, normally done by DagManager\n dags.get(0).getNodes().get(0).getValue().setCurrentAttempts(1);\n dags.get(1).getNodes().get(0).getValue().setCurrentAttempts(1);\n\n // Should not be throwing the exception\n this._quotaManager.init(dags);\n }", "public MicrosoftGraphQuota() {\n }", "public InstanceOverflowException() {\n\t\tsuper();\n\t}", "public LimitExceededException(String message) {\n super(message, true);\n }", "public withdrawException() {\n super(\"The Sum you entered is greater than your available money... \");\n }", "public NotEnoughFundsException() {\n super(\"Not enough money rock star, try again\");\n }", "public InvalidRatingException(int inNumberSent)\r\n {\r\n this.numberSent = inNumberSent;\r\n }", "private void raiseLimitException() {\n\t\t\tthrow new DataBufferLimitException(\"Exceeded limit on max bytes to buffer : \" + getMaxInMemorySize());\n\t\t}", "public PriQOverflowException() {\n\t}", "public ScheduleException() {\r\n }", "public ApiLimitException(final Throwable e) {\n super(e);\n }", "PastReservation createPastReservation();", "public LimitExceededException(String anomalyDetectorId, String message) {\n super(anomalyDetectorId, message, true);\n this.countedInStats(false);\n }", "public OccupiedSlotExtraStorageLeaderCardException(){\n super(\"This leader card cannot accept anymore resources!\");\n }", "public OfferingException(String msg) {\n super(msg);\n }", "Booking createBooking(Booking newBooking) throws Exception;", "@Test(expected = IllegalDateException.class)\n\tpublic void testBookStartDateInPast() throws Exception {\n\t\tCalendar cal = Calendar.getInstance();\n\t\tcal.add(Calendar.HOUR, -2);\n\t\t// start is current date - 2\n\t\tDate invalidStartDate = cal.getTime();\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), invalidStartDate, validEndDate);\n\t}", "private void doReserve() {\n pickParkingLot();\n pickParkingSpot();\n pickTime();\n pickDuration();\n int amount = pickedparkinglot.getPrice() * pickedduration;\n if (pickedAccount.getBalance() >= amount) {\n currentReservation = new Reservation(pickedparkingspot, pickedAccount, pickedtime, pickedduration);\n validateReservation(currentReservation);\n } else {\n System.out.println(\"Insufficient balance\");\n }\n }", "public BucketOverflowException(String msg){\n\t\tsuper(msg);\n\t}", "public com.vodafone.global.er.decoupling.binding.request.UsageAuthRate createUsageAuthRate()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.UsageAuthRateImpl();\n }", "public LimitExceededException(String anomalyDetectorId, String message, boolean stopNow) {\n super(anomalyDetectorId, message, stopNow);\n this.countedInStats(false);\n }", "Limit createLimit();", "public ApiLimitException(final String s) {\n super(s);\n }", "@Test(expected = FacilityNotFreeException.class)\n\tpublic void testBookNotFree() throws Exception {\n\t\t// create a reservation\n\t\tdataHelper.createPersistedReservation(\"aUser\", Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t\t// book should fail..\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t}", "public LimitExceededException(String message, boolean endRun) {\n super(null, message, endRun);\n }", "public Booking createBooking(\n UserAccount customer, Employee employee, Product product, BookingRequest bookingRequest\n ) {\n Schedule schedule =\n scheduleService.findByEmployeeAndDate(employee, bookingRequest.getDate());\n boolean employeeNotScheduled = schedule == null;\n\n // date must be in next 14 days (including today)\n LocalDate future = LocalDate.now().plusDays(14);\n boolean invalidDate = !bookingRequest.getDate().isBefore(future);\n\n // time must be one of the permitted options\n boolean unsupportedTime = !Booking.permittedTimes.contains(bookingRequest.getTimeSlot());\n\n // booking must not have already started\n LocalDateTime startTime = LocalDateTime.of(bookingRequest.getDate(),\n LocalTime.parse(bookingRequest.getTimeSlot())\n );\n boolean invalidAppointmentStart = !startTime.isAfter(LocalDateTime.now());\n\n // employee must not have any preexisting overlapping bookings\n LocalDateTime endTime = startTime.plusMinutes(product.getDuration());\n boolean bookingConflict =\n this.conflictsWithExisting(schedule, employee, startTime, endTime);\n\n if (employeeNotScheduled ||\n invalidDate ||\n unsupportedTime ||\n invalidAppointmentStart ||\n bookingConflict) {\n throw new ConflictException(\"Appointment time not available\");\n }\n\n // now we can make the booking (and hopefully no new conflict has arisen in the\n // meantime)\n // TODO: handle race conditions (create, check conflicts, maybe rollback and error)\n\n Booking booking = new Booking();\n booking.setStatus(BookingStatus.PENDING);\n booking.setCustomer(customer);\n booking.setEmployee(employee);\n booking.setProduct(product);\n booking.setSchedule(schedule);\n booking.setTime(bookingRequest.getTimeSlot());\n this.saveOrUpdateBooking(booking);\n\n return booking;\n }", "public DeferConsultationException() {\n }", "public MyMoneyException() {\r\n\t\tsuper();\r\n\t}", "public NotBoundException(){\n\t\t super();\n\t }", "public Booking() {\r\n\t\t/**\r\n\t\t*\tGet the number of milliSeconds from the system time and set it to the java.sql.Date\r\n\t\t*\tobject to create a booking number and also to set the start time.\r\n\t\t*/\r\n\t\tlong dateTimeMillis = System.currentTimeMillis();\r\n\t\t/**\r\n\t\t*\tThis date is for generating String bookingNo using the date and time values\r\n\t\t*/\r\n\t\tjava.util.Date date = new java.util.Date(dateTimeMillis);\r\n\t\t/**\r\n\t\t*\tPass the current date in sql.Timestamp object.\r\n\t\t*/\r\n\t\tstartTime = new java.sql.Timestamp(date.getTime());\r\n\t\t/**\r\n\t\t*\tLet it be 0 initially and then update it at the time of checkout\r\n\t\t*/\r\n\t\tendTime = new java.sql.Timestamp(0);\r\n\t}", "@Test(expected = BookingNotAllowedException.class)\n\tpublic void testBookNotAllowed() throws Exception {\n\t\tdataHelper.createPersistedReservation(USER_ID, new ArrayList<String>(), validStartDate, validEndDate);\n\t\tbookingManagement.book(USER_ID, Arrays.asList(room1.getId()), validStartDate, validEndDate);\n\t}", "public GameBuyException() {\n }", "public Employee() throws OutOfRangeException { //default constructors have no parameters\n\t\t//must create a default constructor, if a subclass is created\n\t\tthis(\"\",\"\",10.0f,40);\n\t\temployeeCount++;\n\t}", "public PriceModelException() {\n\n }", "public TrafficspacesAPIException() {\n \tthis(null, DEFAULT_MESSAGE);\n }", "public SimDemand(double time, I_Event event, Location location, I_Element element, DemandSet demands) {\n\t\tsuper(time, event, \"Insufficient resources for demand: \" + demands);\n\t\tthis.location = location;\n\t\tthis.element = element;\n\t\tdemands.clean();\n\t\tsetMessage(\"Insufficient resources for demand: \" + demands);\n\t\tthis.demands = demands;\n\t}", "@Override\n public Reservation call() throws ReservationNotCreatedException {\n return reservationService.create(reservation);\n }", "protected ResourceLimitException(String tableName, String msg) {\n super(msg, true /* isRemote */);\n this.tableName = tableName;\n }", "Reservation createReservation();", "public BadDiceException() {\n }", "public BusinessObjectException() {\r\n super();\r\n }", "public DynamicDeckDynamoException() {\n }", "@Test(expected = BidAmountException.class)\n public void bidIsLessThanHighestBidIsRejected() {\n knownUsers.login(seller.userName(), seller.password());\n knownUsers.annointSeller(seller.userName());\n\n knownUsers.login(bidder.userName(), bidder.password());\n\n Auction testAuction = new Auction(seller, item, startingPrice, startTime, endTime);\n testAuction.onStart();\n\n Bid firstBid = new Bid(bidder, startingPrice, startTime.plusMinutes(2));\n\n testAuction.submitBid(firstBid);\n\n testAuction.submitBid(firstBid);\n\n\n }", "public ApiLimitException(final String s, final Throwable e) {\n super(s, e);\n }", "public InstanceOverflowException(\n\t\t\tString msg, \n\t\t\ttv.amwa.maj.record.InstanceNumberGeneration generator) {\n\n\t\tsuper(msg);\n\t\tthis.generator = generator;\n\t}", "public DepotTimetableAsk() {\n }", "@Test(expected = Exception.class)\n public void shouldThrowAnExceptionIfTheOccupanyIsNotIn48Hours()\n\t throws Exception {\n\n\tfinal CreateRoomCommand command = new CreateRoomCommand(\n\t\tArrays.asList(validRoomOfferValues));\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, isOccupancyIn48Hours, isRoomBookable);\n\n\twhen(isOccupancyIn48Hours.isSatisfiedBy((Date) any()))\n\t\t.thenReturn(false);\n\n\troomOfferService.createRoomOffer(command);\n\n\tverify(dao, never()).create(Arrays.asList(validRoomOfferValues));\n }", "public LimitConfiguration() {\n try {\n yellowLimit = new AlertLimit((float) 0.75);\n redLimit = new AlertLimit((float)0.9);\n } catch(Exception e){\n //This exception should not happen\n System.out.println(e.getMessage());\n }\n }", "@Test\n public void testTracking_OutOfQuota() {\n JobStatus jobStatus = createJobStatus(\"testTracking_OutOfQuota\", 1);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(jobStatus, null);\n }\n setStandbyBucket(WORKING_INDEX, jobStatus); // 2 hour window\n setProcessState(ActivityManager.PROCESS_STATE_HOME);\n // Now the package only has two seconds to run.\n final long remainingTimeMs = 2 * SECOND_IN_MILLIS;\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(\n JobSchedulerService.sElapsedRealtimeClock.millis() - HOUR_IN_MILLIS,\n 10 * MINUTE_IN_MILLIS - remainingTimeMs, 1), false);\n\n // Start the job.\n synchronized (mQuotaController.mLock) {\n mQuotaController.prepareForExecutionLocked(jobStatus);\n }\n advanceElapsedClock(remainingTimeMs);\n\n // Wait for some extra time to allow for job processing.\n verify(mJobSchedulerService,\n timeout(remainingTimeMs + 2 * SECOND_IN_MILLIS).times(1))\n .onControllerStateChanged(argThat(jobs -> jobs.size() == 1));\n assertFalse(jobStatus.isConstraintSatisfied(JobStatus.CONSTRAINT_WITHIN_QUOTA));\n assertEquals(JobSchedulerService.sElapsedRealtimeClock.millis(),\n jobStatus.getWhenStandbyDeferred());\n }", "CurrentReservation createCurrentReservation();", "public SureBetNotFoundException() {\r\n\t\tsuper();\r\n\t}", "public OtpErlangRangeException(final String msg) {\n super(msg);\n }", "public Agent(String name, double commissionRate) throws ValueOutOfRangeException {\n this.name = name;\n this.collectionOfCurrentListings = new ArrayList<>();\n this.checkCommissionRate(commissionRate);\n this.commissionRate = commissionRate;\n this.totalEarnings = 0;\n }", "public ItemInvalidoException() {\r\n }", "public QueueOverFlowException(String message){\r\n\t\tsuper(message);\r\n\t}", "public NoAvailableBayException() {\n\t\tsuper(\"There are no bay's free.\");\n\t}", "private void runTestMaybeScheduleStartAlarmLocked_SmallRollingQuota_AllowedTimeCheck() {\n spyOn(mQuotaController);\n doNothing().when(mQuotaController).maybeScheduleCleanupAlarmLocked();\n\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(\n createJobStatus(\"testMaybeScheduleStartAlarmLocked\", 1), null);\n }\n\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n // Working set window size is 2 hours.\n final int standbyBucket = WORKING_INDEX;\n final long contributionMs = mQcConstants.IN_QUOTA_BUFFER_MS / 2;\n final long remainingTimeMs =\n mQcConstants.ALLOWED_TIME_PER_PERIOD_WORKING_MS - contributionMs;\n\n // Session straddles edge of bucket window. Only the contribution should be counted towards\n // the quota.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (2 * HOUR_IN_MILLIS + 3 * MINUTE_IN_MILLIS),\n 3 * MINUTE_IN_MILLIS + contributionMs, 3), false);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - HOUR_IN_MILLIS, remainingTimeMs, 2), false);\n // Expected alarm time should be when the app will have QUOTA_BUFFER_MS time of quota, which\n // is 2 hours + (QUOTA_BUFFER_MS - contributionMs) after the start of the second session.\n final long expectedAlarmTime = now - HOUR_IN_MILLIS + 2 * HOUR_IN_MILLIS\n + (mQcConstants.IN_QUOTA_BUFFER_MS - contributionMs);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeScheduleStartAlarmLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE, standbyBucket);\n }\n verify(mAlarmManager, timeout(1000).times(1)).setWindow(\n anyInt(), eq(expectedAlarmTime), anyLong(), eq(TAG_QUOTA_CHECK), any(), any());\n }", "public com.vodafone.global.er.decoupling.binding.request.UsageAuthRatePlus createUsageAuthRatePlus()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.UsageAuthRatePlusImpl();\n }", "private GuestBooking createGuestBookingInstance(Customer customer, Long taxiId, Date bookingDate ){\n GuestBooking booking = new GuestBooking();\n booking.setCustomer(customer);\n booking.setTaxiId(taxiId);\n booking.setBookingDate(bookingDate);\n return booking;\n }", "GitletException() {\n super();\n }", "public Timeslot() {\n }", "public StockException() {\r\n\t\tsuper();\r\n\t}", "public VTorInUseException() {\n super();\n }", "@Test\n @Date(\"2018-06-28\")\n public void getEmigrationAssumption() {\n assertThrows(SCBClientResponseTooLargeException.class, () -> this.client.getEmigrationRateAssumption().size());\n }", "public void insertBooking(){\n \n Validator v = new Validator();\n if (createBookingType.getValue() == null)\n {\n \n Dialogs.create()\n .owner(prevStage)\n .title(\"Error!\")\n .masthead(null)\n .message(\"Set Booking Type!\")\n .showInformation();\n \n return;\n \n }\n if (createBookingType.getValue().toString().equals(\"Repair\"))\n Dialogs.create()\n .owner(prevStage)\n .title(\"Error!\")\n .masthead(null)\n .message(\"Go to Diagnosis and Repair tab for creating Repair Bookings!\")\n .showInformation();\n \n \n if(v.checkBookingDate(parseToDate(createBookingDate.getValue(),createBookingTimeStart.localTimeProperty().getValue()),\n parseToDate(createBookingDate.getValue(),createBookingTimeEnd.localTimeProperty().getValue()))\n && customerSet)\n \n { \n \n int mID = GLOBAL.getMechanicID();\n \n try {\n mID = Integer.parseInt(createBookingMechanic.getSelectionModel().getSelectedItem().toString().substring(0,1));\n } catch (Exception ex) {\n Dialogs.create()\n .owner(prevStage)\n .title(\"Error!\")\n .masthead(null)\n .message(\"Set Mechanic!\")\n .showInformation();\n return;\n }\n \n if (mID != GLOBAL.getMechanicID())\n if (!getAuth(mID)) return;\n \n createBookingClass();\n dbH.insertBooking(booking);\n booking.setID(dbH.getLastBookingID());\n appointment = createAppointment(booking);\n closeWindow();\n \n }\n else\n {\n String extra = \"\";\n if (!customerSet) extra = \" Customer and/or Vehicle is not set!\";\n Dialogs.create()\n .owner(prevStage)\n .title(\"Error!\")\n .masthead(null)\n .message(\"Errors with booking:\"+v.getError()+extra)\n .showInformation();\n }\n \n }", "public Reservation build() throws BuilderException \n{\n\tif (date == null) {\n\t\tthrow new BuilderException(\"Valid date not found\");\n\t}\n\tif (city == null) {\n\t\tthrow new BuilderException(\"Valid city not found\");\n\t}\n\tif (headcount < MINHEAD) {\n\t\tthrow new BuilderException(\n\t\t\t\"Minimum headcount is \" + MINHEAD); \n\t}\n\tif (dollarsPerHead * headcount < MINTOTAL) {\n\t\tthrow new BuilderException(\n\t\t\t\"Minimum total cost is \" + MINTOTAL); \n\t}\n\treturn new Reservation(\n\t\tdate, \n\t\theadcount, \n\t\tcity, \n\t\tdollarsPerHead, \n\t\thasSite); \n}", "@SuppressWarnings(\"unused\")\n private Booking() {\n }", "public void createFailure() {\n\t\tgetController().changeFree(true);\t\t\n\t\tdisplayAdvertisement(\"opponent failure\");\n\t\tvalidate();\n\t}", "protected StockItem()\r\n \t{\r\n \t\tlimit = new LimitSystem(this);\r\n \t}", "private void runTestMaybeScheduleStartAlarmLocked_SmallRollingQuota_MaxTimeCheck() {\n spyOn(mQuotaController);\n doNothing().when(mQuotaController).maybeScheduleCleanupAlarmLocked();\n\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(\n createJobStatus(\"testMaybeScheduleStartAlarmLocked\", 1), null);\n }\n\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n // Working set window size is 2 hours.\n final int standbyBucket = WORKING_INDEX;\n final long contributionMs = mQcConstants.IN_QUOTA_BUFFER_MS / 2;\n final long remainingTimeMs = mQcConstants.MAX_EXECUTION_TIME_MS - contributionMs;\n\n // Session straddles edge of 24 hour window. Only the contribution should be counted towards\n // the quota.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (24 * HOUR_IN_MILLIS + 3 * MINUTE_IN_MILLIS),\n 3 * MINUTE_IN_MILLIS + contributionMs, 3), false);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - 20 * HOUR_IN_MILLIS, remainingTimeMs, 300), false);\n // Expected alarm time should be when the app will have QUOTA_BUFFER_MS time of quota, which\n // is 24 hours + (QUOTA_BUFFER_MS - contributionMs) after the start of the second session.\n final long expectedAlarmTime = now - 20 * HOUR_IN_MILLIS\n + 24 * HOUR_IN_MILLIS\n + (mQcConstants.IN_QUOTA_BUFFER_MS - contributionMs);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeScheduleStartAlarmLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE, standbyBucket);\n }\n verify(mAlarmManager, timeout(1000).times(1)).setWindow(\n anyInt(), eq(expectedAlarmTime), anyLong(), eq(TAG_QUOTA_CHECK), any(), any());\n }", "@Test\n public void testMaybeScheduleStartAlarmLocked_Ej_SmallRollingQuota() {\n // saveTimingSession calls maybeScheduleCleanupAlarmLocked which interferes with these tests\n // because it schedules an alarm too. Prevent it from doing so.\n spyOn(mQuotaController);\n doNothing().when(mQuotaController).maybeScheduleCleanupAlarmLocked();\n\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeStartTrackingJobLocked(\n createJobStatus(\"testMaybeScheduleStartAlarmLocked_Ej_SRQ\", 1), null);\n }\n\n final long now = JobSchedulerService.sElapsedRealtimeClock.millis();\n setStandbyBucket(WORKING_INDEX);\n final long contributionMs = mQcConstants.IN_QUOTA_BUFFER_MS / 2;\n final long remainingTimeMs = mQcConstants.EJ_LIMIT_WORKING_MS - contributionMs;\n\n // Session straddles edge of bucket window. Only the contribution should be counted towards\n // the quota.\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - (24 * HOUR_IN_MILLIS + 3 * MINUTE_IN_MILLIS),\n 3 * MINUTE_IN_MILLIS + contributionMs, 3), true);\n mQuotaController.saveTimingSession(SOURCE_USER_ID, SOURCE_PACKAGE,\n createTimingSession(now - 23 * HOUR_IN_MILLIS, remainingTimeMs, 2), true);\n // Expected alarm time should be when the app will have QUOTA_BUFFER_MS time of quota, which\n // is 24 hours + (QUOTA_BUFFER_MS - contributionMs) after the start of the second session.\n final long expectedAlarmTime =\n now + HOUR_IN_MILLIS + (mQcConstants.IN_QUOTA_BUFFER_MS - contributionMs);\n synchronized (mQuotaController.mLock) {\n mQuotaController.maybeScheduleStartAlarmLocked(\n SOURCE_USER_ID, SOURCE_PACKAGE, WORKING_INDEX);\n }\n verify(mAlarmManager, timeout(1000).times(1)).setWindow(\n anyInt(), eq(expectedAlarmTime), anyLong(), eq(TAG_QUOTA_CHECK), any(), any());\n }", "private void createAlarm(long backoffTimeMs) {\n Log.d(TAG, \"Scheduling registration retry, backoff = \" + backoffTimeMs);\n Intent retryIntent = new Intent(C2DM_RETRY);\n PendingIntent retryPIntent = PendingIntent.getBroadcast(context, 0, retryIntent, 0);\n AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);\n am.set(AlarmManager.ELAPSED_REALTIME, backoffTimeMs, retryPIntent);\n }", "public ReservedCardOutOfRangeException(String message) {\n super(message);\n }", "public IndexException(int min, int max, int value) {\n super(\"Index is out of range\");\n this.min = min;\n this.max = max;\n this.value = value;\n }", "public ReservationApi()\r\n {\r\n }", "protected abstract T create(final double idealStartTime);", "public com.vodafone.global.er.decoupling.binding.request.BasePrice createBasePrice()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.BasePriceImpl();\n }", "@Test(expected = Exception.class)\n public void shouldNotBookAnInvalidRoomAndInformTheClientWithAnException()\n\t throws Exception {\n\n\tfinal int index = 1;\n\tfinal String customerId = \"12\";\n\tfinal BookRoomCommand command = new BookRoomCommand(validRoomOffer,\n\t\tcustomerId);\n\n\twhen(dao.read(index)).thenReturn(validRoomOffer);\n\twhen(\n\t\tbuilder.createRoomOffer(Arrays.asList(validRoomOfferValues),\n\t\t\tindex)).thenThrow(\n\t\tnew ConstraintViolationException(\"Test\"));\n\twhen(isRoomBookable.isSatisfiedBy(validRoomOffer)).thenReturn(true);\n\n\tfinal UrlyBirdRoomOfferService roomOfferService = new UrlyBirdRoomOfferService(\n\t\tdao, builder, null, isRoomBookable);\n\n\troomOfferService.bookRoomOffer(command);\n }", "public Loyalty() {}", "@Test\r\n\tpublic void testDamageWithinOldRange() throws TooManyAttachmentsException \r\n\t{\r\n\t\tWeapon w = new Pistol();\r\n\t\tassertEquals(10, w.getDamage(5));\r\n\t\tw = new Scope(w);\r\n\t\tassertEquals(18, w.getDamage(5));\r\n\t}", "public ExpiredProductAddedException(){\r\n super(\"Attedmpted to add expired product to the database\");\r\n }", "public com.vodafone.global.er.decoupling.binding.request.ResourceBalanceType createResourceBalanceType()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.ResourceBalanceTypeImpl();\n }", "private void checkCapacity(int capacity) \n {\n if (capacity > MAX_CAPACITY)\n throw new IllegalStateException(\"Attempt to create a bag whose \" +\n \"capacity exeeds allowed \" +\n \"maximum of \" + MAX_CAPACITY);\n }", "public com.vodafone.global.er.decoupling.binding.request.ModifySpendLimitsRequest createModifySpendLimitsRequest()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.ModifySpendLimitsRequestImpl();\n }", "@TargetApi(Build.VERSION_CODES.KITKAT)\n @RequiresApi(api = Build.VERSION_CODES.KITKAT)\n public void createReservation() {\n Time timeObj = null;\n DateFormat formatter= new SimpleDateFormat(\"kk:mm\");\n try {\n timeObj = new Time(formatter.parse(time).getTime());\n } catch (Exception e) {\n e.printStackTrace();\n }\n\n Bitmap generatedQR = generateQR();\n //Create reservation & save to Repository\n Reservation reservation = new Reservation(film, timeObj, listPlaces, generatedQR);\n Repository.addReservation(reservation);\n }", "public CheckingAccount(int id, double balance, double overdraftLimit) {\n\t\tsuper(id, balance);\n\t\tthis.overdraftLimit = overdraftLimit;\n\t}", "@Test(expected = ValidationException.class)\n\tpublic void testFailedBooking_OverlappedBookings1() throws ParseException {\n\t\t// Preparing booking data\n\t\tBooking booking = getExpectedBookingEntity();\n\t\t\n\t\tcom.paypal.bfs.test.bookingserv.service.model.Booking bookingServiceLayer \n\t\t = getServiceLayerBooking();\n\n\t\tMockito.when(bookingRepository.save(Mockito.any())).thenReturn(booking);\n\t\t\n\t\tbookingClient.createBooking(bookingServiceLayer);\n\t\t\n\t\tMockito.when(bookingRepository.findExistingBookings(booking.getFirstName(), \n\t\t\t\tbooking.getLastName(), booking.getDateOfBirth(), \n\t\t\t\tbooking.getAddress().getZipCode())).thenReturn(Arrays.asList(booking));\n\t\tMockito.when(messageUtil.getLocalizedMessage(Mockito.anyString())).thenReturn(\"Test message\");\n\t\t\n\t\t//Try to persist same booking again\n\t\tbookingServiceLayer.setCheckIn(bookingServiceLayer.getCheckIn()+2);\n\t\tbookingClient.createBooking(bookingServiceLayer);\n\t\t\n\t}", "public com.vodafone.global.er.decoupling.binding.request.UsageAuthRateCharge createUsageAuthRateCharge()\n throws javax.xml.bind.JAXBException\n {\n return new com.vodafone.global.er.decoupling.binding.request.impl.UsageAuthRateChargeImpl();\n }", "public InvalidMarkException() { }", "private Reservation(Integer id, Person person, Seat seat, Showing showing, boolean objectOnly)\n throws PersistenceException{\n super();\n this.setId(id);\n personReservationSupervisor.getInstance().set(this, person);\n reservationSeatSupervisor.getInstance().set(this, seat);\n if(objectOnly) return;\n try{reservationShowingSupervisor.getInstance().add(showing,this);}catch(ConstraintViolation cv){}// Ok, because consistency is guaranteed with this statement\n }", "public CardExpiredException() {\n super();\n }", "public Booking(String inUName, String inCarNo, int inLotNo) {\r\n\t\t/**\r\n\t\t*\tGet the number of milliSeconds from the system time and set it to the java.sql.Date\r\n\t\t*\tobject to create a booking number and also to set the start time.\r\n\t\t*/\r\n\t\tlong dateTimeMillis = System.currentTimeMillis();\r\n\t\t/**\r\n\t\t*\tThis date is for generating String bookingNo using the date and time values\r\n\t\t*/\r\n\t\tjava.util.Date date = new java.util.Date(dateTimeMillis);\r\n\t\t/**\r\n\t\t*\tSet a serialized booking Number generated using the present date and time\r\n\t\t*\tThe format of this string is:\r\n\t\t*\tDayMonthYearHourMinuteSecond\r\n\t\t*/\r\n\t\tbookingNo = \"\" + (date.getDay() + 1) + (date.getMonth() + 1) + (date.getYear() + 1900) + date.getHours() + date.getMinutes() + date.getSeconds();\r\n\t\t/**\r\n\t\t*\tSet the values of these fields as passed in the arguments\r\n\t\t*/\r\n\t\tuName = inUName;\r\n\t\tcarNo = inCarNo;\r\n\t\tlotNo = inLotNo;\r\n\t\tcost = 0;\r\n\t\t/**\r\n\t\t*\tPass the current date in sql.Timestamp object.\r\n\t\t*/\r\n\t\tstartTime = new java.sql.Timestamp(date.getTime());\r\n\t\t/**\r\n\t\t*\tLet it be 0 initially and then update it at the time of checkout\r\n\t\t*/\r\n\t\tendTime = new java.sql.Timestamp(0);\r\n\t}", "@Test\n public void setResolutionConfigSlot_faultCreation() throws Exception {\n SdFaultTable lUnsavedFault = getUnsavedFault();\n EqpAssmblBom lResolutionConfigSlot =\n createResolutionConfigSlot( CONFIG_SLOT_1_ATA, CONFIG_SLOT_1_NAME );\n\n iService.setResolutionConfigSlot( lUnsavedFault, lResolutionConfigSlot.getAlternateKey(),\n HumanResourceKey.ADMIN );\n\n // Ensure the value has been set on the fault object\n assertEquals( lResolutionConfigSlot.getPk(), lUnsavedFault.getResolutionConfigSlot() );\n\n // Ensure no history note is logged on creation\n assertTrue( getFaultHistoryNotes( lUnsavedFault.getPk() ).isEmpty() );\n }" ]
[ "0.6543666", "0.64679694", "0.6338044", "0.6066136", "0.59528124", "0.5880841", "0.5830902", "0.57992095", "0.57834023", "0.5645203", "0.5579128", "0.5569882", "0.5505068", "0.54121745", "0.5407174", "0.53861135", "0.53693056", "0.53499424", "0.53433067", "0.5323099", "0.5320679", "0.5310876", "0.529601", "0.5277483", "0.5250737", "0.52392715", "0.5221119", "0.52164537", "0.51895046", "0.51771396", "0.5172991", "0.5172854", "0.51722986", "0.517062", "0.51631194", "0.5147308", "0.51376694", "0.5122375", "0.5114089", "0.5109023", "0.50982237", "0.50585127", "0.50485104", "0.50447387", "0.5028609", "0.50160116", "0.50057894", "0.5002251", "0.5000824", "0.49986407", "0.49936292", "0.49757263", "0.49700156", "0.49592113", "0.4956963", "0.49424914", "0.49382612", "0.49269778", "0.49267432", "0.49262774", "0.4924609", "0.4911331", "0.49011266", "0.4886504", "0.48789993", "0.48776433", "0.48634338", "0.4862871", "0.4857705", "0.48505688", "0.4831638", "0.48151097", "0.48108068", "0.48101246", "0.48083934", "0.48044065", "0.4801256", "0.47957674", "0.47926417", "0.47874057", "0.4784453", "0.47780988", "0.4771454", "0.47692597", "0.47607833", "0.4744261", "0.47419164", "0.47289118", "0.47241753", "0.47178584", "0.47169232", "0.47098902", "0.4706081", "0.47050714", "0.47046316", "0.4701528", "0.4700603", "0.4698091", "0.46948", "0.46831438" ]
0.62430686
3
Gets the quota which caused the exception.
public Quota getQuota() { return this.quota; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public double getQuotaLimit() {\n\t\treturn this.quotaLimit;\n\t}", "public Integer getMaxQuota() {\n return (Integer) getAttributeInternal(MAXQUOTA);\n }", "public BookingQuotaExceededExcpetion(Throwable cause, Quota quota, double limit, String userid) {\n\t\tsuper(cause);\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public BookingQuotaExceededExcpetion(String message, Throwable cause, Quota quota, double limit, String userid) {\n\t\tsuper(message, cause);\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "@Override\n public abstract float calculaQuota(float quotaBase) throws ExcepcioClub;", "public BookingQuotaExceededExcpetion(Quota quota, double limit, String userid) {\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "int getQuotaMetricsCount();", "public BookingQuotaExceededExcpetion(String message, Quota quota, double limit, String userid) {\n\t\tsuper(message);\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "@Override\n\tpublic String dettaglioAggiornaQuota(){\n\t return super.dettaglioAggiornaQuota();\n\t}", "public String quotaId() {\n return this.quotaId;\n }", "@Override\n\tpublic String dettaglioConsultaQuota(){\n\t return super.dettaglioConsultaQuota();\n\t}", "com.google.api.servicecontrol.v1.MetricValueSet getQuotaMetrics(int index);", "com.google.api.servicecontrol.v1.QuotaOperation.QuotaMode getQuotaMode();", "private void getQuota() {\n getProgressDialog().show();\n new Handler().postDelayed(this::onQuotaDownloadComplete, 2000);\n }", "int getQuotaModeValue();", "@Nullable\n public MatrixError getResourceLimitExceededError() {\n return mResourceLimitExceededError;\n }", "public Long get_cachepercentoriginbandwidthsaved() throws Exception {\n\t\treturn this.cachepercentoriginbandwidthsaved;\n\t}", "public Long get_cacherecentpercentstoreablemiss() throws Exception {\n\t\treturn this.cacherecentpercentstoreablemiss;\n\t}", "@Nullable\n BigInteger getStorageGb();", "public Long get_cachepercentstoreablemiss() throws Exception {\n\t\treturn this.cachepercentstoreablemiss;\n\t}", "public float getUsedLimit() {\n return usedLimit;\n }", "com.google.api.servicecontrol.v1.MetricValueSetOrBuilder getQuotaMetricsOrBuilder(int index);", "public java.lang.Double getLimitUsageRate() {\n return limitUsageRate;\n }", "public Long get_cacherecentpercentoriginbandwidthsaved() throws Exception {\n\t\treturn this.cacherecentpercentoriginbandwidthsaved;\n\t}", "public int getLogDiskSpaceLimit() {\n return agentConfig.getLogDiskSpaceLimit();\n }", "public String getTbApWtEntryTotalLimit()\n\t\t\t\tthrows AgentException{\n\t\t// Fill up with necessary processing\n\n\t\treturn tbApWtEntryTotalLimit;\n\t}", "public Double getLimit() {\n return limit;\n }", "public String getLimit_Base();", "public java.math.BigInteger getLimit()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.apache.xmlbeans.SimpleValue target = null;\r\n target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(LIMIT$6, 0);\r\n if (target == null)\r\n {\r\n return null;\r\n }\r\n return target.getBigIntegerValue();\r\n }\r\n }", "public int damagedRangeLimit() {\r\n return fDamagedRange[1];\r\n }", "private void raiseLimitException() {\n\t\t\tthrow new DataBufferLimitException(\"Exceeded limit on max bytes to buffer : \" + getMaxInMemorySize());\n\t\t}", "@Accessor(qualifier = \"redemptionQuantityLimit\", type = Accessor.Type.GETTER)\n\tpublic Integer getRedemptionQuantityLimit()\n\t{\n\t\treturn getPersistenceContext().getPropertyValue(REDEMPTIONQUANTITYLIMIT);\n\t}", "public Long get_cacheerrmemalloc() throws Exception {\n\t\treturn this.cacheerrmemalloc;\n\t}", "public long getRemaining() {\n\t\treturn disk_mgr.getRemaining();\n\t}", "public Long get_cachetotrevalidationmiss() throws Exception {\n\t\treturn this.cachetotrevalidationmiss;\n\t}", "public Integer getLimit() {\n return limit;\n }", "int getThrowsRemaining();", "public double getLimit() {return limit;}", "public int getEventLimit() {\n return eventLimit;\n }", "public String getTbApWtEntryInstantLimit()\n\t\t\t\tthrows AgentException{\n\t\t// Fill up with necessary processing\n\n\t\treturn tbApWtEntryInstantLimit;\n\t}", "public Long get_cachetotinvalidationrequests() throws Exception {\n\t\treturn this.cachetotinvalidationrequests;\n\t}", "public float getLimit() {\n return limit;\n }", "private QuotaConsumer getQuotaConsumer(AppEngineTaskAttemptContext taskAttemptContext) {\n QuotaManager manager = new QuotaManager(MemcacheServiceFactory.getMemcacheService());\n QuotaConsumer consumer = new QuotaConsumer(\n manager, taskAttemptContext.getTaskAttemptID().toString(), DEFAULT_QUOTA_BATCH_SIZE);\n return consumer;\n }", "public long getExceptionCount();", "public org.apache.xmlbeans.XmlNonNegativeInteger xgetLimit()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.apache.xmlbeans.XmlNonNegativeInteger target = null;\r\n target = (org.apache.xmlbeans.XmlNonNegativeInteger)get_store().find_element_user(LIMIT$6, 0);\r\n return target;\r\n }\r\n }", "public int getSizeLimit() {\n\t\treturn sizeLimit;\n\t}", "protected void returnTotalQuestQuota(Key ownerKey) throws ApiException {\n\t\tUser user = dao.get(ownerKey, User.class);\n\t\tint totalUsed = user.getQuota().getUsedQuestNum();\n\t\tuser.getQuota().setUsedQuestNum(totalUsed - 1);\n\t\tdao.save(user);\n\t}", "public double getOccupiedRamGB () { return getRamBaseResource().getOccupiedCapacity(); }", "public int getLimit() {\r\n return limit;\r\n }", "public int capturedLimit() {\n return this.limit.get();\n }", "@Override\n public int getPercentageExtraSpaceToLeave() throws G2AccessException {\n java.lang.Object retnValue = getAttributeValue (SystemAttributeSymbols.PERCENTAGE_EXTRA_SPACE_TO_LEAVE_);\n return ((Integer)retnValue).intValue ();\n }", "@Override\n\tpublic int quotaCount(int studyno) {\n\t\treturn mapper.quotaCount(studyno);\n\t}", "public int getLimit() {\n return limit;\n }", "public int getLimit() {\n return limit;\n }", "public int getLimit() {\n return limit;\n }", "public Long getLimit() {\n return this.Limit;\n }", "public Long getLimit() {\n return this.Limit;\n }", "public int getStorageplace() throws java.rmi.RemoteException, javax.ejb.CreateException, javax.ejb.FinderException, javax.naming.NamingException {\n return (((Integer) __getCache(\"storageplace\")).intValue());\n }", "public Long getLimit() {\n return this.limit;\n }", "public Integer getLimitEnd() {\r\n return limitEnd;\r\n }", "public int getLimit() {\n return limit;\n }", "public Long get_cachetotpetrequests() throws Exception {\n\t\treturn this.cachetotpetrequests;\n\t}", "protected static long getMinUploadFreespace() {\n return minUploadFreespace;\n }", "@Nonnegative\n @CheckReturnValue\n public abstract int getRemainingRequests();", "public int how_many_work_item () throws BaseException {\n throw new BaseException(\"Not implemented\");\n }", "public double getCurrentPercentageError() {\n\t\tdouble returnValue = 0.0;\n\t\tint currentValue = this.readSensorValue();\n\t\tint optimum = getOptimumSensorValue(currentValue);\n\t\tif (currentValue > optimum) {\n\t\t\treturnValue = (double) (currentValue - optimum)\n\t\t\t\t\t/ (double) (this.highReadInValue - optimum);\n\t\t} else if (currentValue < optimum) {\n\t\t\treturnValue = -((double) (optimum - currentValue) / (double) (optimum - this.lowReadInValue));\n\t\t}\n\t\treturn returnValue;\n\t}", "public int getMaxValue() throws Exception {\n\t\treturn RemoteServer.instance().executeAndGetId(\"getmaxvalue\",\n\t\t\t\tgetRefId());\n\t}", "public com.google.protobuf.Int32Value getLimit() {\n return instance.getLimit();\n }", "public Long get_cacheutilizedmemorykb() throws Exception {\n\t\treturn this.cacheutilizedmemorykb;\n\t}", "public int getLimit() {\n\treturn Limit;\n }", "public void getQuestQuota(Key userKey) throws ApiException {\n\t\tUser user = dao.get(userKey, User.class);\n\t\tint dailyUsed = user.getQuota().getUsedDailyQuestNum();\n\t\tint totalUsed = user.getQuota().getUsedQuestNum();\n\t\tcheck(user.getQuota().getDailyQuestNum() > dailyUsed,\n\t\t\t\tErrorCode.quota_daily_quest_usedup);\n\t\tcheck(user.getQuota().getQuestNum() > totalUsed,\n\t\t\t\tErrorCode.quota_total_quest_usedup);\n\t\tuser.getQuota().setUsedDailyQuestNum(dailyUsed + 1);\n\t\tuser.getQuota().setUsedQuestNum(totalUsed + 1);\n\t\tdao.save(user);\n\t}", "int getLimit();", "int getLimit();", "public Long get_cachenummbreadfromdiskrate() throws Exception {\n\t\treturn this.cachenummbreadfromdiskrate;\n\t}", "StorageResourceUsage getStorageResourceUsage(String resourceName);", "java.util.List<com.google.api.servicecontrol.v1.MetricValueSet> getQuotaMetricsList();", "public SpendingLimit spendingLimit() {\n return this.spendingLimit;\n }", "QuantityExtentType getQuantityExtent();", "public Long get_boundedentitiescntfrompe() throws Exception {\n\t\treturn this.boundedentitiescntfrompe;\n\t}", "public int getDiskUtil() {\n\t\treturn getSize();\n\t}", "public float getAmountOfForceToRetrieve() {\n return _amountToRetrieve;\n }", "public int remainingCapacity() throws QueueException\r\n {\r\n if(measurementQueue==null) throw new QueueException(\"CINCAMIMIS Queue not found\");\r\n \r\n return measurementQueue.remainingCapacity();\r\n }", "@Accessor(qualifier = \"redemptionQuantityLimitPerUser\", type = Accessor.Type.GETTER)\n\tpublic Integer getRedemptionQuantityLimitPerUser()\n\t{\n\t\treturn getPersistenceContext().getPropertyValue(REDEMPTIONQUANTITYLIMITPERUSER);\n\t}", "public Integer getResultLimit()\n {\n if (resultLimit == null)\n {\n return HPCCWsWorkUnitsClient.defaultResultLimit;\n }\n return resultLimit;\n }", "public int getLimit(){\r\n return limit;\r\n\r\n }", "public Long get_cachetotrequests() throws Exception {\n\t\treturn this.cachetotrequests;\n\t}", "public Long get_cachenummbreadfromdisk() throws Exception {\n\t\treturn this.cachenummbreadfromdisk;\n\t}", "public int energy_consumed_GET()\n { return (int)((int) get_bytes(data, 29, 4)); }", "public int getLimit() {\n\t\treturn limit;\n\t}", "public int getLimit() {\n\t\treturn limit;\n\t}", "public long getGranularityInMB() {\n return granularityInMB;\n }", "public Integer supportedStorageGb() {\n return this.supportedStorageGb;\n }", "public Long get_cacheinvalidationrequestsrate() throws Exception {\n\t\treturn this.cacheinvalidationrequestsrate;\n\t}", "public Integer getDiskSizeGB() {\n return this.diskSizeGB;\n }", "public Long get_cachemaxmemorykb() throws Exception {\n\t\treturn this.cachemaxmemorykb;\n\t}", "public int getLimitEnd() {\n return limitEnd;\n }", "public int getLimitEnd() {\n return limitEnd;\n }", "public BigDecimal getRepairLim() {\n\t\treturn repairLim;\n\t}", "public double getOverdraftLimit() {\n\t\treturn overdraftLimit;\n\t}", "public Integer getUploadlimit() {\n return uploadlimit;\n }" ]
[ "0.71137136", "0.6559031", "0.65450436", "0.63590276", "0.6333624", "0.63271666", "0.6276849", "0.6263417", "0.6250788", "0.6228926", "0.6213612", "0.60375255", "0.5945749", "0.5926313", "0.5914749", "0.5893393", "0.58165014", "0.5760774", "0.5754853", "0.57297915", "0.5715939", "0.5678967", "0.5664753", "0.5648869", "0.5636871", "0.5636677", "0.5632143", "0.56247926", "0.5613042", "0.55957437", "0.55366766", "0.55286956", "0.5516977", "0.5483508", "0.54797614", "0.54474264", "0.5438617", "0.5437249", "0.54371774", "0.54370004", "0.5426236", "0.5423847", "0.540441", "0.5402787", "0.53718114", "0.5351394", "0.5319691", "0.5310488", "0.5292844", "0.52803767", "0.52774346", "0.5276567", "0.5275714", "0.5275714", "0.5275714", "0.52586013", "0.52586013", "0.5255886", "0.52516586", "0.52494484", "0.5247554", "0.52400196", "0.52373666", "0.52356935", "0.52343345", "0.5233799", "0.5221823", "0.52187693", "0.520783", "0.52066666", "0.52056926", "0.52051044", "0.52051044", "0.51968825", "0.5192781", "0.5189436", "0.5185861", "0.51854074", "0.51797575", "0.5168791", "0.51682186", "0.51648235", "0.5164232", "0.5153239", "0.514625", "0.5142481", "0.513589", "0.51296294", "0.51219815", "0.51219815", "0.51218164", "0.51094866", "0.5100707", "0.50992435", "0.5098742", "0.5097046", "0.5097046", "0.5094138", "0.50899464", "0.50805515" ]
0.68137497
1
Gets the quota limit which caused the exception.
public double getQuotaLimit() { return this.quotaLimit; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public Integer getMaxQuota() {\n return (Integer) getAttributeInternal(MAXQUOTA);\n }", "public Integer getLimit() {\n return limit;\n }", "public int getLimit() {\n return limit;\n }", "public int getLimit() {\r\n return limit;\r\n }", "public int getLimit() {\n return limit;\n }", "public int getLimit() {\n return limit;\n }", "public int getLimit() {\n return limit;\n }", "public Double getLimit() {\n return limit;\n }", "public int getLimit() {\n\t\treturn limit;\n\t}", "public int getLimit() {\n\t\treturn limit;\n\t}", "public java.math.BigInteger getLimit()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.apache.xmlbeans.SimpleValue target = null;\r\n target = (org.apache.xmlbeans.SimpleValue)get_store().find_element_user(LIMIT$6, 0);\r\n if (target == null)\r\n {\r\n return null;\r\n }\r\n return target.getBigIntegerValue();\r\n }\r\n }", "public Long getLimit() {\n return this.limit;\n }", "public int getSizeLimit() {\n\t\treturn sizeLimit;\n\t}", "public int getLimit() {\n\t\t\treturn limit;\n\t\t}", "public float getLimit() {\n return limit;\n }", "public double getLimit() {return limit;}", "public BookingQuotaExceededExcpetion(Quota quota, double limit, String userid) {\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "private void raiseLimitException() {\n\t\t\tthrow new DataBufferLimitException(\"Exceeded limit on max bytes to buffer : \" + getMaxInMemorySize());\n\t\t}", "public BookingQuotaExceededExcpetion(String message, Quota quota, double limit, String userid) {\n\t\tsuper(message);\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public Long getLimit() {\n return this.Limit;\n }", "public Long getLimit() {\n return this.Limit;\n }", "public BookingQuotaExceededExcpetion(Throwable cause, Quota quota, double limit, String userid) {\n\t\tsuper(cause);\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public BookingQuotaExceededExcpetion(String message, Throwable cause, Quota quota, double limit, String userid) {\n\t\tsuper(message, cause);\n\t\tthis.quota = quota;\n\t\tthis.quotaLimit = limit;\n\t\tthis.userId = userid;\n\t}", "public int getLimit() {\n\treturn Limit;\n }", "public com.google.protobuf.Int32Value getLimit() {\n return instance.getLimit();\n }", "int getLimit();", "int getLimit();", "public String getLimit() {\r\n\t\treturn this.limit;\r\n\t}", "@Nullable\n public MatrixError getResourceLimitExceededError() {\n return mResourceLimitExceededError;\n }", "public org.apache.xmlbeans.XmlNonNegativeInteger xgetLimit()\r\n {\r\n synchronized (monitor())\r\n {\r\n check_orphaned();\r\n org.apache.xmlbeans.XmlNonNegativeInteger target = null;\r\n target = (org.apache.xmlbeans.XmlNonNegativeInteger)get_store().find_element_user(LIMIT$6, 0);\r\n return target;\r\n }\r\n }", "public int getLimit(){\r\n return limit;\r\n\r\n }", "public int capturedLimit() {\n return this.limit.get();\n }", "public String getLimit_Base();", "public static double calculateLimit() {\n return 500;\n }", "public Quota getQuota() {\n\t\treturn this.quota;\n\t}", "public long limit();", "public int getMaxValue() throws Exception {\n\t\treturn RemoteServer.instance().executeAndGetId(\"getmaxvalue\",\n\t\t\t\tgetRefId());\n\t}", "public Integer getLimitEnd() {\r\n return limitEnd;\r\n }", "public Integer getLimitnumber() {\n return limitnumber;\n }", "private int getCurrentLimit(){\n\t\treturn this.LIMIT;\n\t}", "public float getUsedLimit() {\n return usedLimit;\n }", "public int getLimitEnd() {\n return limitEnd;\n }", "public int getLimitEnd() {\n return limitEnd;\n }", "public int getEventLimit() {\n return eventLimit;\n }", "public java.lang.Double getLimitUsageRate() {\n return limitUsageRate;\n }", "public int getLimitNum() {\r\n return this.limitNum;\r\n }", "public Integer getResultLimit()\n {\n if (resultLimit == null)\n {\n return HPCCWsWorkUnitsClient.defaultResultLimit;\n }\n return resultLimit;\n }", "public com.google.protobuf.Int32Value getLimit() {\n return limit_ == null ? com.google.protobuf.Int32Value.getDefaultInstance() : limit_;\n }", "public int damagedRangeLimit() {\r\n return fDamagedRange[1];\r\n }", "public Integer getUploadlimit() {\n return uploadlimit;\n }", "public String getTbApWtEntryTotalLimit()\n\t\t\t\tthrows AgentException{\n\t\t// Fill up with necessary processing\n\n\t\treturn tbApWtEntryTotalLimit;\n\t}", "public String getTbApWtEntryInstantLimit()\n\t\t\t\tthrows AgentException{\n\t\t// Fill up with necessary processing\n\n\t\treturn tbApWtEntryInstantLimit;\n\t}", "public double getNumericalLimit() {\n\treturn NUMERICAL_LIMIT;\n }", "@Override\n public abstract float calculaQuota(float quotaBase) throws ExcepcioClub;", "int getQuotaMetricsCount();", "com.google.api.servicecontrol.v1.QuotaOperation.QuotaMode getQuotaMode();", "public int getLogDiskSpaceLimit() {\n return agentConfig.getLogDiskSpaceLimit();\n }", "long getMemLimit();", "public void setMaxQuota(Integer value) {\n setAttributeInternal(MAXQUOTA, value);\n }", "private int getMaxSize() {\r\n return PropUtils.getValue(sizeLimitProp, DEFAULT_MAX_SIZE);\r\n }", "public Long maxSizeInMegabytes() {\n return this.maxSizeInMegabytes;\n }", "public Byte getSourcelimit() {\n return sourcelimit;\n }", "private int getConnectionLimit(String businessId) {\n\t\tString schema = getCustomSchema();\n\t\tString sql = StringUtil.join(\"select quota_no as value from \", schema, \"rezdox_connection_quota_view where business_id=?\");\n\n\t\tDBProcessor db = new DBProcessor(getDBConnection(), schema);\n\t\tdb.setGenerateExecutedSQL(log.isDebugEnabled());\n\t\tList<GenericVO> data = db.executeSelect(sql, Arrays.asList(businessId), new GenericVO());\n\t\treturn !data.isEmpty() ? Convert.formatInteger(\"\"+data.get(0).getValue()) : 0;\n\t}", "public synchronized double getOutputLimit()\n {\n final String funcName = \"getOutputLimit\";\n\n if (debugEnabled)\n {\n dbgTrace.traceEnter(funcName, TrcDbgTrace.TraceLevel.API);\n dbgTrace.traceExit(funcName, TrcDbgTrace.TraceLevel.API, \"=%f\", outputLimit);\n }\n\n return outputLimit;\n }", "public final int getAllocateLimit() {\n return allocateLimit;\n }", "@Accessor(qualifier = \"redemptionQuantityLimit\", type = Accessor.Type.GETTER)\n\tpublic Integer getRedemptionQuantityLimit()\n\t{\n\t\treturn getPersistenceContext().getPropertyValue(REDEMPTIONQUANTITYLIMIT);\n\t}", "@Deprecated\n public static int getLimit() {\n return LIMIT;\n }", "public Integer getLimitStart() {\r\n return limitStart;\r\n }", "int getQuotaModeValue();", "public double getOverdraftLimit() {\n\t\treturn overdraftLimit;\n\t}", "public long getReportLimit()\n {\n if (this.rptLimitCount == 0L) {\n this.rptLimitCount = 1L;\n }\n return this.rptLimitCount;\n }", "public String quotaId() {\n return this.quotaId;\n }", "public long getTimeLimit() {\n\t\treturn timeLimit;\n\t}", "public int getLimitStart() {\n return limitStart;\n }", "public int getLimitStart() {\n return limitStart;\n }", "public int getLimitStart() {\n return limitStart;\n }", "@Override\n\tpublic String dettaglioAggiornaQuota(){\n\t return super.dettaglioAggiornaQuota();\n\t}", "public synchronized int getLowerSizeLimit() {\n \t\treturn lower;\n \t}", "@Nullable\n BigInteger getStorageGb();", "@Override\n\tpublic String dettaglioConsultaQuota(){\n\t return super.dettaglioConsultaQuota();\n\t}", "public int getMaximum() {\n \tcheckWidget();\n \treturn maximum;\n }", "private void getQuota() {\n getProgressDialog().show();\n new Handler().postDelayed(this::onQuotaDownloadComplete, 2000);\n }", "protected Limit getLimit() {\n return new Limit(skip, limit);\n }", "int getMaxTicksLimit();", "public synchronized int getUpperSizeLimit() {\n \t\treturn upper;\n \t}", "public final String getMaximumOutstandingRequests() {\n return properties.get(MAXIMUM_OUTSTANDING_REQUESTS_PROPERTY);\n }", "public Long get_cachemaxmemorykb() throws Exception {\n\t\treturn this.cachemaxmemorykb;\n\t}", "public int getMaximumSize() {\n return maximumSize;\n }", "com.google.api.servicecontrol.v1.MetricValueSet getQuotaMetrics(int index);", "Limits limits();", "public int maxSize()\n {\n return maxSize;\n }", "public Long getFlowLimit() {\r\n \treturn flowLimit;\r\n }", "public SpendingLimit spendingLimit() {\n return this.spendingLimit;\n }", "public int findMaxValue() {\n\t\treturn findMaxValue( this );\n\t}", "public int getMaxSize(){\n return maxSize;\n }", "public ApiLimitException() {\n super();\n }", "@ApiModelProperty(value = \"The maximum number of payments to return in a single response. This value cannot exceed 200.\")\n public Integer getLimit() {\n return limit;\n }", "public static long getApiMaxRequestBytes() {\n return 10L * 1000L * 1000L; // 10 megabytes (https://en.wikipedia.org/wiki/Megabyte)\n }", "protected static long getMinUploadFreespace() {\n return minUploadFreespace;\n }", "public double getMiterLimit(\n )\n {return miterLimit;}" ]
[ "0.7208618", "0.6961902", "0.69052416", "0.6872428", "0.6860288", "0.6860288", "0.6860288", "0.68407315", "0.67767215", "0.67767215", "0.67575186", "0.674802", "0.67212355", "0.6719115", "0.6689294", "0.66802216", "0.6680191", "0.66715896", "0.6666145", "0.66656196", "0.66656196", "0.666334", "0.6653761", "0.664271", "0.65956676", "0.6563315", "0.6563315", "0.6561792", "0.6559324", "0.6485211", "0.64800775", "0.64521194", "0.64408433", "0.64345735", "0.64166296", "0.6394101", "0.6390954", "0.6344888", "0.6332585", "0.63246286", "0.6302633", "0.62923396", "0.62923396", "0.6275023", "0.62717193", "0.62257534", "0.6215014", "0.61964846", "0.6159567", "0.61459607", "0.6144802", "0.6143914", "0.6141118", "0.61102456", "0.6073989", "0.60509366", "0.60497946", "0.60489815", "0.6037935", "0.6026941", "0.60207087", "0.6004408", "0.5999209", "0.5998233", "0.59809357", "0.5979689", "0.5963933", "0.5956239", "0.595161", "0.5913899", "0.5881259", "0.58760417", "0.5870233", "0.58587706", "0.58587706", "0.58587706", "0.5833811", "0.57732546", "0.57589567", "0.5742336", "0.57404685", "0.57382685", "0.5714587", "0.5714311", "0.57043993", "0.5701919", "0.569529", "0.5670696", "0.56679565", "0.56667775", "0.5656532", "0.56512934", "0.56464756", "0.5636926", "0.56367856", "0.5627244", "0.562509", "0.5623127", "0.5622866", "0.5619988" ]
0.7673859
0
Gets the user id affected by the quota.
public String getUserId() { return userId; }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "Integer getUserId();", "public int getUserId() {\n return instance.getUserId();\n }", "long getUserId();", "long getUserId();", "public long getUserId();", "public long getUserId();", "public long getUserId();", "public long getUserId();", "@Override\n\tpublic long getUserId() {\n\t\treturn _userSync.getUserId();\n\t}", "public long getUserId() {\n return instance.getUserId();\n }", "Long getUserId();", "@Override\n\tpublic Long getUserId() {\n\t\treturn user.getKey().getId();\n\t}", "@Override\n public long getUserId() {\n return _usersCatastropheOrgs.getUserId();\n }", "@Override\n\tpublic long getUserId() {\n\t\treturn _userTracker.getUserId();\n\t}", "public Integer getIdUser() {\r\n\t\treturn idUser;\r\n\t}", "@Override\n\tpublic long getUserId();", "@Override\n\tpublic long getUserId();", "public Long getUserId() {\n return this.user.getId();\n }", "java.lang.String getUserId();", "java.lang.String getUserId();", "java.lang.String getUserId();", "@java.lang.Override\n public long getUserId() {\n return instance.getUserId();\n }", "@Override\n\tpublic long getUserId() {\n\t\treturn _changesetEntry.getUserId();\n\t}", "public int getIdUser() {\n return idUser;\n }", "public int getIdUser() {\n return idUser;\n }", "@Override\n\tpublic long getUserId() {\n\t\treturn _dataset.getUserId();\n\t}", "@Override\n\tpublic long getUserId() {\n\t\treturn model.getUserId();\n\t}", "@Override\n\tpublic long getUserId() {\n\t\treturn model.getUserId();\n\t}", "@Override\n\tpublic long getUserId() {\n\t\treturn model.getUserId();\n\t}", "public java.lang.String getUserId() {\n return instance.getUserId();\n }", "public Integer getUserID() {\n return userID;\n }", "public long getUserId() {\n return userId_;\n }", "public long getUserId() {\n return userId_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "String getUserId();", "String getUserId();", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public int getUserID() {\n return userID_;\n }", "public long getUserId() {\n return userId_;\n }", "public int getUserId()\r\n\t{\r\n\t\treturn this.userId;\r\n\t}", "public long getUserId() {\r\n return userId;\r\n }", "public int getUserId() {\n return userId_;\n }", "public int getIduser() {\n return iduser;\n }", "public Integer getUserId() {\r\n\t\treturn userId;\r\n\t}", "public Integer getUserId() {\r\n\t\treturn userId;\r\n\t}", "public Integer getUserId() {\r\n\t\treturn userId;\r\n\t}", "public int getUserID() {\n return userID;\n }", "public int getUserID() {\n return userID;\n }", "public int getUserID() {\n return userID;\n }", "public long getUserId() {\n return userId;\n }", "protected long getUserID() {\n return userID;\n }", "public int getUserId() {\r\n\t\treturn userId;\r\n\t}", "public String getUserId() {\n if (this.isTokenValide()) {\n JWT jwt = new JWT(getToken());\n Claim claim = jwt.getClaim(\"user_id\");\n return claim.asString();\n } else {\n return \"\";\n }\n }", "public Integer getUserId() {\n\t\treturn userId;\n\t}", "public java.lang.Long getUserId() {\n return userId;\n }", "@Override\n public long getUserId() {\n return _partido.getUserId();\n }", "public Integer getUserId() {\r\n return userId;\r\n }", "public Integer getUserId() {\r\n return userId;\r\n }", "public long getUserID() {\r\n\t\treturn userID;\r\n\t}", "private String getCurrentUserId() {\n\t\tUser currentUser = UserDirectoryService.getCurrentUser();\n \tString currentUserId = currentUser.getId();\n\t\treturn currentUserId;\n\t}", "public Integer getUserid() {\n return userid;\n }", "public Integer getUserid() {\n return userid;\n }", "public Integer getUserid() {\n return userid;\n }", "public Integer getUserid() {\n return userid;\n }", "public Integer getUserid() {\n return userid;\n }", "public Integer getUserid() {\n return userid;\n }", "public Integer getUserid() {\n return userid;\n }", "public Integer getUserid() {\n return userid;\n }", "public Integer getUserid() {\n return userid;\n }", "public Integer getUserid() {\n return userid;\n }" ]
[ "0.724852", "0.72258556", "0.7203544", "0.7203544", "0.7191068", "0.7191068", "0.7191068", "0.7191068", "0.7168225", "0.71221715", "0.7122104", "0.70847696", "0.7064446", "0.705766", "0.70506406", "0.7042", "0.7042", "0.7006341", "0.7000642", "0.7000642", "0.7000642", "0.69910085", "0.69786024", "0.6958366", "0.6958366", "0.6936968", "0.6910462", "0.6910462", "0.6910462", "0.6896955", "0.68871725", "0.6881684", "0.6881684", "0.68805104", "0.68805104", "0.68804014", "0.68804014", "0.68804014", "0.68804014", "0.68804014", "0.68804014", "0.68804014", "0.68804014", "0.68804014", "0.68804014", "0.68804014", "0.68804014", "0.68804014", "0.68804014", "0.68804014", "0.68774813", "0.68774813", "0.6870493", "0.6870493", "0.6869951", "0.6869951", "0.6869951", "0.6869951", "0.6869951", "0.6869951", "0.6869951", "0.6869951", "0.6869951", "0.6869951", "0.6869951", "0.6869951", "0.6869951", "0.6869951", "0.6869951", "0.6828887", "0.682175", "0.6819329", "0.6817002", "0.6816712", "0.681383", "0.681383", "0.681383", "0.6813152", "0.6813152", "0.6813152", "0.68131274", "0.68038076", "0.6793226", "0.67926073", "0.6784235", "0.6778035", "0.67775416", "0.67696035", "0.67696035", "0.6758644", "0.6757171", "0.67553985", "0.67553985", "0.67553985", "0.67553985", "0.67553985", "0.67553985", "0.67553985", "0.67553985", "0.67553985", "0.67553985" ]
0.0
-1
/ Implement in java. Read this below two array. Find the lowest difference between the two array cell.
public static void main(String[] args) { int [] array1 = {30,12,5,9,2,20,33,1}; int [] array2 = {18,25,41,47,17,36,14,19}; int a=array1.length; int b=array2.length; System.out.println("The lowest differenc between two array is :"+findLowestDiff(array1,array2,a,b)); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public int smallestDifference(int[] A, int[] B) {\n\t\tint[] longArray = A.length > B.length ? A : B;\n\t\tint[] shortArray = A.length > B.length ? B : A;\n\t\tArrays.sort(longArray);\n\t\tint min = Integer.MAX_VALUE;\n\t\tfor (int i = 0; i < shortArray.length; i++) {\n\t\t\tint a = min(longArray, shortArray[i]);\n\t\t\tif (a == 0) {\n\t\t\t\treturn 0;\n\t\t\t} else if (a < min) {\n\t\t\t\tmin = a;\n\t\t\t}\n\t\t}\n\t\treturn min;\n\t}", "public int compare(int[] a, int[] b) {\r\n return a[1] - b[1];\r\n }", "public int compare(int[] a, int[] b) {\r\n return a[0] - b[0];\r\n }", "public static void main(String[] args) {\n\n\n int[] array1 = {30, 12, 5, 9, 2, 20, 33, 1};\n int[] array2 = {18, 25, 41, 47, 17, 36, 14, 19};\n\n RetoCheat.lowestDifference(array1,array2);\n }", "public double minDifference()\n {\n double minD = 1000.0; // setting unreasonably high\n double testD = 0.0;\n \n for (int i=0; i < data.length -1; i++) // stopping 1 early because reading ahead\n {\n testD = Math.abs(data[i]-data[i+1]);\n if (testD < minD)\n {\n minD = testD;\n }\n }\n \n \n return minD;\n }", "public int compare(int[] t1, int[] t2) {\n if (t1.length == 0 || t2.length == 0)\n return 0;\n return t1[0] - t2[0];\n }", "public static void main(String[] args) throws Exception {\n \n Scanner scn=new Scanner(System.in);\n int n1=scn.nextInt();\n \n int[] a1=new int[n1];\n for(int i=0;i<a1.length;i++){\n a1[i]=scn.nextInt();\n }\n \n int n2=scn.nextInt();\n int[] a2=new int[n2];\n for(int i=0;i<a2.length;i++){\n a2[i]=scn.nextInt();\n }\n \n int[] diff=new int[n2];\n int c=0;\n \n int i=a1.length-1;\n int j=a2.length-1;\n int k=diff.length-1;\n \n while(k >= 0){\n int d=0;\n int a1v= i >= 0? a1[i]: 0;\n \n if(a2[j] +c >= a1v){\n d= a2[j] + c -a1v;\n c=0;\n }else{\n d= a2[j] + c + 10 -a1v;\n c=-1;\n }\n \n diff[k] = d;\n \n i--;\n j--;\n k--;\n }\n \n int idx = 0;\n while(idx < diff.length){\n if(diff[idx] == 0){\n idx++;\n }else{\n break;\n }\n }\n \n while(idx < diff.length){\n System.out.println(diff[idx]);\n idx++;\n }\n \n\n \n \n}", "@Override public int compare(int[] a, int[] b) {\n if (a[0] == b[0]) {\n if (a[1] == b[1]) return a[2] - b[2];\n return a[1] - b[1];\n }\n return a[0] - b[0];\n }", "static int minimumAbsoluteDifferenceSlower(int[] arr) {\n int smallest = 0;\n for (int i = 0; i < arr.length; i++) {\n for (int j = i + 1; j < arr.length; j++) {\n int current = Math.abs(arr[i] - arr[j]);\n if (i == 0) {\n smallest = current;\n } else if (smallest > current) {\n smallest = current;\n }\n }\n }\n\n return smallest;\n }", "@Override\r\n\t\t\tpublic int compare(int[] o1, int[] o2) {\n\t\t\t\treturn o1[1] - o2[1];\r\n\t\t\t}", "private int distance(int[] a, int[] b) {\n return Math.abs(a[0] - b[0]) + Math.abs(a[1] - b[1]);\n }", "public static int min2(double[] mainArray2) {\r\n\t\tint min2 = 0;\r\n\t\tfor(int lessThan = 1; lessThan < mainArray2.length; lessThan ++) {\r\n\r\n\t\t\tif(mainArray2[lessThan]<mainArray2[min2]) {\r\n\t\t\t\tmin2 = lessThan;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn (int) min2;\r\n\t}", "@Override\r\n\t\t\tpublic int compare(int[] o1, int[] o2) {\n\t\t\t\treturn o1[2] - o2[2];\r\n\t\t\t}", "public int compare(double[] a, double[] b)\r\n\t\t\t\t{\n\t\t\t\t\tdouble x, y;\r\n\t\t\t\t\tif(a[0] != b[0]) \r\n\t\t\t\t\t{\r\n\t\t\t\t\t\tx = a[0];\r\n\t\t\t\t\t\ty = b[0];\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tif (x < y) \r\n\t\t\t\t\t\t\treturn -1;\r\n\t\t\t\t\t\telse if (x == y) \r\n\t\t\t\t\t\t\treturn 0;\r\n\t\t\t\t\t\telse \r\n\t\t\t\t\t\t\treturn 1;\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(a.length > 2)\r\n\t\t\t\t\t\t\treturn compare(ArrayUtils.subarray(a, 1, a.length - 1), ArrayUtils.subarray(b, 1, b.length - 1));\r\n\t\t\t\t\t\telse\r\n\t\t\t\t\t\t\treturn 0;\r\n\t\t\t\t\t}\r\n\t\t\t\t}", "public static Integer findSmallestDiffTerrible(List<Integer> A, List<Integer> B) {\n Integer result = null;\n Collections.sort(A);\n Collections.sort(B);\n List<MergeObject> mergeObjects = sortedMerge(A, B);\n MergeObject prev = null;\n\n for (MergeObject element : mergeObjects) {\n if (prev == null) {\n prev = element;\n continue;\n }\n if (element.getSource() != prev.getSource()) {\n int diff = Math.abs(element.getValue() - prev.getValue());\n if (result == null) {\n result = diff;\n } else if (diff < result) {\n result = diff;\n }\n }\n prev = element;\n }\n return result;\n }", "@Override\n public int compare(int[] o1, int[] o2) {\n return o1[1] - o2[1];\n }", "static int[] Differenz(int[] a, int[] b){\n int i = a.length - 1;\n int[] c = new int [a.length];\n Arrays.fill(c, 0);\n while (i >= 0){\n if ((a[i] - b[i]) < 0){\n c[i] = (a[i] + 10) - b[i];\n c[i-1]--;\n }\n else c[i] = a[i] - b[i];\n i--;\n }\n return c;\n }", "int min() {\n\t\t// added my sort method in the beginning to sort our array\n\t\tint n = array.length;\n\t\tint temp = 0;\n\t\tfor (int i = 0; i < n; i++) {\n\t\t\tfor (int j = 1; j < (n - i); j++) {\n\t\t\t\tif (array[j - 1] > array[j]) {\n\t\t\t\t\ttemp = array[j - 1];\n\t\t\t\t\tarray[j - 1] = array[j];\n\t\t\t\t\tarray[j] = temp;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// finds the first term in the array --> first term should be min if\n\t\t// sorted\n\t\tint x = array[0];\n\t\treturn x;\n\t}", "private static int getMin(int[] original) {\n int min =original[0];\n for(int i = 1; i < original.length; i++) {\n if(original[i] < min) min = original[i];\n }\n return min;\n }", "private int min(int index1, int index2) {\n // TODO: YOUR CODE HERE\n E first = getElement(index1);\n E second = getElement(index2);\n if (first == null) { //if null then just return the other one?\n return index2;\n }\n if (second == null) {\n return index1;\n }\n if (first.compareTo(second) > 0) {\n return index2;\n } else {\n return index1;\n }\n }", "protected final double getMinDifference() {\r\n \r\n double difference = 0;\r\n \r\n for(int i = 0; i < this.D; i++) {\r\n difference += Math.pow(this.f.max(i)-this.f.min(i), 2)*0.001;\r\n }\r\n \r\n return difference;\r\n \r\n }", "public static void minMaxDifference() {\n //int arr[] = {4,3,5,6,7,1,2};\n int arr[] = {6, 1, 7, -1, 3, 5, 9};\n int min_number = Integer.MAX_VALUE;\n int max_diff = Integer.MIN_VALUE;\n int current_difference;\n for (int i = 0; i < arr.length; i++) {\n if (arr[i] < min_number)\n min_number = arr[i];\n current_difference = arr[i] - min_number;\n if (current_difference > max_diff)\n max_diff = current_difference;\n }\n System.out.println(\"Max diff : \" + max_diff);\n }", "private double getSolutionDifference(int[] solution1, int[] solution2){\n double solutionDifference = 0;\n double solutionValue1 = calculateSolutionValue(solution1);\n double solutionValue2 = calculateSolutionValue(solution2);\n\n if(solutionValue1 >= solutionValue2){\n solutionDifference = solutionValue1 - solutionValue2;\n }\n else{\n solutionDifference = solutionValue2 - solutionValue1;\n }\n\n return solutionDifference;\n }", "public int minDifference2(int[] array) {\n\t\tint sum = sum(array);\n\t\tboolean[][] matrix = new boolean[array.length][sum + 1];\n\t\tfor (int i = 0; i < array.length; i++) {\n\t\t\tfor (int j = 0; j <= sum; j++) {\n\t\t\t\tif (i == 0) {\n\t\t\t\t\tmatrix[i][j] = (j == 0) || (array[i] == j);\n\t\t\t\t} else {\n\t\t\t\t\tmatrix[i][j] = matrix[i - 1][j] || (j - array[i] >= 0 && matrix[i - 1][j - array[i]]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// post processing\n\t\tint offset = 0, index = sum / 2;\n\t\twhile (!matrix[array.length - 1][index + offset] && !matrix[array.length - 1][index - offset]) {\n\t\t\toffset++;\n\t\t}\n\t\treturn Math.min(\n\t\t\t\t(matrix[array.length - 1][index - offset]) ? Integer.MAX_VALUE : Math.abs(sum - 2 * (index - offset)),\n\t\t\t\t(matrix[array.length - 1][index + offset]) ? Integer.MAX_VALUE : Math.abs(sum - 2 * (index + offset)));\n\t}", "@Test\n public void minDifferenceTest() {\n assertEquals(0, minDifference(new int[]{5, 3, 2, 4}));\n /**\n * Example 2:\n * Input: nums = [1,5,0,10,14]\n * Output: 1\n * Explanation: Change the array [1,5,0,10,14] to [1,1,0,1,1].\n * The difference between the maximum and minimum is 1-0 = 1.\n */\n assertEquals(1, minDifference(new int[]{1, 5, 0, 10, 14}));\n /**\n * Example 3:\n * Input: nums = [6,6,0,1,1,4,6]\n * Output: 2\n */\n assertEquals(2, minDifference(new int[]{6, 6, 0, 1, 1, 4, 6}));\n /**\n * Example 4:\n * Input: nums = [1,5,6,14,15]\n * Output: 1\n */\n assertEquals(1, minDifference(new int[]{1, 5, 6, 14, 15}));\n /**\n * Example 5:\n * Input: nums = [82,81,95,75,20]\n * Output: 1\n */\n assertEquals(1, minDifference(new int[]{82, 81, 95, 75, 20}));\n }", "public static int minimumAbsoluteDifference(int[] arr) {\n Arrays.sort(arr);\n int smallest = Math.abs(arr[0] - arr[arr.length - 1]);\n\n for (int i = 0; i < arr.length; i++) {\n if (i + 1 < arr.length) {\n int current = Math.abs(arr[i + 1] - arr[i]);\n if (smallest > current) {\n smallest = current;\n }\n }\n }\n\n return smallest;\n }", "public double min(){\r\n\t\t//variable for min val\r\n\t\tdouble min = this.data[0];\r\n\t\t\r\n\t\tfor (int i = 1; i < this.data.length; i++){\r\n\t\t\t//if the minimum is more than the current index, change min to that value\r\n\t\t\tif (min > this.data[i]){\r\n\t\t\t\tmin = this.data[i];\r\n\t\t\t}\r\n\t\t}\r\n\t\t//return the minimum val\r\n\t\treturn min;\r\n\t}", "public static void main(String[] args) {\n Scanner sc = new Scanner(System.in);\n int noOfElements = sc.nextInt();\n int[] arr = new int[noOfElements];\n int[] arr1 = new int[noOfElements];\n int diff = Integer.MAX_VALUE;\n int sIndex = 0;\n int j = 0;\n for (int i = 0; i < noOfElements; i++) {\n arr[i] = sc.nextInt();\n }\n for (int j1 = 1; j1 < noOfElements; j1++) {\n int i = j1 - 1;\n int key = arr[j1];\n while (i >= 0 && key < arr[i]) { // 1 2 3\n arr[i + 1] = arr[i];\n i--;\n }\n arr[i + 1] = key;\n }\n //Arrays.sort(arr);\n for (int i = 0; i < noOfElements - 1; i++) {\n int temp = Math.abs(arr[i] - arr[i + 1]);\n if (temp <= diff) {\n diff=temp;\n }\n\n }\n\n for (int i = 0; i < noOfElements - 1; i++) {\n if (Math.abs(arr[i] - arr[i+1]) == diff) {\n System.out.print(arr[i] + \" \" + arr[i+1] + \" \");\n }\n }\n// for (int a = 0; a < j; a++) {\n//\n// System.out.print(arr[arr1[a]] + \" \" + arr[arr1[a]+1] + \" \");\n// }\n\n }", "private double vectDist(double[] a,double[] b) {\n\t\tdouble out = Double.NEGATIVE_INFINITY;\n\t\tfor (int i = 0; i <a.length;i++) {\n\t\t\tdouble diff = Math.abs(a[i]-b[i]);\n\t\t\tif (diff > out)\n\t\t\t\tout = diff;\n\t\t}\n\t\treturn out;\n\t}", "private double[] getMin(double[][] res) {\r\n\t\tdouble min[] = new double [3];\r\n\t\t\tmin[0] = res[0][0];\r\n\t\tfor(int i = 0 ; i < res.length ; i ++){\r\n\t\t\tfor(int j = 0 ; j < res.length ; j++)\r\n\t\tif(res[i][j] < min[0] && res[i][j] != -1){\r\n\t\t\tmin[0] = res[i][j];\r\n\t\t\tmin[1] = i;\r\n\t\t\tmin[2] = j;\r\n\t\tSystem.out.println(\"test\" + res[i][j]);\r\n\t\t}\r\n\t\t}\r\n\t\treturn min;\r\n\t}", "public static int compare(byte[] s1, byte[] s2) {\n int i;\n int len1 = s1.length;\n int len2 = s2.length;\n if (len1 > len2) {\n return 1;\n }\n if (len2 > len1) {\n return -1;\n }\n int acc = 0;\n for (i = 0; i < len1; i++) {\n acc += s1[i];\n acc -= s2[i];\n if (acc != 0) {\n return acc;\n }\n }\n return 0;\n }", "private static int maxDifference(int[] arr) {\n\t\tint maxDiff = arr[1] - arr[0];\n\t\tint minElement = arr[0];\n\t\t\n\t\tfor(int i = 1 ; i < arr.length; i++)\n\t\t{\n\t\t\tif(arr[i] - minElement > maxDiff)\n\t\t\t{\n\t\t\t\tmaxDiff = arr[i] - minElement;\n\t\t\t}\n\t\t\tif(arr[i] < minElement)\n\t\t\t{\n\t\t\t\tminElement = arr[i];\n\t\t\t}\n\t\t\t\n\t\t}\n\t\t\n\t\treturn maxDiff;\n\t}", "private static double min(Double[] darray){\n\t\tdouble min = darray[0];\n\t\tfor ( double dd : darray){\n\t\t\tmin = Math.min(min,dd);\n\t\t}\n\t\treturn min;\n\t}", "public static int bigDiff(int[] nums) {\n int max = nums[0];\n int min = nums[0];\n\n for (int i = 0; i < nums.length; i = i + 1) {\n if(max < nums[i]){\n max = nums[i];\n }\n\n if(min > nums[i]){\n min = nums[i];\n }\n }\n\n return max - min;\n }", "public int minDifference(int[] nums) {\n int n = nums.length;\n // if we have less than or equal to 4 elements in the array, we can always get 0 min diff\n if (n <= 4) return 0;\n int res = Integer.MAX_VALUE;\n // the array must be sorted beforehand\n Arrays.sort(nums);\n // enumerate all 4 options\n for (int i = 0; i <= 3; i++) {\n // get the min difference from new smallest and largest\n // after removing i elements from the front and (3 - i) elements from the end\n res = Math.min(res, nums[n - 1 - (3 - i)] - nums[i]);\n }\n return res;\n }", "static double minimalDistance(int[] x, int y[]) {\n Point[] points = new Point[x.length];\n for (int i = 0; i < x.length; i++) {\n points[i] = new Point(x[i], y[i]);\n }\n\n Arrays.sort(points, (a, b) -> a.x == b.x ? Long.signum(a.y - b.y) : Long.signum(a.y - b.y));\n\n PairPoint minPointsDistance = getMinPointsDistance(points, 0, x.length);\n return minPointsDistance == null ? -1 : minPointsDistance.distance;\n }", "public static void main(String[] args) throws Exception{\n\t\tScanner sc = new Scanner(System.in);\n\t\t\n\t\t//int n = sc.nextInt();\n\t\t\n\t\tBufferedReader br = new BufferedReader(new InputStreamReader(System.in));\n\t\tint n = Integer.parseInt(br.readLine());\n\t\t\n\t\t//System.out.print(n);\n\t\tString input1 = null;\n\t\tString input2 = null;\n\t\tint arr1[] = new int[n];\n\t\tint arr2[] = new int[n];\n\t\t\n\t\tinput1 = br.readLine();\n\t\tinput2 = br.readLine();\n\t\t\n\t\t\n\t\tString tokens1[] = input1.split(\"\\\\s+\");\n\t\tString tokens2[] = input2.split(\"\\\\s+\");\n\t\t\n\t\tfor(int i =0;i<n;i++)\n\t\t{\n\t\t\tarr1[i] = Integer.parseInt(tokens1[i]); \n\t\t\tarr2[i] = Integer.parseInt(tokens2[i]); \n\t\t}\n\t\t\n\t\tHashMap<Integer, Integer> array1 = new HashMap<>();\n\t\tHashMap<Integer, Integer> array2 = new HashMap<>();\n\t\t\n\t\tfor(int i = 0;i<n;i++)\n\t\t{\n\t\t\tarray1.put(arr1[i], i);\n\t\t\tarray2.put(arr2[i], i);\n\t\t}\n\t\tint diff[] = new int[n];\n\t\t\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tdiff[i] = Math.abs(i - array2.get(arr1[i]));\n\t\t}\n\t\tint min = diff[0];\n\t\tint minIndex = 0;\n\t\tfor(int i=0;i<n;i++)\n\t\t{\n\t\t\tif(diff[i] < min)\n\t\t\t{\n\t\t\t\tmin = diff[i];\n\t\t\t\tminIndex = i;\n\t\t\t}\n\t\t\telse if(diff[i] == min)\n\t\t\t{\n\t\t\t\tif(arr1[i] < arr1[minIndex])\n\t\t\t\t{\n\t\t\t\t\tminIndex = i;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tSystem.out.println(arr1[minIndex]);\n\t\t\n\t}", "public long min() {\n\t\tif (!this.isEmpty()) {\n\t\t\tlong result = theElements[0];\n\t\t\tfor (int i=1; i<numElements; i++) {\n\t\t\t\tif (theElements[i] < result) {\n\t\t\t\t\tresult = theElements[i];\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn result;\n\t\t}\n\t\telse {\n\t\t\tthrow new RuntimeException(\"Attempted to find min of empty array\");\n\t\t}\n\t}", "public int compare(byte[] bArr, byte[] bArr2) {\r\n int i;\r\n int i2;\r\n if (bArr.length != bArr2.length) {\r\n i2 = bArr.length;\r\n i = bArr2.length;\r\n } else {\r\n for (int i3 = 0; i3 < bArr.length; i3++) {\r\n if (bArr[i3] != bArr2[i3]) {\r\n i2 = bArr[i3];\r\n i = bArr2[i3];\r\n }\r\n }\r\n return 0;\r\n }\r\n return (i2 == 1 ? 1 : 0) - (i == 1 ? 1 : 0);\r\n }", "public void getDiff(int iOffset, int jOffset){\n int[] tmin = new int[3];\n tmin[0] = 0;\n tmin[1] = 0;\n tmin[2] = 0;\n \n int k = 0;\n for (int i = iOffset; i < iOffset+3; i++) {\n for (int j = jOffset; j < jOffset+3; j++) {\n tmin[0] = tmin[0] + (p.get(k).getVal()[0] - xmin[0]);\n tmin[1] = tmin[1] + (p.get(k).getVal()[1] - xmin[1]);\n tmin[2] = tmin[2] + (p.get(k).getVal()[2] - xmin[2]);\n k++;\n }\n }\n \n dmin[0] = tmin[0]/8; // d-red\n dmin[1] = tmin[1]/8; // d-green\n dmin[2] = tmin[2]/8; // d-blue\n }", "public static int bigDiff(int[] nums) {\n\n {\n int max = nums[0];\n int min = nums[0];\n for (int i = 1; i < nums.length; i++) {\n if (nums[i] > max) {\n max = nums[i];\n } else if (nums[i] < min) {\n min = nums[i];\n }\n }\n return (max - min);\n }\n }", "public static void main(String[] args) {\n\t\t\n\t\tdouble[] testarray1 = {2, 3, 10, 6, 4, 8, 1};\n\t\t// maxdiff: 8\n\t\t\n\t\tdouble[] testarray2 = {7, 9, 1, 6, 3, 2};\n\t\t// maxdiff: 5\n\t\t\n\t\tMinMaxDiff arr1 = new MinMaxDiff();\n\t\tMinMaxDiff arr2 = new MinMaxDiff();\n\t\t\n\t\tarr1 = findmaxdiff(testarray1);\n\t\tarr2 = findmaxdiff(testarray2);\n\n\t\tSystem.out.println(arr1.diff);\n\t\tSystem.out.println(arr2.diff);\n\n\n\t\t\n\t\t// Add test statements \n\t\t\n\t\t\n\t\t\n\t}", "public double getMinimum()\n {\n return Math.min(first, second);\n }", "public static int[] merge_v1(int[] arr1, int[] arr2) {\n\n\t\t// checking if the arrays are null\n\t\tif ((arr1 == null || arr1.length == 0) && (arr2 == null || arr2.length == 0)) {\n\t\t\treturn null;\n\t\t} else if (arr1 == null || arr1.length == 0) {\n\t\t\treturn arr2;\n\t\t} else if (arr2 == null || arr2.length == 0) {\n\t\t\treturn arr1;\n\t\t}\n\n\t\tint[] result = new int[arr1.length + arr2.length];\n\t\tboolean[] isUsed = new boolean[arr1.length + arr2.length];\n\t\tArrays.fill(isUsed, false);\n\n\t\tint index = -1;\n\t\tboolean check;\n\t\tfor (int i = 0; i < result.length; i++) {\n\t\t\tresult[i] = Integer.MIN_VALUE;\n\t\t\tcheck = false;\n\n\t\t\tfor (int j = 0; j < arr1.length; j++) {\n\t\t\t\t// if the current int is greater than lowest and is not used\n\t\t\t\tif ((check == false && isUsed[j] == false) || (result[i] > arr1[j] && isUsed[j] == false)) {\n\t\t\t\t\tresult[i] = arr1[j];\n\t\t\t\t\tindex = j;\n\t\t\t\t\tcheck = true;\n\t\t\t\t\t// isUsed[j] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor (int j = 0; j < arr2.length; j++) {\n\t\t\t\t// if the current int is greater than lowest and is not used\n\t\t\t\tif ((check == false && isUsed[j + arr1.length] == false)\n\t\t\t\t\t\t|| (result[i] > arr2[j] && isUsed[j + arr1.length] == false)) {\n\t\t\t\t\tresult[i] = arr2[j];\n\t\t\t\t\tindex = j + arr1.length;\n\t\t\t\t\tcheck = true;\n\t\t\t\t\t// isUsed[j + + arr1.length] = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tisUsed[index] = true;\n\t\t}\n\n\t\treturn result;\n\t}", "public static int minAdjDiff(int arr[], int n) {\n\n // Your code here\n int min = Math.abs(arr[0] - arr[1]);\n for(int i =1;i<n-1;i++){\n min = Math.min(min, Math.abs(arr[i]-arr[i+1]));\n }\n min = Math.min(min, Math.abs(arr[n-1]-arr[0]));\n return min;\n }", "@Override\n\t\t\tpublic int compare(Map.Entry<T, Integer> e1, Map.Entry<T, Integer> e2)\n\t\t\t{\n\n\t\t\t\treturn - (e1.getValue() - e2.getValue());\n\t\t\t}", "public static int min(int[] mainArray) {\r\n\t\tint min1 = 0;\r\n\t\tfor(int lessThan = 1; lessThan < mainArray.length; lessThan ++) {\r\n\r\n\t\t\tif(mainArray[lessThan]<mainArray[min1]) {\r\n\t\t\t\tmin1 = lessThan;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn min1;\r\n\t}", "private static int min(int d1,int d2){\n\t\treturn d1<d2?d1:d2;\n\t}", "private double getSqEucDist(float[] arr1, float[] arr2, double minDist) {\n\t double dist = 0;\n\t for(int i: dimRngIndxDesc) {\n\t\t dist+= Math.pow(arr1[i]-arr2[i], 2);\n\t\t if(minDist!=-2 && dist>minDist)\n\t\t\t return -1;\n\t }\n\t return dist;\n }", "public static void main(String[] args) {\n\t\tint arr[] = {2,4,11,5,8,1,9};\r\n\t\tint res = arr[1] - arr[0];\r\n\t\tfor(int i = 0; i < arr.length; i++) {\r\n\t\t\tfor(int j = i + 1; j < arr.length; j++) {\r\n\t\t\t\tres = Math.max(res, arr[j] - arr[i]);\r\n\t\t\t}\r\n\t\t}\r\n//\t\tSystem.out.println(first + \" : \" + last + \" : \" + max);\r\n\t\tSystem.out.println(res);\r\n\t}", "public List<List<Integer>> minimumAbsDifference(int[] arr) {\n\n int minNum = 10000000;\n int maxNum = -10000000;\n for (int num : arr) {\n if (num < minNum)\n minNum = num;\n\n if (maxNum < num)\n maxNum = num;\n }\n int[] cnt = new int[maxNum - minNum + 1];\n for (int num : arr)\n cnt[num - minNum] += 1;\n\n int ind = 0;\n for (int i = 0; i < maxNum - minNum + 1; i++) {\n for (int j = 0; j < cnt[i]; j++) {\n arr[ind] = i + minNum;\n ind += 1;\n }\n }\n\n List<List<Integer>> ret = new ArrayList<>();\n\n int minDiff = 10000000;\n for (int i = 0; i < arr.length - 1; i++) {\n int diff = arr[i + 1] - arr[i];\n if (minDiff > diff)\n minDiff = diff;\n }\n\n for (int i = 0; i < arr.length - 1; i++) {\n int diff = arr[i + 1] - arr[i];\n if (diff == minDiff)\n addPair(ret, arr[i], arr[i + 1]);\n }\n\n return ret;\n }", "@Override\n public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2) {\n int c = -1 * WritableComparator.compareBytes(b1, s1 + LENGTH_BYTES, l1 - LENGTH_BYTES, b2,\n s2 + LENGTH_BYTES, l2 - LENGTH_BYTES);\n return c;\n }", "@Override\n public int compare(Slope s1, Slope s2){\n if(s2.deno * s1.nomi - s1.deno * s2.nomi < 0) return -1;\n else if(s2.deno * s1.nomi - s1.deno * s2.nomi > 0) return 1;\n else return 0;\n }", "public int compare(int[] a, int[] b) {\n\t\t \treturn Integer.valueOf(a[0]).compareTo(Integer.valueOf(b[0]));\n\t\t }", "public static int getMin(int[] inputArray){\n int minValue = inputArray[0];\n for(int i=1; i<inputArray.length;i++){\n if(inputArray[i] < minValue){\n minValue=inputArray[i];\n }\n }\n return minValue;\n }", "public double getMinDiffHorizontal(Coordinate a, Coordinate b) {\n\t\t double minDist = a.distance(b) - 2*uncertaintyHorizontal;\n\t\t if (minDist < 0) {\n\t\t\t minDist = 0;\n\t\t }\n\t\t return minDist;\n\t}", "private double min(double a, double b) {\n if (a > b) {\n return b;\n }\n return a;\n }", "private static int[] subtract(int[] big, int[] little) {\n int bigIndex = big.length;\n int result[] = new int[bigIndex];\n int littleIndex = little.length;\n long difference = 0;\n\n // Subtract common parts of both numbers\n while (littleIndex > 0) {\n difference = (big[--bigIndex] & LONG_MASK) -\n (little[--littleIndex] & LONG_MASK) +\n (difference >> 32);\n result[bigIndex] = (int)difference;\n }\n\n // Subtract remainder of longer number while borrow propagates\n boolean borrow = (difference >> 32 != 0);\n while (bigIndex > 0 && borrow)\n borrow = ((result[--bigIndex] = big[bigIndex] - 1) == -1);\n\n // Copy remainder of longer number\n while (bigIndex > 0)\n result[--bigIndex] = big[bigIndex];\n\n return result;\n }", "public int[] smallestRange(int[][] arrays) {\n \n int[] pointer = new int[arrays.length];\n int max = Integer.MIN_VALUE;\n int minY = Integer.MAX_VALUE;\n int minX = 0;\n boolean flag = true;\n \n // PriorityQueue<Integer> queue = new PriorityQueue<>((i,j)-> arrays[i][pointer[i]] - arrays[j][pointer[j]]);\n \n PriorityQueue<Integer> queue = new PriorityQueue<>(new Comparator<Integer>(){\n public int compare(Integer i, Integer j){\n return arrays[i][pointer[i]] - arrays[j][pointer[j]];\n }\n });\n \n for(int i = 0; i < arrays.length; i++){\n queue.offer(i);\n max = Math.max(max, arrays[i][0]);\n }\n \n for(int i = 0; i < arrays.length && flag; i ++){\n for(int j = 0; j < arrays[i].length && flag; j++){\n int minTemp = queue.poll();\n if(minY - minX > max - arrays[minTemp][pointer[minTemp]]){\n minX = arrays[minTemp][pointer[minTemp]];\n minY = max;\n }\n pointer[minTemp]++;\n if(pointer[minTemp] == arrays[minTemp].length){\n flag = false;\n break;\n }\n queue.offer(minTemp);\n max = Math.max(max, arrays[minTemp][pointer[minTemp]]);\n }\n }\n return new int[]{minX, minY};\n }", "public int difference(ArrayList<Integer> numbers) {\n\t\tif(numbers == null) {\n\t\t\treturn -1;\n\t\t} else if(numbers.size() < 1) {\n\t\t\treturn -1;\n\t\t}\n\t\tint maximum = numbers.get(0);\n\t\tint mininum = numbers.get(0);\n\t\tfor(int i = 0; i < numbers.size(); i++) {\n\t\t\tmaximum = (numbers.get(i) > maximum) ? numbers.get(i) : maximum;\n\t\t\tmininum = (numbers.get(i) < mininum) ? numbers.get(i) : mininum;\n\t\t}\n\t\treturn maximum - mininum;\t\t// default return value to ensure compilation\n\t}", "public double minValue(DateTime dt1, DateTime dt2) throws Exception {\r\n Candle[] cd = collectCandlesByIndex(find_index(dt1), find_index(dt2));\r\n double min;\r\n if (cd.length > 1) {\r\n min = cd[0].getLow();\r\n for (Candle c : cd) {\r\n if (c.getLow() < min){\r\n min = c.getLow();\r\n }\r\n }\r\n return min;\r\n } else if (cd.length == 1) {\r\n return cd[0].getLow();\r\n } else {\r\n return 0;\r\n }\r\n }", "public static int minimumAbsoluteDifference(Integer[] input){\n List<Integer> sortedList = Arrays.asList(input);\n Collections.sort(sortedList);\n\n int minimumAbsoluteDifference = Integer.MAX_VALUE;\n\n for(int i = 0; i < sortedList.size() - 1; i ++){\n int currentAbsoluteDifference = Math.abs(sortedList.get(i) - sortedList.get(i + 1));\n\n if(currentAbsoluteDifference < minimumAbsoluteDifference){\n minimumAbsoluteDifference = currentAbsoluteDifference;\n }\n }\n\n return minimumAbsoluteDifference;\n }", "public int trap_old(int[] height) {\n if(height.length <=2){\n return 0;\n }\n int result = 0;\n List<Integer> peaks = new ArrayList<>();\n for(int i=0; i<height.length; i++){\n //if(i+1==height.length && height[i-1]<height[i]){\n // peaks.add(i);\n if(i<height.length-1 && height[i]!=height[i+1]){\n peaks.add(i);\n }\n }\n List<Integer> remove = new ArrayList<>();\n //merge top\n for(int i=0; i<peaks.size(); i++){\n boolean left = false;\n boolean right = false;\n for(int j=0; j<i; j++){ //left\n if(height[peaks.get(j)]>height[peaks.get(i)]){\n left = true;\n }\n }\n for(int j=i+1; j<peaks.size(); j++){ //right\n if(height[peaks.get(j)]>height[peaks.get(i)]){\n right = true;\n }\n }\n if(left&&right){\n remove.add(peaks.get(i));\n }\n }\n System.out.println(Arrays.toString(remove.toArray()));\n peaks.removeAll(remove);\n System.out.println(\"=============\");\n System.out.println(Arrays.toString(peaks.toArray()));\n for(int i=0; i<peaks.size()-1; i++){\n Integer a = peaks.get(i);\n Integer b = peaks.get(i+1);\n int min = Math.min(height[a],height[b]);\n for(int j=a+1; j<b; j++){\n int df = min - height[j];\n if(df > 0 ){\n result += df;\n }\n }\n }\n return result;\n }", "public static void main(String[] args) throws Exception {\n Scanner s = new Scanner(System.in);\n int n1 = s.nextInt();\n int[] a1 = new int[n1];\n for(int i=0; i<a1.length; i++){\n a1[i] = s.nextInt();\n }\n\n int n2 = s.nextInt();\n int[] a2 = new int[n2];\n for(int i=0; i<a2.length; i++){\n a2[i] = s.nextInt();\n }\n\n int[] diff = new int[n2];\n int c =0;\n int i = a1.length-1;\n int j = a2.length-1;\n int k = diff.length-1;\n\n while(k>=0){\n int d =0;\n int a1Val = i>=0?a1[i]:0;\n\n if(a2[j]+c >= a1Val){\n d = a2[j]+c - a1Val;\n c=0;\n }\n else{\n d = a2[j]+c+10 - a1Val;\n c=-1;\n }\n diff[k] = d;\n i--; j--; k--;\n }\n // printing\n // excluding leading zeros\n int ind =0;\n while(ind<diff.length){\n if(diff[ind]==0){\n ind++;\n }\n else{\n break;\n }\n }\n // printing numbers after leading zeros\n while(ind<diff.length){\n System.out.println(diff[ind]);\n ind++;\n }\n }", "static int minimumDistances(int[] a) {\n int l = a.length;\n Map<Integer, List<Integer>> map = new HashMap<>();\n for (int i = 0; i <l ; i++) {\n List<Integer> val = map.get(a[i]);\n if(val == null){\n val = new ArrayList<>();\n }\n val.add(i);\n map.put(a[i], val);\n }\n int min = Integer.MAX_VALUE;\n for (List<Integer> value:\n map.values()) {\n int c = value.size();\n if(c>1){\n for (int i = 0; i < c-1 ; i++) {\n min = Math.min(min, value.get(i+1)- value.get(i));\n }\n }\n }\n if(min == Integer.MAX_VALUE) min = -1;\n return min;\n\n\n }", "public static int findMin(){\n int min = array[0];\n for(int x = 1; x<array.length; x++ ){\n if(array[x]<min){\n min=array[x];\n }\n }\n return min;\n}", "private static int distClosestNumbers(int[] numbers) {\n // try to implement it!\n if (numbers.length < 2) {\n return 0;\n }\n // O(n log(n))\n Arrays.sort(numbers);\n var preLastEl = numbers[numbers.length - 2];\n var lastEl = numbers[numbers.length - 1];\n return lastEl - preLastEl;\n }", "public T findLowest(){\n T lowest = array[0]; \n for (int i=0;i<array.length; i++)\n {\n if (array[i].doubleValue()<lowest.doubleValue())\n {\n lowest = array[i]; \n } \n }\n return lowest;\n }", "public ArrBag<T> difference( ArrBag<T> other )\n {\n // THIS ARRBAG WILL NEVER TRIGGER AN UPSIZE BECUASE YOU MADE IT JUST BIG ENOUGH FOR THE LARGEST POSSIBLE DIFF\n ArrBag<T> diffResult = new ArrBag<T>(this.size() + other.size());\n int differenceCount = 0;\n\n for(int i =0; i<this.size(); i++)\n {\n if(!other.contains(this.get(i)) && !diffResult.contains(this.get(i)))\n {\n diffResult.add(this.get(i));\n }\n // change the 0 to the right value for diff\n }\n return diffResult; \n }", "public static void main(String[] args) {\n\t\t\n\t\tint[] arr = {2, 3, 10, 6, 4, 8, 1};\n\t\tint[] arr2 = {7, 9, 5, 6, 3, 2};\n\t\t\n\t\tint maxDiff = maxDifference(arr2);\n\t\tSystem.out.println(\"Max Difference: \"+ maxDiff); \n\n\t}", "public int[] relativeSortArray(int[] arr1, int[] arr2) {\n int min = Integer.MAX_VALUE;\n int max = Integer.MIN_VALUE;\n\n int[] result = new int[arr1.length];\n\n for( int i : arr1 ) {\n if( min > i ) min = i;\n if( max < i ) max = i;\n }\n\n int[] counts = new int[max - min + 1];\n\n for( int i : arr1 ) {\n counts[i - min]++;\n }\n\n int index = 0;\n // loop thru the privilege array first\n for( int i: arr2 ) {\n while( counts[i - min] != 0 ) {\n result[index++] = i;\n counts[i - min]--;\n }\n }\n\n // ascending order for the rest\n for( int i = 0; i < counts.length; ++i ) {\n if( counts[i] != 0 ) {\n while( counts[i] != 0 ) {\n result[index++] = i + min;\n counts[i]--;\n }\n }\n }\n return result;\n }", "public int findMinDifference(List<String> timePoints) {\n timePoints.sort((t1, t2) -> {\n return t1.compareTo(t2);\n });\n\n int ans = Integer.MAX_VALUE;\n for (int i = timePoints.size() - 1; i > 0; i--) {\n String t1 = timePoints.get(i);\n String t2 = timePoints.get(i - 1);\n ans = Math.min(ans, calDiff(t1, t2));\n }\n\n // compare the first one and last one\n if (timePoints.size() > 1) {\n String t1 = timePoints.get(timePoints.size() - 1);\n int min1 = calMin(t1);\n String t2 = timePoints.get(0);\n int min2 = calMin(t2);\n int diff = (24 * 60 - min1) + min2;\n ans = Math.min(ans, diff);\n }\n\n return ans;\n }", "public int getMinDistanceArray(){\n int result = 0;\n double max_double = Double.MAX_VALUE;\n \n for (int i = 0; i < MinDistance.size(); i++){\n if (!MinDistanceStatus.get(i)){ //only checks for non final weights\n if (MinDistance.get(i) < max_double ){\n max_double = MinDistance.get(i);\n result = i;\n }\n }\n }\n \n return result;\n }", "public static double min(double[] array) { \r\n \r\n double minNum = array[0];\r\n for(int i = 0; i < array.length; i++) {\r\n if(minNum > array[i]) {\r\n minNum = array[i];\r\n }\r\n }\r\n return minNum;\r\n }", "public double[] getMin(){\n double[] min = new double[3];\n for (Triangle i : triangles) {\n double[] tempmin = i.minCor();\n min[0] = Math.min( min[0], tempmin[0]);\n min[1] = Math.min( min[1], tempmin[1]);\n min[2] = Math.min( min[2], tempmin[2]);\n }\n return min;\n }", "@Override\n // Compare values according to columns\n public int compare(final int[] entry1, final int[] entry2) {\n if (entry1[0] > entry2[0])\n return 1;\n else\n return -1;\n }", "static int findMin(double[] pq)\n\t{\n\t\tint ind = -1; \n\t\tfor (int i = 0; i < pq.length; ++i)\n\t\t\tif (pq[i] >= 0 && (ind == -1 || pq[i] < pq[ind]))\n\t\t\t\tind = i;\n\t\treturn ind;\n\t}", "private static int[] subtract(int xStart, int[] x, int yStart, int[] y)\n {\n int iT = x.length;\n int iV = y.length;\n long m;\n int borrow = 0;\n\n do\n {\n m = ((long)x[--iT] & IMASK) - ((long)y[--iV] & IMASK) + borrow;\n x[iT] = (int)m;\n\n// borrow = (m < 0) ? -1 : 0;\n borrow = (int)(m >> 63);\n }\n while (iV > yStart);\n\n if (borrow != 0)\n {\n while (--x[--iT] == -1)\n {\n }\n }\n\n return x;\n }", "public int minDistance(String word1, String word2) {\n char[] cs1 = word1.toCharArray();\n char[] cs2 = word2.toCharArray();\n int len1 = cs1.length;\n int len2 = cs2.length;\n // if (len1 * len2 == 0) {\n // return Math.max(len1, len2);\n // }\n int[][] min = new int[len1][len2];\n int m = Integer.MAX_VALUE;\n for (int i = 0; i < len1; i++) {\n for (int j = 0; j < len2; j++) {\n m = Integer.MAX_VALUE;\n m = Math.min(getMinDis(min, i, j - 1) + 1, m);\n m = Math.min(getMinDis(min, i - 1, j) + 1, m);\n m = Math.min(getMinDis(min, i - 1, j - 1)\n + (cs1[i] == cs2[j] ? 0 : 1), m);\n min[i][j] = m;\n }\n }\n return getMinDis(min, len1 - 1, len2 - 1);\n }", "private float positiveMeanDifference(float arr1[], int i1, float arr2[],\n\t\t\tint i2, int length) {\n\t\tfloat value = 0f;\n\t\tfor (int i = 0; i < length; i++) {\n\t\t\tif (arr1[i1 + i] > arr2[i2 + i])\n\t\t\t\tvalue += arr1[i1 + i] - arr2[i2 + i];\n\t\t}\n\t\treturn value / length;\n\t}", "public double getLeft(double min) {\n return min - this.size; \n }", "int arrayMaximalAdjacentDifference(int[] inputArray) {\n\n\t int maximum = Math.abs(inputArray[1]- inputArray[0]);\n\t int result = 0;\n\t for(int i =1; i<inputArray.length-1; i++){\n\t result =Math.abs(inputArray[i+1]- inputArray[i]);\n\t if(result>=maximum){\n\t maximum = result;\n\t }\n\t }\n\t \n\t return maximum;\n\t}", "public static void main(String[] args) {\n\t\tint a[]={2,1,9,5,11,4,6,7,5};\r\n\t\tint min1=a[1],min2=a[0];\r\n\t\tfor(int i=0;i<a.length; i++)\r\n\t\t{\r\n\t\t\tif(a[i]<min1)\r\n\t\t\t{\r\n\t\t\t\tmin2=min1;\r\n\t\t\t\tmin1=a[i];\r\n\t\t\t}\r\n\t\t\telse\r\n\t\t\t{\r\n\t\t\t\tif(a[i]<min2)\r\n\t\t\t\t{\r\n\t\t\t\t\tmin2=a[i];\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\tSystem.out.println(min2);\r\n\t\t\tSystem.out.println(min1);\r\n\t\t}", "public int getMinimumScore(){\n\n /*\n * creating variable of type int name it lowestScore go in to index 0 and sub 0\n * and lowestScore is refering to instance variable scores\n */\n int lowestScore = scores[0][0]; // assume this value is the smallest score value\n\n /* enhanced for loop with array of type int named gameScores and it will go trough scores array*/\n for (int[] gameScores : scores){\n\n /*\n * and another enhanced for loop inside first for loop\n * int variable, name score and it will iterate(go/repeat) through array gameScores\n *\n */\n for (int score : gameScores){\n if (score < lowestScore){\n lowestScore = score;\n }\n }\n }\n return lowestScore;\n }", "public int getMinimumValue() {\n/* 276 */ return -this.s.getMaximumValue();\n/* */ }", "public int minDistance(String word1, String word2) {\n if(word1==null||word1.length()==0){\n return word2==null?0:word2.length();\n }else if(word2==null||word2.length()==0){\n return word1.length();\n }else if(word1.equals(word2)){\n return 0;\n }\n char[] str1 = word1.toCharArray();\n char[] str2 = word2.toCharArray();\n int[] oldl = new int[str2.length+1];\n int[] newl = new int[str2.length+1];\n for(int i=0;i<=str2.length;i++){\n oldl[i]=i;\n }\n for(int i=1;i<=str1.length;i++){\n newl[0]=i;\n for(int j=1;j<=str2.length;j++){\n newl[j]=Math.min(oldl[j]+1,newl[j-1]+1);\n if(str1[i-1]!=str2[j-1]){\n newl[j]=Math.min(oldl[j-1]+1,newl[j]);\n }else{\n newl[j]=Math.min(oldl[j-1],newl[j]);\n }\n }\n for(int k=0;k<=str2.length;k++){\n oldl[k]=newl[k];\n }\n }\n return newl[str2.length];\n }", "static int minimumTime(int[] x) {\n Arrays.sort(x);\n int l = x.length;\n int s = 0;\n int n = l - 1;\n for (int i = 0; i < n; ++i) {\n s += x[i + 1] - x[i];\n }\n return s;\n }", "int getMin() \n\t{ \n\t\tint x = min.pop(); \n\t\tmin.push(x); \n\t\treturn x; \n\t}", "private static int leftBump(int[] a) {\n for (int i = 2; i <= a.length; i++) {\n if (a[i] < a[i - 1]) {\n return i - 1;\n }\n }\n return -1;\n }", "private static int getMissingNum(int[] nums) {\n int diff1 = Integer.MAX_VALUE;\n int diff2 = Integer.MAX_VALUE;\n int diff1Count = 0;\n int diff2Count = 0;\n int firstDiff1Value = Integer.MAX_VALUE;\n int firstDiff2Value = Integer.MAX_VALUE;\n for (int i = 1; i < nums.length; i++) {\n int diff = nums[i] - nums[i - 1];\n if (diff1Count + diff2Count > 2) {\n\n } else if (diff1Count == 0 || diff == diff1) {\n if (diff1Count == 0) { firstDiff1Value = nums[i -1]; }\n diff1Count++;\n diff1 = diff;\n } else if (diff2Count == 0 || diff == diff2) {\n if (diff2Count == 0) { firstDiff2Value = nums[i -1]; }\n diff2Count++;\n diff2 = diff;\n }\n }\n boolean isDiff1Larger = diff1Count > diff2Count;\n if (isDiff1Larger) {\n return firstDiff2Value + diff1;\n } else {\n return firstDiff1Value + diff2;\n }\n }", "public static double diff() {\n System.out.println(\"Enter minuend\");\n double a = getNumber();\n System.out.println(\"Enter subtrahend\");\n double b = getNumber();\n\n return a - b;\n }", "static int findMinDiff(int arr[], int n, int m) {\n\t\tif (m == 0 || n == 0)\r\n\t\t\treturn 0;\r\n\r\n\t\t// Sort the given packets\r\n\t\tArrays.sort(arr);\r\n\r\n\t\t// Number of students cannot be more than\r\n\t\t// number of packets\r\n\t\tif (n < m)\r\n\t\t\treturn -1;\r\n\r\n\t\t// Largest number of chocolates\r\n\t\tint min_diff = Integer.MAX_VALUE;\r\n\r\n\t\t// Find the subarray of size m such that\r\n\t\t// difference between last (maximum in case\r\n\t\t// of sorted) and first (minimum in case of\r\n\t\t// sorted) elements of subarray is minimum.\r\n\t\tint first = 0, last = 0;\r\n\t\tfor (int i = 0; i + m - 1 < n; i++) {\r\n\t\t\tint diff = arr[i + m - 1] - arr[i];\r\n\t\t\tif (diff < min_diff) {\r\n\t\t\t\tmin_diff = diff;\r\n\t\t\t\tfirst = i;\r\n\t\t\t\tlast = i + m - 1;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn (arr[last] - arr[first]);\r\n\t}", "public static int relativeSort(int[] arr1, int[] arr2) {\n int i = 0;\n\n int[] swap = new int[arr1.length + 1];\n int[] noSwap = new int[arr1.length + 1];\n swap[0] = 1;\n noSwap[0] = 0;\n\n int res = 0;\n while (i < arr1.length - 1) {\n if ( Math.max(arr1[i], arr2[i]) <= Math.max(arr1[i + 1], arr2[i + 1])\n || Math.min(arr1[i], arr2[i]) <= Math.min(arr1[i + 1], arr2[i + 1])) {\n return -1;\n }\n\n if (arr1[i] < arr1[i + 1]) {\n res++;\n swap(arr1, arr2, i + 1);\n }\n i++;\n }\n return Math.min(res, arr1.length - res);\n }", "public double getDifference()\n {\n return first - second;\n }", "private double getLowest()\n {\n if (currentSize == 0)\n {\n return 0;\n }\n else\n {\n double lowest = scores[0];\n for (int i = 1; i < currentSize; i++)\n {\n if (scores[i] < lowest)\n {\n scores[i] = lowest;\n }\n }\n return lowest;\n }\n }", "private int getMin(int[] times) {\n\n\t\t//Initially set min to the first value\n\t\tint min = times[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//Set the minimum\n\t\t\tif (times[i]<min) {\n\n\t\t\t\tmin = times[i];\n\t\t\t}\n\t\t}\n\n\t\treturn min;\n\t}", "public double min() {\n double resultat = Double.MAX_VALUE;\n double tmp = 0;\n for (int i = 0; i < tab.size(); i++) {\n tmp = CalculatorArray.min(tab.get(i));\n if (tmp < resultat) {\n resultat = tmp;\n }\n }\n\n System.out.println(\"Min colonne:\" + resultat);\n return resultat;\n }", "private static void min(int[] a) {\n int min = a[0];\n for(int i=1; i<a.length; i++){\n if(min > a[i]){\n min = a[i];\n }\n }\n System.out.println(\"Min\" + min);\n\n }", "@Override\r\n\t\tpublic int compare(final CellData o1, final CellData o2) {\r\n\t\t\treturn o1.getX() - o2.getX();\r\n\t\t}", "public static void main(String[] args) {\n\t\tint[] array = {3,4,5,1,2};\n\t\tint[] array1 = {1,1, 1, 1 ,1 ,1,1};\n\t\tint[] array2 = {};\n\t\tSystem.out.println(minNumberInRotateArray(array));\n\t\tSystem.out.println(minNumberInRotateArray(array1));\n\t\tSystem.out.println(minNumberInRotateArray(array2));\n\n\t}" ]
[ "0.72184116", "0.6863406", "0.6818696", "0.68087506", "0.6760237", "0.6636966", "0.65739524", "0.64859587", "0.6470515", "0.6467224", "0.6467047", "0.6441139", "0.6439312", "0.6420027", "0.6419708", "0.64089847", "0.64071757", "0.63635814", "0.63020265", "0.63001835", "0.62820214", "0.6281347", "0.62468135", "0.6194996", "0.61855847", "0.6175778", "0.6146994", "0.61248595", "0.6124583", "0.6101463", "0.6095593", "0.6094762", "0.60839844", "0.60635257", "0.6061494", "0.6045664", "0.6044421", "0.6032878", "0.6029906", "0.60285074", "0.6012282", "0.60015666", "0.5994375", "0.59849966", "0.59543127", "0.5947325", "0.5939491", "0.5939286", "0.5938466", "0.5936718", "0.5935081", "0.5933404", "0.5930181", "0.59215736", "0.5916555", "0.5901769", "0.5896167", "0.58925754", "0.5869605", "0.586109", "0.5856035", "0.58558273", "0.5843737", "0.5841135", "0.583889", "0.58385134", "0.5837247", "0.58353597", "0.58333194", "0.58323824", "0.58277136", "0.58194625", "0.5804699", "0.57973224", "0.577836", "0.57590556", "0.575502", "0.57495457", "0.57423836", "0.5736768", "0.5735618", "0.5717774", "0.57144797", "0.57109976", "0.5705417", "0.5702007", "0.56997603", "0.5699064", "0.5698177", "0.5691412", "0.56769234", "0.5676632", "0.56704575", "0.56632495", "0.56621945", "0.5661843", "0.5661144", "0.5659451", "0.56572866", "0.5656349" ]
0.7821728
0
User can write a message on a text input User can send the message he or she has written to the server by pressing submit User can send the message he or she has written to the server by pressing enter
@Test public void UserCanWriteAndSendAMessage() { proLogin(proWait); handler.getDriver("user").navigate().refresh(); // User to queue waitAndFillInformation(userWait); // User from queue waitAndPickFromQueue(proWait); // User can write message waitChatWindowsAppear(userWait).sendKeys("yy kaa koo"); // Can send it By Pressing Submit waitElementPresent(userWait, By.name("send")).submit(); assertEquals("", waitChatWindowsAppear(userWait).getText()); assertTrue(waitForTextToAppear(userWait, "yy kaa koo")); // Can send it By Pressing Enter waitChatWindowsAppear(userWait).sendKeys("kaa koo yy"); waitChatWindowsAppear(userWait).sendKeys(Keys.ENTER); assertEquals("", waitChatWindowsAppear(userWait).getText()); assertTrue(waitForTextToAppear(userWait, "kaa koo yy")); endConversationPro(proWait); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void actionPerformed(ActionEvent e) {\n\n if (inputField.getText().trim().length() == 0) {\n return;\n }\n try {\n\n String input = inputField.getText();\n \n inputField.setText(\"\");\n clientMessage = new Message(getName(), Message.ALL, input, Message.DATA);\n clientMessage.setID(manager.getNextMessageID());\n //JOptionPane.showMessageDialog(null, input);\n //JOptionPane.showMessageDialog(null, clientMessage.getContent());\n sendMessage(clientMessage);\n\n } catch (IOException err) {\n System.err.println(err.getMessage());\n err.printStackTrace();\n }\n }", "public void sendMessage() {\n String userMessage = textMessage.getText();\n if (!userMessage.isBlank()) {//проверяю а есть ли что то в текстовом поле\n textMessage.clear();//очищаю текстовое поле на форме\n\n //пока оставлю\n //sb.append(userMessage).append(\"\\n\");\n\n //в общее поле добавляю сообщение\n areaMessage.appendText(userMessage+\"\\n\");\n }\n\n }", "@Override\r\n public void keyReleased(KeyEvent e) {\n if(e.getKeyCode()==10){ //enter key code is 10\r\n // System.out.println(\"you have pressed enter button\");\r\n String contentToSend=messageInput.getText(); //type kia hua msg nikalna\r\n messageArea.append(\"Me :\"+contentToSend+\"\\n\");\r\n out.println(contentToSend); //msg ko send krna\r\n out.flush();\r\n messageInput.setText(\"\"); //clear hoker isme text ho jayga\r\n messageInput.requestFocus();\r\n }\r\n \r\n }", "public void handleSendBtn(ActionEvent actionEvent) throws IOException {\n Socket socket = ConnSocket.getInstance();\n InputStream inputStream = socket.getInputStream();\n OutputStream outputStream = socket.getOutputStream();\n Scanner in = new Scanner(inputStream);\n PrintWriter out = new PrintWriter(outputStream, true);\n //String [] userInfo = {textField.getText(), nameLabel.getText()};\n out.println(textField.getText());\n\n }", "@Override\n\tpublic void keyPressed(KeyEvent e) {\n\t\tif(e.getKeyCode()==KeyEvent.VK_ENTER)\n\t\t{\n\t\t\t\n\t\t\tString info=\"服务器 对 客户端说: \"+jtf.getText();\n\t\t\tif(jtf.getText().equals(\"\"))\n\t\t\t{\n\t\t\t\tJOptionPane.showMessageDialog(this, \"对不起,发送的内容不能为空...\");\n\t\t\t}else\n\t\t\t{\n\t\t\t\tjta.append(info+\"\\r\\n\");\n\t\t\t\tjta.setCaretPosition(jta.getText().length());\n\t\t\t\tif(jtf.getText().equals(\"bye\"))\n\t\t\t\t{\n\t\t\t\t\tinfo=new String(\"bye\");\n\t\t\t\t}\n\t\t\t\tjtf.setText(\"\");\n\t\t\t\tif(info.equals(\"bye\"))\n\t\t\t\t{\n\t\t\t\t\tint response=JOptionPane.showConfirmDialog(this,\"您确定要强行关闭客户端和服务器吗?\");\n\t\t\t\t\tif(response==0)\n\t\t\t\t\t{\n\t\t\t\t\t\tms.SendMessage(info);\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\tms.SendMessage(info);\n\t\t\t\t}\n\t\t\t\t\n\t\t\t}\n\t\t\t\n\t\t}\n\t}", "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}", "@Override\n\tpublic void actionPerformed(ActionEvent e) {\n\t\tif(e.getSource()==sendButton){\n\t\t\tif(!inputField.getText().trim().isEmpty()){\n\t\t\t\ttry{\n\t\t\t\t\tclient.sendRequest(inputField.getText().trim());\n\t\t\t\t}catch(Exception ee){\n\t\t\t\t\tee.printStackTrace();\n\t\t\t\t}\n\t\t\t\toutputArea.append(client.getResponse()+\"\\n\");\n\t\t\t}\n\t\t\telse{\n\t\t\t\tJOptionPane.showConfirmDialog(this, \"输入不能为空!\");\n\t\t\t}\n\t\t}\n\t\telse{\n\t\t\tinputField.setText(\"\");\n\t\t\toutputArea.setText(\"\");\n\t\t}\n\t}", "@Override\r\n public boolean onSubmit(CharSequence input) {\r\n\r\n //make a message\r\n long systemNenoTime = System.nanoTime();\r\n\r\n _Message message = new _Message(\r\n systemNenoTime + \"::\" + socketManager.getSocketID(), //just make incremental,\r\n // need for chat kit only (No need socket id ref, in this project, but may be future)\r\n systemNenoTime, // this will need for me as primary key, because chatkit abnormally demand ID as String\r\n //but i need long for realm operation\r\n me.getRoomName(), //pass 1-1 unique room name\r\n me, //responsible person is me for this message\r\n input.toString(), //text of message\r\n new Date());\r\n\r\n //check is user valid and ready to broadcast his message\r\n if (socketManager.isUserValid()) {\r\n\r\n //save new submitted message to realm\r\n saveOrUpdateNewMessageRealm(message);\r\n\r\n //emit submitted messages to socket IO for broadcast in current room\r\n socketManager.performEmit(\"newMessage\", message);\r\n\r\n runOnUiThread(() -> {\r\n //submitted message should be view immediately\r\n messagesAdapter.addToStart(message, true);\r\n\r\n //update last chat incremental id\r\n lastMessageIncrementalID = message.getIncrementalID();\r\n });\r\n\r\n\r\n //know the adapter submission has completed\r\n return true;\r\n\r\n } else {\r\n\r\n Toast.makeText(ChatMessageActivity.this, \"Please wait until valid connection confirmed. \" +\r\n \"Try again after sometime! In real project there should be a progress bar.\", Toast.LENGTH_LONG).show();\r\n\r\n //alas adapter will omit submission\r\n return false;\r\n\r\n }\r\n\r\n }", "private void sendTextInBox() {\n\t\tmodelAdapter.send(textFieldMessage.getText());\n\t textFieldMessage.setText(\"\");\n\t }", "@FXML\n private void sendMessage(ActionEvent actionEvent) {\n String playerName = RiskMain.getInstance().getDomain().getPlayerName();\n System.out.println(messageInput.getText());\n String text = playerName + \": \" + messageInput.getText();\n if (RiskMain.getInstance().getDomain().isServer()) {\n this.serverInterface = RiskMain.getInstance().getDomain().getServer();\n this.serverInterface\n .sendMessageChat(RiskMain.getInstance().getDomain().getPlayerName(),\n messageInput.getText(), recipientList.getValue());\n } else {\n this.clientPlayerInterface = RiskMain.getInstance().getDomain().getClient();\n this.clientPlayerInterface.sendMessageChat(RiskMain.getInstance().getDomain().getPlayerName(),\n messageInput.getText(), recipientList.getValue());\n }\n }", "private void sendMessage(String message) {\n\t\tMainstarter.meClient.sendMessage(new MessageSend(message, Mainstarter.meClient));\n\t\ttextInputMessage.clear();\n\t}", "private void sendMessage() {\n Log.d(\"FlashChat\", \"I sent something\");\n // get the message the user typed\n String userInput = mInputText.getText().toString();\n\n if (! (userInput.length() == 0)){\n\n InstantMessage message = new InstantMessage(userInput, mUserMe);\n // push the message to Firebase DB\n mDatabaseReference.child(mLocation).push().setValue(message);\n mInputText.setText(\"\");\n }\n\n }", "private void sendMessage()\n\t{\n\t\tfinal String message = messageTextArea.getText(); \n\t\tif(message.length() == 0)\n\t\t{\n\t\t\treturn;\n\t\t}\n\t\tmessageTextArea.setText(\"\");\n\t\ttry\n\t\t{\n\t\t\teventsBlockingQueue.put(new MessageEvent(message));\n\t\t}\n\t\tcatch (final InterruptedException e1)\n\t\t{\n\t\t}\n\t}", "public void createMessage()\n {\n System.out.println( user + \", type the message you want to send:\" );\n String userInput = sysin.nextLine();\n if( userInput.length() <= MAXLEN )\n msg = userInput;\n else\n msg = userInput.substring( 0, MAXLEN );\n\n }", "@Override\n public void actionPerformed(ActionEvent e) {\n client.sendMessage(new QuestionAnsweredMessage(answerField.getText()));\n //mainGUI.showMainPanel();\n }", "public void actionPerformed(ActionEvent e) {\n\t\t\t\tclient.sendMessage(txtUserInput.getText().trim());\r\n\t\t\t\ttxtUserInput.setText(\"\");\r\n\t\t\t}", "@SuppressWarnings({ \"rawtypes\", \"unchecked\" })\n\t@NiftyEventSubscriber(id = \"chatText\")\n\tpublic void submitChatText(String id, NiftyInputEvent event){\n\t\tTextField tf = nifty.getScreen(\"hud\").findNiftyControl(\"chatText\",TextField.class);\n\t\tListBox lb = nifty.getScreen(\"hud\").findNiftyControl(\"listBoxChat\",ListBox.class);\n\t\tif (NiftyInputEvent.SubmitText.equals(event)) {\n\t\t\tString sendText = tf.getDisplayedText();\n\t\t\tif (sendText.length() == 0){\n\t\t\t\tnifty.getScreen(\"hud\").getFocusHandler().resetFocusElements();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\ttf.setText(\"\");\n\t\t\tif(observers.size()== 0){\n\t\t\t\tlb.addItem(sendText);\n\t\t\t}\n\t\t\tfor (GUIObserver g : observers) {\n\t\t\t\tg.onChatMessage(sendText);\n\t\t\t}\n\t\t\tnifty.getScreen(\"hud\").getFocusHandler().resetFocusElements();\n\t\t\tlb.showItem(lb.getItems().get(lb.getItems().size()-1));\n\t\t}\n\t}", "private void sendMessage(JTextField text){\n \t\tString message = text.getText();\n \t\tfor(int i = 0; i < listeners.size(); i++)\n \t\t{\n \t\t\tboolean b = listeners.get(i).sendMessage(userName, message);\n \t\t\tif(b == false)\n \t\t\t\tSystem.out.println(\"Error, could not send\");\n \t\t}\n \t\t\n \t\ttext.setText(\"\");\n \t}", "@Override\n\tpublic void keyReleased(KeyEvent e) {\n\t\tif (e.getKeyCode() == KeyEvent.VK_ENTER && !inputText.getText().isEmpty()) {\n\t\t\tmsgLabel[9].setForeground(myFontColor);\n\t\t\tcommunication(myName + \": \" + inputText.getText());\n\t\t\tC.send(\"Message\", inputText.getText());\n\t\t\tinputText.setText(\"\");\n\t\t}\n\t}", "private void txtMessageKeyReleased(java.awt.event.KeyEvent evt) {\n if (evt.getKeyCode() == KeyEvent.VK_ENTER) {\n if (!txtMessage.getText().isEmpty()) {\n String msg = txtMessage.getText();\n JLabel userchat = new JLabel();\n userchat.setText(\"Tôi: \" + msg);\n userchat.setForeground(Color.red);\n panelChat.add(userchat);\n txtMessage.setText(\"\");\n revalidate();\n\n client.send(new Message(\"privatechat\", user, msg, target));\n //cái này cái cũ nè\n// StyledDocument doc = txtMessageInfo.getStyledDocument();\n// SimpleAttributeSet right = new SimpleAttributeSet();\n// StyleConstants.setAlignment(right, StyleConstants.ALIGN_RIGHT);\n// Style style = txtMessageInfo.addStyle(null, null);\n// StyleConstants.setForeground(style, Color.red);\n// try {\n// String message = msg + \"\\n\";\n// int lenght = doc.getLength();\n// doc.insertString(lenght, message, style);\n// doc.setParagraphAttributes(lenght + 1, 1, right, false);\n// client.send(new Message(\"privatechat\", user, msg, target));\n// txtMessage.setText(\"\");\n// } catch (Exception e) {\n//\n// }\n }\n// if(!txtMessage.getText().isEmpty())\n// {\n// String msg = txtMessage.getText();\n// StyledDocument doc = txtMessageInfo.getStyledDocument();\n// SimpleAttributeSet right = new SimpleAttributeSet();\n// StyleConstants.setAlignment(right, StyleConstants.ALIGN_RIGHT);\n// Style style = txtMessageInfo.addStyle(null, null);\n// StyleConstants.setForeground(style, Color.MAGENTA);\n// String message = msg +\"\\n\";\n// int length = doc.getLength();\n// try {\n// doc.insertString(length, message, style);\n// doc.setParagraphAttributes(length+1, 1, right, false);\n// txtMessage.setText(\"\");\n// client.send(new Message(\"privatechat\", user, msg , target));\n//\n// } catch (BadLocationException ex) {\n// Logger.getLogger(PrivateChatFrame.class.getName()).log(Level.SEVERE, null, ex);\n// JOptionPane.showMessageDialog(rootPane, \"Loi: \"+ ex.toString());\n// }\n// \n//\n// }\n }\n }", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tString text = getCurUser() + \" : \" + textField.getText();\n\t\t\t\ttextField.setText(\"\");\n\t\t\t\tfinal ChatMessage msg = new ChatMessage();\n\t\t\t\tmsg.setMessage(text);\n\t\t\t\tmainFrame.sendMessage(msg);\n\t\t\t\t\n\t\t\t}", "@FXML\n\tprivate void enterPressedChat(ActionEvent event) throws InterruptedException {\n\t\tString message = chatBox.getText();\n\t\tif (botCheckBox.isSelected()){\n\t\t\tAnswers sassiAnswer = new Answers();\n\t\t\tif (message.toLowerCase().contains(\"why\")){\n\t\t\t\tappend(message, client.username);\n\t\t\t\tappend(sassiAnswer.getWhy(), \"SASSIBOT\");\n\t\t\t}\n\t\t\telse if (message.toLowerCase().contains(\"how\")){\n\t\t\t\tappend(message, client.username);\n\t\t\t\tappend(sassiAnswer.getHow(), \"SASSIBOT\");\n\t\t\t}\n\t\t\telse if (message.toLowerCase().contains(\"what\")){\n\t\t\t\tappend(message, client.username);\n\t\t\t\tappend(sassiAnswer.getWhat(), \"SASSIBOT\");\n\t\t\t}\n else if (message.toLowerCase().contains(\"where\")){\n\t\t\t\tappend(message, client.username);\n\t\t\t\tappend(sassiAnswer.getWhere(), \"SASSIBOT\");\n\t\t\t}\n else if (message.toLowerCase().contains(\"who\")){\n\t\t\t\tappend(message, client.username);\n\t\t\t\tappend(sassiAnswer.getWho(), \"SASSIBOT\");\n\t\t\t}\n\t\t\telse {\n\t\t\t\tappend(message, client.username);\n\t\t\t\tappend(sassiAnswer.getOther(), \"SASSIBOT\");\n\t\t\t}\n\t\t} else {\n\t\t\tString catchPhrase = \"@task \";\n\t\t\tif (message.contains(catchPhrase)) {\n\t\t\t\tString task = message.replace(\"@task \", \"\");\n\t\t\t\tString task_split[] = task.split(\" \", 2);\n\t\t\t\ttaskList.getItems().add(\"@\" + task_split[0] + \": \" + task_split[1] + \"\\n\");\n\t\t\t\tchatBox.setText(\"\");\n\t\t\t\tclient.sendTaskToGroup(task_split[1], task_split[0]);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tclient.sendMessageToGroup(message);\n\t\t\t\tappend(chatBox.getText(), client.username);\n\t\t\t}\n\n\t\t\tchatBox.setText(\"\");\n\n\t\t}\n\t}", "private void sendNameToServer() {\n\n\t\tString textToServer = nameField.getText();\n\n\t\t// Then, we send the input to the server.\n\n\t\tgreetingService.greetServer(nameField.getValue(),\n\t\t\t\tnew AsyncCallback<String>() {\n\t\t\t\t\tpublic void onFailure(Throwable caught) {\n\t\t\t\t\t\tresultField.setValue(caught.getMessage());\n\n\t\t\t\t\t}\n\n\t\t\t\t\tpublic void onSuccess(String result) {\n\t\t\t\t\t\tresultField.setValue(result);\n\t\t\t\t\t}\n\t\t\t\t});\n\t}", "public void actionPerformed(ActionEvent e) \n //if connect button is clicked\n {if (e.getSource() == connect) {\n connect(); // for ActionListener\n return;}\n \n //if user did not enter data\n data = tf.getText();\n if (data == null || data.trim().length() == 0) { \n \t// if the text field is empty\n JOptionPane.showMessageDialog(null, \"Enter data to send\"); \n data = null;\n return; }\n \n //send data to server\n try {\n if (data != null) { // if the text is not empty\n output.write(data + \"\\n\");// write it into socket server\n output.flush();} //close\n \t} \t \n catch (IOException ioe) {\n display(\"Sending error: \" + ioe.getMessage());} \n }", "private void userMessageEvent(){\n message = UI.getMessage(); //Get object\r\n message.addKeyListener(new KeyListener() {\r\n @Override\r\n public void keyTyped(KeyEvent e) {}\r\n\r\n @Override\r\n public void keyPressed(KeyEvent e) {\r\n if(e.getKeyCode() == KeyEvent.VK_ENTER){ //Check if enter button is pressed\r\n if(!UI.getMessage().getText().equalsIgnoreCase(\"\")){ //If the message is not empty\r\n for (UserLogic t : threads) { //Go through users\r\n if(((String)UI.getContacts().getSelectedValue()).equals(groupChat)) { //If the chat is a group chat\r\n groupChatSend(t);\r\n }\r\n else { //Current User\r\n individualSend(t);\r\n }\r\n }\r\n UI.getMessage().setText(\"\"); //Clear message\r\n }\r\n }\r\n }\r\n\r\n @Override\r\n public void keyReleased(KeyEvent e) {}\r\n });\r\n }", "private void sendMessage(String message){\n\t\ttry{\n\t\t\toutput.writeObject(\"Punk Ass Server: \" + message);\n\t\t\toutput.flush();\n\t\t\tshowMessage(\"\\nPunk Ass Server: \" + message); \n\t\t}catch(IOException ioe){\n\t\t\tchatWindow.append(\"\\n Message not sent, try again or typing something else\");\n\t\t\t\n\t\t}\n\t\t\n\t}", "public void actionPerformed(ActionEvent e) {\n\t\t\t\tclient.sendMessage(txtUserInput.getText().trim()+\".\");\r\n\t\t\t\ttxtUserInput.setText(\"\");\r\n\t\t\t}", "@Override\r\n\tpublic void actionPerformed(ActionEvent e)\r\n\t{\r\n\t\t\r\n\r\n\t\t// Get input from GUI window\r\n\t\tString input = m_GUI.getInput();\r\n\r\n\t\tif (input.isEmpty())\r\n\t\t\treturn;\r\n\r\n\t\tString message = new String();\r\n\r\n\t\tif (input.startsWith(\"/\"))\r\n\t\t{\r\n\t\t\t// Input is a command\r\n\t\t\tString command = new String(input.split(\" \")[0].trim().toLowerCase());\r\n\r\n\t\t\tswitch (command)\r\n\t\t\t{\r\n\t\t\tcase \"/connect\":\r\n\t\t\tcase \"/c\":\r\n\t\t\t\tString hostname = input.split(\" \")[1];\r\n\t\t\t\ttry\r\n\t\t\t\t{\r\n\t\t\t\t\tm_connection.connect(hostname);\r\n\t\t\t\t} catch (IOException e1)\r\n\t\t\t\t{\r\n\t\t\t\t\tSystem.err.println(\"Error: IO exception when conencting to server\");\r\n\t\t\t\t\te1.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase \"/disconnect\":\r\n\t\t\tcase \"/dc\":\r\n\t\t\t\tm_connection.disconnect();\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase \"/whisper\":\r\n\t\t\tcase \"/w\":\r\n\t\t\t\tString recepient = input.split(\" \")[1];\r\n\t\t\t\tmessage = input.split(\" \", 3)[2];\r\n\t\t\t\tm_connection.whisper(recepient, message);\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase \"/list\":\r\n\t\t\tcase \"/l\":\r\n\t\t\t\tm_connection.list();\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tdefault:\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t} else\r\n\t\t{\r\n\t\t\t// Type is broadcast\r\n\t\t\tmessage = input;\r\n\t\t\tm_connection.broadcast(message);\r\n\t\t}\r\n\t\tm_GUI.clearInput();\r\n\t}", "private void run() throws IOException\r\n {\r\n\r\n // Make connection and initialize streams\r\n String serverAddress = getServerAddress();\r\n Socket socket = new Socket(serverAddress, 9001);\r\n in = new BufferedReader(new InputStreamReader(socket.getInputStream()));\r\n out = new PrintWriter(socket.getOutputStream(), true);\r\n\r\n // Process all messages from server, according to the protocol.\r\n while (true) {\r\n String line = in.readLine();\r\n if (line.startsWith(\"SUBMITNAME\")) {\r\n out.println(getName());\r\n } else if (line.startsWith(\"NAMEACCEPTED\")) {\r\n textField.setEditable(true);\r\n } else if (line.startsWith(\"MESSAGE\")) {\r\n messageArea.append(line.substring(8) + \"\\n\");\r\n }\r\n }\r\n }", "public void actionPerformed(ActionEvent e) {\n try {\r\n if (roomOrUser == 1) {\r\n // send message to a room\r\n sock.executeCommand(new RoomMessageCommand(new LongInteger(name), textArea_1.getText()\r\n .getBytes()));\r\n textArea_2.setText(textArea_2.getText() + textField.getText() + \": \" + textArea_1.getText()\r\n + \"\\n\");\r\n } else if (roomOrUser == 2) {\r\n // send message to a user\r\n sock.executeCommand(new UserMessageCommand(new LongInteger(name), textArea_1.getText()\r\n .getBytes(), true));\r\n textArea_2.setText(textArea_2.getText() + textField.getText() + \": \" + textArea_1.getText()\r\n + \"\\n\");\r\n }\r\n } catch (InvalidCommandException ex) {\r\n JOptionPane.showMessageDialog(null, \"Unable to join or leave room.\", \"alert\",\r\n JOptionPane.ERROR_MESSAGE);\r\n }\r\n }", "public void onClick(ClickEvent event) {\n\t\t\t\tString msgtxt = view.getCreateMessageText().getText().trim();\n\n\t\t\t\t// 2. Lock input, show sending indicator: goto 3\n\t\t\t\tview.lockCreateMessageInput();\n\n\t\t\t\t// 3. Validate input: valid ? goto 4 : goto e1\n\t\t\t\tif(msgtxt.isEmpty()) {\n\t\t\t\t\t// TODO: Show warning message: goto 6\n\n\t\t\t\t\t// 6. Unlock input, remove sending indicator, set focus to inputText: goto 1\n\t\t\t\t\tview.unlockCreatemessageInput();\n\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tMessage msg = new MessageImpl();\n\t\t\t\tmsg.setText(msgtxt);\n\t\t\t\tservice.createMessage(msg, new AsyncCallback<Void>() {\t\t\t\t\t\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onSuccess(Void result) {\n\t\t\t\t\t\tGWT.log(\"INFO: Message saved succesfully.\");\n\n\t\t\t\t\t\t// 5. Clear input: goto 6\n\t\t\t\t\t\tview.getCreateMessageText().setText(\"\");\n\n\t\t\t\t\t\t// 6. Unlock input, remove sending indicator, set focus to inputText: goto 1\n\t\t\t\t\t\tview.unlockCreatemessageInput();\t\t\t\t\t\n\t\t\t\t\t}\t\t\t\t\n\n\t\t\t\t\t@Override\n\t\t\t\t\tpublic void onFailure(Throwable caught) {\n\t\t\t\t\t\tGWT.log(caught.getMessage());\n\n\t\t\t\t\t\t// TODO: Show error message: goto 6\n\n\t\t\t\t\t\t// 6. Unlock input, remove sending indicator, set focus to inputText: goto 1\n\t\t\t\t\t\tview.unlockCreatemessageInput();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}", "@Override\r\n\tpublic void actionPerformed(ActionEvent e) {\n\t\tif (e.getSource() == jb)// 发送消息\r\n\t\t{\r\n\t\t\tMessage m = new Message();\r\n\t\t\tm.setMesType(\"20\");// MessageType.message_comm_mes\r\n\t\t\tm.setSender(this.ownerId);\r\n\t\t\tm.setGetter(\"\");\r\n\t\t\tm.setCon(jtf.getText());\r\n\t\t\tthis.jta.append(\"我说:\" + jtf.getText() + \"\\r\\n\");\r\n\t\t\ttry {\r\n\t\t\t\tObjectOutputStream oos = new ObjectOutputStream(\r\n\t\t\t\t\t\tManageClientConServerThread\r\n\t\t\t\t\t\t\t\t.getClientConServerThread(ownerId).getS()\r\n\t\t\t\t\t\t\t\t.getOutputStream());\r\n\t\t\t\toos.writeObject(m);\r\n\t\t\t} catch (Exception e1) {\r\n\t\t\t\te1.printStackTrace();\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\t}", "private void sendMessage() throws Exception {\n\t\tGetTimestamp(\"Sending Message: \");\n\t\tString inputMessage;\n\t\tinputMessage = input.nextLine();\n\t\tString tosend = encrypt(clientkey, inputMessage);\n\t\t\n\t\tJSONObject RESPONSE = new JSONObject();\n\t\tRESPONSE.put(\"payload\",tosend);\n\t\tSystem.out.println(RESPONSE);\n\t\t\n\t\tpw.println(tosend);\n\t\tpw.flush();\n\t\tSystem.out.println(\"Message sent to the client : \" + inputMessage);\n\t\tif (inputMessage.equalsIgnoreCase(\"bye\")) {\n\t\t\tSystem.out.println(\"sending close command\");\n\t\t\tcloseConnection();\n\t\t} else {\n\t\t\tgetMessage();\n\t\t}\n\t}", "@Override\n public void handle(KeyEvent keyEvent) {\n if(keyEvent.getCode() == KeyCode.ENTER){\n ChatPane2 chatPanel=mainMenuGUI.getChatPane();\n Message mess=new Message(mainMenuGUI.getFacade().getClientAccount(),\n null,chatPanel.getChatMessage());\n mess.setStatus(MessageStatus.broadcast);\n chatPanel.addChatMessage(mainMenuGUI.getFacade().getUsername(),chatPanel.getChatMessage());\n com.write(mess);\n }\n }", "@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 }", "@Override\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tif(chat_field.getText().equals(\"\")) {\n\t\t\t\t\tJOptionPane.showMessageDialog(null, \"채팅을 입력해주세요.\", \"warning\",JOptionPane.WARNING_MESSAGE);\n\t\t\t\t}\n\t\t\t\tchat_area.append(\"[\" + id + \"]\" + chat_field.getText() + \"\\n\");\n\t\t\t\twt.sendMsg();\n\t\t\t\tchat_field.setText(\"\");\n\t\t\t}", "@Override\n\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\ttry {\n\t\t\t\ttextfield.setEditable(false);\n\t\t\t\tconnectButton.setEnabled(false); // username can be sent only once\n\t\t\t\tclient.sendUsername(textfield.getText()); //sends the username to the server\n\t\t\t}catch(Exception a){\n\t\t\t\ta.printStackTrace();\n\t\t\t}\n\t\t}", "public String onInputMessage(String userInput) throws QuitException{\n if (!userInput.equals(\"\"))\n System.out.println(userInput);\n\n //Enter data using BufferReader \n BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); \n \n // Reading data using readLine\n String input; \n try {\n input = reader.readLine();\n } catch (IOException e) {\n return null;\n }\n if (input.equals(\"sortir\"))\n throw new QuitException();\n\n // Printing the read line \n return input;\n }", "@Override\n public boolean onSubmit(CharSequence input) {\n Author author =new Author();\n author.setId(\"2\");\n author.setName(\"Jubril\");\n Message message=new Message();\n message.setCreatedAt(new Date());\n message.setId(\"1\");\n message.setText(input.toString());\n message.setAuthor(author);\n adapter.addToStart(message, true);\n return true;\n }", "public void actionPerformed(ActionEvent e) {\n\t\t\t\ttry{\n\t\t\t\t\tString query =\"insert into message (username, msg) values (?,?)\";\n\t\t\t\t\tPreparedStatement pst = conn.prepareStatement(query);\n\t\t\t\t\tpst.setString(1, touserFeild.getText());\n\t\t\t\t\tpst.setString(2, msgFeild.getText());\n\t\t\t\t\t\n\t\t\t\t\tpst.execute();\n\t\t\t\t\t\n\t\t\t\t\tSystem.out.println(\"post message success\");\n\t\t\t\t\t\n\t\t\t\t\tpst.close();\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t\tcatch (Exception e7)\n\t\t\t\t{\n\t\t\t\t\tSystem.out.println(\"post message fail\");\n\t\t\t\t\tJOptionPane.showMessageDialog(null, \"Message Failed to post\");\n\t\t\t\t}\n\t\t\t\t//msgObject.refreshTable();\n\t\t\t\tdispose();\n\t\t\t}", "public String submitText();", "@Override\n\tpublic void handle(T event) {\n\t\tString messageFromClient;\n\t\tmessageFromClient = breakOut.getView().getInputTextfield().getText();\n\t\ttry {\n\t\t\tbreakOut.getClient().getWriter().println(messageFromClient);\n\t\t\tbreakOut.getClient().getWriter().flush();\n\t\t\tbreakOut.getView().getInputTextfield().clear();\n\t\t} catch (Exception e) {\n\t\t\tSystem.out.println(\"No reachable Server\");\n\t\t}\n\t}", "public void sendText(View view)\n {\n String toSay = editText.getText().toString();\n editText.getText().clear();\n findViewById(R.id.main_layout).requestFocus();\n InputMethodManager imm = (InputMethodManager) getSystemService(Activity.INPUT_METHOD_SERVICE);\n imm.hideSoftInputFromWindow(view.getWindowToken(), 0);\n logicController.ConnectToServer(toSay, false);\n //ttsCont.speakThis(toSay);\n //toastWithTimer(toSay, true);\n }", "@Override\n\tprotected void doPost(HttpServletRequest request, HttpServletResponse response)\n\t\t\tthrows ServletException, IOException {\n\t\tint id = -1;\n\t\ttry {\n\t\t\tid = Integer.parseInt(request.getParameter(\"id\"));\n\t\t} catch (Exception e) {\n\t\t}\n\n\t\tChatServerConnector.sentMessage(request.getParameter(\"message\"), id);\n\t}", "private void sendMessage(String message){\n try{\n output.writeObject(nickname+\" : \" + message);\n output.flush();\n showMessage(\"\\n\"+nickname+\" : \" + message);\n }catch(IOException ioException){\n chatWindow.append(\"\\n Oops! Something went wrong!\");\n }\n }", "public Server () {\n\t\t\n\t\tsuper(\"The best messager ever! \");\n\t\t//This sets the title. (Super - JFrame).\n\t\t\n\t\tuserText = new JTextField();\n\t\tuserText.setEditable(false);\n\t\tuserText.addActionListener(\n\t\t\t\tnew ActionListener() {\n\t\t\t\t\t\n\t\t\t\t\tpublic void actionPerformed(ActionEvent event) {\n\t\t\t\t\t\t\n\t\t\t\t\t\tsendMessage(event.getActionCommand());\n\t\t\t\t\t\t//This returns whatever event was performed in the text field i.e the text typed in.\n\t\t\t\t\t\tuserText.setText(\"\");\n\t\t\t\t\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\t\n\t\t\t\t\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t);\n\t\t\n\t\tadd(userText,BorderLayout.NORTH);\n\t\tchatWindow = new JTextArea();\n\t\tadd(new JScrollPane (chatWindow));\n\t\tsetSize(800,600);\n\t\tsetVisible(true);\n\t\t\n\t\t\n\t\n\t\n\t}", "private void sendTextMessage(String message) {\n if ( message == null || message.length() < 1 ) {\n return;\n }\n DateFormat localDateFormat = Constant.getServerDateFormat();\n Chat chat = new Chat(0,tournamentID,clubID,receiverID, selfID,self.getDisplayName(),\n Constant.MESSAGE_TYPE_TEXT,message,localDateFormat.format(new Date()));\n RequestAction actionPostChatText = new RequestAction() {\n @Override\n public void actOnPre() {\n et_message.setText(\"\");\n }\n\n @Override\n public void actOnPost(int responseCode, String response) {\n if ( responseCode == 201 ) {\n Log.d(TAG,\"Message sent successfully!\");\n }\n }\n };\n String url;\n if ( tournament != null ) { // tournament chat\n url = UrlHelper.urlChatByTournament(tournament.id,club.id);\n } else if ( club != null ) {// club chat\n url = UrlHelper.urlChatByClub(club.id);\n } else if ( receiver != null ) { // private chat\n url = UrlHelper.urlPrivateChat(receiver.getId());\n } else {\n Toast.makeText(getContext(), \"Unknown error!\", Toast.LENGTH_SHORT).show();\n Log.e(TAG,\"Unspecified chat type.\");\n return;\n }\n RequestHelper.sendPostRequest(url,chat.toJson(),actionPostChatText);\n }", "public void actionPerformed(ActionEvent e) {\n\t\t\t\tString message= txtMessage.getText();\n\t\t\t\tsend(message);\n\t\t\t}", "public void submitAction(ActionEvent actionEvent) {\r\n try {\r\n connecting();\r\n userName = usernameSignIn.getText();\r\n password = passwordSignIn.getText();\r\n userMain.setUsername(userName);\r\n userLoginChecking=new UserLoginChecking(userName,password);\r\n new WriteThreadClient(clientNetworkUtil,userLoginChecking);\r\n // clientNetworkUtil.write(userLoginChecking);\r\n new ReadThreadClient(clientNetworkUtil,userMain);\r\n\r\n }catch (Exception e)\r\n {\r\n System.out.println(\"Error loading Home page\");\r\n }\r\n }", "public ChatClient() {\r\n\r\n // Layout GUI\r\n textField.setEditable(false);\r\n messageArea.setEditable(false);\r\n frame.getContentPane().add(textField, \"North\");\r\n frame.getContentPane().add(new JScrollPane(messageArea), \"Center\");\r\n frame.pack();\r\n\r\n // Add Listeners\r\n textField.addActionListener(new ActionListener() {\r\n /**\r\n * Responds to pressing the enter key in the textfield by sending the contents of the text\r\n * field to the server. Then clear the text area in preparation for the next message.\r\n */\r\n public void actionPerformed(ActionEvent e)\r\n {\r\n out.println(textField.getText());\r\n textField.setText(\"\");\r\n }\r\n });\r\n }", "@Override\n public void onClick(View v) {\n String inputText = inputEditText.getText().toString();\n\n // Show the user's input text\n messageTextView.setText(inputText);\n\n }", "public void writeMassege() {\n m = ChatClient.message;\n jtaChatHistory.setText(\"You : \" + m);\n //writeMassageServer();\n }", "private void sendNameToServer() {\n\t\t\t\t// First, we validate the input.\n\t\t\t\terrorLabel.setText(\"\");\n\t\t\t\tString textToServer = nameField.getText();\n\t\t\t\tif (!FieldVerifier.isValidName(textToServer)) {\n\t\t\t\t\terrorLabel.setText(\"Please enter at least four characters\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Then, we send the input to the server.\n\t\t\t\t// sendButton.setEnabled(false);\n\t\t\t\tSearchRequest request = new SearchRequest();\n\t\t\t\tDate twoMinsAgo = new Date(new Date().getTime() - 1000*60*2);\n\t\t\t\trequest.setFetchTime(Interval.after(twoMinsAgo));\n\t\t\t\tgreetingService.greetServer(request,\n\t\t\t\t\t\tnew AsyncCallback<Collection<Place>>() {\n\t\t\t\t\t\t\tpublic void onFailure(Throwable caught) {\n\t\t\t\t\t\t\t\tnotification.handleFailure(caught);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tpublic void onSuccess(Collection<Place> result) {\n\t\t\t\t\t\t\t\t// TODO: sign of utter stupidity\n\t\t\t\t\t\t\t\tfinal MapWidget map = (MapWidget) RootPanel\n\t\t\t\t\t\t\t\t\t\t.get(\"mapsTutorial\").getWidget(0);\n\t\t\t\t\t\t\t\tmap.clearOverlays();\n\n\t\t\t\t\t\t\t\tLatLng markerPos = null;\n\t\t\t\t\t\t\t\tfor (final Place place : result) {\n\t\t\t\t\t\t\t\t\tLocation coordinates = place.getCoordinates();\n\t\t\t\t\t\t\t\t\tmarkerPos = LatLng.newInstance(\n\t\t\t\t\t\t\t\t\t\t\tcoordinates.getLatitude(), coordinates.getLongitude());\n\n\t\t\t\t\t\t\t\t\t// Add a marker\n\t\t\t\t\t\t\t\t\tMarkerOptions options = MarkerOptions\n\t\t\t\t\t\t\t\t\t\t\t.newInstance();\n\t\t\t\t\t\t\t\t\toptions.setTitle(place.getAddress());\n\t\t\t\t\t\t\t\t\tMarker marker = new Marker(markerPos,\n\t\t\t\t\t\t\t\t\t\t\toptions);\n\t\t\t\t\t\t\t\t\tfinal LatLng currMarkerPos = markerPos;\n\t\t\t\t\t\t\t\t\tmarker.addMarkerClickHandler(new MarkerClickHandler() {\n\n\t\t\t\t\t\t\t\t\t\tpublic void onClick(\n\t\t\t\t\t\t\t\t\t\t\t\tMarkerClickEvent event) {\n\t\t\t\t\t\t\t\t\t\t\tPlaceFormatter places = new PlaceFormatter();\n\t\t\t\t\t\t\t\t\t\t\tInfoWindowContent wnd = new InfoWindowContent(places.format(place));\n\t\t\t\t\t\t\t\t\t\t\twnd.setMaxWidth(200);\n\t\t\t\t\t\t\t\t\t\t\tmap.getInfoWindow().open(\n\t\t\t\t\t\t\t\t\t\t\t\t\tcurrMarkerPos,\n\t\t\t\t\t\t\t\t\t\t\t\t\twnd);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\tmap.addOverlay(marker);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (markerPos != null) {\n\t\t\t\t\t\t\t\t\tmap.setCenter(markerPos);\n\t\t\t\t\t\t\t\t\tmap.setZoomLevel(12);\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}", "@Override\n public boolean onSubmit(CharSequence input) {\n Message message = new Message(input.toString());\n Message message2 = new Message(\"Hey dear!\");\n Author ab = new Author();\n ab.setId(senderId);\n message.setAuthor(ab);\n\n //adapter.addToStart(message,true);\n adapter.addToStart(message,true);\n adapter.addToStart(message2,false);\n return true;\n }", "public void insertUpdate(DocumentEvent e) \n \t{\n \t\tsend_textbox_text_value = input_box.getText();\n \t\tif(isConnected == false)\n \t\t\treturn;\n \t\tSend_Button.setEnabled(Check_send());\n }", "@Override\n public void keyPressed(KeyEvent e) {\n if (e.getSource().equals(txtMensaje)\n && e.getKeyCode() == KeyEvent.VK_ENTER\n && !txtMensaje.getText().trim().isEmpty()) {\n hiloCliente.enviarMensajeChat(txtMensaje.getText().trim());\n txtMensaje.setText(\"\");\n }\n }", "@Override\n public void handle(KeyEvent keyEvent) {\n if(keyEvent.getCode() == KeyCode.ENTER){\n ChatPanel chatPanel=game.getChatPanel();\n Message mess=new Message(facade.getClientAccount(),\n chatPanel.getSelectedAccount(),chatPanel.getChatMessage());\n mess.setStatus(chatPanel.getSelectedOption());\n mess.setGameIndex(facade.getGameIndex());\n mess.setSlotIndex(facade.getHeroSlot());\n chatPanel.addChatMessage(facade.getUsername(),chatPanel.getChatMessage());\n com.write(mess);\n }\n }", "@Override\n public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {\n String emailValue = request.getParameter(\"email-input\");\n String textValue = request.getParameter(\"text-input\");\n\n // Print the value so you can see it in the server logs.\n System.out.println(\"You submitted : \" + textValue + \"\\n By : \" + emailValue);\n\n // Create instance of DataStore\n Datastore datastore = DatastoreOptions.getDefaultInstance().getService();\n // Create a key with a \"kind\"\n KeyFactory keyFactory = datastore.newKeyFactory().setKind(\"Email\");\n FullEntity emailEntity = Entity.newBuilder(keyFactory.newKey()).set(\"Email\", emailValue)\n .set(\"Message\", textValue).build();\n\n datastore.put(emailEntity);\n\n // Write the value to the response so the user can see it.\n response.sendRedirect(\"/\");\n }", "@Override\n public void start(Stage primaryStage) {\n TextArea clientTA = new TextArea();\n TextArea serverTA = new TextArea();\n serverTA.setEditable(false);\n \n VBox vBox = new VBox(10);\n Label lblClient = new Label(\"Client\");\n Label lblServer = new Label(\"Server\");\n vBox.getChildren().addAll(lblServer, serverTA, lblClient, clientTA);\n vBox.setPadding(new Insets(10));\n \n // Create a scene and place it in the stage\n Scene scene = new Scene(vBox, 450, 450);\n primaryStage.setTitle(\"Client\");\n primaryStage.setScene(scene);\n primaryStage.show();\n \n // Gives the text area focus when the application starts\n clientTA.requestFocus();\n \n // Send text back to the server\n clientTA.setOnKeyPressed(event -> {\n if(event.getCode() == KeyCode.ENTER){\n try {\n String[] sa = clientTA.getText().split(\"\\n\");\n toServer.writeUTF(sa[sa.length - 1]);\n toServer.flush();\n } catch (IOException ex) {\n ex.printStackTrace();\n }\n }\n });\n \n try {\n // Create a socket to connect to the server\n Socket socket = new Socket(\"localhost\", 8000);\n \n // Create an input stream to receive data from the server\n fromServer = new DataInputStream(socket.getInputStream());\n \n // Create an output stream to send data to the server\n toServer = new DataOutputStream(socket.getOutputStream());\n } catch (IOException ex) {\n clientTA.appendText(ex.toString() + \"\\n\");\n }\n \n new Thread(() -> {\n try {\n \n while (true) {\n // Receive text from the server\n String message = fromServer.readUTF();\n \n // Display message in text area\n serverTA.appendText(message + \"\\n\");\n toServer.flush();\n }\n } \n catch (IOException ex) {\n ex.printStackTrace();\n }\n }).start();\n }", "private void sendMessage() {\n\t\tString text = myMessagePane.getText();\n\t\tMessage msg = new Message(text, myData.userName, myData.color);\n\n\t\tcommunicationsHandler.send(msg);\n\n\t\t// De-escape xml-specific characters\n\t\tXmlParser xmlParser = new XmlParser(myData);\n\t\tString outText = xmlParser.deEscapeXMLChars(msg.text);\n\t\tmsg.text = outText;\n\n\t\tmyMessagePane.setText(\"\");\n\t\tupdateMessageArea(msg);\n\n\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}", "@Override\n\tpublic void start(Stage primaryStage) {\n\t\tBorderPane paneForTextField = new BorderPane(); \n\t\tpaneForTextField.setPadding(new Insets(5, 5, 5, 5)); \n\t\tpaneForTextField.setStyle(\"-fx-border-color: green\"); \n\t\tpaneForTextField.setLeft(new Label(\"Set your username: \"));\n\t\tTextField tf = new TextField();\n\t\ttf.setAlignment(Pos.BOTTOM_RIGHT);\n\t\tpaneForTextField.setCenter(tf);\n\t\tBorderPane mainPane = new BorderPane(); \n\t\t// Text area to display contents\n\t\tta = new TextArea();\n\t\tta.setEditable(false);\n\t\tmainPane.setTop(new ScrollPane(ta)); \n\t\tmainPane.setBottom(paneForTextField);\n\t\t// Create a scene and place it in the stage \n\t\tScene scene = new Scene(mainPane, 480, 220);\n\t\tprimaryStage.setTitle(\"Client\");\n\t\t// Set the stage title \n\t\tprimaryStage.setScene(scene); \n\t\t// Place the scene in the stage \n\t\tprimaryStage.show(); \n\t\t// Display the stage\n\t\ttf.setOnAction(e -> {\n\t\t\tif (!userNameSet) {\n\t\t\t\tuserName = tf.getText().trim();\n\t\t\t\tuserNameSet = true;\n\t\t\t\tpaneForTextField.setLeft(new Label(\"Message: \"));\n\t\t\t\ttf.setText(\"\");\n\t\t\t\tprimaryStage.setTitle(userName + \" Messenger\");\n\t\t\t} else {\n\t\t\t\tString message = userName + \": \" + tf.getText().trim();\n\t\t\t\ttf.setText(\"\");\n\t\t\t\t// Send the message to the server \n\t\t\t\ttoServer.println(message); \n\t\t\t\ttoServer.flush();\n\t\t\t}\n\t\t}); try {\n\t\t\t// Create a socket to connect to the server @SuppressWarnings(\"resource\") \n\t\t\tSocket socket = new Socket(\"localhost\", 8018);\n\t\t\t// Create an output stream to send data to the server \n\t\t\ttoServer = new PrintWriter(socket.getOutputStream());\n\t\t\t// Create an input stream to receive data from the server \n\t\t\tfromServer = new InputStreamReader(socket.getInputStream());\n\t\t\treader = new BufferedReader(fromServer);\n\t\t\tThread readerThread = new Thread(new IncomingReader());\n\t\t\treaderThread.start();\n\t\t\t} catch (IOException ex) {\n\t\t\t\tta.appendText(ex.toString() + '\\n');\n\t\t\t}\n\t\t\n\t\t}", "private void handleInput() {\n\n // Get the input string and check if its not empty\n String text = textInput.getText().toString();\n if (text.equals(\"\\n\")) {\n textInput.setText(\"\");\n return;\n }\n // remove empty line\n if (text.length() >= 2 && text.endsWith(\"\\n\")) text = text.substring(0, text.length() - 1);\n\n if (TextUtils.isEmpty(text)) return;\n textInput.setText(\"\");\n\n myGame.onInputString(text);\n }", "public abstract void onSubmit(String text);", "@Override\n\tpublic void run() {\n\t\tInetSocketAddress remoteAddr = (InetSocketAddress) socket.getRemoteSocketAddress();\n\t\tChatServer.log(\"[server] connected by client[\" + remoteAddr.getAddress().getHostAddress() + \":\" + remoteAddr.getPort());\n\t\t\n\t\ttry {\n\t\t\t//2. 스트림 얻기\n\t\t\tBufferedReader reader = new BufferedReader(new InputStreamReader(socket.getInputStream(), \"utf-8\"));\n\t\t PrintWriter writer = new PrintWriter(new OutputStreamWriter(socket.getOutputStream() ,\"utf-8\"),true);\n\t\t \n\t\t while(true) {\n\t\t \tString request = reader.readLine();\n\t\t \tSystem.out.println(request);\n\t\t \tif(request == null) {\n\t\t \t\tChatServer.log(\"클라이언트로 부터 연결 끊김\");\n\t\t \t\tbreak;\n\t\t \t}\n\t\t \tString[] tokens = request.split(\":\");\n\t\t \t// Join:둘리 일때 - 0은 Join 1은 둘리\n\t\t \tif(\"join\".equals(tokens[0])) {\n\t\t \t\tnickname = tokens[1]; \n\t\t \t\tdoJoin(nickname + \"님이 입장하였습니다.\", writer);\n\t\t \t}else if(\"message\".equals(tokens[0])) {\n\t\t \t\t\n\t\t \t\tdoMessage(nickname + \":\" + tokens[1] );\n\t\t \t}else if(\"quit\".equals(tokens[0])) {\n\t\t \t\tdoQuit(nickname + \"님이 퇴장하였습니다.\", writer);\n\t\t \t}else {\n\t\t \t\tChatServer.log(\"에러: 알수 없는 요청(\" + tokens[0] + \")\");\n\t\t \t}\n\t\t }\n\t\t\n\t\t} catch (SocketException e) {\n\t\t\tChatServer.log(nickname);\n\t\t\te.printStackTrace();\n\t\t} catch (IOException e) {\n\t\t\te.printStackTrace();\n\t\t}\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 }", "public void actionPerformed(ActionEvent e) {\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}", "void sendText(String content);", "public void actionPerformed(ActionEvent ae) {\n\t\tmyObject = new ChatMessage();\n\t\t//sets name for ChatMessage\n\t\tmyObject.setName(nameField.getText());\n\t\t//gets the text from the chat text area and puts it in the ChatMessage \n\t\tmyObject.setMessage(tf.getText());\n\t\t//Resets the column for typing message again\n\t\ttf.setText(\"\");\n\t\ttry {\n\t\t\tmyOutputStream.reset();\n\t\t\t//writes the object to output stream\n\t\t\tmyOutputStream.writeObject(myObject);\n\t\t} catch (IOException ioe) {\n\t\t\tSystem.out.println(ioe.getMessage());\n\t\t}\n\n\t}", "private void sendMessage(String text)\n {\n Message msg = mHandler.obtainMessage();\n Bundle bundle = new Bundle();\n bundle.putString(\"text\",text);\n msg.setData(bundle);\n msg.what = 1;\n mHandler.sendMessage(msg);\n }", "@Override\n public void keyPressed(KeyEvent ke) {\n if (ke.getSource().equals(frmMain.getMessageBox()) && ke.getKeyCode() == KeyEvent.VK_ENTER) {\n sendContent();\n }\n }", "public void actionPerformed(ActionEvent ae){\n String actionString = ae.getActionCommand();\n System.out.println(\"[CLIENT] - Action - \" + actionString);\n\n /*\n * if Reveal Password is pressed, the password will be shown in plaintext\n */\n if(actionString.equals(\"Reveal Password\")){\n char[] pass = passWordField.getPassword();\n String password = new String(pass);\n passWordField.setEchoChar((char) 0);\n passWordField.setText(password);\n showPassword.setText(\"Hide Password\");\n }\n\n /*\n * if Reveal Password is pressed, the password will be shown in asterisks\n */\n else if(actionString.equals(\"Hide Password\")){\n passWordField.setEchoChar('*');\n showPassword.setText(\"Reveal Password\");\n }\n\n /*\n * if login is pressed:\n * Username and Password is sent to server\n * Verification of Success or Failure is read back\n */\n else if(actionString.equals(\"Login\")){\n char[] pass = passWordField.getPassword();\n String password = new String(pass);\n CoronosAuth auth = new CoronosAuth(jtfUserNameField.getText(), password);\n try{\n oos.writeObject(auth);\n oos.flush();\n }\n catch(IOException ioe){\n ioe.printStackTrace();\n }\n }\n\n /*\n * if send button is pressed, message is sent to server, which is sent to all clients\n */\n else if(actionString.equals(\"Send\")){\n if(jtfChatField.getText().equals(\"\")){\n return;\n }\n else{\n Message msg = new Message(String.format(\"%s: %s\\n\", username, jtfChatField.getText()));\n jtfChatField.setText(\"\");\n try{\n oos.writeObject(msg);\n oos.flush();\n }\n catch(IOException ioe){\n ioe.printStackTrace();\n }\n }\n }\n\n /*\n * if the hide chat button is pressed, chat panel will be hidden\n */\n else if(actionString.equals(\"Hide Chat\")){\n jbHideChat.setText(\"Show Chat\");\n jpContainerPanel.remove(jpChatPanel);\n jpContainerPanel.revalidate();\n jfFrame.repaint();\n jbHideChat.setToolTipText(\"Want to harass your boss? Enable chat!\");\n }\n\n /*\n * if the show chat button is pressed, chat panel will be shown\n */\n else if(actionString.equals(\"Show Chat\")){\n jbHideChat.setText(\"Hide Chat\");\n jpContainerPanel.add(jpChatPanel);\n jpContainerPanel.revalidate();\n jfFrame.repaint();\n jbHideChat.setToolTipText(\"Hate your co-workers? Want to hide from your boss? Just close chat!\");\n }\n\n /*\n * if the view punches button is pressed, punches will be shown\n */\n else if(actionString.equals(\"View Punches\")){\n JSONArray punches = employee.getClockTimes();\n WageFrame wf = new WageFrame(punches);\n wf.setLocationRelativeTo(null);\n }\n\n /*\n * if the view profile button is pressed:\n * Data will be populated in a GUI\n * If a change is detected, the updated information will be sent to the server\n */\n else if(actionString.equals(\"View Profile\")){\n JFrame editUser = new JFrame(\"Coronos - View/Edit Profile\");\n editUser.setLayout(new GridLayout(5, 1));\n\n JSONObject data = employee.getEmployeeData();\n\n String firstName = (String) data.get(\"firstName\");\n String lastName = (String) data.get(\"lastName\");\n String hourlyPay = Double.toString((double) data.get(\"wage\"));\n String role = (String) data.get(\"role\");\n String address = (String) data.get(\"address\");\n String zip = (String) data.get(\"zip\");\n String state = (String) data.get(\"state\");\n String city = (String) data.get(\"city\");\n\n JPanel centerPanel = new JPanel(new FlowLayout());\n JPanel bottomPanel = new JPanel(new FlowLayout());\n JPanel panelfour = new JPanel(new FlowLayout());\n JPanel panelfive = new JPanel(new FlowLayout());\n JPanel panelsix = new JPanel(new FlowLayout());\n\n JLabel wageLabel = new JLabel(\"Hourly Pay:\");\n JTextField wageField = new JTextField(hourlyPay, 10);\n JLabel roleLabel = new JLabel(\"Role:\");\n JTextField roleField = new JTextField(role,10);\n\n wageField.setEditable(false);\n roleField.setEditable(false);\n\n JLabel firstNameLabel = new JLabel(\"First Name:\");\n JLabel lastNameLabel = new JLabel(\"Last Name:\");\n JTextField firstNameField = new JTextField(firstName, 10);\n JTextField lastNameField = new JTextField(lastName, 10);\n\n firstNameField.setEditable(false);\n lastNameField.setEditable(false);\n\n JLabel addressLabel = new JLabel(\"Street Address:\");\n JTextField addressField = new JTextField(address, 10);\n\n JLabel cityLabel = new JLabel(\"City:\");\n JTextField cityField = new JTextField(city,10);\n\n JLabel zipLabel = new JLabel(\"Zip Code\");\n JTextField zipField = new JTextField(zip,10);\n\n JLabel statesLabel = new JLabel(\"State:\");\n JComboBox statesBox = new JComboBox(states);\n int i = java.util.Arrays.asList(states).indexOf(state);\n statesBox.setSelectedIndex(i);\n\n JButton saveButton = new JButton(\"Save\");\n\n saveButton.addActionListener(new ActionListener() {\n @Override\n public void actionPerformed(ActionEvent ae) {\n String actionString = ae.getActionCommand();\n if(actionString.equals(\"Save\")){\n String address = addressField.getText();\n String zip = zipField.getText();\n int selected = statesBox.getSelectedIndex();\n String selectedState = states[selected];\n String city = cityField.getText();\n\n if(address.equals(\"\") || selectedState.equals(\"\") || city.equals(\"\") || zip.equals(\"\")){\n JOptionPane.showMessageDialog(null, \"Empty Field Detected, ensure all fields are filled.\", \"User Update Error\", JOptionPane.ERROR_MESSAGE);\n }\n else{\n try{\n oos.writeObject(employee);\n JOptionPane.showMessageDialog(null, \"Saved Data to Server.\", \"Employee Data\", JOptionPane.INFORMATION_MESSAGE);\n }\n catch(IOException ioe){\n JOptionPane.showMessageDialog(null, \"Failed to send data to server.\", \"Server Error\", JOptionPane.ERROR_MESSAGE);\n }\n\n editUser.setVisible(false);\n }\n }\n }\n });\n\n centerPanel.add(wageLabel);\n centerPanel.add(wageField);\n centerPanel.add(roleLabel);\n centerPanel.add(roleField);\n\n bottomPanel.add(saveButton);\n\n panelfour.add(firstNameLabel);\n panelfour.add(firstNameField);\n panelfour.add(lastNameLabel);\n panelfour.add(lastNameField);\n\n panelfive.add(addressLabel);\n panelfive.add(addressField);\n\n panelfive.add(cityLabel);\n panelfive.add(cityField);\n\n panelsix.add(statesLabel);\n panelsix.add(statesBox);\n\n panelsix.add(zipLabel);\n panelsix.add(zipField);\n\n\n editUser.add(panelfour);\n editUser.add(centerPanel);\n editUser.add(panelfive);\n editUser.add(panelsix);\n editUser.add(bottomPanel);\n editUser.setLocationRelativeTo(null);\n editUser.setVisible(true);\n editUser.pack();\n\n }\n\n /*\n * if the view report button is pressed:\n * Wages are calculated and shown\n */\n else if(actionString.equals(\"View Report\")){\n JSONArray punches = employee.getClockTimes();\n double total = 0.0;\n int length = punches.size();\n for(Object data : punches){\n JSONObject jsonData = (JSONObject) data;\n try{\n double payForPeriod = (double) jsonData.get(\"pay\");\n total += payForPeriod;\n }\n catch(NullPointerException npe){\n break;\n }\n }\n String dataString = String.format(\"You have worked %d shifts for a total of $%.2f pay.\", length, total);\n JOptionPane.showMessageDialog(null, dataString, \"Employee Report\", JOptionPane.INFORMATION_MESSAGE);\n\n }\n\n /*\n * if the punch in button is pressed, a punch in time is set\n */\n else if(actionString.equals(\"Punch In\")){\n if(employee.getClockedIn()){\n JOptionPane.showMessageDialog(null, \"You are already clocked in.\");\n }\n else{\n punchIn();\n saved = false;\n }\n }\n\n /*\n * if the punch out button is pressed, a punch out time is set\n */\n else if(actionString.equals(\"Punch Out\")){\n if(!employee.getClockedIn()){\n JOptionPane.showMessageDialog(null, \"You are already clocked out.\");\n }\n else{\n punchOut();\n saved = false;\n }\n }\n\n /*\n * if the save button is pressed, the employee profile is saved\n */\n else if(actionString.equals(\"Save\")){\n try{\n oos.writeObject((Object) employee);\n oos.flush();\n saved = true;\n }\n catch(IOException ioe){\n System.err.println(\"Error saving employee data.\");\n }\n }\n\n /*\n * if the time toggle button is pressed, the time is switched to 12 or 24 hour format\n */\n else if(actionString.equals(\"12/24HR Time\")){\n if (clockState){\n clockLabelOne.setVisible(false);\n clockLabelTwo.setVisible(true);\n clockState = false;\n }\n else{\n clockLabelOne.setVisible(true);\n clockLabelTwo.setVisible(false);\n clockState = true;\n }\n\n }\n\n /*\n * if the exit button is pressed, exit command is verified and client is safely shutdown\n */\n else if(actionString.equals(\"Exit\")){\n TimerTask shutDown = new TimerTask() {\n @Override\n public void run() {\n if(saved){\n System.exit(0);\n }\n else{\n int n = JOptionPane.showConfirmDialog(null, \"You have not saved your punches. Do you want to save before exiting?\", \"Unsaved Punches\", JOptionPane.YES_NO_OPTION);\n if(n == 0){\n System.out.println(\"User Chose 0\");\n try{\n oos.writeObject((Object) employee);\n oos.flush();\n System.out.println(\"[EXIT] - [Shutdown] - Shutting down. Save complete.\");\n }\n catch(IOException ioe){\n System.err.println(\"[EXIT] - [Save] - Failed to Write to Server\");\n }\n }\n else{\n System.out.println(\"[EXIT] - [Shutdown] - Shutting down without saving.\");\n System.exit(0);\n }\n }\n }\n };\n Timer timer = new java.util.Timer();\n timer.schedule(shutDown, 500);\n }\n\n /*\n * if the about button is pressed, crediting information is displayed\n */\n else if(actionString.equals(\"About\")){\n JOptionPane.showMessageDialog(null, \"Coronos Time Clock © 2020\\nAll Rights Reserved\\n\\nAuthors:\\nConnor Stevens\\nEverett Simone\\nDalton Kruppenbacher\\nBrian Zhu\", \"About Coronos\", JOptionPane.INFORMATION_MESSAGE);\n }\n }", "@Override\n\tpublic void messageFromServer(String message, SimpleAttributeSet keyWord) throws RemoteException {\t\t\t\n\t\ttry { \n\t\t\t// first argument sets the position of the meesage to go in\n \tchatGUI.doc.insertString(chatGUI.doc.getLength(), message + \"\\n\", keyWord); \n }\n catch (BadLocationException e){\n \tSystem.out.print(e);\n } \n\n\t}", "public void communicate() throws IOException{\n\t\tdo{\n\t\t\t//Messages recieved by the client\n\t\t\t\n\t\t\t\n\t\t\t//Messages being sent by the client\t\n\t\t\t//Chat client is reading in data from its own user and from the chat client thread\n//\t\t\t line = console.readLine(); //client msg is read from console environment\n\t\t\t\n\t\t\t//nope \n//\t\t\tScanner scanner = new Scanner(System.in);\n//\t String line = scanner.nextLine();\n//\t System.out.println(line);\n//\t\t\tscanner.close();\n\t\t\t\n\t\t\t//nope\n//\t line = strIn.readUTF();\n//\t\t\tSystem.out.println(\"User said: \"+ line);\n\t\t\t\n\n//\t\t\tnope needs to be a constant stream cant just get client message from client gui\n//\t\t\tline = gui.getLatestMsg();\n\t\t\t\n//\t\t\tnope initial stream is null. read from gui stream\n//\t\t\tByteArrayInputStream bInput = new ByteArrayInputStream(gui.b);\n//\t\t\tline = bInput.toString();\n//\t\t\t\n\t\t\tstrOut.writeUTF(line); // Writes a string to the underlying output stream using modified UTF-8 encoding\n\t\t\tstrOut.flush(); //Forces any buffered output bytes to be written out to the stream.\n\t\t\t\n\t\t}while(!line.equalsIgnoreCase(\"bye\")); //not working. Still listens\n\t}", "public void processInput( String input ){\n\t\tString opponent;//holds either \"client\" or \"server\". Whichever is the opponent\n\t\tif( parent.whichPlayer.equals(\"server\") ) opponent = \"client\";\n\t\telse opponent = \"server\";\n\t\t\n\t\t//create a string array to hold the input split around spaces\n\t\tString[] split = input.split(\" \");\n\t\t\n\t\t//input was mouseclick\n\t\tif( split[0].equals(\"C\") ) {\n\t\t\t//If the line contains mouseClick information, then send it to handleMouseClick\n\t\t\tparent.handleMouseClick(Integer.parseInt(split[1]), Integer.parseInt(split[2]), opponent);\n\t\t}\n\n\t\t//input was name\n\t\telse if(split[0].equals(\"N\")) {\n\t\t\t//if this window is the server, set the recieved name to the client\n\t\t\tif( parent.serverRadio.isSelected() ) {\n\t\t\t\tparent.playerTwoTextField.setText(split[1]);\n\t\t\t}\n\t\t\t//if this window is the client, set the recieved name to the server\n\t\t\telse {\n\t\t\t\tparent.playerOneTextField.setText(split[1]);\n\t\t\t}\n\t\t}\n\t\t//if a quit flag was sent\n\t\telse if(split[0].equals(\"Q\")){\n\t\t\ttry {\n\t\t\t\tsock.close();\n\t\t\t\tss.close();\n\t\t\t\tpw.close();\n\t\t\t\tsc.close();\n\t\t\t}catch(Exception e) {\n\t\t\t\tSystem.out.println(\"Unable to close the connection!\");\n\t\t\t}\n\t\t}\n\n\t}", "void sendMessage(String msg);", "String userInputFromTextArea();", "@Override\n\tpublic void actionPerformed(ActionEvent e) {\n\t\tif(e.getSource()==b1){\n\t\t\ttry {\n\t\t\t\tint nLines = text.getLineCount();\n\t\t\t\tint start = text.getLineStartOffset(nLines-1);\n\t\t\t\tint end = text.getLineEndOffset(nLines -1);\n\t\t\t\tString m = text.getText(start, (end - start));\n\t\t\t\tString result = c.send(\"1 \" + m);\n\t\t\t\tSystem.out.println(\"Sending: \" + m);\n\t\t\t\ttext.append(\" \\nMultimedia:\\n\" + result + \"\\n\");\n\t\t\t\ttext.append(\">Introduce name of file: \\n\");\n\t\t\t} catch (BadLocationException e1) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te1.printStackTrace();\n\t\t\t}\n\t\t}else if(e.getSource()==b2){\n\t\t\ttry {\n\t\t\t\tint nLines = text.getLineCount();\n\t\t\t\tint start = text.getLineStartOffset(nLines-1);\n\t\t\t\tint end = text.getLineEndOffset(nLines -1);\n\t\t\t\tString m = text.getText(start, (end - start));\n\t\t\t\tc.send(\"2 \" + m);\n\t\t\t\tSystem.out.println(\"Sending: \" + m);\n\t\t\t\ttext.append(\" \\nMultimedia being played on server\\n\" );\n\t\t\t\ttext.append(\">Introduce name of file: \\n\");\n\t\t\t} catch (BadLocationException e1) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te1.printStackTrace();\n\t\t\t}\n\t\t}else if(e.getSource()==b3){\n\t\t\tSystem.exit(0);\n\t\t}\n\t\t\n\t}", "public static void main(String[] args) {\n\t\tint portNo = 1234;\r\n\t\tServerSocket serverSocket;\r\n\t\ttry {\r\n\t\t\tserverSocket = new ServerSocket(portNo);\r\n\r\n\t\t// Server needs to be alive forever\r\n\t\twhile (true) {\t\t\r\n\t\t\tSystem.out.print(\"Server is Running.\");\r\n\r\n\t\t\t// Accept client request for connection\r\n\t\t\tSocket clientSocket = serverSocket.accept();\r\n\t\t\t\r\n\t\t\t// Create stream to Read data from network\r\n\t\t\t DataInputStream dataIn = new DataInputStream(clientSocket.getInputStream());\r\n\t\t\t// Create stream to write data on the network\r\n\t\t\t DataOutputStream outputStream = \r\n\t\t\t\t\t\tnew DataOutputStream(clientSocket.getOutputStream());\t\t\r\n\t\t\t \r\n\t\t\t \r\n\t\t\tString oriText = dataIn.readUTF();\r\n\t\t\tSystem.out.print(oriText);\r\n\r\nif (oriText != null) {\r\n\t\t\t// Send translated Text back to the client\r\n\t\t\tif (oriText.contains(\"Selamat pagi\") ) {\r\n\t\t\t\teng = \"Good morning \";\r\n\t\t\t\tarabic = \"صباحالخير \"; \r\n\t\t\t\tkorean = \"좋은 아침 \";\r\n\t\t\t}\r\n\t\t\telse if(oriText.contains(\"Selamat malam\")) {\r\n\t\t\t\teng = \"Good night \";\r\n\t\t\t\tarabic = \"طاب مساؤك \" ; \r\n\t\t\t\tkorean = \"안녕히 주무세요 \";\r\n\t\t\t}\r\n\t\t\telse if(oriText.contains( \"Apa khabar?\") ){\r\n\t\t\t\teng = \"How are you? \";\r\n\t\t\t\tarabic = \"كيف حالك؟ \"; \r\n\t\t\t\tkorean = \"어떻게 지내세요? \";\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\telse if(oriText.contains(\"Terima kasih\") ){\r\n\t\t\t\teng = \"Thank you \";\r\n\t\t\t\tarabic = \"شكرا لك \"; \r\n\t\t\t\tkorean = \"감사합니다 \";\r\n\t\t\t\t\r\n\t\t\t}\r\n\t\t\telse if(oriText.contains(\"Selamat tinggal\") ){\r\n\t\t\t\teng = \"Goodbye \";\r\n\t\t\t\tarabic = \"مع السلامة \" ; \r\n\t\t\t\tkorean = \"안녕 \";\t\r\n\t\t\t}\r\n\t\t\telse if(oriText.contains( \"Ada apa?\")) {\r\n\t\t\t\teng = \"What’s up? \";\r\n\t\t\t\tarabic = \"ما أخبارك؟ \"; \r\n\t\t\t\tkorean = \"뭐야? \";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\toutputStream.writeUTF(eng);\r\n\t\t\toutputStream.writeUTF(arabic);\r\n\t\t\t//outputStream.writeUTF(korean);\r\n\t\t\toutputStream.flush();\r\n\r\n\r\n\t\t\t//System.out.print(korean+eng+arabic);\r\n\t\t\t\r\n\t\t\tdataIn.close();\r\n\t\t\toutputStream.close();\r\n\t\t\toutputStream.close();\t\t\t\r\n\t\t\t//outputStream.close();\r\n\r\n\t\tclientSocket.close();\r\n\t\t\t\r\n}\r\n\t\t}\t\t\t\t\t\t\r\n\t\t} catch (IOException e) {\r\n\t\t\t\t// TODO Auto-generated catch block\r\n\t\t\t\te.printStackTrace();\r\n\t\t\t}\t\r\n\t\t\t\r\n\t\t}", "private void sendMessageToClient(String messageToClient){\n SwingUtilities.invokeLater(new Runnable() {\n @Override\n public void run() {\n output.println(\"\\n\" + \"Server: \" + messageToClient);\n output.flush();\n }\n });\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 }", "private void inputHandler(String input) throws Exception{\n\n switch (input) {\n\n case \"/quit\":\n done = true;\n break;\n\n default:\n PduMess mess = new PduMess(input);\n outStream.writeToServer(mess.getByteArray());\n break;\n }\n }", "private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed\r\n sendMessage(jTextField1.getText());\r\n }", "public void onClickSend(View view) {\n //String string = editText.getText().toString();\n //serialPort.write(string.getBytes());\n //tvAppend(txtResponse, \"\\nData Sent : \" + string + \"\\n\");\n }", "@Override\r\n\t\t\tpublic void actionPerformed(ActionEvent event) {\n\t\t\t\tsendData(event.getActionCommand());//调用sendData方法,响应操作。\t将信息发送给客户\r\n\t\t\t\tenterField.setText(\"\"); //将输入区域置空\r\n\t\t\t}", "public void replyMessage(String s) {\n\t\ttextArea.append(\"CTZ Bot : \" + s + \"\\n\");\n\t}", "@FXML\n public void sendAmessage(ActionEvent event) throws SQLException{\n DBConnect db = DBConnect.getInstance();\n db.sendMessage(message.getText(), selectedCustomer.getChat_id());\n message.setText(\"\");\n updateChat();\n }", "private void ChatNachricht() {\n\t\t//Kein leerer Text\n\t\tif (this.chatSendenArea.getText() != null) {\n\t\t\ttry {\n\t\t\t\tserver.sendChatMessage(\"Spieler \" + this.spielerNummer + \":\"\n\t\t\t\t\t\t+ this.chatSendenArea.getText());\n\t\t\t\tthis.chatSendenArea.setText(\"\");\n\t\t\t} catch (RemoteException e) {\n\t\t\t\te.printStackTrace();\n\t\t\t}\n\t\t}\n\t}", "private void showMessage() throws IOException {\n String msg = fromServer.readUTF();\n chatArea.append(msg + \"\\n\");\n // set the chat area always keep focus at bottom\n chatArea.setCaretPosition(chatArea.getDocument().getLength());\n }", "public void replyToThread(String message) {\n\t\twait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath(\".//input[@name='postTitle']\")));\n\t\tdriver.findElement(By.xpath(\".//textarea[@name='postBody']\")).sendKeys(message);\n\t\tdriver.findElement(By.xpath(\".//button[@ng-click='submit()']\")).click();\n\t}", "@Override\n public void actionPerformed(ActionEvent e) {\n chat.receiveMessage();\n }", "public void SendNewMessage(DBMethods dbm) {\r\n\t\t\r\n\t\tScanner SendNewMessageSC=new Scanner(System.in);\r\n\t\tString ReceiverUsername=null;\r\n\t\tString ContinueSendMessageAnswer=\"\";\r\n\t\tString MessageSendAnswer=\"\";\r\n\t\tString MessageText=\"\";\r\n\t\t//String ContinueSendingMessages=\"\";\r\n\t\tboolean b1=true;\r\n\t\t\r\n\t\t\r\n\t\ttry {\r\n\t\t\t\r\n\t\t\tdo {\r\n\t\t\t\t//SEND NEW MESSAGE MENU Structure\r\n\t\t\t\tSystem.out.println(\"\\n\"+\"-----------SEND NEW MESSAGE------------\"+\"\\n\"+\r\n\t\t\t \"Please type in the receiver's username:\");\r\n\t\t\t\tReceiverUsername=SendNewMessageSC.next();\r\n\t\t\t\t\r\n\t\t\t\t//Query that searches the DB to find out if the username exists in the 'users' TABLE\r\n\t\t\t\tString query4=\"SELECT users.username AS 'Username'\"+\"\\n\"+\r\n\t\t \"FROM dont_shoot_the_messenger.users\"+\"\\n\"+\r\n\t\t\t\t \"WHERE users.username='\"+ReceiverUsername+\"'\"+\"\\n\"+\r\n\t\t \"LIMIT 1;\";\r\n\t\t\t\t\r\n\t\t\t\tStatement stm4 = dbm.getConnection().createStatement();\r\n\t\t\t\tResultSet rs3 = stm4.executeQuery(query4);\r\n\t\t\t\t\r\n\t\t\t\tSystem.out.print(\"\\n\");\r\n\t\t\t\t\r\n\t\t\t\t//Returns FALSE if the username doesn't exist\r\n\t\t\t\tb1=rs3.next();\r\n\t\t\t\t\r\n\t\t\t\t//Case that the username does NOT exist in the 'users' Table\r\n\t\t\t\tif (b1==false) {\r\n\t\t\t\t\tSystem.out.println(\"User not found\"+\"\\n\");\r\n\t\t\t\t\t\r\n\t\t\t\t\tSystem.out.println(\"Do you want to continue sending messages? (y/n): \");\r\n\t\t\t\t\tContinueSendMessageAnswer=SendNewMessageSC.next();\r\n\t\t\t\t\t\r\n\t\t\t\t\t//While Loop for preventing Wrong Input\r\n\t\t\t\t\twhile(!ContinueSendMessageAnswer.equalsIgnoreCase(\"y\")&&!ContinueSendMessageAnswer.equalsIgnoreCase(\"n\")) {\r\n\t\t\t\t\t\tSystem.out.println(\"Invalid input\"+\"\\n\"+\r\n\t\t\t\t\t \"Do you want to continue sending messages? (y/n): \");\r\n\t\t\t\t\t\tContinueSendMessageAnswer=SendNewMessageSC.next();\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\t//Case that the username Exists in the 'users' Table\r\n\t\t\t\telse {\r\n\t\t\t\t\tSystem.out.println(\"Please type in the message you want to send (250 characters max): \");\r\n\t\t\t\t\t\r\n\t\t\t\t\t//Way to put the whole message to a string called 'MessageText'\r\n\t\t\t\t\tMessageText=SendNewMessageSC.next();\r\n\t\t\t\t\tMessageText=MessageText+SendNewMessageSC.nextLine();\r\n\t\t\t\t\t\r\n\t\t\t\t\t//Replacing the \" and ' characters from MessageText with /\r\n\t\t\t\t\tMessageText=MessageText.replace('\"','/');\r\n\t\t\t\t\tMessageText=MessageText.replaceAll(\"'\",\"/\");\r\n\t\t\t\t\t\r\n\t\t\t\t\t//Asking for confirmation to send the message\r\n\t\t\t\t\tSystem.out.println(\"Do you want to continue sending the message? (y/n): \");\r\n\t\t\t\t\tMessageSendAnswer=SendNewMessageSC.next();\r\n\t\t\t\t\t\r\n\t\t\t\t\t//While Loop for preventing Wrong Input\r\n\t\t\t\t\twhile(!MessageSendAnswer.equalsIgnoreCase(\"y\")&&!MessageSendAnswer.equalsIgnoreCase(\"n\")) {\r\n\t\t\t\t\t\tSystem.out.println(\"Invalid input\"+\"\\n\"+\r\n\t\t\t\t\t\t\t\t \"Do you want to continue sending the message? (y/n): \");\r\n\t\t\t\t\t\tMessageSendAnswer=SendNewMessageSC.next();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tswitch(MessageSendAnswer) {\r\n\t\t\t\t\t\r\n\t\t\t\t\t//Case that the user wants to send the message\r\n\t\t\t\t\tcase \"y\":\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//Query that inserts all message data to 'messages' Table\r\n\t\t\t\t\t\tString query5=\"INSERT INTO `dont_shoot_the_messenger`.`messages`\"+\"\\n\"+\r\n\t\t\t\t\t\t\t \"(`sender_id`, `receiver_id`, `text`)\"+\"\\n\"+\r\n\t\t\t\t\t\t\t \"VALUES\"+\"\\n\"+\r\n\t\t\t\t\t\t\t \"(\"+\"\\n\"+\r\n\t\t\t\t\t\t\t \"(SELECT users.id\"+\"\\n\"+\r\n\t\t\t\t\t\t\t \"FROM dont_shoot_the_messenger.users\"+\"\\n\"+\r\n\t\t\t\t\t\t\t \"WHERE users.username='\"+getUsername()+\"'\"+\"\\n\"+\r\n\t\t\t\t\t\t\t \"LIMIT 1),\"+\r\n\t\t\t\t\t\t\t \"(SELECT users.id\"+\"\\n\"+\r\n\t\t\t\t\t\t\t \"FROM dont_shoot_the_messenger.users\"+\"\\n\"+\r\n\t\t\t\t\t\t\t \"WHERE users.username='\"+ReceiverUsername+\"'\"+\"\\n\"+\r\n\t\t\t\t\t\t\t \"LIMIT 1),\"+\r\n\t\t\t\t\t\t\t \"'\"+MessageText+\"');\";\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tSystem.out.println(\"Sending Message to \"+ReceiverUsername+\" ...\"+\"\\n\");\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tdbm.executeStatement(query5);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tSystem.out.print(\"Message Sent\"+\"\\n\");\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\t//Keeping Log of the action\r\n\t\t\t\t\t\tLog.appendStrToFile(\"Dont_Shoot_The_Messenger_Log_File.txt\", getUsername()+\r\n\t\t\t\t\t\t\t\t \" Sent a Message To: \"+ReceiverUsername+\" at \"+timeStamp+\" Message text: \"+MessageText);\r\n\t\t\t\t\t\t\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t\r\n\t\t\t\t\t//Case that the user does NOT want to send the message\r\n\t\t\t\t\tcase \"n\":\r\n\t\t\t\t\t\tSystem.out.println(\"Canceling the sending of the message...\"+\"\\n\"+\"Sent Canceled\"); \r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t\tSystem.out.println(\"Do you want to continue sending messages? (y/n): \");\r\n\t\t\t\t\tContinueSendMessageAnswer=SendNewMessageSC.next();\r\n\t\t\t\t\t\r\n\t\t\t\t\t//While Loop for preventing Wrong Input\r\n\t\t\t\t\twhile(!ContinueSendMessageAnswer.equalsIgnoreCase(\"y\")&&!ContinueSendMessageAnswer.equalsIgnoreCase(\"n\")) {\r\n\t\t\t\t\t\tSystem.out.println(\"Invalid input\"+\"\\n\"+\r\n\t\t\t\t\t \"Do you want to continue sending messages? (y/n): \");\r\n\t\t\t\t\t\tContinueSendMessageAnswer=SendNewMessageSC.next();\r\n\t\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\t\r\n\t\t\t\t//Do...While Loop for keeping User to the SEND NEW MESSAGE Menu Unless he/she chooses 'n'\r\n\t\t\t\t}while(ContinueSendMessageAnswer.equals(\"y\"));\r\n\t\t\t\r\n\t\t\tSystem.out.println(\"\\n\"+\"Returning to Main Menu...\"+\"\\n\");\r\n\t\t\t}\r\n\t\t\r\n\t\tcatch (SQLException e) {\r\n\t\t\t//e.printStackTrace();\r\n\t\t\t}\r\n\t\t\r\n\t\t}", "@Override\n public void run() {\n Handler temp = getHandler();\n Scanner scanner = temp.getScanner();\n temp.getGameServer().sendMsg(\"yek nafar ra entekhab konid :(tanha yek payam baraye Mafia) \" +\n temp.getGameServer().getNames().toString(), temp);\n String msg = scanner.nextLine().strip();\n temp.getGameServer().sendMsgToMafia(temp.getName() + \" : \" + msg, temp);\n System.out.println(msg + \"<------\" + toString());\n }", "public void sendMessage(String text)\n\t{\n\t\ttry\n\t\t{\n\t\t\tout.println(text);\n\t\t\tout.flush();\n\t\t}\n\t\tcatch(NullPointerException e)\n\t\t{\n\t\t\tSystem.out.println(e);\n\t\t}\n\t\t\n\t}", "public void sendMessage(String message){\n pw.print(message);\n pw.flush();\n }", "public void keyPressed (KeyEvent e)\n\t{\n\t\tif (e.getKeyCode() == 10) // enter key\n\t\t{\n\t\t\tNGlobals.cPrint(\"ENTER\");\n\n\t\t\tString tString = input.getText();\n\t\t\tint tLen = tString.length();\n\t\t\t// char[] tStringAsChars = tString.toCharArray();\n\t\t\tbyte[] tStringAsBytes = tString.getBytes();\n\n\t\t\tdiscussSand.sendGrain((byte)NAppID.INSTRUCTOR_DISCUSS, (byte)NCommand.SEND_MESSAGE, (byte)NDataType.CHAR, tLen, tStringAsBytes );\n\n\n\t\t\t// The data \n\t\t\tNGlobals.cPrint(\"sending: (\" + tLen + \") of this data type\");\n\n\t\t\t// for (int i=0; i<tLen; i++) {\n\t\t\t// NGlobals.cPrint(\"sending: \" + tString.charAt(i));\n\t\t\t// streamOut.writeByte(tString.charAt(i));\n\t\t\t// }\n\n\t\t\tNGlobals.cPrint(\"sending: (\" + tString + \")\");\n\t\t\tinput.setText(\"\");\n\t\t}\n\t}", "private void createGUI() {\r\n\t\t// Create the frame for client window.\r\n\t\tJFrame frame = new JFrame(\"Client\");\r\n\t\t/*\r\n\t\t * Set the layout as null as using setbounds to set complonents set size\r\n\t\t * and close the frame when clicked on exit\r\n\t\t */\r\n\t\tframe.setLayout(null);\r\n\t\t// exit chat rrom system if clicks on close icon\r\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\t\tJLabel userlabel = new JLabel(\"Enter Username\");// label for username\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// input\r\n\t\tJLabel inputlabel = new JLabel(\"Enter Message\");// label for message\r\n\t\t/*\r\n\t\t * Create the buttons Send button to send messegs connect to connect to\r\n\t\t * chat room disconnect to logout from the chat room\r\n\t\t */\r\n\t\tJButton send = new JButton(\"Send\");\r\n\t\tJButton connect = new JButton(\"Connect\");\r\n\t\tJButton disconnect = new JButton(\"Disconnect\");\r\n\t\t// usertext is to input username from user and inputfield is to input\r\n\t\t// messages\r\n\t\tJTextField usertext = new JTextField();\r\n\t\t// set textfield as editable\r\n\t\tusertext.setEditable(true);\r\n\t\tJTextField inputfield = new JTextField();\r\n\t\t// set textfield as editable\r\n\t\tinputfield.setEditable(true);\r\n\t\tuserlabel.setBounds(10, 40, 100, 20);\r\n\t\tusertext.setBounds(120, 40, 120, 30);\r\n\t\tinputlabel.setBounds(10, 70, 150, 20);\r\n\t\tinputfield.setBounds(120, 70, 120, 30);\r\n\t\ttextarea.setBounds(10, 110, 500, 300);\r\n\t\t// https://www.youtube.com/watch?v=Uo5DY546rKY\r\n\t\tsend.setBounds(10, 430, 150, 30);\r\n\t\tconnect.setBounds(180, 430, 150, 30);\r\n\t\tdisconnect.setBounds(350, 430, 150, 30);\r\n\t\t// provide scrolling capability to textarea\r\n\t\tJScrollPane scrollPane = new JScrollPane(textarea);\r\n\t\t// set textarea as not editable\r\n\t\ttextarea.setEditable(false);\r\n\t\t// Create textfield to write message\r\n\t\t// http://cs.lmu.edu/~ray/notes/javanetexamples/\r\n\t\t// exit on close\r\n\t\tframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);\r\n\r\n\t\t// put created components in the frame.\r\n\t\tframe.add(userlabel);// add userlabel to the frame\r\n\t\tframe.add(usertext);// add usertext to the frame\r\n\t\tframe.add(inputlabel);// add inputlabel to the frame\r\n\t\tframe.add(inputfield);// add inputfield to the frame\r\n\t\tframe.add(textarea);// add textarea to the frame\r\n\t\tscrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);\r\n\t\tframe.add(send);// add send button to the frame\r\n\t\tframe.add(connect);// add connect button to the frame\r\n\t\tframe.add(disconnect);// add disconnect button to the frame\r\n\t\t/*\r\n\t\t * add listeners set action to start button\r\n\t\t * https://docs.oracle.com/javase/tutorial/uiswing/components/button.\r\n\t\t * html#abstractbutton When user clicks on send button after adding\r\n\t\t * message then client converts that message to HTTP format\r\n\t\t */\r\n\t\tsend.addActionListener(new ActionListener() {\r\n\t\t\tpublic void actionPerformed(ActionEvent action) {\r\n\r\n\t\t\t\ttry {\r\n\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * user-agent displays name of the browsers,this list shows\r\n\t\t\t\t\t * this application is independent of a browser. display the\r\n\t\t\t\t\t * host name in this case host is \"localhost\"\r\n\t\t\t\t\t */\r\n\t\t\t\t\tString useragent = \" User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36\";\r\n\t\t\t\t\tString host = \" Host:\" + socket.getInetAddress().getHostName();// get\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// host\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// name\r\n\r\n\t\t\t\t\t/* get length of the original messsage */\r\n\t\t\t\t\tString ContentLength = \" Content-length:\" + inputfield.getText().length();\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * htm as this is simple chat room system,independent of the\r\n\t\t\t\t\t * browser the content type is text/plain\r\n\t\t\t\t\t */\r\n\t\t\t\t\tString contentType = \" Conent-Type:text/plain\";\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * To print current date in the HTTP date format explicitly\r\n\t\t\t\t\t * adding the time zone to the formatter\r\n\t\t\t\t\t */\r\n\t\t\t\t\tInstant i = Instant.now();\r\n\t\t\t\t\tString dateFormatted = DateTimeFormatter.RFC_1123_DATE_TIME.withZone(ZoneOffset.UTC).format(i);\r\n\t\t\t\t\tString currentDate = \"Date:\" + dateFormatted;\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * To get time difference between to messages and converting\r\n\t\t\t\t\t * it to the string format\r\n\t\t\t\t\t */\r\n\t\t\t\t\tString time2 = dispTime.format(System.currentTimeMillis());\r\n\t\t\t\t\tdate2 = dispTime.parse(time2);\r\n\t\t\t\t\t// get difference between previous message and recent\r\n\t\t\t\t\t// message\r\n\t\t\t\t\tdifference = date2.getTime() - date1.getTime();\r\n\t\t\t\t\tint min = (int) ((difference / (1000 * 60)) % 60);// calculate\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// minute\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t// difference\r\n\t\t\t\t\tint sec = (int) ((difference / 1000) % 60);//// calculate\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//// seconds\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t//// difference\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * the format of the time is two digit numbers so concevert\r\n\t\t\t\t\t * minutes and seconds to 2 digits\r\n\t\t\t\t\t */\r\n\t\t\t\t\tString m = String.format(\"%02d\", min);\r\n\t\t\t\t\tString s = String.format(\"%02d\", sec);\r\n\t\t\t\t\tString time = \"(\" + m + \".\" + s + \") - \";\r\n\t\t\t\t\t// minutes and seconds\r\n\t\t\t\t\tdate1 = date2;\r\n\t\t\t\t\t// append useragent,host,ContentLength,contentType to a\r\n\t\t\t\t\tString httpmsg = useragent + host + ContentLength + contentType + currentDate;\r\n\t\t\t\t\t// append timedifference to the username\r\n\t\t\t\t\tString timetrack = username + time;\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * append all the strings\r\n\t\t\t\t\t * useragent,host,ContentLength,contentType, timedifference\r\n\t\t\t\t\t * to the username for HTTP format in the main message\r\n\t\t\t\t\t * entered server reads this whole message\r\n\t\t\t\t\t */\r\n\t\t\t\t\tString wholeMsg = \"POST:\" + timetrack + \":\" + inputfield.getText() + \":\" + httpmsg + \":Chat\";\r\n\t\t\t\t\tout.println(wholeMsg);// send whole message in HTTP format\r\n\t\t\t\t\t\t\t\t\t\t\t// to output stream\r\n\t\t\t\t\tout.flush(); // flushes the buffer\r\n\t\t\t\t} catch (Exception e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t\t/*\r\n\t\t\t\t * After sending message to output stream clear the textfield\r\n\t\t\t\t * and set focus to inputfield to take messages input\r\n\t\t\t\t */\r\n\t\t\t\tinputfield.setText(\"\");\r\n\t\t\t\tinputfield.requestFocus();\r\n\r\n\t\t\t}\r\n\r\n\t\t});\r\n\t\t/*\r\n\t\t * add listner to connect button after entering username if user clicks\r\n\t\t * on connect button then it checks if the username is valid(ie.only\r\n\t\t * charachters) then its creates a new thread with setting username in\r\n\t\t * title\r\n\t\t */\r\n\t\tconnect.addActionListener(new ActionListener() {\r\n\t\t\tpublic void actionPerformed(ActionEvent action) {\r\n\t\t\t\tif (isConnected == false) {\r\n\t\t\t\t\t// take username\r\n\t\t\t\t\tusername = usertext.getText();\r\n\r\n\t\t\t\t\t// check if the user name is valid that is contains only\r\n\t\t\t\t\t// letters\r\n\t\t\t\t\tif (username.matches(\"[a-zA-Z]*\")) {\r\n\t\t\t\t\t\tusertext.setEditable(false);\r\n\t\t\t\t\t\ttry {\r\n\t\t\t\t\t\t\t// server is at localhost and port 7879 so use same\r\n\t\t\t\t\t\t\t// port number here\r\n\t\t\t\t\t\t\tsocket = new Socket(\"localhost\", 7879);\r\n\t\t\t\t\t\t\t// create inputstream and outputstream\r\n\t\t\t\t\t\t\tInputStreamReader streamreader = new InputStreamReader(socket.getInputStream());\r\n\t\t\t\t\t\t\tin = new BufferedReader(streamreader);\r\n\t\t\t\t\t\t\tout = new PrintWriter(socket.getOutputStream());\r\n\t\t\t\t\t\t\tout.println(\"POST:\" + username + \":(00.00) has connected.:Connect\");\r\n\t\t\t\t\t\t\tout.flush();\r\n\t\t\t\t\t\t\tisConnected = true; // connection is established so\r\n\t\t\t\t\t\t\t\t\t\t\t\t// this value is true\r\n\t\t\t\t\t\t\tconnect.setEnabled(false);// disable the connect\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t// button\r\n\t\t\t\t\t\t\tframe.setTitle(\"Thread \" + username);\r\n\t\t\t\t\t\t} // try\r\n\t\t\t\t\t\tcatch (Exception 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// create and start a new thread\r\n\t\t\t\t\t\tThread thread = new Thread(new ListenServer());\r\n\t\t\t\t\t\tthread.start();\r\n\t\t\t\t\t} // if\r\n\t\t\t\t\t\t// if user enters invalid username then give message to\r\n\t\t\t\t\t\t// enter valid user name\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\ttextarea.append(\"Username is not valid.\");\r\n\t\t\t\t\t\ttextarea.append(\"\\nPlease enter only Charachters.\");\r\n\t\t\t\t\t\ttextarea.append(\"\");\r\n\r\n\t\t\t\t\t} // else\r\n\r\n\t\t\t\t} // if\r\n\t\t\t}\r\n\t\t});\r\n\t\t/*\r\n\t\t * add listner to disconnect button this button logs off the user from\r\n\t\t * chat room\r\n\t\t */\r\n\t\tdisconnect.addActionListener(new ActionListener() {\r\n\t\t\tpublic void actionPerformed(ActionEvent action) {\r\n\t\t\t\tString dc = (\"POST:\" + username + \": has disconnected.:Disconnect\");\r\n\r\n\t\t\t\ttry {\r\n\t\t\t\t\t/*\r\n\t\t\t\t\t * set output stream disable disconnect and send buttons\r\n\t\t\t\t\t */\r\n\t\t\t\t\tout.println(dc);\r\n\t\t\t\t\tout.flush();\r\n\t\t\t\t\tdisconnect.setEnabled(false);\r\n\t\t\t\t\tsend.setEnabled(false);\r\n\t\t\t\t\t// socket.close();\r\n\r\n\t\t\t\t} catch (Exception e) {\r\n\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t}\r\n\t\t\t\tisConnected = false;\r\n\t\t\t}\r\n\t\t});\r\n\t\t// setting frame as visible\r\n\t\tframe.setVisible(true);\r\n\t\tframe.setSize(520, 500);\r\n\t\tframe.setResizable(false);\r\n\r\n\t}", "public static void main(String[] args) {\n\n try {\n client = new Socket(InetAddress.getByName(\"127.0.0.1\"), 12345);\n\n do {\n //1. Establish IO paths between client and server\n output = new ObjectOutputStream(client.getOutputStream());\n output.flush();\n input = new ObjectInputStream(client.getInputStream());\n\n //2. Wait for our client user to type a response\n System.out.println(\"Please type your message: \");\n keyboardInput = new Scanner(System.in);\n messageOut = keyboardInput.nextLine();\n\n //3. Send message to server\n output.writeObject(messageOut);\n output.flush();\n\n if (messageOut.equals(\"<OUT>\")) {\n break;\n } else if (messageOut.equals(\"<OVER>\"))\n break;\n\n //4. Wait for an incoming string object\n messageIn = (String) input.readObject();\n\n //5. Print it to the screen\n System.out.println(\"SERVER SAYS: \" + messageIn);\n\n } while (!messageOut.equals(\"<OUT>\"));\n } catch (SocketException e) {\n System.out.println(\"Oops! : \" + e.getMessage());\n } catch (Exception e) {\n System.out.println(\"Exception occurred\");\n\n {\n System.out.println();\n }\n }\n\n }", "public void talk() {\n\t try{\t\n\t \twhile(exit) {\n\t\t \t\t//Definizione stream per la comunicazione\n\t\t \t\ttastiera = new BufferedReader(new InputStreamReader(System.in));\n\t\t \t\tout = new DataOutputStream(connection.getOutputStream());\n\t\t\t\t in = new DataInputStream(connection.getInputStream());\n\t\t\t\t \n\t\t \t\t//Invio messaggio\n\t\t\t\t System.out.println(\"Inserisci il messaggio da mandare al server: \\n\");\n\t\t\t\t mess = tastiera.readLine();\n\t\t\t\t\tout.writeUTF(mess + \"\\n\");\n\t\t\t\t\t\n\t\t\t\t\t//Ricezione risposta server\n\t\t\t\t\tservermess = in.readUTF();\n\t\t\t System.out.println(\"Risposta dal server: \"+servermess);\n\t\t\t if(mess.equals(\"FINE\")) {\n\t\t\t \texit = false;\n\t\t\t }\n\t\t\t\t}\n\t\t }\n\t\t catch (IOException e) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te.printStackTrace();\n\t\t }\n\t \tfinally {\n\t\t\t try {\n\t\t\t\t if (connection!=null)\n\t\t\t\t {\n\t\t\t\t connection.close();\n\t\t\t\t System.out.println(\"Connessione chiusa!\");\n\t\t\t\t }\n\t\t\t\t\t}\n\t\t\t catch(IOException e){\n\t\t\t System.err.println(\"Errore nella chiusura della connessione!\");\n\t\t\t }\n\t \t}\t\n \t}", "@Override\n\tpublic void actionPerformed(ActionEvent e) {\n\n\t\tString name = e.getActionCommand();\n\t\tswitch (name) {\n\t\tcase \"开始聊天\":\n\t\t\tif (!(Boolean.logicalXor((textIP.getText().equals(\"\")), (textGroup.getText().equals(\"\"))))\n\t\t\t\t\t|| (textPort.getText().equals(\"\"))) {\n\t\t\t\tJOptionPane.showMessageDialog(null, \"地址或端口不能为空\");\n\t\t\t} else if (textGroup.getText().equals(\"\")) {\n\t\t\t\trespond = false;\n\t\t\t\tconnectedToSocket();\n\t\t\t} else if (textIP.getText().equals(\"\")) {\n\n\t\t\t}\n\n\t\t\tbreak;\n\t\tcase \"断开\":\n\t\t\ttry {\n\t\t\t\tclient.close();\n\t\t\t\tChangeButtonSta(true, false);\n\t\t\t} catch (Exception e1) {\n\t\t\t\t// TODO Auto-generated catch block\n\t\t\t\te1.printStackTrace();\n\t\t\t}\n\n\t\t\tbreak;\n\t\tcase \"清屏\":\n\t\t\ttextList.removeAll();\n\t\t\tbreak;\n\t\tcase \"发送\":\n\t\t\tif ((chat.isEnabled() || client.isClosed())&&!respond) {\n\t\t\t\tSystem.out.println(\"chat.isEnabled:\"+chat.isEnabled());\n\t\t\t\tSystem.out.println(\"client.isclosed:\"+client.isClosed());\n\t\t\t\tSystem.out.println(\"respond:\"+respond);\n\n\t\t\t\tJOptionPane.showMessageDialog(null, \"还没连接,发送消息失败\");\n\n\t\t\t} else {\n\t\t\t\tsendMsg(sendContext.getText());\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tSystem.out.println(\"--------3------\");\n\t\t\tbreak;\n\n\t\t}\n\n\t}" ]
[ "0.72368264", "0.72356224", "0.6910392", "0.6848576", "0.68008393", "0.68000764", "0.677979", "0.67144024", "0.66980124", "0.6672051", "0.6589405", "0.65543705", "0.6511921", "0.650395", "0.6478154", "0.6477585", "0.6468366", "0.64593846", "0.6455347", "0.6446797", "0.64295226", "0.64272755", "0.6403939", "0.63956577", "0.63610387", "0.63505083", "0.6332343", "0.6317586", "0.631522", "0.62648606", "0.625342", "0.62530357", "0.62396413", "0.6235564", "0.6232972", "0.62311393", "0.62276196", "0.6222418", "0.62071", "0.6206084", "0.6201739", "0.6198812", "0.6145653", "0.6143787", "0.6126649", "0.61113787", "0.6098716", "0.60921776", "0.60713035", "0.60709864", "0.6062732", "0.60615575", "0.6040189", "0.6026963", "0.6015546", "0.5996233", "0.5995146", "0.5992664", "0.5992465", "0.59863454", "0.5971252", "0.5964552", "0.59634864", "0.596335", "0.594964", "0.59408975", "0.59398097", "0.59321374", "0.5921903", "0.5912216", "0.59021765", "0.59016114", "0.59005225", "0.5892322", "0.58861667", "0.58857816", "0.58793837", "0.587843", "0.5877959", "0.5871659", "0.58647156", "0.5861573", "0.5851157", "0.58432275", "0.58414304", "0.5830407", "0.5824998", "0.5824423", "0.582077", "0.5818584", "0.5818161", "0.58170694", "0.5805701", "0.5800791", "0.5791219", "0.5787244", "0.5786397", "0.57856387", "0.57777953", "0.5773091" ]
0.60721445
48
Keep token secured, use System.getenv("$TOKEN_VARIABLE")
public DiscordBot() throws LoginException { // 1. Setup a EnumSet of GatewayIntent and load all permissions to list EnumSet<GatewayIntent> gatewayIntents = initializeGateways(); // 2. Build JDA Api configuration with api token and permission list API = JDABuilder.create(TOKEN, gatewayIntents).build(); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "public void GuardarToken(String token){\n SharedPreferences.Editor edits = prefs.edit();\n edits.putString(MYConstantsPreferences.MAQUIPURAY_TOKEN, token);\n edits.apply();\n }", "private void enviarTokenRegistro(String token){\n Log.d(TAG, token);\n }", "public void storeToken(AuthorizationToken token);", "Pokemon.RequestEnvelop.AuthInfo.JWT getToken();", "public void setToken(java.lang.String param){\n localTokenTracker = true;\n \n this.localToken=param;\n \n\n }", "private void requestToken(){\n APIAuth auth = new APIAuth(this.prefs.getString(\"email\", \"\"), this.prefs.getString(\"password\", \"\"), this.prefs.getString(\"fname\", \"\") + \" \" +this.prefs.getString(\"lname\", \"\"), this.prefs, null);\n auth.authenticate();\n }", "java.lang.String getToken();", "java.lang.String getToken();", "java.lang.String getToken();", "java.lang.String getToken();", "java.lang.String getToken();", "java.lang.String getToken();", "public String getToken();", "public void updateToken(String token){\n //todo something\n if (sharedPreferencesUtils != null){\n sharedPreferencesUtils.writeStringPreference(Contains.PREF_DEVICE_TOKEN, token);\n }else {\n sharedPreferencesUtils = new SharedPreferencesUtils(this);\n sharedPreferencesUtils.writeStringPreference(Contains.PREF_DEVICE_TOKEN, token);\n }\n }", "public AuthorizationToken retrieveToken(String token);", "String getToken();", "String getToken();", "String getToken();", "String getToken();", "String getToken();", "static String getToken(Context context) {\r\n SharedPreferences preferences = context.getSharedPreferences(context.getString(R.string.shared_preferences), MODE_PRIVATE);\r\n return preferences.getString(context.getString(R.string.token), null);\r\n }", "public java.lang.String getToken(){\r\n return localToken;\r\n }", "public void setToken(String token) {\r\n this.token = token;\r\n }", "String getSecret();", "ApiTokenProperty(String seed) {\n apiToken = Secret.fromString(seed);\n }", "public java.lang.String getToken(){\n return localToken;\n }", "private void saveToken(Context context, String text) {\n android.content.SharedPreferences settings;\n android.content.SharedPreferences.Editor editor;\n \n settings = context.getSharedPreferences(\"PREFS_NAME\", Context.MODE_PRIVATE);\n editor = settings.edit();\n editor.putString(\"TOKEN\", text);\n editor.apply();\n }", "GetToken.Req getGetTokenReq();", "public String getToken(String name){\n\n return credentials.get(name, token);\n }", "public void putToken(Token token)throws Exception;", "private String issueToken(String username) {\n \n String token =TokenManagement.getTokenHS256(username,tokenSec,tokenduration);\n return token;\n }", "public void setToken(final String token) {\n this.token = token;\n }", "public static void setRequestToken(String token, Context context){\n\t\t\tSharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);\n\t\t\tSharedPreferences.Editor prefEditor = prefs.edit();\n\t\t\tprefEditor.putString(TWITTER_REQUEST_TOKEN, token);\n\t\t\tprefEditor.commit();\n\t\t\t\n\t\t}", "SecurityToken loadByTokenValue(String tokenValue);", "String getUsernameFromToken(String token);", "private String newToken(String token) {\n UserDetails userDetails = new UserDetails();\r\n userDetails.setEmail(jwtUtils.extractEmail(token));\r\n userDetails.setUserType((String) jwtUtils.extractAllClaims(token).get(\"userType\"));\r\n return jwtUtils.generateToken(userDetails);\r\n }", "public void setToken(String token) {\n\t\tthis.token = token;\n\t}", "public String authByToken (String token){\n if (token.equals(\"ripcpsrlro3mfdjsaieoppsaa\")){\n return \"admin\";\n }\n else {\n Document query = new Document();\n query.put(\"token\", token);\n MongoCursor<Document> cursor = Security.find(query).iterator();\n if (cursor==null || !cursor.hasNext()) {\n System.out.println(\"here fails ! token used: \"+token);\n return \"none\";\n }\n else {\n Document c = cursor.next();\n String tnp = c.get(\"token\").toString();\n String admin = c.get(\"admin\").toString();\n if (tnp.equals(token)){\n if (admin.equals(\"true\")){\n return \"admin\";\n }\n else return \"user\";\n }\n else return \"none\";\n }\n //return \"none\";\n }\n }", "String getToken(PortalControllerContext portalControllerContext);", "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}", "private String getToken(HttpServletRequest request){\n String header = request.getHeader(\"Authorization\");\n if(header != null && header.startsWith(\"Bearer\"))\n \t// Sacamos al bearer del token\n return header.replace(\"Bearer \", \"\");\n return null;\n }", "public static void storeToken(AccessToken token, Context cont)\n\t{\n\t\tSharedPreferences.Editor editor = cont.getSharedPreferences(\"StatPump\", 0).edit();\n\t\teditor.putString(\"Token\", token.getToken());\n\t\teditor.putString(\"Token Secret\", token.getTokenSecret());\n\t\teditor.commit();\n\t}", "public void setToken(java.lang.String param){\r\n \r\n if (param != null){\r\n //update the setting tracker\r\n localTokenTracker = true;\r\n } else {\r\n localTokenTracker = false;\r\n \r\n }\r\n \r\n this.localToken=param;\r\n \r\n\r\n }", "java.lang.String getSecret();", "private void m2192d(String str) {\n this.f980b.m1158c().getSharedPreferences(\"com.facebook.login.AuthorizationClient.WebViewAuthHandler.TOKEN_STORE_KEY\", 0).edit().putString(\"TOKEN\", str).apply();\n }", "protected void validateToken() {\n\n authToken = preferences.getString(getString(R.string.auth_token), \"\");\n saplynService = new SaplynService(preferences.getInt(debugLvl, -1), authToken);\n\n // Check if user already authenticated\n if (authToken.equals(\"\")) {\n Intent intent = new Intent(HomeActivity.this, AuthenticationActivity.class);\n startActivityForResult(intent, 0);\n }\n else {\n populateUser();\n }\n }", "public String LoginServiceToken(String token) {\n return token =\n given().log().all().accept(\"text/plain, */*\")\n .headers(\n \"App-Code\", APPCODE,\n \"X-IBM-Client-Id\", IBMCLIENTID\n )\n .and().given().contentType(\"application/x-www-form-urlencoded\")\n .and().given().body(\"grant_type=password&scope=security&username=\"+MXUSER+\"&password=\"+PWD+\"&client_id=\"+IBMCLIENTID)\n .when().post(AZUREURL+\"/v2/secm/oam/oauth2/token\")\n .then().log().ifError().assertThat().statusCode(200)\n .extract().path(\"oauth2.access_token\").toString();\n\n }", "@SuppressLint(\"CommitPrefEdits\") // Preferences change needs to be synchronous\n public void invalidateToken() {\n preferences.edit().remove(getString(R.string.auth_token)).commit();\n validateToken();\n }", "java.lang.String getRemoteToken();", "public void setToken(){\n token=null;\n try {\n OkHttpClient client = new OkHttpClient();\n RequestBody reqbody = RequestBody.create(null, new byte[0]); \n Request request = new Request.Builder()\n .url(\"https://api.mercadolibre.com/oauth/token?grant_type=client_credentials&client_id=\"+clienteID +\"&client_secret=\"+secretKey)\n .post(reqbody)\n .addHeader(\"content-type\", \"application/json\")\n .addHeader(\"cache-control\", \"no-cache\")\n .addHeader(\"postman-token\", \"67053bf3-5397-e19a-89ad-dfb1903d50c4\")\n .build();\n \n Response response = client.newCall(request).execute();\n String respuesta=response.body().string();\n token=respuesta.substring(respuesta.indexOf(\"APP\"),respuesta.indexOf(\",\")-1);\n System.out.println(token);\n } catch (IOException ex) {\n Logger.getLogger(MercadoLibreAPI.class.getName()).log(Level.SEVERE, null, ex);\n token=null;\n }\n }", "public java.lang.String getOauth_token(){\r\n return localOauth_token;\r\n }", "String getTokenString();", "public void generateToken(String uri) {\n this.token = \"sandbox\";\n }", "public static String urlSafeRandomToken() {\n SecureRandom random = new SecureRandom();\n byte bytes[] = new byte[20];\n random.nextBytes(bytes);\n Base64.Encoder encoder = Base64.getUrlEncoder().withoutPadding();\n String token = encoder.encodeToString(bytes);\n return token;\n }", "private byte[] getTokenKey() throws InternalSkiException {\n return sysKey(TOKEN_KEY);\n }", "public void sendTokenToRemote() { }", "public static String getToken() {\n String token = \"96179ce8939c4cdfacba65baab1d5ff8\";\n return token;\n }", "public static String fetchSecurityToken(String securityToken) throws Exception {\n\t\tString finalSecurityToken = securityToken.equalsIgnoreCase(\"<<security token>>\") ? System.getProperty(\"securityToken\") : securityToken;\n\t\t//throw exceptions if securityToken isnt passed:\n\t\tif(finalSecurityToken == null || finalSecurityToken.equalsIgnoreCase(\"<<security token>>\"))\n\t\t\tthrow new Exception(\"Please replace <<security token>> with your perfecto security token or pass it as maven properties: -DsecurityToken=<<SECURITY TOKEN>>\");\n\t\telse\n\t\t\treturn finalSecurityToken;\n\t}", "private String getToken() {\n String keyFilePath = System.getenv(\"APE_API_KEY\");\n if (Strings.isNullOrEmpty(keyFilePath)) {\n File globalKeyFile = GlobalConfiguration.getInstance().getHostOptions().\n getServiceAccountJsonKeyFiles().get(GLOBAL_APE_API_KEY);\n if (globalKeyFile == null || !globalKeyFile.exists()) {\n CLog.d(\"Unable to fetch the service key because neither environment variable \" +\n \"APE_API_KEY is set nor the key file is dynamically downloaded.\");\n return null;\n }\n keyFilePath = globalKeyFile.getAbsolutePath();\n }\n if (Strings.isNullOrEmpty(mApiScope)) {\n CLog.d(\"API scope not set, use flag --business-logic-api-scope.\");\n return null;\n }\n try {\n Credential credential = GoogleCredential.fromStream(new FileInputStream(keyFilePath))\n .createScoped(Collections.singleton(mApiScope));\n credential.refreshToken();\n return credential.getAccessToken();\n } catch (FileNotFoundException e) {\n CLog.e(String.format(\"Service key file %s doesn't exist.\", keyFilePath));\n } catch (IOException e) {\n CLog.e(String.format(\"Can't read the service key file, %s\", keyFilePath));\n }\n return null;\n }", "@Override\n public Object getCredentials() {\n return token;\n }", "public static void setRequestTokenSecret(String secret, Context context){\n\t\t\tSharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);\n\t\t\tSharedPreferences.Editor prefEditor = prefs.edit();\n\t\t\tprefEditor.putString(TWITTER_REQUEST_TOKEN_SECRET, secret);\n\t\t\tprefEditor.commit();\n\t\t}", "String getToken(String scope, String username, String password) throws AuthorizationException;", "public static Result token(String body) {\n\t\t\r\n\t\tArrayList<String> data = new Gson().fromJson(body, ArrayList.class);\r\n\t\tif(data == null) {\r\n\t\t\treturn new BadRequest(\"No payload data\");\r\n\t\t}\r\n\t\t\r\n\t\tString token = data.get(0);\r\n\t\tif(token == null || token.trim().equals(\"\")) {\r\n\t\t\treturn new BadRequest(\"Invalid payload data\");\r\n\t\t}\r\n\r\n\t\tString uname = data.get(1);\r\n\t\tif(uname == null || uname.trim().equals(\"\")) {\r\n\t\t\treturn new BadRequest(\"Invalid payload data\");\r\n\t\t}\r\n\t\t\r\n\t\tUser loggedUser = User.find(\"byUsername\", uname).first();\r\n\t\tif (loggedUser == null) {\r\n\t\t\treturn new BadRequest(\"Invalid payload data\");\r\n\t\t}\r\n\t\t\r\n\t\tif(!CsrfTokenUtils.checkToken(uname, token)) {\r\n\t\t\treturn new BadRequest(\"Invalid token\");\r\n\t\t}\r\n\r\n\t\tLong msgNum = userMsgNum.get(loggedUser.username);\r\n\t\tif(msgNum == null) {\r\n\t\t\tloggedUser.msgNum = 0L;\r\n\t\t\tuserMsgNum.put(loggedUser.username, loggedUser.msgNum);\r\n\t\t}\r\n\t\telse {\r\n\t\t\tloggedUser.msgNum = Long.parseLong(msgNum.toString());\r\n\t\t}\r\n\r\n\t\tsession.put(\"user\", loggedUser.username);\r\n\t\tsession.put(\"userRole\", loggedUser.role.name);\r\n\t\tsession.put(\"userMsgNum\", loggedUser.msgNum);\r\n\t\t\r\n\t\ttoken = JWTUtils.generateJWT(loggedUser.username);\r\n\t\tString json = \"{\\\"role\\\": \\\"\" + loggedUser.role.name\r\n\t\t\t\t\t\t+ \"\\\", \\\"username\\\": \\\"\" + loggedUser.username\r\n\t\t\t\t\t\t+ \"\\\", \\\"msgNum\\\": \" + loggedUser.msgNum\r\n\t\t\t\t\t\t+ \", \\\"token\\\": \\\"\" + token + \"\\\"}\";\r\n\t\treturn new RenderText(json);\r\n\t}", "@Test\n\tpublic void getTokenTest() {\n\t}", "public boolean isTokenValide() {\n try {\n token = Save.defaultLoadString(Constants.PREF_TOKEN, getApplicationContext());\n if (token != null && !token.equals(\"\")) {\n if (token.equals(\"\"))\n return false;\n JWT jwt = new JWT(token);\n boolean isExpired = jwt.isExpired(0);\n return !isExpired;\n } else\n return false;\n } catch (Exception e) {\n e.printStackTrace();\n return false;\n }\n\n }", "@Override\n\t\tpublic void injectToken(RequestFacade facade, String token) {\n\t\t\tfacade.addHeader(\"Authorization\", \"token \" + token);\n\t\t}", "public String getTokenKey()\r\n\t{\r\n\t\treturn TOKEN_KEY;\r\n\t}", "User setTokenForUser(String username, String token) throws DatabaseException;", "@Test\n public void tokenTest() {\n // TODO: test token\n }", "@Test\n public void tokenTest() {\n // TODO: test token\n }", "public String getToken()\n {\n return token;\n }", "public String getSecurityToken()\r\n {\r\n return getAttribute(\"token\");\r\n }", "private void checkAuthSessionToken() {\n val auth = config.getString(\"authSessionToken\");\n\n checkArgument(auth.length() > 10, \"auth string (sessionToken) length is less than or equal to 10!\");\n }", "String createToken(User user);", "public String getToken() {\r\n return token;\r\n }", "public String getToken() {\r\n return token;\r\n }", "public static boolean checkSavedToken(Context context) {\n SharedPreferences preferences = context.getSharedPreferences(token_storage, 0);\n String storage_token = preferences.getString(\"token\", \"notoken\");\n\n if (!storage_token.equals(\"notoken\")) {\n Log.d(\"Service\", \"Using stored token\");\n header_token = \"Bearer \" + storage_token;\n isTokenPresent = true;\n bindToken();\n return true;\n }\n return false;\n }", "public void setSecureIdentityToken(String token) {\n setRuntimeProperty(PROPERTY_SECURE_IDENTITY_TOKEN, token);\n }", "OAuth2Token getToken();", "public String getToken() {\n return token.get();\n }", "public void setToken(int value){token = value;}", "com.google.protobuf.ByteString\n getTokenBytes();", "com.google.protobuf.ByteString\n getTokenBytes();", "com.google.protobuf.ByteString\n getTokenBytes();", "void checkToken(String token) throws InvalidTokenException;", "public String getToken() {\n return token;\n }", "public String getToken() {\n return token;\n }", "public String getToken() {\n return token;\n }", "public String getToken() {\n return token;\n }", "public String getToken() {\n return token;\n }", "Pokemon.RequestEnvelop.AuthInfo.JWTOrBuilder getTokenOrBuilder();", "WithCreate withSecurityToken(SourceControlSecurityTokenProperties securityToken);", "public String userToken() {\n return userToken;\n }", "public String refreshToken(String token) {\n String refreshedToken;\n try {\n final Claims claims = this.getClaimsFromToken(token);\n claims.put(CREATED, dateUtil.getCurrentDate());\n refreshedToken = this.generateToken(claims);\n } catch (Exception e) {\n refreshedToken = null;\n }\n return refreshedToken;\n }", "public void setToken(String token) {\r\n hc.setToken(token);\r\n }", "private void sendToken(byte[] outToken) throws IOException, AuthenticationException {\n String token = base64.encodeToString(outToken);\n conn = (HttpURLConnection) openConnection(url);\n conn.setRequestMethod(AUTH_HTTP_METHOD);\n conn.setRequestProperty(AUTHORIZATION, NEGOTIATE + \" \" + token);\n conn.connect();\n }", "public String getToken(final HttpServletRequest request) {\n final String param = ofNullable(request.getHeader(AUTHORIZATION))\n .orElse(request.getParameter(\"t\"));\n\n return ofNullable(param)\n .map(value -> removeStart(value, BEARER))\n .map(String::trim)\n .orElseThrow(() -> new BadCredentialsException(Constants.AUTHENTICATION_FILTER_MISSING_TOKEN));\n }", "com.google.protobuf.ByteString\n getTokenBytes();", "public void saveToken(String token, long passTime) {\n }", "String setRememberToken(HttpServletRequest request, HttpServletResponse response, String password, int maxAge, String domain, String path);", "@Override\n public Response intercept(Chain chain) throws IOException {\n Request authorisedRequest = chain.request().newBuilder()\n .header(\"Authorization:\", \"Token \" + sharedPrefsWrapper.getString(KEY))\n .build();\n\n\n return chain.proceed(authorisedRequest);\n }" ]
[ "0.67838365", "0.6414537", "0.6407305", "0.63325936", "0.62021", "0.61989695", "0.61762446", "0.61762446", "0.61762446", "0.61762446", "0.61762446", "0.61762446", "0.61629534", "0.61446965", "0.61392593", "0.6053133", "0.6053133", "0.6053133", "0.6053133", "0.6053133", "0.6053021", "0.59323996", "0.5924237", "0.5919509", "0.5885698", "0.5851369", "0.58412945", "0.5837296", "0.58265054", "0.5818924", "0.581096", "0.58098316", "0.5807335", "0.5803329", "0.5799698", "0.5789428", "0.57604456", "0.57581955", "0.575621", "0.57557696", "0.5734036", "0.5717861", "0.57105184", "0.56995773", "0.56937134", "0.56926763", "0.5686178", "0.5654593", "0.56534994", "0.5651061", "0.56497175", "0.56479484", "0.5634043", "0.5623663", "0.56158495", "0.560862", "0.5600449", "0.5599795", "0.559295", "0.55924183", "0.55857486", "0.5582856", "0.5578819", "0.5578022", "0.557759", "0.5568769", "0.55645174", "0.5561573", "0.55605966", "0.55605966", "0.55525374", "0.55418533", "0.5536277", "0.5519181", "0.55105543", "0.55105543", "0.55035555", "0.55007756", "0.54977065", "0.5478575", "0.54750466", "0.54737574", "0.54737574", "0.54737574", "0.54681766", "0.5462195", "0.5462195", "0.5462195", "0.5462195", "0.5462195", "0.54617536", "0.5459613", "0.54546267", "0.54461306", "0.54356134", "0.5433694", "0.54292244", "0.5427823", "0.542334", "0.5416355", "0.5414746" ]
0.0
-1
1. Create method with return type of EnumSet with no params
private EnumSet<GatewayIntent> initializeGateways() { return EnumSet.allOf(GatewayIntent.class); }
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "@SafeVarargs\r\n\tpublic static <A extends Enum<A>> Set<A> hardenumset(A... elems)\r\n\t{\n\t\tif(elems.length == 0)\r\n\t\t{\r\n\t\t\treturn Collections.emptySet();\t\r\n\t\t}\r\n\t\t\r\n\t\tEnumSet<A> eset = EnumSet.of(elems[0]);\r\n\t\t\r\n\t\tfor(int i = 1; i < elems.length; i++)\r\n\t\t\t{ eset.add(elems[i]); }\r\n\t\t\r\n\t\treturn Collections.unmodifiableSet(eset);\r\n\t}", "public interface OrtFlags {\n\n /**\n * Gets the underlying flag value.\n *\n * @return The flag value.\n */\n public int getValue();\n\n /**\n * Converts an EnumSet of flags into the value expected by the C API.\n *\n * @param set The enum set to aggregate the values from.\n * @param <E> The enum type to aggregate.\n * @return The aggregated values\n */\n public static <E extends Enum<E> & OrtFlags> int aggregateToInt(EnumSet<E> set) {\n int value = 0;\n\n for (OrtFlags flag : set) {\n value |= flag.getValue();\n }\n\n return value;\n }\n}", "public Set<E> getActiveFlags();", "public static void main(String[] args) {\n\t\tSet<Numbers> enumSet = EnumSet.of(Numbers.ONE,Numbers.TWO,Numbers.THREE,Numbers.FOUR,Numbers.FIVE);\n\t\t \n\t\t\tSystem.out.println(\"enumSet: \" + enumSet);\n\t\t\tSystem.out.println(\"contains: \" + enumSet.contains(Numbers.ONE));\n\t\t\tSystem.out.println(\"isEmpty: \" + enumSet.isEmpty());\n\t\t\tSystem.out.println(\"iterator: \" + enumSet.iterator());\n\t\t\tSystem.out.println(\"remove: \" + enumSet.remove(Numbers.THREE));\n\t\t\tSystem.out.println(\"treeSet: \" + enumSet);\n\t\t\tSystem.out.println(\"size: \" + enumSet.size());\n\t\t\tenumSet.clear();\n\t\t\tSystem.out.println(\"treeSet: \" + enumSet);\n\t}", "private Set<E> parse( int flags ) {\n\t\tEnumSet<E> set = EnumSet.noneOf( enumClass );\n\t\t\t\t\n\t\tfor( Map.Entry<Integer, E> entry : bits2enums.entrySet() ) {\n\t\t\tint bits = entry.getKey();\n\t\t\tE e = entry.getValue();\n\t\t\t\n\t\t\tif(( flags & bits ) != 0 ) set.add( e );\n\t\t}\n\t\t\n\t\treturn set;\n\t}", "<V extends Object> Set<V> getSet(String setName);", "protected abstract Set method_1559();", "Set createSet();", "EnumSet<ViewExecutionFlags> getFlags();", "public Set<E> Setcall(int opcion) {\n\t\tswitch(opcion) {\n\t\tcase 1:\n\t\t\treturn new HashSet<E>();\n\t\tcase 2:\n\t\t\treturn new TreeSet<E>();\n\t\tcase 3:\n\t\t\treturn new LinkedHashSet<E>();\n\t\tdefault:\n\t\t\treturn null;\n\t\t}\n\n\t}", "EnumListValue createEnumListValue();", "public Set<HttpMethod> getAllow()\r\n/* 137: */ {\r\n/* 138:209 */ String value = getFirst(\"Allow\");\r\n/* 139:210 */ if (value != null)\r\n/* 140: */ {\r\n/* 141:211 */ List<HttpMethod> allowedMethod = new ArrayList(5);\r\n/* 142:212 */ String[] tokens = value.split(\",\\\\s*\");\r\n/* 143:213 */ for (String token : tokens) {\r\n/* 144:214 */ allowedMethod.add(HttpMethod.valueOf(token));\r\n/* 145: */ }\r\n/* 146:216 */ return (Set)EnumSet.copyOf(allowedMethod);\r\n/* 147: */ }\r\n/* 148:219 */ return (Set)EnumSet.noneOf(HttpMethod.class);\r\n/* 149: */ }", "public abstract EnumSet<TickType> ticks();", "CodeSetType createCodeSetType();", "private static BitSet makeBitSet( int... args ) {\n\tBitSet result = new BitSet( MAX_OPCODE + 1 ) ;\n\tfor (int value : args )\n\t result.set( value ) ;\n\treturn result ;\n }", "Map<ParameterInstance, SetType> getInstanceSetTypes();", "@SuppressWarnings(\"UnusedReturnValue\")\n public static <E extends Enum<E>> CompoundNBT nbtSetEnumSet(CompoundNBT nbt, String key, EnumSet<E> value) {\n\n final ListNBT tagList = new ListNBT();\n\n for (final E enumValue : value) {\n tagList.add(NBTHelper.nbtSetEnum(new CompoundNBT(), \"enum\", enumValue));\n }\n\n nbt.put(key, tagList);\n return nbt;\n }", "Set<X> toSet();", "public abstract java.util.Set getPaymentTypes();", "public static <E extends Enum<E>> EnumSet<E> nbtGetEnumSet(CompoundNBT nbt, String key, Class<E> enumClass) throws IllegalArgumentException {\n\n final ListNBT tagList = nbt.getList(key, Constants.NBT.TAG_STRING);\n final List<E> valueList = Lists.newArrayList();\n\n for (int i = 0; i < tagList.size(); ++i) {\n\n final E enumValue = nbtGetEnum(tagList.getCompound(i), \"enum\", enumClass);\n\n valueList.add(enumValue);\n }\n\n return EnumSet.copyOf(valueList);\n }", "public abstract ImmutableSet<String> getExplicitlyPassedParameters();", "@Override\n public Set<T> asSet() {\n return new AbstractSet<T>() {\n @Override\n public Iterator<T> iterator() {\n return new Iterator<T>() {\n boolean foundNext;\n boolean hasNext;\n T next;\n \n private void findNext() {\n if (!foundNext) {\n hasNext = isPresent();\n if (hasNext) {\n try {\n next = get();\n } catch (NoSuchElementException e) {\n // in case there was a race and the value became absent\n hasNext = false;\n next = null;\n }\n } else {\n next = null;\n }\n foundNext = true;\n }\n }\n \n @Override\n public boolean hasNext() {\n findNext();\n return hasNext;\n }\n\n @Override\n public T next() {\n findNext();\n if (hasNext) {\n // no next after consuming the single present value \n hasNext = false;\n T ret = next;\n next = null;\n return ret;\n }\n throw new NoSuchElementException();\n }\n\n @Override\n public void remove() {\n throw new UnsupportedOperationException();\n }\n };\n }\n\n @Override\n public int size() {\n return isPresent() ? 1 : 0;\n }\n };\n }", "boolean isCustomiseSet();", "public interface Set<Type> {\r\n\r\n\t/**\r\n\t * Ensures that this set contains the specified item.\r\n\t * \r\n\t * @param item\r\n\t * - the item whose presence is ensured in this set\r\n\t * @return true if this set changed as a result of this method call (that\r\n\t * is, if the input item was actually inserted); otherwise, returns\r\n\t * false\r\n\t */\r\n\tpublic boolean add(Type item);\r\n\r\n\t/**\r\n\t * Ensures that this set contains all items in the specified collection.\r\n\t * \r\n\t * @param items\r\n\t * - the collection of items whose presence is ensured in this\r\n\t * set\r\n\t * @return true if this set changed as a result of this method call (that\r\n\t * is, if any item in the input collection was actually inserted);\r\n\t * otherwise, returns false\r\n\t */\r\n\tpublic boolean addAll(Collection<? extends Type> items);\r\n\r\n\t/**\r\n\t * Removes all items from this set. The set will be empty after this method\r\n\t * call.\r\n\t */\r\n\tpublic void clear();\r\n\r\n\t/**\r\n\t * Determines if there is an item in this set that is equal to the specified\r\n\t * item.\r\n\t * \r\n\t * @param item\r\n\t * - the item sought in this set\r\n\t * @return true if there is an item in this set that is equal to the input\r\n\t * item; otherwise, returns false\r\n\t */\r\n\tpublic boolean contains(Type item);\r\n\r\n\t/**\r\n\t * Determines if for each item in the specified collection, there is an item\r\n\t * in this set that is equal to it.\r\n\t * \r\n\t * @param items\r\n\t * - the collection of items sought in this set\r\n\t * @return true if for each item in the specified collection, there is an\r\n\t * item in this set that is equal to it; otherwise, returns false\r\n\t */\r\n\tpublic boolean containsAll(Collection<? extends Type> items);\r\n\r\n\t/**\r\n\t * Returns true if this set contains no items.\r\n\t */\r\n\tpublic boolean isEmpty();\r\n\r\n\t/**\r\n\t * Returns the number of items in this set.\r\n\t */\r\n\tpublic int size();\r\n}", "abstract CharArraySet build();", "@com.exedio.cope.instrument.Generated // customize with @WrapperType(genericConstructor=...)\n\tprivate WrapEnumItem(final com.exedio.cope.SetValue<?>... setValues){super(setValues);}", "public static void main(String[] args) {\n\n for (OperateTypeEnum test : OperateTypeEnum.values()) {\n System.out.println(test.name()+\" \"+test.ordinal());\n }\n\n EnumMap<OperateTypeEnum, String> enumMap = new EnumMap<OperateTypeEnum, String>(OperateTypeEnum.class);\n enumMap.put(OperateTypeEnum.DELETE, \"dddddddddddddd\");\n enumMap.put(OperateTypeEnum.UPDATE, \"uuuuuuuuuuuuuu\");\n for (Map.Entry<OperateTypeEnum, String> entry : enumMap.entrySet()) {\n System.out.println(entry.getValue() + entry.getKey().getEnumDesc());\n }\n\n// EnumSet<OperateTypeEnum> enumSets = EnumSet.of(OperateTypeEnum.DELETE);\n// EnumSet<OperateTypeEnum> enumSets = EnumSet.allOf(OperateTypeEnum.class);\n// EnumSet<OperateTypeEnum> enumSets = EnumSet.range(OperateTypeEnum.DELETE,OperateTypeEnum.UPDATE);\n EnumSet<OperateTypeEnum> enumSet = EnumSet.noneOf(OperateTypeEnum.class);\n enumSet.add(OperateTypeEnum.DELETE);\n enumSet.add(OperateTypeEnum.UPDATE);\n for (Iterator<OperateTypeEnum> it = enumSet.iterator(); it.hasNext();) {\n System.out.println(it.next().getEnumDesc());\n }\n for (OperateTypeEnum enumTest : enumSet) {\n System.out.println(enumTest.getEnumDesc() + \" ..... \");\n }\n\n EnumSet<OperateTypeEnum> enumSets = EnumSet.copyOf(enumSet);\n }", "GeneralizationSet createGeneralizationSet();", "abstract protected EnumSet<Parser.Flag> getParserFlags();", "public abstract Set<Map.Entry<K, V>> a();", "public interface Set {\n\n /**\n * Create an empty set.\n *\n * @return the empty set\n */\n static Set createEmpty() {\n return new EmptySet();\n }\n\n /**\n * Checks if the ASet is empty.\n *\n * @return true if the set is empty, false otherwise\n */\n boolean isEmpty();\n\n /**\n * Given an {@code Integer} {@code element} add the element to the set. If {@code element} is\n * already a member of the set, we perform no operation and return back the set intact.\n *\n * @param element the new element to add to the set\n *\n * @return a newly created set that contains {@code element} and the original elements of the set.\n */\n Set add(Integer element);\n\n /**\n * Given an {@code Integer} {@code element} returns {@code true} if the element is already in the\n * set and {@code false} otherwise.\n *\n * @param element the element to check\n *\n * @return true if {@code element} is in the set, false otherwise\n */\n Boolean contains(Integer element);\n\n /**\n * Return the size of the set.\n *\n * @return return the size of the set\n */\n Integer size();\n\n /**\n * Given an element {@code element} remove it from the this list if it exists.\n *\n * @param element the element to remove\n *\n * @return set without {@code element}\n */\n Set remove(Integer element);\n\n\n /**\n * Given a set {@code other} return a new set which is the set union between {@code this} set and\n * {@code other} set.\n *\n * @param other set to perform union\n *\n * @return set union of this and other\n */\n Set union(Set other);\n\n\n /**\n * Returns the set intersection between {@code this} and {@code otherSet}.\n *\n * @param otherSet set to perform intersection with\n *\n * @return set intersection between {@code this} and {@code otherSet}\n */\n Set intersect(Set otherSet);\n\n\n /**\n * Returns the set difference between {@code this} and {@code otherSet}.\n *\n * @param otherSet set to perform set difference with\n *\n * @return set difference between {@code this} and {@code otherSet}\n */\n Set difference(Set otherSet);\n\n\n /**\n * Returns true if {@code this} set is a subset of {@code otherSet}.\n *\n * @param otherSet the set to check against\n *\n * @return true if this is a subset of otherSet, false otherwise\n */\n Boolean subset(Set otherSet);\n\n\n}", "public Set<String> honorifics();", "private static HashSet<String> set(String... s)\r\n {\r\n return new HashSet<>(Arrays.asList(s));\r\n }", "public Enumeration permissions();", "public static Set unmodifiableSet(Set set) {\n/* 175 */ return UnmodifiableSet.decorate(set);\n/* */ }", "public static Set typedSet(Set set, Class type) {\n/* 205 */ return TypedSet.decorate(set, type);\n/* */ }", "public interface TransformsToUnsortedSetTrait extends RichIterableTestCase\n{\n @Override\n default <T> UnsortedSetIterable<T> getExpectedTransformed(T... elements)\n {\n return Sets.immutable.with(elements);\n }\n\n @Override\n default <T> MutableSet<T> newMutableForTransform(T... elements)\n {\n return Sets.mutable.with(elements);\n }\n\n @Override\n default MutableBooleanSet newBooleanForTransform(boolean... elements)\n {\n return new BooleanHashSet(elements);\n }\n\n @Override\n default MutableByteSet newByteForTransform(byte... elements)\n {\n return new ByteHashSet(elements);\n }\n\n @Override\n default MutableCharSet newCharForTransform(char... elements)\n {\n return new CharHashSet(elements);\n }\n\n @Override\n default MutableDoubleSet newDoubleForTransform(double... elements)\n {\n return new DoubleHashSet(elements);\n }\n\n @Override\n default MutableFloatSet newFloatForTransform(float... elements)\n {\n return new FloatHashSet(elements);\n }\n\n @Override\n default MutableIntSet newIntForTransform(int... elements)\n {\n return new IntHashSet(elements);\n }\n\n @Override\n default MutableLongSet newLongForTransform(long... elements)\n {\n return new LongHashSet(elements);\n }\n\n @Override\n default MutableShortSet newShortForTransform(short... elements)\n {\n return new ShortHashSet(elements);\n }\n}", "boolean getSet();", "public List<Enum<?>> enums()\n/* */ {\n/* 92 */ return Arrays.asList(this._values);\n/* */ }", "<T> Set<T> lookupAll(Class<T> type);", "public static List<Color> getColorList(){\n EnumSet<Color> allColor = EnumSet.allOf(Color.class);\n //create a List from the Collection \n return new ArrayList<Color>(allColor);\n //the ArrayList takes a Collection as an argument\n }", "@Override\n public boolean add(Set<E> e) {\n throw new UnsupportedOperationException(\"Add not supported\");\n }", "public void setValuesToSearchFor(final Collection<T> values) {\n if (values.isEmpty()) {\n this.values.clear();\n } else {\n this.values = EnumSet.copyOf(values);\n }\n }", "public interface ValueSet {\n boolean isEmpty();\n int size();\n boolean contains(Object v);\n void add(Object v);\n void add(ValueSet s);\n Iterator<Object> iterator();\n}", "private EmptySet() {}", "@Override\n\tpublic Set<T> valeurs() {\n\t\treturn Set.of(val);\n\t}", "interface Set\n{\n boolean contains(String s);\n void add(String s); // notice that void means Set will be mutated. \n // => no longer functional. \n}", "@SuppressWarnings(\"unchecked\")\n \tpublic static <T> Set<T> createConcurrentHashSet() {\n \t\treturn (Set<T>) Collections.synchronizedSet(CollectionFactory.createHashSet());\n \t}", "static Set createEmpty() {\n return new EmptySet();\n }", "@Override\r\n\tprotected Set<String>[] getForbidSetArray() {\n\t\treturn null;\r\n\t}", "@Override\n public Function<TradeAccumulator, Set<Trade>> finisher() {\n return (accum) -> {return accum.toSet();};\n }", "public UnicodeSet getUnicodeSet() {\n/* 64 */ throw new RuntimeException(\"Stub!\");\n/* */ }", "public static Set<String> createSet() {\n Set<String> set = new HashSet<>();\n set.add(\"lesson\");\n set.add(\"large\");\n set.add(\"link\");\n set.add(\"locale\");\n set.add(\"love\");\n set.add(\"light\");\n set.add(\"limitless\");\n set.add(\"lion\");\n set.add(\"line\");\n set.add(\"lunch\");\n set.add(\"level\");\n set.add(\"lamp\");\n set.add(\"luxurious\");\n set.add(\"loop\");\n set.add(\"last\");\n set.add(\"lie\");\n set.add(\"lose\");\n set.add(\"lecture\");\n set.add(\"little\");\n set.add(\"luck\");\n\n return set;\n }", "UnionCancionSecuencia createUnionCancionSecuencia();", "public T caseSetType(SetType object)\n {\n return null;\n }", "boolean isSetType();", "@Test\n public void testGetBrowsersOneMSIE() {\n System.out.println(\"testGetBrowsersOneMSIE\");\n String info = \"MSIE\";\n EnumSet<Browsers> expResult = EnumSet.of(Browsers.MSIE);\n EnumSet<Browsers> result = BrowserFinder.getBrowsers(info);\n assertEquals(expResult, result);\n }", "public Set<? extends ConcreteOption> getConcreteOptions();", "CodeSetsType createCodeSetsType();", "Set<String> getBaseTypes();", "public CallSet() {}", "EnumValue createEnumValue();", "EnumValue createEnumValue();", "EnumValue createEnumValue();", "int getOneof2857();", "ImmutableList<T> getServices();", "int getOneof1111();", "BSet createBSet();", "Set<Condition> getInstanceInvariantConditions();", "BitSet valueLeafFlags();", "BitSet valueLeafFlags();", "EnumTypeDefinition createEnumTypeDefinition();", "public MyHashSet() {\n \n }", "int getOneof2566();", "public static EnumSet<AccessFlag> fromMask(final int mask) {\r\n final EnumSet<AccessFlag> result = \r\n EnumSet.noneOf(AccessFlag.class);\r\n for (final AccessFlag flag : AccessFlag.values()) {\r\n if ((flag.value & mask) != 0) {\r\n result.add(flag);\r\n }\r\n }\r\n return result;\r\n }", "Set<String> getOsUSet();", "Enumeration createEnumeration();", "int getOneof2727();", "int getOneof2587();", "public ImmutableSetTest( String testName )\n {\n super( testName );\n }", "int getOneof2586();", "public static java.util.Set unmodifiableSet(java.util.Set arg0)\n { return null; }", "public static java.util.Set<SecurityPolicy> forValue(final int value) {\n Set<SecurityPolicy> values = new HashSet<SecurityPolicy>();\n SecurityPolicy[] enums = getEnumConstants();\n for (int pos = 0; pos != enums.length; ++pos) {\n if ((enums[pos].intValue & value) == enums[pos].intValue) {\n values.add(enums[pos]);\n }\n }\n return values;\n }", "@Override\n\tpublic HashSet<String> getTeams() {\n return new HashSet<String>();\n\t}", "private Set() {\n this(\"<Set>\", null, null);\n }", "public Set<Edge<V>> edgeSet();", "default Set<T> from(Set<Source> sources){\n return sources.stream()\n .map(this::from)\n .collect(Collectors.toSet());\n }", "Set<ValueType> get(KeyType key);", "int getOneof2787();", "int getOneof2766();", "int getOneof2786();", "int getOneof2966();", "int getOneof2900();", "int getOneof1766();", "Set<String> getOsPSet();", "public static <T> Set<T> AsSet(@NonNull T... ts) {\n return Create_UnModifiableSet_By_InputElements(new HashSet<T>(), ts);\n }", "Set<TokenType> tokenTypes();", "int getOneof2626();", "public EnumSet<KeyUsage> convert(boolean[] keyUsageBits) {\n EnumSet<KeyUsage> usages = EnumSet.noneOf(KeyUsage.class);\n if (keyUsageBits != null) {\n for (int i = 0; i < Math.min(BIT_TO_USAGE.size(), keyUsageBits.length); i++) {\n if (keyUsageBits[i]) {\n usages.add(BIT_TO_USAGE.get(i));\n }\n }\n }\n return usages;\n }", "int getOneof2589();", "int getOneof2066();" ]
[ "0.6251736", "0.594286", "0.58312863", "0.58175373", "0.5759125", "0.5731814", "0.5662234", "0.5619976", "0.55426985", "0.5470262", "0.54600704", "0.54210275", "0.541784", "0.53766096", "0.53594995", "0.53581333", "0.53317374", "0.52939284", "0.52821", "0.5276603", "0.5253282", "0.5248363", "0.5248324", "0.5242348", "0.5238628", "0.5235348", "0.5232428", "0.5221152", "0.52003837", "0.51856536", "0.5160326", "0.5154716", "0.51545346", "0.5147546", "0.51442534", "0.514062", "0.51379395", "0.51339984", "0.51152277", "0.50881255", "0.5086971", "0.5078771", "0.50716984", "0.5065695", "0.5062468", "0.5056952", "0.5052975", "0.50500625", "0.50455856", "0.5039821", "0.50222045", "0.49973843", "0.49952403", "0.49863848", "0.49817935", "0.49683446", "0.49678463", "0.49628204", "0.49616027", "0.4956679", "0.494507", "0.49442235", "0.49442235", "0.49442235", "0.4929687", "0.4926595", "0.49124074", "0.4905786", "0.49036527", "0.49028042", "0.49028042", "0.4898438", "0.48946923", "0.48919934", "0.4890086", "0.48899084", "0.4889861", "0.48879737", "0.48799315", "0.48798558", "0.48777583", "0.48736608", "0.48727658", "0.48685464", "0.48610064", "0.48560482", "0.48519015", "0.485145", "0.4847835", "0.4846263", "0.4845398", "0.48419502", "0.4839539", "0.4839475", "0.48337024", "0.4833514", "0.48324987", "0.48321128", "0.48267323", "0.4824089", "0.4822077" ]
0.0
-1